1
I have one GPG key in my computer, whose ID is "jviotti@openmailbox.org".
I'm using the --encrypt
command to encrypt a dummy text file, adding myself as the recipient, but with a typo on my ID:
$ echo "Hello World" > foo
$ gpg --recipient jviotti@openmailbox.or --encrypt foo
Now if I try to decrypt it with gpg -d foo.gpg
, the usual password screen is presented, showing Juan Cruz Viotti <jviotti@openmailbox.org>
. If I put my password correctly, the file is decrypted just fine.
This confuses me, given that the recipient I specified had a typo. Is gpg
adding my ID as an implicit recipient?
I'm interested by this, having never properly used gpg. It seems there is an option to default to using your own id as the default -
The user ID of the default key is used as the default recipient. gpg does not query for a recipient if this specifies a valid key. The default key is the first key on the private keyring or the key specified with the option default-key.
--
However I'm confused to why it doesn't tell you the specified recipient isn't one that you have the public key for? – djsmiley2k TMW – 2017-03-09T19:09:54.563
Can you add a
gpg --list-keys
to your question, I'm wondering if you've accidently added the 'incorrectly spelt id' to your keychain as well? – djsmiley2k TMW – 2017-03-09T19:11:12.527There is no incorrectly spelt id on my keychain, and "jviotti@openmailbox.org" is the only id in there. – jviotti – 2017-03-10T03:48:55.310
I'm guessing that it matched the first part of the recipient that you did correctly type, it may even work with only typing
j
since it would match the only key you've got (similar to "tab complete" in a terminal). Try with an actual typo, not just omitting the last letter. And try running your gpg command again, but adding some verbose flags (-v
) you can add multiple flags to get more info, I think 9 or 10 is the max, so try adding-vvvvvvvvvv
– Xen2050 – 2017-03-10T12:11:05.227Hi @Xen2050, looks like you theory is right. If I have the public key of a recipient that starts with the ID I pass to
--recipient
, than such ID is added as a recipient. If the initial part of the string doesn't match, then gpg complains. Do you mind creating a proper answer so I can accept it? – jviotti – 2017-03-11T22:24:50.237