I can’t find anything in the documentation about this (encryption yes, decryption no).
The line I was given by someone already using this software (he’s actually encrypting what I’m decrypting) is:
gpg --passphrase-fd 0 --decrypt-file C:\temp\REDEMPTION_TC_20110119.txt.pgp < C:\temp\passphrase.txt
Where passphrase.txt contains the passphrase. Unfortunately this fails with the message:
gpg: encrypted with RSA key, ID 88BD0CC6
gpg: decryption failed: No secret key
So I’m at a loss.
It seems to me to be saying that you have the public key for 88BD0CC6, but not the secret key for 88BD0CC6, which you need to have to decrypt it.
I can decrypt the files just fine using the GUI, all I’m asked is for the password (which is like 12 characters). The problem (it seems to me) is that in the command line I can’t specify nor am I asked for, the password.
OK, I can get it to work, but not with the gpg???.exe(s) that comes in Gpg4win. I have found that the gpg programs in Gpg4win are squirrelie. Not sure if you are using that, however.
This works with the gpg’s for windows found at:
ftp://ftp.gnupg.org/gcrypt/binary/gnupg-w32cli-1.4.11.exe
The two lines that work for me are:
echo your-passphrase|C:\GnuPG1\gpg.exe --yes --passphrase-fd 0 --decrypt-file C:\AMisc\ATemp\testgnupg.pgp
C:\GnuPG1\gpg.exe --yes --passphrase-fd 0 --decrypt-file C:\AMisc\ATemp\testgnupg.pgp < C:\AMisc\ATemp\passphrase.txt
I will take a look at this solution in the next few days (when I next do decryption). Thanks a bunch.
One other thing. You might want to point to your keyrings, if the string will accept these parameters:
–no-default-keyring --keyring c:<path-to-your-public-keyring> --secret-keyring c:<path-to-your-secret-keyring>
Good luck! Fought these battles before.
Here’s what I get:
C:\Users\Tip25>echo PASS|gpg.exe --yes --passphrase-fd 0 --decrypt-file C:\temp\REDEMPTION_TC_20110119.txt.pgp --no-default-keyring --keyring C:\temp\Zenpep Key.asc --secret-keyring C:\temp\Zenpep Key.asc
gpg: encrypted with ELG key, ID EE414B55
gpg: decryption failed: No secret key
gpg: --no-default-keyring: unknown suffix
gpg: --keyring: unknown suffix
gpg: C:\temp\Zenpep: unknown suffix
gpg: can’t open Key.asc' gpg: --secret-keyring: unknown suffix gpg: C:\\temp\\Zenpep: unknown suffix gpg: can't open
Key.asc’
The public and private key are held in the same .asc file.
Per William’s post, it seems it makes a difference whether you’re using what’s from gpg4win.org or gnupg.org so which are you using exactly?
I have tried both, and unless I need to do something different, I haven’t gotten it to work.
I had tried with the gpg4win.org version earlier, just now I tried the gnuph.org one and this is what I got:
C:\Users\Tip25>echo pass|gpg.exe --yes --passphrase-fd 0 --decrypt-fil
e C:\temp\REDEMPTION_TC_20110119.txt.pgp --no-default-keyring --keyring C:\temp
ZenpepKey.asc --secret-keyring C:\temp\ZenpepKey.asc
gpg: encrypted with ELG key, ID EE414B55
gpg: decryption failed: No secret key
gpg: --no-default-keyring: unknown suffix
gpg: --keyring: unknown suffix
sec 2048R/68A57EF6 2011-01-25 Zenpep Key key@tzenpap.com
ssb 2048R/88BD0CC6 2011-01-25
pub 2048R/68A57EF6 2011-01-25 Zenpep Key key@tzenpap.com
sub 2048R/88BD0CC6 2011-01-25
gpg: --secret-keyring: unknown suffix
sec 2048R/68A57EF6 2011-01-25 Zenpep Key key@tzenpap.com
ssb 2048R/88BD0CC6 2011-01-25
pub 2048R/68A57EF6 2011-01-25 Zenpep Key key@tzenpap.com
sub 2048R/88BD0CC6 2011-01-25
If you’re still looking for a method to make this unattended (i.e., piping the passphrase to the program via command line), this is the way I did it and it has worked for me.
echo passphrase|gpg --batch --passphrase-fd 0 --output decrypted.txt -d c:\path*.gpg