Adding an email address to gpg key

2012-09-26

When I last time set my gpg key up I thought I'd associate more than one email address with it like I've seen people on the mailing lists do. I tried looking into it but as it didn't seem trivial I got distracted and forgot all about it.

A while back I remembered I still hadn't done it and decided it was about time to get my hands dirty. It turned out to be quite trivial, after all.

If you don't already have a gpg key you should probably find another resource on how they work, but in short you can get one by having gpg installed and running

gpg --gen-keys

and following the instructions.

Once you have the key associated with that one email address (or identity) you can add another one simply by first issuing

gpg --edit-key <key-id>

If you don't know what your key-id is, you can see it in the output of

gpg --list-secret-keys

You should now be looking at a gpg> prompt. Command

gpg> adduid

and go through similar process as you initially did when creating the key. After you're done and back at the gpg> prompt it should list both of your identities. If there isn't an asterisk beside your new key, set it with

gpg> uid #

where # is the number of the new uid in your list. The asterisk indicates that the commands you take next operate on that uid. Now, say

gpg> trust

and assign the new key to be ultimately trusted (you're a decent fellow, aren't you?!). Now all there is to do is to exit with

gpg> save

and you're all done.