A Practical Guide to GPG Part 1: Generate Your Public/Private Key Pair

LinuxBabe
2 min readMay 11, 2022

--

This tutorial series will teach you how to use GPG (Gnu Privacy Guard) in the Linux terminal, so you will be able to send encrypted email messages and digitally sign documents.

What is GPG?

GPG (GNU privacy guard) is an open-source implementation of the OpenPGP protocol. It’s a free alternative to the PGP program. Then what is PGP? PGP (Pretty Good Privacy) is an encryption program developed in 1991 by Phil Zimmermann.

PGP and GPG are commonly used for two things.

  • Encryption: encrypt emails and files like Edward Snowden does every day, so bad actors can’t read your encrypted emails and files.
  • Signing: create digital signatures for signing documents. You can also use it to digitally sign all your outgoing emails, so the recipient can know the email hasn’t been tampered with. The software repository of your Linux distribution is also signed by a PGP key, so you can be sure that you are not downloading malware when running commmand sudo apt update or sudo dnf update.

PGP and GPG are sometimes interchangeable. You can say you have a PGP key or a GPG key.

Encryption at rest

If you run your own email server, you should know that a TLS certificate can be used to encrypt email traffic between SMTP servers, then why use GPG?

  • A TLS certificate is used to encrypt email traffic in transit. Hackers can’t snoop on your email traffic and extract valuable information.
  • GPG is used to encrypt emails at rest. If someone gains access to your computer, your emails are still safe, because only you have the passphrase to decrypt the email messages.

Read full tutorial here: https://www.linuxbabe.com/security/a-practical-guide-to-gpg-part-1-generate-your-keypair

--

--