Newbie question - how to include the passphrase in the command

Mark L Mark L <markl81@lycos.co.uk>
Thu Jun 5 18:47:01 2003


Hello Ping,

Thursday, June 5, 2003, 12:29:12 AM, you wrote:

PK> Hi:

PK> I use the gen-key command to create a key, and then I import a key that is
PK> export by our client 

PK> This is the command I use to encrypt a file to our client :
PK> gpg -o OutputFilename -a -r MyUserID --encrypt-to
PK> RecipientUserID --passphrase MyPassword -es SourceFile

PK> But I always got the following message
PK> Reading passphrase from file descriptor 0 .. 
--8<
PK> How can I use the passphrase in the command line so it will not prompt me
PK> for the passphrase?  I want to put this into a cmd or batch file then I can
PK> call it from a windows application and passing the values throught the
PK> parameters 

The only way I could get this to work was with the passphrase stored
in a file (not a great idea I think).
--passphrase needs a file descriptor rather than a file name it seems
so you need to redirect output from your passphrase file into a
standard file handle:

gpg -o OutputFilename -a -r MyUserID --encrypt-to RecipientUserID
--passphrase 1 1<PasswordFile -es SourceFile
Could use the --yes and --no-tty options as well and there's no
interaction at all.

I guess if you must do this it would be an idea to keep the passphrase
in an encrypted file and decrypt it to another file, use it and delete
it within the same batch. Still not too secure though. I'm a casual
user myself so I can't help much more but I'll have a play with it anyway.


-- 
Best regards,
 Mark                            mailto:markl81@lycos.co.uk