gpg2 man pages says following:

`Note that exporting a secret key can  be a security risk if the exported keys are sent over an insecure channel.`

I assume that exported key is encrypted with passphrase. What are security risks if I put exported encrypted secret key on public file server, considering that passphrase is long enough?

  • Why do you assume that the key is exported encrypted? – Matteo Dec 21 '19 at 16:26
  • @Matteo Because it's how PGP worked. – U. Windl Dec 21 '19 at 18:50

The encryption of your secret key is only one component of the private key's security; the other component is that only you posess it. Sending the private key (even if encrypted) over a public channel allows an eavesdropper to get the (encrypted) key file. Then an brute-force attack on the passphrase could be started and your private key could possible be disclosed.

I read that a random German sentence of 80 characters (corresponding to approximately 20 random characters) would be strong enough to protect a 1024 bit RSA key. My guess is that the average user's passphrase is much weaker than that, so keep your secret key away from public if possible.

| improve this answer | |

The key is not encrypted when exporting. For this reason you get the warning.

| improve this answer | |
  • Thanks for the response. Is there any documentation that says it is not encrypted? I understood it such passphrase is used to decrypt secret key each time it is used or imported and i works just like pem encrypted private key. – Konstantin Rybakov Dec 21 '19 at 16:41
  • In the documentation there is no mention of encrypting. When you export it, you are asked for the password to decrypt it, but there is no prompt for a transport password. – Matteo Dec 21 '19 at 16:45
  • When you import exported secret key on another machine, which is unaware of that key existence, you are asked for passphrase, which means that the key you are importing is encrypted. If it were raw - another machine would not be able to verify previously set passphrase. – Konstantin Rybakov Dec 21 '19 at 16:54
  • I just tried, exported on one machine, scp to a second machine, imported it. No password prompt. – Matteo Dec 21 '19 at 16:58
  • 1
    @KonstantinRybakov Provided it's encrypted w/ a min of 16char, containing at least two each of lowercase, uppercase, numbers, and symbols, it would guarantee the passphrase will remain uncrackable (it would take the largest known botnet [to date] using GPUs over a thousand years to try 50% of the possible passphrases, assuming a possible 80 different characters [math] could be used). If security is a real concern, export on an air-gapped device, then immediately securely erase the drives 5x - 7x w/ random characters. – JW0914 Dec 21 '19 at 17:33

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.