Skip to content

Instantly share code, notes, and snippets.

@Trevoke
Forked from paul-schwendenman/gpg.rst
Created March 3, 2016 05:00
Show Gist options
  • Save Trevoke/5def92454a50ec295f27 to your computer and use it in GitHub Desktop.
Save Trevoke/5def92454a50ec295f27 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 [email protected] 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