When I create a keypair with gpg, then it stores the secret key inside of
~/.gnupg/private-keys-v1.d
It stores the public-key inside of a keyring-file - I can name it or it uses the default-location.
If I have a look (--list-public-keys and --list-secret-keys) at my public and secret-keys I can see what pair matches. The 40 character string/hash in the output is the same for both.
The file of the secret-key is different to this string. It is also 40 chars long, but different.
How do I find out what secret-key file matches my public-key??
Using gpg 2.2.40 on Debian 12.
--export
and--export-secret-keys
to export the key pair that you have already identified. You find more details in the manualman gpg
.