GPG cheatsheet

To generate keypair :

gpg --gen-key

Listing:

To list all public keys

gpg --list-keys
gpg -k

To List private keys -

gpg --list-secret-keys
gpg -K

Encrypt/Decrypt:

The option -a is for armor (Base64 output)
To encrypt gpg -a -e -r <recipient> [file]
To decrypt gpg -a -d [file]

Sign:

To create a signed version of the file gpg [-a] -s <file>
To create a separate signature gpg --detach-sign -a <file>

Verify and decrypt are the same thing. Or use the specific verify option
gpg --verify file.asc file

Export:

To export a public key: gpg --export -a <id/email>
To export a secret key: gpg --export-secret-keys -a -o <outfile> <id/email>

Import:

To import a key: gpg --import <key.gpg>

Arumugam Jeganathan

Arumugam Jeganathan

A Java developer by profession, everything* developer at pastime, a Linux enthusiast, hobbyist photographer, F.R.I.E.N.D.S fanatic and Hollywood aficionado.
Rhode Island