Introduction
OpenPGP keys are used to encrypt and sign email and files, and to sign software releases. A key file holds a public key, or a whole key pair, together with the names and email addresses it belongs to and the signatures that bind them. The format is the OpenPGP standard, which grew out of Phil Zimmermann’s PGP program and is now defined in RFC 9580.
The same data can be saved as binary, usually .gpg or .pgp, or
as ASCII armour, usually .asc, which wraps it in base64 text that survives
email and web pages. The extension .asc is also used for armoured signatures
and messages, which are different data in the same wrapping.
Structure
Binary OpenPGP data is a sequence of packets. Each packet starts with a header byte whose top bit is set and which gives the packet type, then a length, then the body. A public key is a Public-Key packet (type 6), then one or more User ID packets (type 13), each followed by Signature packets (type 2) that certify it, then any subkeys (type 14) with their own binding signatures. A secret key uses Secret-Key packets (type 5) instead, with the private parts usually encrypted with a passphrase.
ASCII armour wraps the packets in a -----BEGIN PGP PUBLIC KEY BLOCK-----
line (or PRIVATE KEY BLOCK), optional header lines, a blank line, the base64
data, a checksum line starting with =, and the matching END line.
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEZ…
…
-----END PGP PUBLIC KEY BLOCK-----
Not described
Known, not yet covered
- Reference: the key material, public-key encryption fields and signature fields of the post-quantum algorithms 30–36, defined in RFC 9980, which was not read (key material).
- Reference: version 3 key and signature packets (history) and the rest of RFC 9580 from section 5.2.3.12 on that these pages do not repeat, such as the signature-computation rules of section 5.2.4 and the message grammar of section 10.3.
- Viewer: there is no viewer for OpenPGP armoured files yet.
Links
Software
- GnuPG – the free OpenPGP implementation, which imports and exports keys (Windows, macOS, Linux)
- Gpg4win – GnuPG with the Kleopatra key manager (Windows)
- GPG Suite – GnuPG with a key manager and Mail plug-in for the Mac (macOS)
- Thunderbird – email program with OpenPGP built in (Windows, macOS, Linux)
Developers
- GPGME – library for using GnuPG from programs, with bindings for other languages (C)
- Sequoia PGP – OpenPGP library (Rust)
- OpenPGP.js – OpenPGP library (JavaScript)