Do I have to export public GnuPG keys as well when exporting the private ones?

2

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.

yarun can

Posted 2014-08-23T01:22:08.243

Reputation: 800

1

Your private key should always remain private, you should not upload it to anywhere. http://en.wikipedia.org/wiki/Public-key_cryptography

– Tyson – 2014-08-23T01:47:55.943

Hi. I am not uploading it anywhere. I need to use it on my laptop as well. – yarun can – 2014-08-23T02:08:06.403

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 – 2014-08-23T02:11:45.807

edited my question – yarun can – 2014-08-23T02:21:23.873

Answers

0

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).

Jonas Malaco

Posted 2014-08-23T01:22:08.243

Reputation: 359

0

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:

5.5.1.3. 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.

Jens Erat

Posted 2014-08-23T01:22:08.243

Reputation: 14 141