Earlier on today I decided to backup my laptop and re-install everything. I thought I backed up the GPG keys correctly but it turns out I only exported my public key.

I understand that I can't get that key back as I failed to back it up correctly.

My question though is, can I re-generate a new secret key and assign it to the public key exported earlier? or should I just create another key/pair but then I would have 3 keys on my PC the old public key and then the new generated keys each would have the same name and email address - Is this the correct thing to do?

  • Do you have a revocation certificate for the old key? Commented Oct 13, 2018 at 20:57
  • No I don't, I only copied across the exported public key before wiping the old install. Commented Oct 13, 2018 at 21:00
  • I guess now you know why it is called a secret key: If anybody could create a matching secret key from your public key, it wouldn't be very much secret, actually. You have learned to backup your secret keys (or a t least the revocation certificates) by now. If you had the latter, then you could at least declare you lost key as obsoleted.
    – U. Windl
    Commented Jan 28, 2023 at 18:47

1 Answer 1


Your old private key is gone so about all your old public key is good for is 'legacy' usage. (i.e. you won't be doing anything new with it but it could be used to verify anything previously signed, for example) Going forward, everything would be based on your new private/public key pair which have no relation to your old keys.

Also, since it doesn't sound like your old key used a CA you'll have to manually make sure that any people/services that need to be are notified and get your new public key.

  • Thanks, I'll create a new key - wasn't sure the "correct" approach. As for the old key fairly sure I only used it with Apache previously when signing a committer form. Commented Oct 13, 2018 at 21:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .