Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I edit my private/secret gnupg key

Tags:

gnupg

Some years ago I changed my real life name. I then naturally want to change the names to my public and private GPG keys. I have managed to generate subkeys to my public keys with my new real life name, and I have managed to revoke subkeys with my previous name.

However: How can I change the name in the private key?

(I do understand that this actually does not matter much, since I'm not sharing this key with anyone anyway.)

like image 800
Øystein Schønning-Johansen Avatar asked Feb 18 '14 19:02

Øystein Schønning-Johansen


1 Answers

There is no name stored in your private key. All UIDs are bound to the primary public/private key pair (by a special kind of signature). Add a new UID, make it primary and revoke the old one - you're done.

$ gpg --edit-key [key-id]
gpg> adduid   # Go through user ID assistant
gpg> list     # Get list of UIDs
gpg> [n]      # The number of the just added UID, probably "2"
gpg> primary  # Set primary UID
gpg> [m]      # The number of the old UID
gpg> revuid   # Revoke that UID
gpg> save

Be aware that all incoming signatures (if you had any) point to the old UID, not the key; so you will be losing them anyway.

like image 65
Jens Erat Avatar answered Jan 04 '23 05:01

Jens Erat