16

I would like to know how data encryption and decryption works in PGP. As part of encryption, "gpg --gen-key" is used to generate the keys, And I got a public key, however I am not sure how to get private key. does it store in a specific location? is there any command to generate? I don't have any clue.

This is not specified in the document that I am following.

arghtype
  • 4,376
  • 11
  • 45
  • 60
Swamy
  • 771
  • 1
  • 8
  • 24

1 Answers1

25

The private key is not "visible" like the public one, but you can get it following these instructions:

You can list private keys this way, in order to check if it exists:

gpg --list-secret-keys

And you can make it visible doing a backup of your keys:

gpg --armor --export-secret-keys your_email@domain.com > your_name.asc
arutaku
  • 5,937
  • 1
  • 24
  • 38
  • Thanks a lot. I could get it using the following command. "sudo gpg --armor --export-secret-keys "name (comment) " > filename.asc" – Swamy Sep 07 '12 at 09:00
  • This option doesn't show up in the help output, it is really "secret". I think it should be added. – blmayer Nov 23 '22 at 13:42