OpenPGP (formalized in RFC 4880 and updated in RFC 9580) is the foundational open standard behind GNU Privacy Guard (GnuPG). It powers signed Git commits, package repository verification in Debian/Ubuntu and RedHat, and encrypted developer communications.
1. The Master Key vs Subkey Paradigm
In early PGP systems, a single key pair was used for both signing and encryption. If that key was compromised, all historical encrypted messages were readable, and the user had to revoke their entire identity.
Modern OpenPGP architecture enforces a strict separation between the Primary Master Key and specialized Subkeys:
- Primary Master Key [C - Certify]: The master key possesses the Certify capability. It is used solely to sign subkeys, add or revoke User IDs, and sign keys of other people (Web of Trust). In hardened security setups, the master key is kept on an offline air-gapped USB drive or paper backup.
- Signing Subkey [S - Sign]: Used for day-to-day operations like signing Git commits, signing software releases, and authenticating messages.
- Encryption Subkey [E - Encrypt]: Used to encrypt session keys when receiving confidential files.
- Authentication Subkey [A - Authenticate]: Used in place of SSH keys for secure remote server login via
gpg-agent.
2. How OpenPGP Fingerprints are Calculated
An OpenPGP key ID (such as the legacy 8-character 32-bit short ID or 16-character 64-bit long ID) is merely the lower 32 or 64 bits of the key's full cryptographic fingerprint. Because 32-bit short IDs are susceptible to collision attacks (generating two distinct public keys with the same short ID takes minutes on consumer hardware), developers must always verify the full 40-character (160-bit) v4 fingerprint.
Under RFC 4880 §12.2, a v4 fingerprint is computed by taking the SHA-1 hash of a specific byte buffer:
Fingerprint = SHA1( 0x99 || 2-byte-packet-length || 1-byte-version (0x04) || 4-byte-creation-timestamp || 1-byte-algorithm-id || algorithm-specific-public-key-fields )
Under the newly ratified RFC 9580 (v6 keys), the fingerprint algorithm has transitioned to SHA-256 (256 bits, 64 hex characters), providing quantum-resistant preimage and collision security.
3. Dissecting an Armored OpenPGP Block
An ASCII-armored PGP key consists of:
- Armor Header Line:
-----BEGIN PGP PUBLIC KEY BLOCK----- - Armor Headers: Optional key-value pairs (e.g.,
Version: GnuPG v2). - Base64 Encoded Packets: The binary OpenPGP packets encoded in standard Base64.
- Armor Checksum: A 24-bit Radix-64 CRC checksum preceded by an equals sign (e.g.,
=r4k2). - Armor Tail Line:
-----END PGP PUBLIC KEY BLOCK-----
4. Key Inspection with GnuPG
# List keys in your public keyring with full fingerprints:
gpg --list-keys --keyid-format LONG --with-fingerprint
# Inspect binary packet structure of an armored key file without importing:
gpg --list-packets public-key.asc
# Export public key in ASCII-armored format:
gpg --armor --export developer@example.com > public-key.asc
Put This Guide into Practice
Test your certificates, keys, or tokens in-memory with our zero-disk developer tool.