OpenPGP Smartcard Secret Key Stub Recovery

TIL: If you use a Yubikey/Yubikey Neo as a gnupg smartcard, you can regenerate the secret key stubs with only the hardware token, provided you put the public key on a keyserver previously (e.g. at generation time).

https://security.stackexchange.com/questions/45094/smart-card-gnupg-what-is-stored-in-my-keyring-how-to-adopt-smart-card

1: Download Public Key

gpg --card-edit --keyserver pgp.mit.edu
fetch
quit

2: Regenerate Secret Stubs

Then, when you run the following command, it will regenerate the secret key stubs needed to decrypt or sign using the card:

gpg --card-status

3: View (Optional)

gpg --list-secret-keys

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now