Question Regarding Passphrases When Signing

Gregor Zattler telegraph at
Fri Jan 10 09:38:28 CET 2014

Hi Jim,
* Jim Ernst <jernst at> [09. Jan. 2014]:
> I am trying to sign and encrypt a file using a UNIX script. No
> matter what I do, the passphrase that is requested appears to
> be for the first key that is listed via -list-keys. I have
> tried specifying a recipient but that does not seem to make any
> difference; it still asks for the same key's passphrase. 
> Is it possible to specify which key that the passphrase is
> requested for when signing/encrypting ? 

The passphrase is not for enrcyption but for signing.  Therefore
gpg asks for the passphrase of your key.  To enforce the use of
one among several signung keys under your control use the `-u'
option.  From the man page:

       --local-user name

              -u     Use name as the key to sign with. Note that
               this option  overrides --default-key.

HTH, Gregor               

More information about the Gnupg-users mailing list