My Common GPG usage

Gao
GnuPG uses public key cryptography so that users may communicate securely. Create Key ```shell gpg --gen-key ``` This will ask for key type, commonly uses RSA algorithms. Then it will ask for your name, email and comment for this key. List Key ```shell gpg --list-key ``` Encrypt file ```shell gpg --output doc.gpg --encrypt --recipient blake@cyb.org doc ``` Decrypt file ```shell gpg --output doc --decrypt doc.gpg ``` Symmetric encrypt ```shell gpg --output doc.gpg --symmetric doc ``` Message Encrypt ```bash # Encrypt with public key gpg --encrypt --sign --armor -r person@email.com name_of_file # Decrypt gpg file_name.asc ``` Export all public keys ```shell gpg -a --export > mypubkeys.asc ``` Export all encrypted private keys (which will also include corresponding public keys) ```shell gpg -a --export-secret-keys > myprivatekeys.asc ``` Export gpg’s trusted to a text file ```shell gpg --export-ownertrust > otrust.txt ``` Import gpg private keys and public keys and trust db ```shell # batch will not prompt password verify gpg (--batch) --import myprivatekeys.asc gpg --import mypubkeys.asc gpg --import-ownertrust otrust.txt ```