Page MenuHome GnuPG

Distinguish between key names
Closed, ResolvedPublic

Description

I had three public keys in my key ring. They are named:
Test Other
TestKeyPub MRG App Key 2015
TestKeyPub MRG App Key 2017

I ran this command:
gpg --homedir /home/test/.gnupg --trust-model always -r "TestKeyPub MRG App Key 2017" --encrypt -o
/home/private/ksfile.pgp /home/private/ksfile.txt

and GPG used TestKeyPub MRG App Key 2015, when I expected it would use TestKeyPub MRG App Key 2017 to encrypt the
file.

I figured I could fix the problem by deleting TestKeyPub MRG App Key 2015, which worked. However, I noticed a
similar problem. When I ran:

gpg --delete-key TestKeyPub MRG App Key 2015

gpg asked me interactively if I wanted to delete TestKeyPub MRG App Key 2015, and then it asked me if I wanted to
delete TestKeyPub MRG App Key 2017. It seems that whatever code is doing the selection of keys has a bug in it. I
see in the documentation that there is a request to use the fingerprint for this command, but still, I believe that
a key would best match on the full name given for the key, not just the beginning of the specified key.

Details

Version
2.0.14

Event Timeline

dduane added projects: gnupg, Bug Report.
dduane added a subscriber: dduane.

A user id is not designed to be unique. Thus you can't rely on it. It, is
convenient to use a user id but it is only a shortcut.

To see why gpg selects a certain key we need to see more information - in
particular the output of "gpg -k".

BTW, your delete example is missing the quotes around the user id. And 2.0.14
is pretty old.

I see now I meant to use gpg -u "TestKeyPub MRG App Key 2017"
and not -r.

Please close this case.

--Darrell Duane
Text/Mobile: +1 202 670 8728
Skype: darrell_duane
Twitter: @DarrellDuane

On Wed, May 27, 2015 at 2:40 PM, Werner Koch via BTS <gnupg@bugs.g10code.com

wrote:

Werner Koch <wk@gnupg.org> added the comment:

A user id is not designed to be unique. Thus you can't rely on it. It, is
convenient to use a user id but it is only a shortcut.

To see why gpg selects a certain key we need to see more information - in
particular the output of "gpg -k".

BTW, your delete example is missing the quotes around the user id. And
2.0.14
is pretty old.


status: unread -> chatting


GnuPG's BTS <gnupg@bugs.g10code.com>
<T1993>


werner claimed this task.