Creating Your Key

Before you can encrypt or sign files with GPG you must have a key.

~ $ gpg --gen-key

Post the public, ascii side of your key to the web

~ $ gpg --armor --output pubkey.txt --export 'Your Name'
~ $ gpg --send-keys 'Your Name' --keyserver hkp://

Encrypting / Decrypting

Here we encrypt/decrypt a file that is just for our own use.

~ $ gpg --encrypt --recipient 'Your Name' foo.txt
~ $ gpg --output foo.txt --decrypt foo.txt.gpg

Encrypting for Recipient

gpg --search-keys '' --keyserver hkp://
gpg --import key.asc
gpg --list-keys
gpg --encrypt --recipient '' foo.txt


gpg --output foo.txt --decrypt foo.txt.gpg


gpg --verify crucial.tar.gz.asc crucial.tar.gz
gpg --armor --detach-sign

See Also