AW: WINDOWS - Adding passphrase to gpg via command line

Mike Kaufmann m.kaufmann at
Fri Jun 17 11:25:53 CEST 2016

Hi Peter

The hint with the homedir did the trick - you are my hero!

> The --homedir option has a lot of influence. You cannot use a "gpg" in one homedir with an agent running in another. So you should also supply the "--homedir <blah>" argument to gpg-connect-agent to get a connection for an agent with the correct homedir.
> You either need to supply the --homedir option to all commands you invoke, or set it through the Windows registry (HKCU\Software\GNU\GnuPG:HomeDir), or just keep it at its default. Also note that running "gpg" as one user and the agent as another will most likely lead to trouble.

I was able to sign a file with a passphrase protected private key in Windows Command Line with a different homedir without pinentry dialog with the following commands  (74657374 is the hexstring for "test"):

gpgconf --kill gpg-agent

gpg-connect-agent --homedir c:\ESA\EIOPA\PreProd\DCCR "preset_passphrase C9FE2B0938FC146E088A9D563AED4892A6ACB6FB -1 74657374" /bye

gpg --homedir C:\ESA\EIOPA\PreProd\DCCR -v --output C:\ESA\EIOPA\Export\LI001_DATPPP_EIOPA_000001_16.asc --armor -u sender at --digest-algo SHA512 --sign c:\ESA\EIOPA\LI001_DATPPP_EIOPA_000001_16.csv

Thank you very much for all your advises help!


More information about the Gnupg-users mailing list