GnuPG (GNU Privacy Guard, or simply GPG) is an implementation of the OpenPGP standard as described in RFC4080.

Typical Use Cases

  • End-to-end encryption (E2EE) on supported services
  • Code signing via git (see GitHub’s tutorial)
  • Authenticating to SSH servers
  • Encrypting documents

Best Practices

  • Store the primary key offline, and only use subkeys. Your primary key is usually used to change expiration dates on subkeys, add new subkeys, generate revocation certificates, sign others’ keys, etc, none of which you will do on a daily basis, so don’t carry it around.
  • Set a expiration date (e.g., 5-7 years) on the subkeys. You can still extend the expiration date or create new subkeys after they expire, but try to leave ample time to do so (e.g., 1-2 years) before actual expiry. This protects the case where you lost the keys and can’t revoke them for any reason. Expiry on the mater key is unnecessary if it’s stored offline.
  • Store the subkeys in a hardware key if possible. Note that tools like ykman for Yubikey deletes the local copy of keys when importing, so make sure to make a backup beforehand.
  • Backup your keys and revocation certificate, ideally in a fireproof container and in multiple places.
  • Secure your key with a good passphrase, e.g., 4-6 Diceware words with random extra characters.

Guides