PGP
What is a PGP key? Public keys, key blocks and fingerprints
A PGP key is a pair: a public key you share and a private key you keep. What a public key block holds, how fingerprints work and how to check a key.
Updated · 8 min read
Written and fact-checked by the Mantis Payments team. Reviewed by Basit Nasir, Founder and CEO.
In short
- A PGP key is a pair: a public key you share so people can encrypt to you, and a private key you never share.
- A “PGP public key block” is your public key as text, holding your user IDs, subkeys and the signatures that bind them.
- Identify keys by their full fingerprint. Short 8-character key IDs can be faked in seconds.
- Before trusting a key, compare its fingerprint with the owner in person or over another secure channel.
- OpenPGP is still used to sign software, list security contacts and send documents to journalists, though it has real limits for email.
A PGP key is a pair of keys. The public key is the half you share: people use it to encrypt messages to you and to check your signatures. The private key stays secret on your device, where it decrypts those messages and makes your signatures.[1] Each key has a fingerprint, a code that identifies it.
This guide explains the names (PGP, OpenPGP, GPG), what’s inside a “PGP public key block”, how fingerprints work and how to make, share, check and retire a key. To put a key to work, see how to decrypt and encrypt a PGP message.
What is a PGP key used for?
Two jobs. For encryption, anyone with your public key can encrypt a message that only your private key can decrypt. For signatures, your private key signs a message or file, and anyone with your public key can check that it came from you and wasn’t changed.[1]
That’s why your public key can go anywhere, from your website to a keyserver (a public directory of keys), while the private key must stay private. Anyone who copies your private key can read messages meant for you and sign messages in your name.[2]
Are GPG and PGP different?
They’re names for related things:
- PGP (Pretty Good Privacy) is the original family of programs, developed by Phil Zimmermann.[3]
- OpenPGP is the open standard based on PGP. Its current version is RFC 9580, published by the Internet Engineering Task Force (IETF) in July 2024. It replaced RFC 4880, from 2007.[1][3]
- GnuPG (GNU Privacy Guard), also called GPG, is a free program that implements OpenPGP.[3] Its gpg command appears in the examples below.
So “PGP key”, “OpenPGP key” and “GPG key” mean the same thing in practice: a key in the OpenPGP format.
What is a PGP public key block?
A PGP public key block is your public key written out as text, so you can paste it into an email, a web page or a form. It begins with the line -----BEGIN PGP PUBLIC KEY BLOCK----- and ends with -----END PGP PUBLIC KEY BLOCK-----, with lines of letters, numbers and symbols in between. This text form is called ASCII armor: the key’s binary data, encoded as base64, a way of writing any data with ordinary letters, digits and symbols.[1]
The same wrapping is used for other PGP data, and its first line tells you what it holds:[1]
| First line | What it holds |
|---|---|
-----BEGIN PGP PUBLIC KEY BLOCK----- | A public key, safe to share |
-----BEGIN PGP PRIVATE KEY BLOCK----- | A private key |
-----BEGIN PGP MESSAGE----- | An encrypted, signed or compressed message or file |
-----BEGIN PGP SIGNATURE----- | A signature, kept separate from what it signs or added below a signed message |
What’s inside a public key block?
Decoded, a public key block (the standard calls it an OpenPGP certificate) is a bundle of parts:[1]
- A primary key: the main public key. It can make signatures, and it vouches for everything else in the bundle.
- User IDs: usually a name and an email address. Each comes with a self-signature, in which the primary key vouches for that identity.
- Subkeys: extra keys, each tied to the primary key by a binding signature. A typical key has a separate subkey for encryption.
- Revocation signatures, if the owner has withdrawn the key or part of it.
Self-signatures also carry settings, such as the key’s expiry date and the algorithms its owner prefers.[1] To see what a key file contains without importing it, run gpg --show-keys key.asc.
What is a PGP key fingerprint?
A fingerprint is a code calculated from the public key itself with a hash function, so it identifies one exact key. For version 4 keys, the format the 2007 standard required, it’s a 160-bit SHA-1 hash, written as 40 hexadecimal characters (0–9 and A–F).[3] For example, the Tor Project gives the fingerprint of its Tor Browser signing key as EF6E 286D DA85 EA2A 4BA7 DE68 4E2C 6E87 9329 8290.[4]
A key ID is a shortened fingerprint. For a v4 key, the “long” key ID is the last 16 characters of the fingerprint (4E2C 6E87 9329 8290 for the Tor key), and the “short” key ID is the last 8.[1] Key IDs are handy labels, but they aren’t unique: the standard warns that two different keys can share one.[3]
Why aren’t short key IDs safe?
Because they’re easy to fake. In 2014 the Evil32 project showed that a graphics card can create a key matching any chosen 32-bit (8-character) key ID in about four seconds. It made look-alike keys for every key in the “strong set” of the web of trust, the network of keys that people vouch for by certifying each other’s keys.[5]
Its advice was simple: stop using 32-bit key IDs and check fingerprints.[5] Use the full fingerprint whenever you look up, compare or publish a key.
How do I generate a PGP key?
Make it in a PGP app on your own device, never on a website, so the private key is created where it will live. In Kleopatra (Windows) or GPG Keychain (Mac), choose the option to create a new key pair, then enter your name, your email address and a strong passphrase. On the command line, gpg --full-generate-key asks about every option, including the expiry date, while gpg --generate-key uses the current defaults.[6]
When gpg creates a key, it also saves a revocation certificate in the openpgp-revocs.d folder inside GnuPG’s home directory.[6] Copy that file, and a backup of your private key, to safe offline storage such as an encrypted USB stick. Then export your public key block to share it: gpg --armor --output my-key.asc --export you@example.org
Where do I find my PGP key?
Your keys are in your PGP app’s keyring, on the device where you created or imported them. With gpg:
gpg --list-secret-keyslists the keys whose private half you hold.gpg --fingerprint you@example.orgshows your full fingerprint.gpg --armor --export you@example.orgprints your public key block, ready to copy.
In Kleopatra or GPG Keychain, your own keys sit in the main list with everyone else’s, and Export saves your public key block to a file. Make sure you export only the public key, unless you’re making a backup.
How do I get someone’s PGP public key?
The most reliable source is the person, or a place they control, such as their website. Two public directories can also find a key from an email address:
- keys.openpgp.org is a public keyserver that shares the identity details in a key, such as its email address, only after the owner has verified that address. Until then, it publishes only the key’s technical parts.[7]
- Web Key Directory (WKD) lets an email domain publish its users’ keys on its own web server, at an address worked out from the email address. It’s set out in an Internet-Draft, a working document that isn’t an official IETF standard.[8] With gpg,
gpg --locate-external-keys alice@example.orgasks the domain for the key.
Import a key file with gpg --import alice.asc or your app’s Import button. Wherever a key comes from, treat it as a starting point and check its fingerprint before you rely on it.
How do you know a PGP key really belongs to someone?
Anyone can make a key with your name and email address in it, so a user ID proves nothing on its own. What counts is the fingerprint, checked with the owner over a channel an impostor can’t easily fake. EFF’s Surveillance Self-Defense guide suggests comparing fingerprints in person when possible, or otherwise over another secure channel, such as an end-to-end encrypted messaging app or a video call.[2]
Once you’ve checked, you can record it by certifying the key. gpg --lsign-key alice@example.org marks it as verified on your device only, while gpg --sign-key alice@example.org makes a certification you can share.[6] Shared certifications are the basis of the “web of trust”, in which people vouch for each other’s keys.
What happens when a PGP key expires or is revoked?
Many keys carry an expiry date, stored in their self-signatures.[1] Expiry isn’t final: the owner can set a new date, for example with gpg --quick-set-expire followed by the key’s fingerprint and a period such as 2y, and then share the updated public key.[6] An expiry date limits the damage if you lose a key and can’t revoke it.
Revocation is permanent. If a private key is stolen or lost, its owner publishes a revocation signature, which marks the key as revoked. Only the key itself, or a key it has named for the job, can make one.[1] That’s why you make the revocation certificate in advance: if the private key is gone, it’s how you revoke the key. With GnuPG, you import the certificate and then share the revoked public key the same way you shared the original, for example on a keyserver or your website.[6] If you have no certificate but still have the private key, gpg --generate-revocation makes one.
What’s the difference between v4 and v6 PGP keys?
RFC 9580 added version 6 keys in 2024. The most visible change is the fingerprint: v6 keys use the SHA-256 hash function, giving a 256-bit fingerprint written as 64 hexadecimal characters, and their key ID is the first 16 characters instead of the last.[1]
The standard says software should now create v6 keys but should still accept v4 keys, which RFC 4880 had required.[1][3] Older software written only for RFC 4880 may not read v6 keys, so the choice is a trade-off: v6 follows the current standard, while v4 also works with older software. Check what the people you write to use before you switch. Our guide to PGP vs GPG covers how the main programs handle the newer format.
Is PGP still used today?
Yes, though EFF’s Surveillance Self-Defense guide notes that PGP itself is rarely used anymore.[2] Its OpenPGP format still does several important jobs:
- Signing software. Projects sign their downloads so you can check that a file came from them and wasn’t tampered with. Each Tor Browser download, for example, comes with a matching OpenPGP signature file.[4]
- Security contacts. The security.txt format (RFC 9116) lets a website point security researchers to an encryption key for reporting problems, and its examples are OpenPGP keys.[9]
- Journalism. SecureDrop, which newsrooms run to receive documents from sources, gives journalists GPG-encrypted submissions to decrypt on a computer that never connects to the internet.[10]
What are the main criticisms of PGP?
- No forward secrecy. Forward secrecy means a stolen key can’t unlock past messages, and PGP doesn’t have it: if someone gets your private key, they can read every message encrypted to it, past and future.[2]
- Metadata stays visible. Encryption hides the message itself, but the servers in between can still see details such as the sender, the recipient, the dates and, for email, the subject line.[2]
- It’s hands-on. You manage keys and check fingerprints yourself; EFF notes that PGP makes you do several steps by hand.[2]
Those limits matter most for ongoing private conversations. They matter least for signatures on public files such as software downloads, where nothing is secret and the point is to prove who signed.
Mantis plans to include on-device OpenPGP tools that detect PGP messages and keep PGP keys separate from its chat and wallet keys.
Questions people ask
What is PGP?
PGP, short for Pretty Good Privacy, is a way to encrypt and sign messages and files with a pair of keys: a public key you share and a private key you keep. It began as a family of programs developed by Phil Zimmermann, and its format is now an open standard called OpenPGP. GnuPG is a free program that implements it.
Sources
- [1]RFC 9580: OpenPGP, IETF
- [2]A Deep Dive on End-to-End Encryption: How Do Public Key Encryption Systems Work?, Electronic Frontier Foundation, Surveillance Self-Defense
- [3]RFC 4880: OpenPGP Message Format, IETF
- [4]How to verify Tor Browser’s signature, Tor Project
- [5]Evil 32: Check Your GPG Fingerprints, Evil32 project
- [6]OpenPGP Key Management (Using the GNU Privacy Guard), GnuPG
- [7]About keys.openpgp.org, keys.openpgp.org
- [8]OpenPGP Web Key Directory (draft-koch-openpgp-webkey-service-22), IETF Datatracker
- [9]RFC 9116: A File Format to Aid in Security Vulnerability Disclosure, IETF
- [10]What Is SecureDrop?, Freedom of the Press Foundation, SecureDrop documentation