gpg offering to encrypt to an unwanted key

Philip Jackson philip.jackson at
Sun Oct 5 20:44:47 CEST 2014

During a recent encryption of a file, I made a mistake in the command options
and gpg looked as if it was going to encrypt to another key. It picked a key
which was in my keyring but not specified as a default in gpg.conf.  (my own key
is specified as default in the gpg.conf)

My mistake was to mis-spell  the encrypt part :

I put '-encrypt'  instead of '-e' or '--encrypt'

This is what I got :

> desktop:~$ gpg2 -encrypt filename.txt

(pinentry asked my password, then second confirmation entry) then

> gpg: 0xDCEA1B7C6B136ECF: There is no assurance this key belongs to the named user
> pub  4077g/0xDCEA1B7C6B136ECF 2004-06-06 TrueCrypt Foundation <contact at>
>  Primary key fingerprint: C5F4 BAC4 A7B2 2DB8 B8F8  5538 E3BA 73CA F0D6 B1E0
>       Subkey fingerprint: EB79 356A 3AFA B492 66A3  322F DCEA 1B7C 6B13 6ECF
> It is NOT certain that the key belongs to the person named
> in the user ID.  If you *really* know what you are doing,
> you may answer the next question with yes.
> Use this key anyway? (y/N) N
> gpg: filename.txt: encryption failed: Unusable public key
> desktop:~$ 

This is repeatable as often as I want.  If I use one of the correct options for
encrypt, the operation goes perfectly.

Why would gnupg pick an unwanted key for encryption ?  That seems a potentially
dangerous thing to do even though there was a warning message.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20141005/aae9aa07/attachment.sig>

More information about the Gnupg-users mailing list