WINDOWS - Adding passphrase to gpg via command line

Josh Clearihan Josh.Clearihan at isuzu.net.au
Mon May 11 07:17:59 CEST 2015


Hi all,

Environment
Windows 2012 Server
GnuPG 2.0.27

Requirement
To automatically decrypt and encrypt files from cmd batch file.

I'm experiencing issues trying to decrypt a .pgp file from command line.

When running this it launches the pinentry window, manually requiring the 
passkey.
gpg2.exe --output D:\Folder --recipient certname --decrypt 
D:\Folder\*.txt.pgp

If I enter the passkey manually in the pinentry box it seems to stay 
active for a number of minutes, allowing me to decrypt multiple files 
without being prompted by pinentry. However, after say 10 - 15 mins when I 
try to decrypt another file, the pinentry windows appears requiring manual 
entry again.

After researching how to set the passkey in the stdin cache I attempted 
this
gpg-preset-passphrase.exe --preset "mypassphrase"
This syntax seems correct because it does not come up invalid, it just 
sits there in cmd on the next line doing nothing
https://www.gnupg.org/documentation/manuals/gnupg/Invoking-gpg_002dpreset_002dpassphrase.html#Invoking-gpg_002dpreset_002dpassphrase

I manually edited my gpg-agent.conf file, it looks like this
###+++--- GPGConf ---+++###
enable-passphrase-history
allow-preset-passphrase
###+++--- GPGConf ---+++### 04/30/15 09:41:02 AUS Eastern Standard Time
# GPGConf edited this configuration file.
# It will disable options before this marked block, but it will
# never change anything below these lines.

I have also tried piping in my passphrase via this command, but this also 
launches pinentry requiring manual entry if the passphrase
echo "mypassphrase"| gpg2.exe --output D:\Folder --recipient certname 
--decrypt D:\Folder\*.txt.pgp

This solution was posted here
http://www.gossamer-threads.com/lists/gnupg/users/59418

Can someone please tell me what I'm doing wrong.

Many Thanks!


Josh Clearihan
Senior Systems Administrator 



858 Lorimer Street | PO Box 107
Port Melbourne, VIC 3207

T: 03 9644 6666 | D: 03 9644 6899 
F: 03 9644 6622 | M: 0437 096 974 
E: Josh.Clearihan at isuzu.net.au	
	Think Green!

DISCLAIMER: Any views or opinions expressed in this communication are those of 
the individual sender, except where the sender specifically states them to be 
the views or opinions of Isuzu Australia Limited.

This communication is confidential. If you are not the intended recipient of 
this communication please delete and destroy all copies and contact the sender 
immediately. Any unauthorised form of disclosure or reproduction of this 
message is prohibited. Isuzu Australia Ltd does not guarantee the security of 
any information electronically transmitted. Isuzu Australia Ltd does not accept 
responsibility for any improper or incomplete transmission. 


Any views or opinions expressed in this communication are those of the individual sender, except where the sender specifically states them to be the views or opinions of Isuzu Australia Limited.

This communication is confidential. If you are not the intended recipient of this communication please delete and destroy all copies and contact the sender immediately. Any unauthorised form of disclosure or reproduction of this message is prohibited. Isuzu Australia Ltd does not guarantee the security of any information electronically transmitted. Isuzu Australia Ltd does not accept responsibility for any improper or incomplete transmission.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20150511/ef54b76a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 3482 bytes
Desc: not available
URL: </pipermail/attachments/20150511/ef54b76a/attachment.jpe>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 3685 bytes
Desc: not available
URL: </pipermail/attachments/20150511/ef54b76a/attachment-0001.jpe>


More information about the Gnupg-users mailing list