WRITELOOP

GNUPG CHEATSHEET

2018 October 17

CREATE A KEY:

$ gpg –gen-key

EXPORT A PUBLIC KEY INTO FILE PUBLIC.KEY:

$ gpg –export -a “User Name” > public.key

EXPORT A PRIVATE KEY:

$ gpg –export-secret-key -a “User Name” > private.key

IMPORT A PUBLIC KEY:

$ gpg –import public.key

IMPORT A PRIVATE KEY:

$ gpg –allow-secret-key-import –import private.key

DELETE A PUBLIC KEY (FROM YOUR PUBLIC KEY RING):

$ gpg –delete-key “User Name” OBS.: If there is a private key on your private key ring associated with this public key, you must delete your private key for this key pair from your private key ring first.

DELETE AN PRIVATE KEY (A KEY ON YOUR PRIVATE KEY RING):

$ gpg –delete-secret-key “User Name” This deletes the secret key from your secret key ring.

LIST THE KEYS IN YOUR PUBLIC KEY RING:

$ gpg –list-keys

LIST THE KEYS IN YOUR SECRET KEY RING:

$ gpg –list-secret-keys

GENERATE A SHORT LIST OF NUMBERS THAT YOU CAN USE VIA AN ALTERNATIVE METHOD TO VERIFY A PUBLIC KEY, USE:

$ gpg –fingerprint > fingerprint

ENCRYPT A FILE

$ gpg -r KEY -se /path/to/file/to/encrypt

DECRYPT A FILE IN NON-INTERACTIVE MODE:

$ gpg -q –batch –yes –decrypt –passphrase=“MyKeySecurePassword” -o /tmp/config config.gpg