Problem trying to automate decrypt option

Werner Koch wk at
Thu Oct 18 10:38:43 CEST 2012

On Thu, 18 Oct 2012 08:34, gabi at said:

> If I write gpg2.exe --help (or gpg.exe --help) the command or option
> --passphrase is not shown anywhere.

Note that --help does not show all options.  See the man page for a
complete list.

> I'm using windows version. Is that a feature not available in windows
> version?

It is the same on all platforms.

What you need to use is the command gpg-preset-passphrase to tell the
gpg-agent the passphrase in advance.

       gpg-preset-passphrase [options] [command] keygrip

       The gpg-preset-passphrase is a utility to seed the internal cache
       of a running gpg-agent with passphrases.  It is mainly useful for
       unattended machines, where the usual pinentry tool may not be
       used and the passphrases for the to be used keys are given at
       machine startup.

       Passphrases set with this utility don't expire unless the
       --forget option is used to explicitly clear them from the cache
       --- or gpg-agent is either restarted or reloaded (by sending a
       SIGHUP to it).  It is necessary to allow this passphrase
       presetting by starting gpg-agent with the --allow-

       gpg-preset-passphrase is invoked this way:

         gpg-preset-passphrase [options] [command] keygrip

       keygrip is a 40 character string of hexadecimal characters
       identifying the key for which the passphrase should be set or
       cleared.  This keygrip is listed along with the key when running
       the command: gpgsm --dump-secret-keys. One of the following
       command options must be given:


For use with gpg you can use

       gpg2 --with-keygrip -K

to view the keygrip.



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

More information about the Gnupg-users mailing list