PGP and GPG keys

last edited Wed, 24 Jul 2024 05:21:40 GMT
backlinks: null


The use and understanding of Pretty Good Privacy as an encryption standard is misunderstood, even among professionals and whistleblowers. Phil Zimmerman developed PGP encryption software in 1991. It functions as a public encryption system where two individuals need each others' respective public key to communicate. Open PGP refers to this standard, gpg -not the non-free software.

You sign with your private key aand encrypt with the recepients public key. The recepient will decrypt with their private key.

GNUpg direct link to this section

GPG is a open source implementation of Open PGP. Cipher CAST5 is used by default.

Create a Keypair direct link to this section

gpg --gen-key

Encrypting Files direct link to this section

gpg --encrypt --recipient receiversname filename.txt

A file with the .asc will be generated. The filename can also be specified after the output.

gpg --armour --output myoutfile --symmetric my_file

Decrypting Files direct link to this section

This will only display the message in the command line and not to disk:

gpg --decrypt filename.txt.gpg

Exporting Public Keys direct link to this section

gpg --export --armor youremail@example.com > publickey.asc

Exporting a Secret Key direct link to this section

gpg --export-secret-key -a "User Name" > private.key
#ascii armoured
gpg --output private.pgp --armor --export-secret-key username@email

#import
gpg --allow-secret-key-import --import private.key

Backups direct link to this section

gpg -o private.gpg --export-options backup --export-secret-keys myemail@example.com

Restore a Key

gpg --import-options restore --import private.gpg
#edit
gpg --edit-key email@example.com

View Keyring direct link to this section

gpg --list-keys

For secret keys:

gpg --list-secret-keys

Import Public Key direct link to this section

This applies to public keys that may be sharded or downloaded through keyservers.

gpg --import <filename>

Open Manual direct link to this section

gpg --help

PGP direct link to this section

Original software is developed by Symantec.

Create a keypair direct link to this section

pgp -kg

References direct link to this section