Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

gpg cheat sheet

The GNU Privacy Guard (GnuPG or GPG) is a free software alternative for the PGP suite of
cryptographic software, released under the GNU General Public License. It is an essential tool
to encrypt data or communications.

Create a key
gpg --gen-key

Export keys
gpg --export -a "User Name" > public.key
gpg --export-secret-key -a "User Name" > private.key

Import keys and give trust


gpg --import public.key
gpg --import private.key
gpg --edit "User Name"
>trust
(select the 'trust ultimately' option)
>q

List and delete


gpg --delete-secret-key "User Name"
gpg --delete-key "User Name" #corresponding private first
gpg --list-keys
gpg --list-secret-keys

Encrypt
gpg -e [-u "Sender"] [-r "Receiver"] somefile
• creates somefile.gpg, does not delete somefile
• Use yourself as receiver for private data

Decrypt
gpg -d mydata.tar.gpg
Sign
gpg -s

if you don’t specify a from/to person, it will ask. If you don’t specify a file, it will wait for input.
Type or paste your input and pressing[ctrl] D will tell the program that you are done with the
input and move on.

You might also like