GPG Packet Structure Breakdown | Generated by AI
Explanation of GPG Packet Structure
The output from gpg --list-packets README.md.gpg dissects the OpenPGP message embedded in the encrypted file. This is a standard encrypted archive containing a compressed version of README.md. Here’s a breakdown of each packet, from outer to inner layer:
1. Public-Key Encrypted Session Key Packet (offset 0, tag 1)
- Purpose: This holds the symmetric session key (used for bulk encryption) wrapped in the recipient’s public key.
- Details:
- Version: 3 (older format, but still common).
- Algorithm: 1 (RSA).
- Key ID:
D259131C2144FDC0(matches the 4096-bit RSA key). - Key owner: “Zhiwei Li lzwjava@gmail.com”, created on 2025-10-08.
- Data size: 4093 bits (roughly the encrypted session key payload).
- Implication: To decrypt, you’d need the private key corresponding to this public key ID.
2. AEAD Encrypted Data Packet (offset 527, tag 20)
- Purpose: The core encrypted payload, using Authenticated Encryption with Associated Data (AEAD) for confidentiality and integrity.
- Details:
- Cipher: 9 (AES-256).
- AEAD algorithm: 2 (likely EAX mode, common for OpenPGP).
- Chunk byte (cb): 16 (indicates partial chunking for streaming decryption).
- Length: Unknown (uses partial new-CTB format for dynamic sizing).
- Implication: This wraps everything inside it—strong modern encryption standard.
3. Compressed Data Packet (offset 548, tag 8)
- Purpose: Compresses the inner data to reduce size before encryption.
- Details:
- Algorithm: 2 (zlib/ZIP deflate).
- Length: Indeterminate (depends on the encrypted stream).
- Implication: Decompression happens after decryption; original file was likely larger than the 4566 raw bytes shown.
4. Literal Data Packet (offset 550, tag 11)
- Purpose: The actual plaintext file content.
- Details:
- Mode: b (binary—treats data as raw bytes, no text conversion).
- Creation time: 1760464731 (Unix timestamp, equivalent to 2025-10-14 17:58:51 UTC).
- Filename:
README.md. - Raw data size: 4566 bytes (this is the uncompressed plaintext length).
- Implication: Once decrypted and decompressed, you’ll get back the original
README.mdfile from around Oct 14, 2025.
Summary
This is a straightforward OpenPGP-encrypted file:
- Encryption flow: Session key → RSA-wrapped → AES-256 AEAD → zlib compression → literal
README.md. - Total structure size: ~5KB (inferred from offsets and lengths).
- To decrypt: Run
gpg --output README.md --decrypt README.md.gpgwith the private key imported (or passphrase if it’s a subkey). If you don’t have the key, you’d need to obtain it from the owner (e.g., via keyserver search for IDD259131C2144FDC0).
If this is part of a larger task (e.g., verifying the key or extracting without decryption), provide more details!