Forest Notes

Tips, tricks, cheatsheets

Project maintained by iamzaychik Hosted on GitHub Pages — Theme by mattgraham

PGP, GPG Cheatsheet


Create key:

$ gpg --full-generate-key
$ gpg --full-generate-key --expert

Import pubkey:

$ gpg --import pubkey.gpg

Export key:

$ gpg --output mygpgkey_pub.gpg --armor --export ABCDFE01
$ gpg --output mygpgkey_sec.gpg --armor --export-secret-key ABCDFE01

Show all keys:

$ gpg --list-keys

Encrypt file decrypted.txt with key 0x12345678 to text file encrypted.gpg:

$ gpg -a -r 0x12345678 -e decrypted.txt > encrypted.gpg

Decrypt file with key:

$ gpg -r 0x12345678 -d encrypted.gpg > decrypted.txt

Sign file message.txt and save sign to sign.asc:

$ gpg -u 0x12345678 -s message.txt > sign.asc

Sign message and save message with sign to file:

$ gpg -r 0x12345678 --clearsign message.txt > message.gpg

Check sign:

$ gpg --verify message.asc message.txt