Working with GnuPG
GnuPG, the GNU Privacy Guard is a complete implementation of the OpenPGP standard. It allows you to generate and manage your own GnuPG key, and is tightly integrated to many e-mail clients, libraries, and many other applications.
Ubuntu 18.04 includes both
The following command will guide you though the process of creating a new key:
If gpg2 command does not work, try with gpg
Follow the instructions and set a limited duration for the new key, for example one or two years. And remember the password!
Import Keys from Other Users
You can find the keys corresponding to your colleagues with this command:
gpg2 --search email@address
Once found, use the
gpg2 --recv-keys ABCDEF01 command to add it to your keychain.
Exporting Keys for Backup
You should export your key and store it safely, for example in your password manager.
List your keys:
Export your keys as follows:
gpg2 --output mygpgkey_pub.gpg --armor --export ABCDFE01 gpg2 --output mygpgkey_sec.gpg --armor --export-secret-key ABCDFE01
This also works:
gpg2 --armor --export firstname.lastname@example.org > mykey.asc
gpg --export-secret-key [last 8 digits of your fingerprint] > ~/my-key.asc
|The resulting file can be safely imported into other applications, for example ProtonMail or GitLab.|
Using your Key
Check these related pages for more information about how to use your newly created key: