WINDOWS - Adding passphrase to gpg via command line

Peter Lebbing peter at
Fri Jun 17 10:19:40 CEST 2016

Well, at least it seems to make more sense now.

On 17/06/16 07:24, Mike Kaufmann wrote:
> gpg --homedir C:\ESA\EIOPA\PreProd\DCCR -k
> [...]
> gpg --homedir C:\ESA\EIOPA\PreProd\DCCR -K
> [...]
> gpg --homedir c:\ESA\EIOPA\PreProd\DCCR --with-keygrip -K 29FDE3FE sec rsa2048/29FDE3FE 2016-03-21
> [...]
> gpg-connect-agent
>> havekey C9FE2B0938FC146E088A9D563AED4892A6ACB6FB
> ERR 67108881 Kein geheimer Schl³ssel <GPG Agent>

(First of all, the third should just end "--with-keygrip -K", or
possibly with 29FDE3FE to select to list just that secret key. The rest
was in my example because I accidentally screwed up the formatting; it
is actually the start of the output on the next line)

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.

In fact, since you're continually running into trouble with
preset_passphrase, it might make sense to first get it working using
just the default homedir, and only when that works, move on to a
different homedir. That is, if you do need that different homedir.

> gpg --version
> gpg (GnuPG) 2.1.12
> libgcrypt 1.7.0


> Home: C:/Users/mika.INTERN/AppData/Roaming/gnupg

This is its default homedir.

> I use the following command to sign a file:
> gpg --homedir c:\ESA\EIOPA\PreProd\DCCR --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

Could you show its output as well?



I use the GNU Privacy Guard (GnuPG) in combination with Enigmail.
You can send me encrypted mail if you want some privacy.
My key is available at <>

More information about the Gnupg-users mailing list