Matuku
Matuku

Reputation: 949

Are exported private keys in GPG still encrypted?

Are the exported private keys gotten by executing gpg --export-secret-keys still encrypted and protected by their passphrase? This seems to be the case but I can't find anywhere that explicitly confirms this.

If the exported keys are still encrypted then is there anyway to get the pure, unencrypted private key (like you can for the public segment)?

Upvotes: 59

Views: 18957

Answers (3)

shalamus
shalamus

Reputation: 2370

Yes secret keys are encrypted after exporting. Once you've imported the private key file via the following command:

gpg --import <name of your private key>.pgp

It will prompt you to enter the correct passphrase (same passphrase used to create the private key in the first place).

Upvotes: 3

mshroyer
mshroyer

Reputation: 1968

Exported secret keys are encrypted by default, however --export-options export-reset-subkey-passwd will produce an unprotected export:

When using the --export-secret-subkeys command, this option resets the passphrases for all exported subkeys to empty. This is useful when the exported subkey is to be used on an unattended machine where a passphrase doesn't necessarily make sense. Defaults to no.

Upvotes: 31

rsaw
rsaw

Reputation: 3537

Are exported secret keys still protected by their passphrase? You could find the answer to this so easily by exporting and then importing a secret key.

GnuPG has no simple way to export a private key in the way you describe. I can only hope you have a good reason for wanting to do this, and that you're aware of how dangerous it is to let the bits and bytes of an unprotected private key touch a disk. That said, the only option I see is to remove the passphrase before exporting...

gpg --edit-key KEYID
> passwd
> *(Press Enter twice, i.e., use a blank passphrase)*
> save

PS: This should be moved to Superuser; it's off-topic here.

Upvotes: 7

Related Questions