
John Reed
GnuPG is a complete and free implementation of the OpenPGP standard as defined by RFC4880 (also known as PGP). In addition to the source code being available, GPG also lives in Ubuntu’s repositories.
sudo aptitude install gnupg2
gpg2 --gen-key
The private key is stored in ~/.gnupg/secring.gpg
.
The -armor
option exports the keys in ASCII format instead of binary.
gpg2 --armor --output public.key --export 'User Name'
gpg2 --armor --output private.key --export-secret-key -a 'User Name'
gpg2 --import public.key
gpg2 --allow-secret-key-import --import private.key
gpg2 --delete-secret-key 'User Name'
gpg2 --delete-key 'User Name'
gpg2 --list-secret-keys
gpg2 --list-keys
gpg2 --cipher-algo AES256 --symmetric example_file.txt
gpg2 example_file.txt.gpg
gpg2 -e -r 'Your Name' example_file.txt
gpg2 example_file.txt.gpg
You will be prompted to enter the password that you used to protect your private key when you created it (if you used one).
gpg2 -e -r 'Your Name' example_file.txt
You’ll need to have already imported their public key before you can encrypt a file for them.
gpg2 example_file.txt.gpg
Only the recipient’s private key will be able to decrypt the encrypted file.