GPG Cheat Sheet
Listing Keys
- List All private GPG Keys
gpg --list-secret-keys
- List All public GPG Keys
gpg --list-public-keys
or
gpg -k
Exporting Keys
- to export one or more of your public GPG Keys
gpg --armor --export <ID or E-Mail>...
- to export one or more of your private GPG Keys
gpg --armor --export-secret-key <ID or E-Mail>...
importing PGP Keys
this can be one or more Keys in one file Public or Private.
gpg --import <File Path>...
Encryption
- to Encrypt a message to a Specific Person
if you have someone’s GPG Key in your local database you can encrypt a massage for that specific Person
gpg -r <reciever's ID or E-Mail> --armor --encrypt <filename>
- to Encrypt a message secured by a pashphrase
this type of Encryption is also called Symetrical Encryption, since the same Key used for Encryption is also used for Decryption
gpg --symmetric <filename>
Advanced Options
--with-colons
the output is colon separated and can be filtered by using Programs such as sed,
awk, cut.
this is very useful if you are planning to make a program that interfaces with
GPG.
for example
gpg --with-colons --list-keys
gpg --with-colons --list-keys | grep ^uid | cut -d ':' -f 8,10
--armor
the outputed file will be ASCII encoded, this makes it easy to copy and paste