PGP, short for Pretty Good Privacy, is one of the historic tools of cryptography for the general public. Created in 1991 by Phil Zimmermann, it gave rise to the open OpenPGP standard, whose most widespread free implementation is GnuPG (or GPG). It is still used today to encrypt email, sign files and verify the authenticity of software. It works well, provided you understand how it thinks.
The principle: hybrid encryption and personal keys
Each user generates their own key pair: a private key, protected by a passphrase, and a public key to share. When someone sends you an encrypted message:
- the program generates a random symmetric key and encrypts the message with it;
- it encrypts that key with your public key;
- it sends you both.
Only you, with your private key, can recover the symmetric key and read the text. If the message has several recipients, the symmetric key is encrypted separately for each of them.
A signature works the other way round: the sender signs the message's hash with their private key, and the recipient verifies the signature with the sender's public key.
The central problem: whose key is this?
With PGP, anyone can create a key associated with any name and email address. There is no central authority checking identities, as there is with website certificates. That is why verifying keys is essential.
The key fingerprint
Every key has a fingerprint, 40 hexadecimal characters long for current keys, computed from the key itself. To be sure a key really belongs to the person you are dealing with, compare the fingerprint through a channel other than email: in person, over the phone, on a business card or on an official website.
Do not rely on short 8-character identifiers: it is possible to generate fake keys that share them with genuine ones.
The web of trust
PGP proposes a decentralised model called the web of trust: users sign the keys of people they have verified directly, and those who trust them can extend that trust. It is an elegant idea, but in practice few people use it systematically. For most people, directly checking the fingerprint remains the most reliable method.
Good key management
A few practices make using PGP much more robust.
- Use a strong passphrase to protect the private key: if someone copies the file, it is the only barrier.
- Create a revocation certificate straight away and store it somewhere safe. If you lose the key or the passphrase, you can still tell everyone the key should no longer be used.
- Set an expiry date on the key, which can be extended. An abandoned key will then expire on its own instead of remaining valid forever.
- Use subkeys: the primary key certifies the subkeys, which are used for everyday operations. The primary key can stay on offline media.
- Consider a hardware token, such as an OpenPGP-compatible smart card, to keep the private key off the computer.
- Make an encrypted backup of the private key: losing it means you can no longer read messages received in the past.
What PGP does not protect
It is important to know where protection ends.
- Metadata: sender, recipients, date and time remain visible to mail servers. In traditional use the email subject is not encrypted either, so do not put confidential information in it.
- No forward secrecy: if your private key were ever compromised, every past message encrypted for that key would become readable by whoever kept a copy.
- The recipient's computer: once decrypted, the message is in plain text on their device.
In 2018 researchers showed, with the vulnerabilities known as EFAIL, that certain mail programs could be tricked into revealing the decrypted content of encrypted emails by exploiting how they handled HTML content. The problem mainly concerned the clients and their integration with cryptography, and it was addressed with updates and stricter use of integrity checks. The lesson still applies: keep your software updated and, for sensitive messages, prefer plain-text display.
Where PGP is still the right choice
- Verifying software: many projects publish OpenPGP signatures for their downloadable files. Checking them guarantees the file comes from the developers.
- Signing documents or commits: to prove the origin of a file or a code change.
- Email communication with professionals who have already adopted PGP, when an app with end-to-end encryption is not an option.
Many mail clients, such as Thunderbird, now integrate OpenPGP without add-ons, making everyday use simpler than it used to be.
In short
- PGP uses hybrid encryption: a symmetric key for the message, protected with the recipient's public key.
- With no central authority, verifying the key fingerprint is indispensable.
- A strong passphrase, a revocation certificate, an expiry date and backups are the basis of good management.
- PGP does not hide metadata or the subject line and offers no forward secrecy.
- It remains very useful for verifying software, signing files and communicating with people who already use it.