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"
  (select the 'trust ultimately' option)

List and delete

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


  gpg -e [-u "Sender"] [-r "Receiver"] somefile

     - creates somefile.gpg, does not delete somefile
     - Use yourself as receiver for private data


  gpg -d mydata.tar.gpg