Skip to content

Instantly share code, notes, and snippets.

@paul-schwendenman
Last active July 30, 2018 14:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save paul-schwendenman/9833491 to your computer and use it in GitHub Desktop.
Save paul-schwendenman/9833491 to your computer and use it in GitHub Desktop.
GPG Cheatsheet

GPG Cheat sheet

A small guide to little things

Create a key

gpg --gen-key

Sign a file

gpg -u {KEY_ID} --clearsign <file_name>

Move a key-pair privately

  1. export the public and private keys and encrypt the pair:

    gpg --output - --export-secret-key {KEY_ID} | cat <(gpg --output - --export {KEY_ID}) - | gpg --armor --output keys.asc --symmetric --cipher-algo AES256
  2. move the file (keys.asc) to the other computer.
  3. import the key on the other computer:

    gpg --no-use-agent --output - keys.asc | gpg --import
  4. shred the file for good measure:

    shred -n 3 -u keys.asc

Thanks to Dark Otter

source

http://montemazuma.wordpress.com/2010/03/01/moving-a-gpg-key-privately/

Encrypt a file

gpg --output out.gpg --encrypt --recipient paul@example.com input

GPG a directory

Encrypt:

tar cfz - this/ | gpg --armor --output files.asc --symmetric --cipher-algo AES256

Decrypt:

gpg --no-use-agent --output - files.asc | tar xzf -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment