Since GnuPG 2.1 (https://www.gnupg.org/faq/whats-new-in-2.1.html), private keys of GnuPG are stored in the private-keys-v1.d
subdirectory. After experimenting with key creation etc., I found that I have several *.key
files in this directory:
$ ls .gnupg/private-keys-v1.d
xxxxxxxxxxxxxxxxxxxxxxxxxxxx.key
yyyyyyyyyyyyyyyyyyyyyyyyyyyy.key
zzzzzzzzzzzzzzzzzzzzzzzzzzzz.key
...
The file names (x+, y+ and z+) looks like fingerprints etc., but are not equal to any of my existing public keys. How can I find which key file in this directory belongs to which key visible with gpg --list-keys
?
Use --with-keygrip
option when listing your keys.
gpg --list-secret-keys --with-keygrip
gpg --list-keys --with-keygrip
You can compare than the output with the content of the private-keys-v1.d
subdirectory, where the keys are named like <keygrip>.key
.