Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which private key file in private-keys-v1.d directory belongs to which key?

Tags:

gnupg

pgp

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?

like image 347
Matthias Lohr Avatar asked Dec 20 '18 13:12

Matthias Lohr


People also ask

Where private keys are stored?

Private keys and personal certificates are stored in keystores. Public keys and CA certificates are stored in truststores. A truststore is a keystore that by convention contains only trusted keys and certificates.

Where is the private key stored GPG?

The private GPG keys are encrypted and stored in the secret keyring, and public keys are maintained with certificates attesting to their trustworthiness in the public keyring. You can use the public key for the data encryption, and that encrypted data will be decrypted using the Private key.

What does private key contain?

A private key is typically a long, randomly or pseudo-randomly generated sequence of bits that cannot be easily guessed. The complexity and length of the private key determine how easily an attacker can execute a brute-force attack, where they try out different keys until the right one is found.

In which directory are your public and private keyrings stored?

pkr (public keyring) and secring. skr (private keyring) file in the default keyring location. For Windows this is in the Documents>PGP folder. This article will use [ ] to identify information that you will need to enter that is specific to your individual keys.


1 Answers

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.

like image 142
JTK Avatar answered Oct 02 '22 09:10

JTK