How to work with GnuPG
1. Create a key pair
./gpg --quick-gen-key This email address is being protected from spambots. You need JavaScript enabled to view it.
2. Export the public key (-a or -armor means export as ASCII instead of binary)
gpg -a --export This email address is being protected from spambots. You need JavaScript enabled to view it. > /tmp/key
3. List keys in keyring
./gpg --list-keys
4. Encrypt a file (-r specifies the owner of the public key)
./gpg -r This email address is being protected from spambots. You need JavaScript enabled to view it. -e /tmp/testfile
5. Decrypt a file (pasadena is the passphrase used to crete the key)
echo pasadena | gpg —-yes —verbose /tmp/testfile.gpg
(or simply gpg /tmp/testfile.gpg and follow prompt)
6. Set cipher preference
get current preferences
* gpg —-verbose —-version
set preferences
* gpg —-edit-key This email address is being protected from spambots. You need JavaScript enabled to view it.
Encrypting requires pubring.gpg
Decryption requires secring.gpg