I created my GnuPG keys. They show up in my keys repository. Now I want to export my secret key and import it into another computer so I could use it on that computer (for example my laptop).

Do I have to export and import private and public keys separately? Does the secret key already include the public key somewhat?

Basically I want to have a copy of my public and private keys on my laptop.

  • 1
    Your private key should always remain private, you should not upload it to anywhere. en.wikipedia.org/wiki/Public-key_cryptography – Tyson Aug 23 '14 at 1:47
  • Hi. I am not uploading it anywhere. I need to use it on my laptop as well. – yarun can Aug 23 '14 at 2:08
  • Your public key goes on the server, the private key should NEVER leave your computer. The way your question is worded leads me to belive you want to "export it and import it into another computer". – Tyson Aug 23 '14 at 2:11
  • edited my question – yarun can Aug 23 '14 at 2:21

From a message in the GnuPG user group:

If you import a secret key and you don't have the public key, GPG will use the embedded public key data to recreate the public key, so effectively an exported secret key is like exporting a key pair.

But it is a good idea to also send you public key with all signatures.

Also, you can consider submitting your key to a keyserver (such as the SKS keyserver pool).


No, you don't have to export them separately; when exporting the secret key everything public is also contained. From RFC 4880, OpenPGP, highlighting added by me: Secret-Key Packet (Tag 5)

A Secret-Key packet contains all the information that is found in a Public-Key packet, including the public-key material, but also includes the secret-key material after all the public-key fields.

You can also verify this by running gpg --list-packets [file], which will dump a list of all contained packets including public (sub)keys, signatures etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.