rfc9580.original   rfc9580.txt 
Network Working Group P. Wouters, Ed. Internet Engineering Task Force (IETF) P. Wouters, Ed.
Internet-Draft Aiven Request for Comments: 9580 Aiven
Obsoletes: 4880, 5581, 6637 (if approved) D. Huigens Obsoletes: 4880, 5581, 6637 D. Huigens
Intended status: Standards Track Proton AG Category: Standards Track Proton AG
Expires: 7 July 2024 J. Winter ISSN: 2070-1721 J. Winter
Sequoia-PGP Sequoia PGP
Y. Niibe Y. Niibe
FSIJ FSIJ
4 January 2024 May 2024
OpenPGP OpenPGP
draft-ietf-openpgp-crypto-refresh-13
Abstract Abstract
This document specifies the message formats used in OpenPGP. OpenPGP This document specifies the message formats used in OpenPGP. OpenPGP
provides encryption with public-key or symmetric cryptographic provides encryption with public key or symmetric cryptographic
algorithms, digital signatures, compression and key management. algorithms, digital signatures, compression, and key management.
This document is maintained in order to publish all necessary This document is maintained in order to publish all necessary
information needed to develop interoperable applications based on the information needed to develop interoperable applications based on the
OpenPGP format. It is not a step-by-step cookbook for writing an OpenPGP format. It is not a step-by-step cookbook for writing an
application. It describes only the format and methods needed to application. It describes only the format and methods needed to
read, check, generate, and write conforming packets crossing any read, check, generate, and write conforming packets crossing any
network. It does not deal with storage and implementation questions. network. It does not deal with storage and implementation questions.
It does, however, discuss implementation issues necessary to avoid It does, however, discuss implementation issues necessary to avoid
security flaws. security flaws.
This document obsoletes: RFC 4880 (OpenPGP), RFC 5581 (Camellia in This document obsoletes RFCs 4880 ("OpenPGP Message Format"), 5581
OpenPGP) and RFC 6637 (Elliptic Curves in OpenPGP). ("The Camellia Cipher in OpenPGP"), and 6637 ("Elliptic Curve
Cryptography (ECC) in OpenPGP").
About This Document
This note is to be removed before publishing as an RFC.
The latest revision of this draft can be found at https://openpgp-
wg.gitlab.io/rfc4880bis/. Status information for this document may
be found at https://datatracker.ietf.org/doc/draft-ietf-openpgp-
crypto-refresh/.
Discussion of this document takes place on the OpenPGP Working Group
mailing list (mailto:openpgp@ietf.org), which is archived at
https://mailarchive.ietf.org/arch/browse/openpgp/. Subscribe at
https://www.ietf.org/mailman/listinfo/openpgp/.
Source for this draft and an issue tracker can be found at
https://gitlab.com/openpgp-wg/rfc4880bis.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This is an Internet Standards Track document.
provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months This document is a product of the Internet Engineering Task Force
and may be updated, replaced, or obsoleted by other documents at any (IETF). It represents the consensus of the IETF community. It has
time. It is inappropriate to use Internet-Drafts as reference received public review and has been approved for publication by the
material or to cite them other than as "work in progress." Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in Section 2 of RFC 7841.
This Internet-Draft will expire on 7 July 2024. Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
https://www.rfc-editor.org/info/rfc9580.
Copyright Notice Copyright Notice
Copyright (c) 2024 IETF Trust and the persons identified as the Copyright (c) 2024 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents (https://trustee.ietf.org/ Provisions Relating to IETF Documents
license-info) in effect on the date of publication of this document. (https://trustee.ietf.org/license-info) in effect on the date of
Please review these documents carefully, as they describe your rights publication of this document. Please review these documents
and restrictions with respect to this document. Code Components carefully, as they describe your rights and restrictions with respect
extracted from this document must include Revised BSD License text as to this document. Code Components extracted from this document must
described in Section 4.e of the Trust Legal Provisions and are include Revised BSD License text as described in Section 4.e of the
provided without warranty as described in the Revised BSD License. Trust Legal Provisions and are provided without warranty as described
in the Revised BSD License.
This document may contain material from IETF Documents or IETF This document may contain material from IETF Documents or IETF
Contributions published or made publicly available before November Contributions published or made publicly available before November
10, 2008. The person(s) controlling the copyright in some of this 10, 2008. The person(s) controlling the copyright in some of this
material may not have granted the IETF Trust the right to allow material may not have granted the IETF Trust the right to allow
modifications of such material outside the IETF Standards Process. modifications of such material outside the IETF Standards Process.
Without obtaining an adequate license from the person(s) controlling Without obtaining an adequate license from the person(s) controlling
the copyright in such materials, this document may not be modified the copyright in such materials, this document may not be modified
outside the IETF Standards Process, and derivative works of it may outside the IETF Standards Process, and derivative works of it may
not be created outside the IETF Standards Process, except to format not be created outside the IETF Standards Process, except to format
it for publication as an RFC or to translate it into languages other it for publication as an RFC or to translate it into languages other
than English. than English.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 9 1. Introduction
1.1. Terms . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.1. Terms
2. General functions . . . . . . . . . . . . . . . . . . . . . . 10 2. General Functions
2.1. Confidentiality via Encryption . . . . . . . . . . . . . 10 2.1. Confidentiality via Encryption
2.2. Authentication via Digital Signature . . . . . . . . . . 11 2.2. Authentication via Digital Signature
2.3. Compression . . . . . . . . . . . . . . . . . . . . . . . 12 2.3. Compression
2.4. Conversion to Base64 . . . . . . . . . . . . . . . . . . 12 2.4. Conversion to Base64
2.5. Signature-Only Applications . . . . . . . . . . . . . . . 12 2.5. Signature-Only Applications
3. Data Element Formats . . . . . . . . . . . . . . . . . . . . 12 3. Data Element Formats
3.1. Scalar Numbers . . . . . . . . . . . . . . . . . . . . . 12 3.1. Scalar Numbers
3.2. Multiprecision Integers . . . . . . . . . . . . . . . . . 12 3.2. Multiprecision Integers
3.2.1. Using MPIs to encode other data . . . . . . . . . . . 13 3.2.1. Using MPIs to Encode Other Data
3.3. Key IDs and Fingerprints . . . . . . . . . . . . . . . . 13 3.3. Key IDs and Fingerprints
3.4. Text . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.4. Text
3.5. Time Fields . . . . . . . . . . . . . . . . . . . . . . . 14 3.5. Time Fields
3.6. Keyrings . . . . . . . . . . . . . . . . . . . . . . . . 14 3.6. Keyrings
3.7. String-to-Key (S2K) Specifier . . . . . . . . . . . . . . 14 3.7. String-to-Key (S2K) Specifier
3.7.1. String-to-Key (S2K) Specifier Types . . . . . . . . . 14 3.7.1. S2K Specifier Types
3.7.1.1. Simple S2K . . . . . . . . . . . . . . . . . . . 15 3.7.1.1. Simple S2K
3.7.1.2. Salted S2K . . . . . . . . . . . . . . . . . . . 16 3.7.1.2. Salted S2K
3.7.1.3. Iterated and Salted S2K . . . . . . . . . . . . . 16 3.7.1.3. Iterated and Salted S2K
3.7.1.4. Argon2 . . . . . . . . . . . . . . . . . . . . . 17 3.7.1.4. Argon2
3.7.2. String-to-Key Usage . . . . . . . . . . . . . . . . . 18 3.7.2. S2K Usage
3.7.2.1. Secret-Key Encryption . . . . . . . . . . . . . . 18 3.7.2.1. Secret Key Encryption
3.7.2.2. Symmetric-Key Message Encryption . . . . . . . . 20 3.7.2.2. Symmetric Key Message Encryption
4. Packet Syntax . . . . . . . . . . . . . . . . . . . . . . . . 21 4. Packet Syntax
4.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 21 4.1. Overview
4.2. Packet Headers . . . . . . . . . . . . . . . . . . . . . 21 4.2. Packet Headers
4.2.1. OpenPGP Format Packet Lengths . . . . . . . . . . . . 22 4.2.1. OpenPGP Format Packet Lengths
4.2.1.1. One-Octet Lengths . . . . . . . . . . . . . . . . 23 4.2.1.1. 1-Octet Lengths
4.2.1.2. Two-Octet Lengths . . . . . . . . . . . . . . . . 23 4.2.1.2. 2-Octet Lengths
4.2.1.3. Five-Octet Lengths . . . . . . . . . . . . . . . 23 4.2.1.3. 5-Octet Lengths
4.2.1.4. Partial Body Lengths . . . . . . . . . . . . . . 23 4.2.1.4. Partial Body Lengths
4.2.2. Legacy Format Packet Lengths . . . . . . . . . . . . 24 4.2.2. Legacy Format Packet Lengths
4.2.3. Packet Length Examples . . . . . . . . . . . . . . . 24 4.2.3. Packet Length Examples
4.3. Packet Criticality . . . . . . . . . . . . . . . . . . . 25 4.3. Packet Criticality
5. Packet Types . . . . . . . . . . . . . . . . . . . . . . . . 25 5. Packet Types
5.1. Public-Key Encrypted Session Key Packet (Type ID 1) . . . 27 5.1. Public Key Encrypted Session Key Packet (Type ID 1)
5.1.1. Version 3 Public-Key Encrypted Session Key Packet 5.1.1. Version 3 Public Key Encrypted Session Key Packet
Format . . . . . . . . . . . . . . . . . . . . . . . 28 Format
5.1.2. Version 6 Public-Key Encrypted Session Key Packet 5.1.2. Version 6 Public Key Encrypted Session Key Packet
Format . . . . . . . . . . . . . . . . . . . . . . . 28 Format
5.1.3. Algorithm-Specific Fields for RSA encryption . . . . 29 5.1.3. Algorithm-Specific Fields for RSA Encryption
5.1.4. Algorithm-Specific Fields for Elgamal encryption . . 29 5.1.4. Algorithm-Specific Fields for Elgamal Encryption
5.1.5. Algorithm-Specific Fields for ECDH encryption . . . . 30 5.1.5. Algorithm-Specific Fields for ECDH Encryption
5.1.6. Algorithm-Specific Fields for X25519 encryption . . . 30 5.1.6. Algorithm-Specific Fields for X25519 Encryption
5.1.7. Algorithm-Specific Fields for X448 encryption . . . . 31 5.1.7. Algorithm-Specific Fields for X448 Encryption
5.1.8. Notes on PKESK . . . . . . . . . . . . . . . . . . . 32 5.1.8. Notes on PKESK
5.2. Signature Packet (Type ID 2) . . . . . . . . . . . . . . 32 5.2. Signature Packet (Type ID 2)
5.2.1. Signature Types . . . . . . . . . . . . . . . . . . . 32 5.2.1. Signature Types
5.2.1.1. Signature of a binary document (type ID 0x00) . . 33 5.2.1.1. Binary Signature (Type ID 0x00) of a Document
5.2.1.2. Signature of a canonical text document (type ID 5.2.1.2. Text Signature (Type ID 0x01) of a Canonical
0x01) . . . . . . . . . . . . . . . . . . . . . . . 34 Document
5.2.1.3. Standalone signature (type ID 0x02) . . . . . . . 34 5.2.1.3. Standalone Signature (Type ID 0x02)
5.2.1.4. Generic certification of a User ID and Public-Key 5.2.1.4. Generic Certification Signature (Type ID 0x10) of a
packet (type ID 0x10) . . . . . . . . . . . . . . . 34 User ID and Public Key Packet
5.2.1.5. Persona certification of a User ID and Public-Key 5.2.1.5. Persona Certification Signature (Type ID 0x11) of a
packet (type ID 0x11) . . . . . . . . . . . . . . . 34 User ID and Public Key Packet
5.2.1.6. Casual certification of a User ID and Public-Key 5.2.1.6. Casual Certification Signature (Type ID 0x12) of a
packet (type ID 0x12) . . . . . . . . . . . . . . . 34 User ID and Public Key Packet
5.2.1.7. Positive certification of a User ID and Public-Key 5.2.1.7. Positive Certification Signature (Type ID 0x13) of
packet (type ID 0x13) . . . . . . . . . . . . . . . 34 a User ID and Public Key Packet
5.2.1.8. Subkey Binding Signature (type ID 0x18) . . . . . 35 5.2.1.8. Subkey Binding Signature (Type ID 0x18)
5.2.1.9. Primary Key Binding Signature (type ID 0x19) . . 35 5.2.1.9. Primary Key Binding Signature (Type ID 0x19)
5.2.1.10. Direct Key Signature (type ID 0x1F) . . . . . . . 35 5.2.1.10. Direct Key Signature (Type ID 0x1F)
5.2.1.11. Key revocation signature (type ID 0x20) . . . . . 35 5.2.1.11. Key Revocation Signature (Type ID 0x20)
5.2.1.12. Subkey revocation signature (type ID 0x28) . . . 35 5.2.1.12. Subkey Revocation Signature (Type ID 0x28)
5.2.1.13. Certification revocation signature (type ID 5.2.1.13. Certification Revocation Signature (Type ID 0x30)
0x30) . . . . . . . . . . . . . . . . . . . . . . . 36 5.2.1.14. Timestamp Signature (Type ID 0x40)
5.2.1.14. Timestamp signature (type ID 0x40) . . . . . . . 36 5.2.1.15. Third-Party Confirmation Signature (Type ID 0x50)
5.2.1.15. Third-Party Confirmation signature (type ID 5.2.1.16. Reserved (Type ID 0xFF)
0x50) . . . . . . . . . . . . . . . . . . . . . . . 36 5.2.2. Version 3 Signature Packet Format
5.2.1.16. Reserved (type ID 0xFF) . . . . . . . . . . . . . 36 5.2.3. Versions 4 and 6 Signature Packet Formats
5.2.2. Version 3 Signature Packet Format . . . . . . . . . . 36 5.2.3.1. Algorithm-Specific Fields for RSA Signatures
5.2.3. Version 4 and 6 Signature Packet Formats . . . . . . 37
5.2.3.1. Algorithm-Specific Fields for RSA signatures . . 38
5.2.3.2. Algorithm-Specific Fields for DSA or ECDSA 5.2.3.2. Algorithm-Specific Fields for DSA or ECDSA
signatures . . . . . . . . . . . . . . . . . . . . 38 Signatures
5.2.3.3. Algorithm-Specific Fields for EdDSALegacy 5.2.3.3. Algorithm-Specific Fields for EdDSALegacy
signatures (deprecated) . . . . . . . . . . . . . . 39 Signatures (Deprecated)
5.2.3.4. Algorithm-Specific Fields for Ed25519 5.2.3.4. Algorithm-Specific Fields for Ed25519 Signatures
signatures . . . . . . . . . . . . . . . . . . . . 39 5.2.3.5. Algorithm-Specific Fields for Ed448 Signatures
5.2.3.5. Algorithm-Specific Fields for Ed448 signatures . 40 5.2.3.6. Notes on Signatures
5.2.3.6. Notes on Signatures . . . . . . . . . . . . . . . 40 5.2.3.7. Signature Subpacket Specification
5.2.3.7. Signature Subpacket Specification . . . . . . . . 41 5.2.3.8. Signature Subpacket Types
5.2.3.8. Signature Subpacket Types . . . . . . . . . . . . 44 5.2.3.9. Notes on Subpackets
5.2.3.9. Notes on Subpackets . . . . . . . . . . . . . . . 44 5.2.3.10. Notes on Self-Signatures
5.2.3.10. Notes on Self-Signatures . . . . . . . . . . . . 45 5.2.3.11. Signature Creation Time
5.2.3.11. Signature Creation Time . . . . . . . . . . . . . 46 5.2.3.12. Issuer Key ID
5.2.3.12. Issuer Key ID . . . . . . . . . . . . . . . . . . 47 5.2.3.13. Key Expiration Time
5.2.3.13. Key Expiration Time . . . . . . . . . . . . . . . 47 5.2.3.14. Preferred Symmetric Ciphers for v1 SEIPD
5.2.3.14. Preferred Symmetric Ciphers for v1 SEIPD . . . . 47 5.2.3.15. Preferred AEAD Ciphersuites
5.2.3.15. Preferred AEAD Ciphersuites . . . . . . . . . . . 47 5.2.3.16. Preferred Hash Algorithms
5.2.3.16. Preferred Hash Algorithms . . . . . . . . . . . . 48 5.2.3.17. Preferred Compression Algorithms
5.2.3.17. Preferred Compression Algorithms . . . . . . . . 48 5.2.3.18. Signature Expiration Time
5.2.3.18. Signature Expiration Time . . . . . . . . . . . . 49 5.2.3.19. Exportable Certification
5.2.3.19. Exportable Certification . . . . . . . . . . . . 49 5.2.3.20. Revocable
5.2.3.20. Revocable . . . . . . . . . . . . . . . . . . . . 50 5.2.3.21. Trust Signature
5.2.3.21. Trust Signature . . . . . . . . . . . . . . . . . 50 5.2.3.22. Regular Expression
5.2.3.22. Regular Expression . . . . . . . . . . . . . . . 50 5.2.3.23. Revocation Key (Deprecated)
5.2.3.23. Revocation Key . . . . . . . . . . . . . . . . . 51 5.2.3.24. Notation Data
5.2.3.24. Notation Data . . . . . . . . . . . . . . . . . . 51 5.2.3.25. Key Server Preferences
5.2.3.25. Key Server Preferences . . . . . . . . . . . . . 53 5.2.3.26. Preferred Key Server
5.2.3.26. Preferred Key Server . . . . . . . . . . . . . . 53 5.2.3.27. Primary User ID
5.2.3.27. Primary User ID . . . . . . . . . . . . . . . . . 53 5.2.3.28. Policy URI
5.2.3.28. Policy URI . . . . . . . . . . . . . . . . . . . 54 5.2.3.29. Key Flags
5.2.3.29. Key Flags . . . . . . . . . . . . . . . . . . . . 54 5.2.3.30. Signer's User ID
5.2.3.30. Signer's User ID . . . . . . . . . . . . . . . . 56 5.2.3.31. Reason for Revocation
5.2.3.31. Reason for Revocation . . . . . . . . . . . . . . 56 5.2.3.32. Features
5.2.3.32. Features . . . . . . . . . . . . . . . . . . . . 58 5.2.3.33. Signature Target
5.2.3.33. Signature Target . . . . . . . . . . . . . . . . 58 5.2.3.34. Embedded Signature
5.2.3.34. Embedded Signature . . . . . . . . . . . . . . . 59 5.2.3.35. Issuer Fingerprint
5.2.3.35. Issuer Fingerprint . . . . . . . . . . . . . . . 59 5.2.3.36. Intended Recipient Fingerprint
5.2.3.36. Intended Recipient Fingerprint . . . . . . . . . 59 5.2.4. Computing Signatures
5.2.4. Computing Signatures . . . . . . . . . . . . . . . . 60 5.2.4.1. Notes about Signature Computation
5.2.4.1. Notes About Signature Computation . . . . . . . . 62 5.2.5. Malformed and Unknown Signatures
5.2.5. Malformed and Unknown Signatures . . . . . . . . . . 62 5.3. Symmetric Key Encrypted Session Key Packet (Type ID 3)
5.3. Symmetric-Key Encrypted Session Key Packet (Type ID 3) . 63 5.3.1. Version 4 Symmetric Key Encrypted Session Key Packet
5.3.1. Version 4 Symmetric-Key Encrypted Session Key Packet Format
Format . . . . . . . . . . . . . . . . . . . . . . . 63 5.3.2. Version 6 Symmetric Key Encrypted Session Key Packet
5.3.2. Version 6 Symmetric-Key Encrypted Session Key Packet Format
Format . . . . . . . . . . . . . . . . . . . . . . . 64 5.4. One-Pass Signature Packet (Type ID 4)
5.4. One-Pass Signature Packet (Type ID 4) . . . . . . . . . . 65 5.5. Key Material Packets
5.5. Key Material Packets . . . . . . . . . . . . . . . . . . 66 5.5.1. Key Packet Variants
5.5.1. Key Packet Variants . . . . . . . . . . . . . . . . . 67 5.5.1.1. Public Key Packet (Type ID 6)
5.5.1.1. Public-Key Packet (Type ID 6) . . . . . . . . . . 67 5.5.1.2. Public Subkey Packet (Type ID 14)
5.5.1.2. Public-Subkey Packet (Type ID 14) . . . . . . . . 67 5.5.1.3. Secret Key Packet (Type ID 5)
5.5.1.3. Secret-Key Packet (Type ID 5) . . . . . . . . . . 67 5.5.1.4. Secret Subkey Packet (Type ID 7)
5.5.1.4. Secret-Subkey Packet (Type ID 7) . . . . . . . . 67 5.5.2. Public Key Packet Formats
5.5.2. Public-Key Packet Formats . . . . . . . . . . . . . . 67 5.5.2.1. Version 3 Public Keys
5.5.2.1. Version 3 Public Keys . . . . . . . . . . . . . . 67 5.5.2.2. Version 4 Public Keys
5.5.2.2. Version 4 Public Keys . . . . . . . . . . . . . . 68 5.5.2.3. Version 6 Public Keys
5.5.2.3. Version 6 Public Keys . . . . . . . . . . . . . . 69 5.5.3. Secret Key Packet Formats
5.5.3. Secret-Key Packet Formats . . . . . . . . . . . . . . 69 5.5.4. Key IDs and Fingerprints
5.5.4. Key IDs and Fingerprints . . . . . . . . . . . . . . 72 5.5.4.1. Version 3 Key ID and Fingerprint
5.5.4.1. Version 3 Key ID and Fingerprint . . . . . . . . 73 5.5.4.2. Version 4 Key ID and Fingerprint
5.5.4.2. Version 4 Key ID and Fingerprint . . . . . . . . 73 5.5.4.3. Version 6 Key ID and Fingerprint
5.5.4.3. Version 6 Key ID and Fingerprint . . . . . . . . 74 5.5.5. Algorithm-Specific Parts of Keys
5.5.5. Algorithm-specific Parts of Keys . . . . . . . . . . 75 5.5.5.1. Algorithm-Specific Part for RSA Keys
5.5.5.1. Algorithm-Specific Part for RSA Keys . . . . . . 75 5.5.5.2. Algorithm-Specific Part for DSA Keys
5.5.5.2. Algorithm-Specific Part for DSA Keys . . . . . . 75 5.5.5.3. Algorithm-Specific Part for Elgamal Keys
5.5.5.3. Algorithm-Specific Part for Elgamal Keys . . . . 75 5.5.5.4. Algorithm-Specific Part for ECDSA Keys
5.5.5.4. Algorithm-Specific Part for ECDSA Keys . . . . . 76
5.5.5.5. Algorithm-Specific Part for EdDSALegacy Keys 5.5.5.5. Algorithm-Specific Part for EdDSALegacy Keys
(deprecated) . . . . . . . . . . . . . . . . . . . 76 (Deprecated)
5.5.5.6. Algorithm-Specific Part for ECDH Keys . . . . . . 77 5.5.5.6. Algorithm-Specific Part for ECDH Keys
5.5.5.7. Algorithm-Specific Part for X25519 Keys . . . . . 78 5.5.5.7. Algorithm-Specific Part for X25519 Keys
5.5.5.8. Algorithm-Specific Part for X448 Keys . . . . . . 79 5.5.5.8. Algorithm-Specific Part for X448 Keys
5.5.5.9. Algorithm-Specific Part for Ed25519 Keys . . . . 79 5.5.5.9. Algorithm-Specific Part for Ed25519 Keys
5.5.5.10. Algorithm-Specific Part for Ed448 Keys . . . . . 79 5.5.5.10. Algorithm-Specific Part for Ed448 Keys
5.6. Compressed Data Packet (Type ID 8) . . . . . . . . . . . 80 5.6. Compressed Data Packet (Type ID 8)
5.7. Symmetrically Encrypted Data Packet (Type ID 9) . . . . . 80 5.7. Symmetrically Encrypted Data Packet (Type ID 9)
5.8. Marker Packet (Type ID 10) . . . . . . . . . . . . . . . 82 5.8. Marker Packet (Type ID 10)
5.9. Literal Data Packet (Type ID 11) . . . . . . . . . . . . 82 5.9. Literal Data Packet (Type ID 11)
5.9.1. Special Filename _CONSOLE (Deprecated) . . . . . . . 84 5.9.1. Special Filename _CONSOLE (Deprecated)
5.10. Trust Packet (Type ID 12) . . . . . . . . . . . . . . . . 84 5.10. Trust Packet (Type ID 12)
5.11. User ID Packet (Type ID 13) . . . . . . . . . . . . . . . 84 5.11. User ID Packet (Type ID 13)
5.12. User Attribute Packet (Type ID 17) . . . . . . . . . . . 84 5.12. User Attribute Packet (Type ID 17)
5.12.1. The Image Attribute Subpacket . . . . . . . . . . . 85 5.12.1. Image Attribute Subpacket
5.13. Symmetrically Encrypted Integrity Protected Data Packet 5.13. Symmetrically Encrypted and Integrity Protected Data Packet
(Type ID 18) . . . . . . . . . . . . . . . . . . . . . . 86 (Type ID 18)
5.13.1. Version 1 Symmetrically Encrypted Integrity Protected 5.13.1. Version 1 Symmetrically Encrypted and Integrity
Data Packet Format . . . . . . . . . . . . . . . . . 87 Protected Data Packet Format
5.13.2. Version 2 Symmetrically Encrypted Integrity Protected 5.13.2. Version 2 Symmetrically Encrypted and Integrity
Data Packet Format . . . . . . . . . . . . . . . . . 89 Protected Data Packet Format
5.13.3. EAX Mode . . . . . . . . . . . . . . . . . . . . . . 91 5.13.3. EAX Mode
5.13.4. OCB Mode . . . . . . . . . . . . . . . . . . . . . . 91 5.13.4. OCB Mode
5.13.5. GCM Mode . . . . . . . . . . . . . . . . . . . . . . 91 5.13.5. GCM Mode
5.14. Padding Packet (Type ID 21) . . . . . . . . . . . . . . . 92 5.14. Padding Packet (Type ID 21)
6. Base64 Conversions . . . . . . . . . . . . . . . . . . . . . 92 6. Base64 Conversions
6.1. Optional checksum . . . . . . . . . . . . . . . . . . . . 93 6.1. Optional Checksum
6.1.1. An Implementation of the CRC-24 in "C" . . . . . . . 94 6.1.1. An Implementation of the CRC24 in "C"
6.2. Forming ASCII Armor . . . . . . . . . . . . . . . . . . . 94 6.2. Forming ASCII Armor
6.2.1. Armor Header Line . . . . . . . . . . . . . . . . . . 95 6.2.1. Armor Header Line
6.2.2. Armor Headers . . . . . . . . . . . . . . . . . . . . 95 6.2.2. Armor Headers
6.2.2.1. "Version" Armor Header . . . . . . . . . . . . . 96 6.2.2.1. "Version" Armor Header
6.2.2.2. "Comment" Armor Header . . . . . . . . . . . . . 96 6.2.2.2. "Comment" Armor Header
6.2.2.3. "Hash" Armor Header . . . . . . . . . . . . . . . 97 6.2.2.3. "Hash" Armor Header
6.2.2.4. "Charset" Armor Header . . . . . . . . . . . . . 97 6.2.2.4. "Charset" Armor Header
6.2.3. Armor Tail Line . . . . . . . . . . . . . . . . . . . 97 6.2.3. Armor Tail Line
7. Cleartext Signature Framework . . . . . . . . . . . . . . . . 98 7. Cleartext Signature Framework
7.1. Cleartext Signed Message Structure . . . . . . . . . . . 98 7.1. Cleartext Signed Message Structure
7.2. Dash-Escaped Text . . . . . . . . . . . . . . . . . . . . 99 7.2. Dash-Escaped Text
7.3. Issues with the Cleartext Signature Framework . . . . . . 99 7.3. Issues with the Cleartext Signature Framework
8. Regular Expressions . . . . . . . . . . . . . . . . . . . . . 100 8. Regular Expressions
9. Constants . . . . . . . . . . . . . . . . . . . . . . . . . . 100 9. Constants
9.1. Public-Key Algorithms . . . . . . . . . . . . . . . . . . 101 9.1. Public Key Algorithms
9.2. ECC Curves for OpenPGP . . . . . . . . . . . . . . . . . 104 9.2. ECC Curves for OpenPGP
9.2.1. Curve-Specific Wire Formats . . . . . . . . . . . . . 106 9.2.1. Curve-Specific Wire Formats
9.3. Symmetric-Key Algorithms . . . . . . . . . . . . . . . . 107 9.3. Symmetric Key Algorithms
9.4. Compression Algorithms . . . . . . . . . . . . . . . . . 108 9.4. Compression Algorithms
9.5. Hash Algorithms . . . . . . . . . . . . . . . . . . . . . 108 9.5. Hash Algorithms
9.6. AEAD Algorithms . . . . . . . . . . . . . . . . . . . . . 111 9.6. AEAD Algorithms
10. Packet Sequence Composition . . . . . . . . . . . . . . . . . 111 10. Packet Sequence Composition
10.1. Transferable Public Keys . . . . . . . . . . . . . . . . 112 10.1. Transferable Public Keys
10.1.1. OpenPGP v6 Certificate Structure . . . . . . . . . . 112 10.1.1. OpenPGP Version 6 Certificate Structure
10.1.2. OpenPGP v6 Revocation Certificate . . . . . . . . . 113 10.1.2. OpenPGP Version 6 Revocation Certificate
10.1.3. OpenPGP v4 Certificate Structure . . . . . . . . . . 113 10.1.3. OpenPGP Version 4 Certificate Structure
10.1.4. OpenPGP v3 Key Structure . . . . . . . . . . . . . . 114 10.1.4. OpenPGP Version 3 Key Structure
10.1.5. Common requirements . . . . . . . . . . . . . . . . 114 10.1.5. Common Requirements
10.2. Transferable Secret Keys . . . . . . . . . . . . . . . . 116 10.2. Transferable Secret Keys
10.3. OpenPGP Messages . . . . . . . . . . . . . . . . . . . . 116 10.3. OpenPGP Messages
10.3.1. Unwrapping Encrypted and Compressed Messages . . . . 117 10.3.1. Unwrapping Encrypted and Compressed Messages
10.3.2. Additional Constraints on Packet Sequences . . . . . 117 10.3.2. Additional Constraints on Packet Sequences
10.3.2.1. Packet Versions in Encrypted Messages . . . . . 118 10.3.2.1. Packet Versions in Encrypted Messages
10.3.2.2. Packet Versions in Signatures . . . . . . . . . 119 10.3.2.2. Packet Versions in Signatures
10.4. Detached Signatures . . . . . . . . . . . . . . . . . . 120 10.4. Detached Signatures
11. Elliptic Curve Cryptography . . . . . . . . . . . . . . . . . 120 11. Elliptic Curve Cryptography
11.1. ECC Curves . . . . . . . . . . . . . . . . . . . . . . . 121 11.1. ECC Curves
11.2. EC Point Wire Formats . . . . . . . . . . . . . . . . . 121 11.2. EC Point Wire Formats
11.2.1. SEC1 EC Point Wire Format . . . . . . . . . . . . . 121 11.2.1. SEC1 EC Point Wire Format
11.2.2. Prefixed Native EC Point Wire Format . . . . . . . . 122 11.2.2. Prefixed Native EC Point Wire Format
11.2.3. Notes on EC Point Wire Formats . . . . . . . . . . . 122 11.2.3. Notes on EC Point Wire Formats
11.3. EC Scalar Wire Formats . . . . . . . . . . . . . . . . . 122 11.3. EC Scalar Wire Formats
11.3.1. EC Octet String Wire Format . . . . . . . . . . . . 123 11.3.1. EC Octet String Wire Format
11.3.2. Elliptic Curve Prefixed Octet String Wire Format . . 124 11.3.2. EC Prefixed Octet String Wire Format
11.4. Key Derivation Function . . . . . . . . . . . . . . . . 124 11.4. Key Derivation Function
11.5. EC DH Algorithm (ECDH) . . . . . . . . . . . . . . . . . 125 11.5. ECDH Algorithm
11.5.1. ECDH Parameters . . . . . . . . . . . . . . . . . . 128 11.5.1. ECDH Parameters
12. Notes on Algorithms . . . . . . . . . . . . . . . . . . . . . 129 12. Notes on Algorithms
12.1. PKCS#1 Encoding in OpenPGP . . . . . . . . . . . . . . . 129 12.1. PKCS#1 Encoding in OpenPGP
12.1.1. EME-PKCS1-v1_5-ENCODE . . . . . . . . . . . . . . . 129 12.1.1. EME-PKCS1-v1_5-ENCODE
12.1.2. EME-PKCS1-v1_5-DECODE . . . . . . . . . . . . . . . 130 12.1.2. EME-PKCS1-v1_5-DECODE
12.1.3. EMSA-PKCS1-v1_5 . . . . . . . . . . . . . . . . . . 130 12.1.3. EMSA-PKCS1-v1_5
12.2. Symmetric Algorithm Preferences . . . . . . . . . . . . 132 12.2. Symmetric Algorithm Preferences
12.2.1. Plaintext . . . . . . . . . . . . . . . . . . . . . 132 12.2.1. Plaintext
12.3. Other Algorithm Preferences . . . . . . . . . . . . . . 133 12.3. Other Algorithm Preferences
12.3.1. Compression Preferences . . . . . . . . . . . . . . 133 12.3.1. Compression Preferences
12.3.1.1. Uncompressed . . . . . . . . . . . . . . . . . . 133 12.3.1.1. Uncompressed
12.3.2. Hash Algorithm Preferences . . . . . . . . . . . . . 133 12.3.2. Hash Algorithm Preferences
12.4. RSA . . . . . . . . . . . . . . . . . . . . . . . . . . 134 12.4. RSA
12.5. DSA . . . . . . . . . . . . . . . . . . . . . . . . . . 134 12.5. DSA
12.6. Elgamal . . . . . . . . . . . . . . . . . . . . . . . . 134 12.6. Elgamal
12.7. EdDSA . . . . . . . . . . . . . . . . . . . . . . . . . 134 12.7. EdDSA
12.8. Reserved Algorithm IDs . . . . . . . . . . . . . . . . . 135 12.8. Reserved Algorithm IDs
12.9. CFB Mode . . . . . . . . . . . . . . . . . . . . . . . . 135 12.9. CFB Mode
12.10. Private or Experimental Parameters . . . . . . . . . . . 135 12.10. Private or Experimental Parameters
12.11. Meta-Considerations for Expansion . . . . . . . . . . . 136 12.11. Meta Considerations for Expansion
13. Security Considerations . . . . . . . . . . . . . . . . . . . 136 13. Security Considerations
13.1. SHA-1 Collision Detection . . . . . . . . . . . . . . . 138 13.1. SHA-1 Collision Detection
13.2. Advantages of Salted Signatures . . . . . . . . . . . . 138 13.2. Advantages of Salted Signatures
13.3. Elliptic Curve Side Channels . . . . . . . . . . . . . . 139 13.3. Elliptic Curve Side Channels
13.4. Risks of a Quick Check Oracle . . . . . . . . . . . . . 139 13.4. Risks of a Quick Check Oracle
13.5. Avoiding Leaks From PKCS#1 Errors . . . . . . . . . . . 140 13.5. Avoiding Leaks from PKCS#1 Errors
13.6. Fingerprint Usability . . . . . . . . . . . . . . . . . 140 13.6. Fingerprint Usability
13.7. Avoiding Ciphertext Malleability . . . . . . . . . . . . 141 13.7. Avoiding Ciphertext Malleability
13.8. Secure Use of the v2 SEIPD Session-Key-Reuse Feature . . 143 13.8. Secure Use of the v2 SEIPD Session-Key-Reuse Feature
13.9. Escrowed Revocation Signatures . . . . . . . . . . . . . 145 13.9. Escrowed Revocation Signatures
13.10. Random Number Generation and Seeding . . . . . . . . . . 146 13.10. Random Number Generation and Seeding
13.11. Traffic Analysis . . . . . . . . . . . . . . . . . . . . 146 13.11. Traffic Analysis
13.12. Surreptitious Forwarding . . . . . . . . . . . . . . . . 147 13.12. Surreptitious Forwarding
13.13. Hashed vs. Unhashed Subpackets . . . . . . . . . . . . . 147 13.13. Hashed vs. Unhashed Subpackets
13.14. Malicious Compressed Data . . . . . . . . . . . . . . . 148 13.14. Malicious Compressed Data
14. Implementation Considerations . . . . . . . . . . . . . . . . 148 14. Implementation Considerations
14.1. Constrained Legacy Fingerprint Storage for v6 Keys . . . 149 14.1. Constrained Legacy Fingerprint Storage for Version 6 Keys
15. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 149 15. IANA Considerations
15.1. Rename "Pretty Good Privacy (PGP)" Protocol Group to 15.1. Renamed Protocol Group
"OpenPGP" . . . . . . . . . . . . . . . . . . . . . . . 150 15.2. Renamed and Updated Registries
15.2. Registries to be Renamed and Updated . . . . . . . . . . 150 15.3. Removed Registry
15.3. Registries to be Removed . . . . . . . . . . . . . . . . 151 15.4. Added Registries
15.4. Registries to be Added . . . . . . . . . . . . . . . . . 151 15.5. Registration Policies
15.5. Registration Policies . . . . . . . . . . . . . . . . . 152 15.5.1. Registries That Use RFC Required
15.5.1. Registries that are RFC REQUIRED . . . . . . . . . . 152 15.6. Designated Experts
15.6. Designated Experts . . . . . . . . . . . . . . . . . . . 153 15.6.1. Key and Signature Versions
15.6.1. Key and Signature Versions . . . . . . . . . . . . . 153 15.6.2. Encryption Versions
15.6.2. Encryption Versions . . . . . . . . . . . . . . . . 153 15.6.3. Algorithms
15.6.3. Algorithms . . . . . . . . . . . . . . . . . . . . . 153 15.6.3.1. Elliptic Curve Algorithms
15.6.3.1. Elliptic Curve Algorithms . . . . . . . . . . . 153 15.6.3.2. Symmetric Key Algorithms
15.6.3.2. Symmetric-Key Algorithms . . . . . . . . . . . . 154 15.6.3.3. Hash Algorithms
15.6.3.3. Hash Algorithms . . . . . . . . . . . . . . . . 154 16. References
16. References . . . . . . . . . . . . . . . . . . . . . . . . . 154 16.1. Normative References
16.1. Normative References . . . . . . . . . . . . . . . . . . 154 16.2. Informative References
16.2. Informative References . . . . . . . . . . . . . . . . . 158 Appendix A. Test Vectors
Appendix A. Test vectors . . . . . . . . . . . . . . . . . . . . 164 A.1. Sample Version 4 Ed25519Legacy Key
A.1. Sample v4 Ed25519Legacy key . . . . . . . . . . . . . . . 164 A.2. Sample Version 4 Ed25519Legacy Signature
A.2. Sample v4 Ed25519Legacy signature . . . . . . . . . . . . 164 A.3. Sample Version 6 Certificate (Transferable Public Key)
A.3. Sample v6 Certificate (Transferable Public Key) . . . . . 165 A.3.1. Hashed Data Stream for Signature Verification
A.3.1. Hashed Data Stream for Signature Verification . . . . 166 A.4. Sample Version 6 Secret Key (Transferable Secret Key)
A.4. Sample v6 Secret Key (Transferable Secret Key) . . . . . 170 A.5. Sample Locked Version 6 Secret Key (Transferable Secret
A.5. Sample locked v6 Secret Key (Transferable Secret Key) . . 170 Key)
A.5.1. Intermediate Data for Locked Primary Key . . . . . . 171 A.5.1. Intermediate Data for Locked Primary Key
A.5.2. Intermediate Data for Locked Subkey . . . . . . . . . 171 A.5.2. Intermediate Data for Locked Subkey
A.6. Sample Cleartext Signed Message . . . . . . . . . . . . . 172 A.6. Sample Cleartext Signed Message
A.7. Sample inline-signed message . . . . . . . . . . . . . . 175 A.7. Sample Inline-Signed Message
A.8. Sample X25519-AEAD-OCB encryption and decryption . . . . 176 A.8. Sample X25519-AEAD-OCB Encryption and Decryption
A.8.1. Sample public-key encrypted session key packet A.8.1. Sample Version 6 Public Key Encrypted Session Key
(v6) . . . . . . . . . . . . . . . . . . . . . . . . 176 Packet
A.8.2. X25519 encryption/decryption of the session key . . . 177 A.8.2. X25519 Encryption/Decryption of the Session Key
A.8.3. Sample v2 SEIPD packet . . . . . . . . . . . . . . . 178 A.8.3. Sample v2 SEIPD Packet
A.8.4. Decryption of data . . . . . . . . . . . . . . . . . 179 A.8.4. Decryption of Data
A.8.5. Complete X25519-AEAD-OCB encrypted packet sequence . 180 A.8.5. Complete X25519-AEAD-OCB Encrypted Packet Sequence
A.9. Sample AEAD-EAX Encryption and Decryption
A.9. Sample AEAD-EAX encryption and decryption . . . . . . . . 181 A.9.1. Sample Version 6 Symmetric Key Encrypted Session Key
A.9.1. Sample symmetric-key encrypted session key packet Packet
(v6) . . . . . . . . . . . . . . . . . . . . . . . . 181 A.9.2. Starting AEAD-EAX Decryption of the Session Key
A.9.2. Starting AEAD-EAX decryption of the session key . . . 181 A.9.3. Sample v2 SEIPD Packet
A.9.3. Sample v2 SEIPD packet . . . . . . . . . . . . . . . 182 A.9.4. Decryption of Data
A.9.4. Decryption of data . . . . . . . . . . . . . . . . . 183 A.9.5. Complete AEAD-EAX Encrypted Packet Sequence
A.9.5. Complete AEAD-EAX encrypted packet sequence . . . . . 184 A.10. Sample AEAD-OCB Encryption and Decryption
A.10. Sample AEAD-OCB encryption and decryption . . . . . . . . 184 A.10.1. Sample Version 6 Symmetric Key Encrypted Session Key
A.10.1. Sample symmetric-key encrypted session key packet Packet
(v6) . . . . . . . . . . . . . . . . . . . . . . . . 184 A.10.2. Starting AEAD-OCB Decryption of the Session Key
A.10.2. Starting AEAD-OCB decryption of the session key . . 185 A.10.3. Sample v2 SEIPD Packet
A.10.3. Sample v2 SEIPD packet . . . . . . . . . . . . . . . 186 A.10.4. Decryption of Data
A.10.4. Decryption of data . . . . . . . . . . . . . . . . . 187 A.10.5. Complete AEAD-OCB Encrypted Packet Sequence
A.10.5. Complete AEAD-OCB encrypted packet sequence . . . . 188 A.11. Sample AEAD-GCM Encryption and Decryption
A.11. Sample AEAD-GCM encryption and decryption . . . . . . . . 188 A.11.1. Sample Version 6 Symmetric Key Encrypted Session Key
A.11.1. Sample symmetric-key encrypted session key packet Packet
(v6) . . . . . . . . . . . . . . . . . . . . . . . . 188 A.11.2. Starting AEAD-GCM Decryption of the Session Key
A.11.2. Starting AEAD-GCM decryption of the session key . . 189 A.11.3. Sample v2 SEIPD Packet
A.11.3. Sample v2 SEIPD packet . . . . . . . . . . . . . . . 190 A.11.4. Decryption of Data
A.11.4. Decryption of data . . . . . . . . . . . . . . . . . 191 A.11.5. Complete AEAD-GCM Encrypted Packet Sequence
A.11.5. Complete AEAD-GCM encrypted packet sequence . . . . 192 A.12. Sample Messages Encrypted Using Argon2
A.12. Sample messages encrypted using Argon2 . . . . . . . . . 192 A.12.1. V4 SKESK Using Argon2 with AES-128
A.12.1. Version 4 SKESK using Argon2 with AES-128 . . . . . 192 A.12.2. V4 SKESK Using Argon2 with AES-192
A.12.2. Version 4 SKESK using Argon2 with AES-192 . . . . . 193 A.12.3. V4 SKESK Using Argon2 with AES-256
A.12.3. Version 4 SKESK using Argon2 with AES-256 . . . . . 193 Appendix B. Upgrade Guidance (Adapting Implementations from RFCs
Appendix B. Upgrade Guidance (Adapting Implementations from RFC 4880 and 6637)
4880 and RFC 6637) . . . . . . . . . . . . . . . . . . . 193 B.1. Terminology Changes
B.1. Terminology Changes . . . . . . . . . . . . . . . . . . . 197 Appendix C. Errata Addressed by This Document
Appendix C. Acknowledgements . . . . . . . . . . . . . . . . . . 197 Acknowledgements
Appendix D. Errata addressed by this document . . . . . . . . . 198 Authors' Addresses
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 199
1. Introduction 1. Introduction
This document provides information on the message-exchange packet This document provides information on the message-exchange packet
formats used by OpenPGP to provide encryption, decryption, signing, formats used by OpenPGP to provide encryption, decryption, signing,
and key management functions. It is a revision of RFC 4880, "OpenPGP and key management functions. It is a revision of [RFC4880]
Message Format", which is a revision of RFC 2440, which itself ("OpenPGP Message Format"), which is a revision of [RFC2440], which
replaces RFC 1991, "PGP Message Exchange Formats" [RFC1991] [RFC2440] itself replaces [RFC1991] ("PGP Message Exchange Formats").
[RFC4880].
This document obsoletes: [RFC4880] (OpenPGP), [RFC5581] (Camellia in This document obsoletes [RFC4880] (OpenPGP), [RFC5581] (Camellia in
OpenPGP) and [RFC6637] (Elliptic Curves in OpenPGP). This document OpenPGP), and [RFC6637] (Elliptic Curves in OpenPGP). At the time of
incorporates all - at the time of writing - outstanding verified writing, this document incorporates all outstanding verified errata,
errata which are listed in Appendix D. which are listed in Appendix C.
Software that has already implemented those previous standards may Software that has already implemented those previous specifications
want to review Appendix B for pointers to what has changed. may want to review Appendix B for pointers to what has changed.
1.1. Terms 1.1. Terms
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in "OPTIONAL" in this document are to be interpreted as described in BCP
BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all 14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here. capitals, as shown here.
The key words "PRIVATE USE", "SPECIFICATION REQUIRED", and "RFC The key words "Private Use", "Specification Required", and "RFC
REQUIRED" that appear in this document when used to describe Required" that appear in this document when used to describe
namespace allocation are to be interpreted as described in [RFC8126]. namespace allocation are to be interpreted as described in [RFC8126].
Some terminology used in this document has been improved from Some terminology used in this document has been improved from
previous versions of the OpenPGP specification. See Appendix B.1 for previous versions of the OpenPGP specification. See Appendix B.1 for
more details. more details.
2. General functions 2. General Functions
OpenPGP provides data confidentiality and integrity for messages and OpenPGP provides data confidentiality and integrity for messages and
data files by using public-key and/or symmetric encryption, and data files by using public key and/or symmetric encryption and
digital signatures. It provides formats for encoding and digital signatures. It provides formats for encoding and
transferring encrypted and/or signed messages. In addition, OpenPGP transferring encrypted and/or signed messages. In addition, OpenPGP
provides functionality for encoding and transferring keys and provides functionality for encoding and transferring keys and
certificates, though key storage and management is beyond the scope certificates, though key storage and management are beyond the scope
of this document. of this document.
2.1. Confidentiality via Encryption 2.1. Confidentiality via Encryption
OpenPGP combines symmetric-key encryption and (optionally) public-key OpenPGP combines symmetric key encryption and (optionally) public key
encryption to provide confidentiality. When using public keys, first encryption to provide confidentiality. When using public keys, first
the object is encrypted using a symmetric encryption algorithm. Each the object is encrypted using a symmetric key encryption algorithm.
symmetric key is used only once, for a single object. A new "session Each symmetric key is used only once, for a single object. A new
key" is generated as a random number for each object (sometimes "session key" is generated as a random number for each object
referred to as a session). Since it is used only once, the session (sometimes referred to as a "session"). Since it is used only once,
key is bound to the message and transmitted with it. To protect the the session key is bound to the message and transmitted with it. To
key, it is encrypted with the receiver's public key. The sequence is protect the key, it is encrypted with the receiver's public key. The
as follows: sequence is as follows:
1. The sender creates a message. 1. The sender creates a message.
2. The sending OpenPGP implementation generates a random session key 2. The sending OpenPGP implementation generates a random session key
for this message. for this message.
3. The session key is encrypted using each recipient's public key. 3. The session key is encrypted using each recipient's public key.
These "encrypted session keys" start the message. These "encrypted session keys" start the message.
4. The sending OpenPGP implementation optionally compresses the 4. The sending OpenPGP implementation optionally compresses the
message, and then encrypts it using a message key derived from message and then encrypts it using a message key derived from the
the session key. The encrypted message forms the remainder of session key. The encrypted message forms the remainder of the
the OpenPGP message. OpenPGP Message.
5. The receiving OpenPGP implementation decrypts the session key 5. The receiving OpenPGP implementation decrypts the session key
using the recipient's private key. using the recipient's private key.
6. The receiving OpenPGP implementation decrypts the message using 6. The receiving OpenPGP implementation decrypts the message using
the message key derived from the session key. If the message was the message key derived from the session key. If the message was
compressed, it will be decompressed. compressed, it will be decompressed.
When using symmetric-key encryption, a similar process as described When using symmetric key encryption, a similar process as described
above is used, but the session key is encrypted with a symmetric above is used, but the session key is encrypted with a symmetric
algorithm derived from a shared secret. algorithm derived from a shared secret.
Both digital signature and confidentiality services may be applied to Both digital signature and confidentiality services may be applied to
the same message. First, a signature is generated for the message the same message. First, a signature is generated for the message
and attached to the message. Then the message plus signature is and attached to the message. Then, the message plus signature is
encrypted using a symmetric message key derived from the session key. encrypted using a symmetric message key derived from the session key.
Finally, the session key is encrypted using public-key encryption and Finally, the session key is encrypted using public key encryption and
prefixed to the encrypted block. prefixed to the encrypted block.
2.2. Authentication via Digital Signature 2.2. Authentication via Digital Signature
The digital signature uses a cryptographic hash function and a The digital signature uses a cryptographic hash function and a public
public-key signature algorithm. The sequence is as follows: key algorithm capable of signing. The sequence is as follows:
1. The sender creates a message. 1. The sender creates a message.
2. The sending implementation generates a hash digest of the 2. The sending implementation generates a hash digest of the
message. message.
3. The sending implementation generates a signature from the hash 3. The sending implementation generates a signature from the hash
digest using the sender's private key. digest using the sender's private key.
4. The signature is attached to or transmitted alongside the 4. The signature is attached to or transmitted alongside the
skipping to change at page 12, line 8 skipping to change at line 508
the message signature. the message signature.
6. The receiving implementation generates a new hash digest for the 6. The receiving implementation generates a new hash digest for the
received message and verifies it using the message's signature. received message and verifies it using the message's signature.
If the verification is successful, the message is accepted as If the verification is successful, the message is accepted as
authentic. authentic.
2.3. Compression 2.3. Compression
An OpenPGP implementation MAY support the compression of data. Many An OpenPGP implementation MAY support the compression of data. Many
existing OpenPGP messages are compressed. Implementers, such as existing OpenPGP Messages are compressed. Implementers, such as
those working on constrained implementations that do not want to those working on constrained implementations that do not want to
support compression, might want to consider at least implementing support compression, might want to consider at least implementing
decompression. decompression.
2.4. Conversion to Base64 2.4. Conversion to Base64
OpenPGP's underlying native representation for encrypted messages, OpenPGP's underlying representation for encrypted messages,
signatures, keys, and certificates is a stream of arbitrary octets. signatures, keys, and certificates is a stream of arbitrary octets.
Some systems only permit the use of blocks consisting of seven-bit, Some systems only permit the use of blocks consisting of 7-bit,
printable text. For transporting OpenPGP's native raw binary octets printable text. For transporting OpenPGP's raw binary octets through
through channels that are not safe to transport raw binary data, a channels that are not safe to transport raw binary data, a printable
printable encoding of these binary octets is defined. The raw 8-bit encoding of these binary octets is defined. The raw 8-bit binary
binary octet stream can be converted to a stream of printable ASCII octet stream can be converted to a stream of printable ASCII
characters using base64 encoding, in a format called ASCII Armor (see characters using base64 encoding in a format called "ASCII Armor"
Section 6). (see Section 6).
Implementations SHOULD support base64 conversions. Implementations SHOULD support base64 conversions.
2.5. Signature-Only Applications 2.5. Signature-Only Applications
OpenPGP is designed for applications that use both encryption and OpenPGP is designed for applications that use both encryption and
signatures, but there are a number of use cases that only require a signatures, but there are a number of use cases that only require a
signature-only implementation. Although this specification requires signature-only implementation. Although this specification requires
both encryption and signatures, it is reasonable for there to be both encryption and signatures, it is reasonable for there to be
subset implementations that are non-conformant only in that they omit subset implementations that are non-conformant only in that they omit
encryption support. encryption support.
3. Data Element Formats 3. Data Element Formats
This section describes the data elements used by OpenPGP. This section describes the data elements used by OpenPGP.
3.1. Scalar Numbers 3.1. Scalar Numbers
Scalar numbers are unsigned and are always stored in big-endian Scalar numbers are unsigned and always stored in big-endian format.
format. Using n[k] to refer to the kth octet being interpreted, the Using n[k] to refer to the kth octet being interpreted, the value of
value of a two-octet scalar is ((n[0] << 8) + n[1]). The value of a a 2-octet scalar is ((n[0] << 8) + n[1]). The value of a 4-octet
four-octet scalar is ((n[0] << 24) + (n[1] << 16) + (n[2] << 8) + scalar is ((n[0] << 24) + (n[1] << 16) + (n[2] << 8) + n[3]).
n[3]).
3.2. Multiprecision Integers 3.2. Multiprecision Integers
Multiprecision integers (also called MPIs) are unsigned integers used Multiprecision Integers (MPIs) are unsigned integers used to hold
to hold large integers such as the ones used in cryptographic large integers such as the ones used in cryptographic calculations.
calculations.
An MPI consists of two pieces: a two-octet scalar that is the length An MPI consists of two pieces: a 2-octet scalar that is the length of
of the MPI in bits followed by a string of octets that contain the the MPI in bits, followed by a string of octets that contain the
actual integer. actual integer.
These octets form a big-endian number; a big-endian number can be These octets form a big-endian number; a big-endian number can be
made into an MPI by prefixing it with the appropriate length. made into an MPI by prefixing it with the appropriate length.
Examples: Examples:
(all numbers in the octet strings identified by square brackets are (Note that all numbers in the octet strings identified by square
in hexadecimal) brackets are in hexadecimal.)
The string of octets [00 00] forms an MPI with the value 0. The The string of octets [00 00] forms an MPI with the value 0.
string of octets [00 01 01] forms an MPI with the value 1. The
string [00 09 01 FF] forms an MPI with the value of 511. The string of octets [00 01 01] forms an MPI with the value 1.
The string [00 09 01 FF] forms an MPI with the value 511.
Additional rules: Additional rules:
The size of an MPI is ((MPI.length + 7) / 8) + 2 octets. * The size of an MPI is ((MPI.length + 7) / 8) + 2 octets.
The length field of an MPI describes the length starting from its * The length field of an MPI describes the length starting from its
most significant non-zero bit. Thus, the MPI [00 02 01] is not most significant non-zero bit. Thus, the MPI [00 02 01] is not
formed correctly. It should be [00 01 01]. When parsing an MPI in a formed correctly. It should be [00 01 01]. When parsing an MPI
v6 Key, Signature, or Public-Key Encrypted Session Key packet, the in a version 6 Key, Signature, or Public Key Encrypted Session Key
implementation MUST check that the encoded length matches the length (PKESK) packet, the implementation MUST check that the encoded
starting from the most significant non-zero bit, and reject the length matches the length starting from the most significant non-
packet as malformed if not. zero bit; if it doesn't match, reject the packet as malformed.
Unused bits of an MPI MUST be zero. * Unused bits of an MPI MUST be zero.
3.2.1. Using MPIs to encode other data 3.2.1. Using MPIs to Encode Other Data
Note that MPIs are in some places used to encode non-integer data, Note that in some places, MPIs are used to encode non-integer data,
such as an elliptic curve point (see Section 11.2), or an octet such as an elliptic curve (EC) point (see Section 11.2) or an octet
string of known, fixed length (see Section 11.3). The wire string of known, fixed length (see Section 11.3). The wire
representation is the same: two octets of length in bits counted from representation is the same: 2 octets of length in bits counted from
the first non-zero bit, followed by the smallest series of octets the first non-zero bit, followed by the smallest series of octets
that can represent the value while stripping off any leading zero that can represent the value while stripping off any leading zero
octets. octets.
3.3. Key IDs and Fingerprints 3.3. Key IDs and Fingerprints
A Key ID is an eight-octet scalar that identifies a key. A Key ID is an 8-octet scalar that identifies a key. Implementations
Implementations SHOULD NOT assume that Key IDs are unique. A SHOULD NOT assume that Key IDs are unique. A fingerprint is more
fingerprint is more likely to be unique than a key ID. The likely to be unique than a Key ID. The fingerprint and Key ID of a
fingerprint and key ID of a key are calculated differently according key are calculated differently according to the version of the key.
to the version of the key.
Section 5.5.4 describes how Key IDs and Fingerprints are formed. Section 5.5.4 describes how Key IDs and Fingerprints are formed.
3.4. Text 3.4. Text
Unless otherwise specified, the character set for text is the UTF-8 Unless otherwise specified, the character set for text is the UTF-8
[RFC3629] encoding of Unicode [ISO10646]. [RFC3629] encoding of Unicode [ISO10646].
3.5. Time Fields 3.5. Time Fields
A time field is an unsigned four-octet number containing the number A time field is an unsigned 4-octet number containing the number of
of seconds elapsed since midnight, 1 January 1970 UTC. seconds elapsed since midnight, 1 January 1970 UTC.
3.6. Keyrings 3.6. Keyrings
A keyring is a collection of one or more keys in a file or database. A keyring is a collection of one or more keys in a file or database.
Traditionally, a keyring is simply a sequential list of keys, but may Typically, a keyring is simply a sequential list of keys, but it may
be any suitable database. It is beyond the scope of this standard to be any suitable database. It is beyond the scope of this
discuss the details of keyrings or other databases. specification to discuss the details of keyrings or other databases.
3.7. String-to-Key (S2K) Specifier 3.7. String-to-Key (S2K) Specifier
A string-to-key (S2K) specifier type is used to convert a passphrase A string-to-key (S2K) Specifier is used to convert a passphrase
string into a symmetric-key encryption/decryption key. Passphrases string into a symmetric key encryption/decryption key. Passphrases
requiring use of S2K conversion are currently used in two places: to requiring use of S2K conversion are currently used in two places: to
encrypt the secret part of private keys, and for symmetrically encrypt the secret part of private keys and for symmetrically
encrypted messages. encrypted messages.
3.7.1. String-to-Key (S2K) Specifier Types 3.7.1. S2K Specifier Types
There are four types of S2K Specifier Types currently specified, and There are four types of S2K Specifiers currently specified and some
some reserved values: reserved values:
+=====+==============+===============+===========+==================+ +=========+==============+===============+==============+===========+
| ID | S2K Type | S2K field | Reference | Generate? | | ID | S2K Type | S2K Field | Generate? | Reference |
| | | size (octets) | | | | | | Size | | |
+=====+==============+===============+===========+==================+ | | | (Octets) | | |
| 0 | Simple S2K | 2 | Section | No | +=========+==============+===============+==============+===========+
| | | | 3.7.1.1 | | | 0 | Simple S2K | 2 | No | Section |
+-----+--------------+---------------+-----------+------------------+ | | | | | 3.7.1.1 |
| 1 | Salted S2K | 10 | Section | Only when | +---------+--------------+---------------+--------------+-----------+
| | | | 3.7.1.2 | string is | | 1 | Salted S2K | 10 | Only when | Section |
| | | | | high entropy | | | | | string is | 3.7.1.2 |
+-----+--------------+---------------+-----------+------------------+ | | | | high entropy | |
| 2 | Reserved | - | - | No | +---------+--------------+---------------+--------------+-----------+
| | value | | | | | 2 | Reserved | - | No | |
+-----+--------------+---------------+-----------+------------------+ | | value | | | |
| 3 | Iterated and | 11 | Section | Yes | +---------+--------------+---------------+--------------+-----------+
| | Salted S2K | | 3.7.1.3 | | | 3 | Iterated and | 11 | Yes | Section |
+-----+--------------+---------------+-----------+------------------+ | | Salted S2K | | | 3.7.1.3 |
| 4 | Argon2 | 20 | Section | Yes | +---------+--------------+---------------+--------------+-----------+
| | | | 3.7.1.4 | | | 4 | Argon2 | 20 | Yes | Section |
+-----+--------------+---------------+-----------+------------------+ | | | | | 3.7.1.4 |
| 100 | Private/ | - | - | As | +---------+--------------+---------------+--------------+-----------+
| to | Experimental | | | appropriate | | 100-110 | Private or | - | As | |
| 110 | S2K | | | | | | Experimental | | appropriate | |
+-----+--------------+---------------+-----------+------------------+ | | Use | | | |
+---------+--------------+---------------+--------------+-----------+
Table 1: OpenPGP String-to-Key (S2K) Types registry Table 1: OpenPGP String-to-Key (S2K) Types Registry
These are described in the subsections below. If the "Generate?" The S2K Specifier Types are described in the subsections below. If
column is not "Yes", the S2K entry is used only for reading in "Yes" is not present in the "Generate?" column, the S2K entry is used
backwards compatibility mode and SHOULD NOT be used to generate new only for reading in backward-compatibility mode and SHOULD NOT be
output. used to generate new output.
3.7.1.1. Simple S2K 3.7.1.1. Simple S2K
This directly hashes the string to produce the key data. See below Simple S2K directly hashes the string to produce the key data. This
for how this hashing is done. hashing is done as shown below.
Octet 0: 0x00 Octet 0: 0x00
Octet 1: hash algorithm Octet 1: hash algorithm
Simple S2K hashes the passphrase to produce the session key. The Simple S2K hashes the passphrase to produce the session key. The
manner in which this is done depends on the size of the session key manner in which this is done depends on the size of the session key
(which depends on the cipher the session key will be used with) and (which depends on the cipher the session key will be used with) and
the size of the hash algorithm's output. If the hash size is greater the size of the hash algorithm's output. If the hash size is greater
than the session key size, the high-order (leftmost) octets of the than the session key size, the high-order (leftmost) octets of the
hash are used as the key. hash are used as the key.
If the hash size is less than the key size, multiple instances of the If the hash size is less than the key size, multiple instances of the
hash context are created --- enough to produce the required key data. hash context are created -- enough to produce the required key data.
These instances are preloaded with 0, 1, 2, ... octets of zeros (that These instances are preloaded with 0, 1, 2, ... octets of zeros (that
is to say, the first instance has no preloading, the second gets is, the first instance has no preloading, the second gets preloaded
preloaded with 1 octet of zero, the third is preloaded with two with 1 octet of zero, the third is preloaded with 2 octets of zeros,
octets of zeros, and so forth). and so forth).
As the data is hashed, it is given independently to each hash As the data is hashed, it is given independently to each hash
context. Since the contexts have been initialized differently, they context. Since the contexts have been initialized differently, they
will each produce different hash output. Once the passphrase is will each produce a different hash output. Once the passphrase is
hashed, the output data from the multiple hashes is concatenated, hashed, the output data from the multiple hashes is concatenated,
first hash leftmost, to produce the key data, with any excess octets first hash leftmost, to produce the key data, and any excess octets
on the right discarded. on the right are discarded.
3.7.1.2. Salted S2K 3.7.1.2. Salted S2K
This includes a "salt" value in the S2K specifier --- some arbitrary Salted S2K includes a "salt" value in the S2K Specifier -- some
data --- that gets hashed along with the passphrase string, to help arbitrary data -- that gets hashed along with the passphrase string
prevent dictionary attacks. to help prevent dictionary attacks.
Octet 0: 0x01 Octet 0: 0x01
Octet 1: hash algorithm Octet 1: hash algorithm
Octets 2-9: 8-octet salt value Octets 2-9: 8-octet salt value
Salted S2K is exactly like Simple S2K, except that the input to the Salted S2K is exactly like Simple S2K, except that the input to the
hash function(s) consists of the 8 octets of salt from the S2K hash function(s) consists of the 8 octets of salt from the S2K
specifier, followed by the passphrase. Specifier, followed by the passphrase.
3.7.1.3. Iterated and Salted S2K 3.7.1.3. Iterated and Salted S2K
This includes both a salt and an octet count. The salt is combined Iterated and Salted S2K includes both a salt and an octet count. The
with the passphrase and the resulting value is repeated and then salt is combined with the passphrase, and the resulting value is
hashed. This further increases the amount of work an attacker must repeated and then hashed. This further increases the amount of work
do to try dictionary attacks. an attacker must do to try dictionary attacks.
Octet 0: 0x03 Octet 0: 0x03
Octet 1: hash algorithm Octet 1: hash algorithm
Octets 2-9: 8-octet salt value Octets 2-9: 8-octet salt value
Octet 10: count, a one-octet, coded value Octet 10: count; a 1-octet coded value
The count is coded into a one-octet number using the following The count is coded into a 1-octet number using the following formula:
formula:
#define EXPBIAS 6 #define EXPBIAS 6
count = ((Int32)16 + (c & 15)) << ((c >> 4) + EXPBIAS); count = ((Int32)16 + (c & 15)) << ((c >> 4) + EXPBIAS);
The above formula is in [C99], where "Int32" is a type for a 32-bit The above formula is described in [C99], where "Int32" is a type for
integer, and the variable "c" is the coded count, Octet 10. a 32-bit integer, and the variable "c" is the coded count, octet 10.
Iterated-Salted S2K hashes the passphrase and salt data multiple Iterated and Salted S2K hashes the passphrase and salt data multiple
times. The total number of octets to be hashed is specified in the times. The total number of octets to be hashed is specified in the
encoded count in the S2K specifier. Note that the resulting count encoded count in the S2K Specifier. Note that the resulting count
value is an octet count of how many octets will be hashed, not an value is an octet count of how many octets will be hashed, not an
iteration count. iteration count.
Initially, one or more hash contexts are set up as with the other S2K Initially, one or more hash contexts are set up the same as the other
algorithms, depending on how many octets of key data are needed. S2K algorithms, depending on how many octets of key data are needed.
Then the salt, followed by the passphrase data, is repeatedly Then the salt, followed by the passphrase data, is repeatedly
processed as input to each hash context until the number of octets processed as input to each hash context until the number of octets
specified by the octet count has been hashed. The input is truncated specified by the octet count has been hashed. The input is truncated
to the octet count, except if the octet count is less than the to the octet count, except if the octet count is less than the
initial isize of the salt plus passphrase. That is, at least one initial size of the salt plus passphrase. That is, at least one copy
copy of the full salt plus passphrase will be provided as input to of the full salt plus passphrase will be provided as input to each
each hash context regardless of the octet count. After the hashing hash context regardless of the octet count. After the hashing is
is done, the key data is produced from the hash digest(s) as with the done, the key data is produced from the hash digest(s), which is the
other S2K algorithms. same way it is produced for the other S2K algorithms.
3.7.1.4. Argon2 3.7.1.4. Argon2
This S2K method hashes the passphrase using Argon2, specified in This S2K method hashes the passphrase using Argon2, as specified in
[RFC9106]. This provides memory-hardness, further protecting the [RFC9106]. This provides memory hardness, further protecting the
passphrase against brute-force attacks. passphrase against brute-force attacks.
Octet 0: 0x04 Octet 0: 0x04
Octets 1-16: 16-octet salt value Octets 1-16: 16-octet salt value
Octet 17: one-octet number of passes t Octet 17: 1-octet number of passes t
Octet 18: one-octet degree of parallelism p Octet 18: 1-octet degree of parallelism p
Octet 19: one-octet encoded_m, specifying the exponent of the memory size Octet 19: 1-octet encoded_m, specifying the exponent of
the memory size
The salt SHOULD be unique for each passphrase. The salt SHOULD be unique for each passphrase.
The number of passes t and the degree of parallelism p MUST be non- The number of passes t and the degree of parallelism p MUST be non-
zero. zero.
The memory size m is 2**encoded_m kibibytes of RAM. The encoded The memory size m is 2^(encoded_m) kibibytes (KiB) of RAM. The
memory size MUST be a value from 3+ceil(log_2(p)) to 31, such that encoded memory size MUST be a value from 3+ceil(log_2(p)) to 31, such
the decoded memory size m is a value from 8*p to 2**31. Note that that the decoded memory size m is a value from 8*p to 2^31. Note
memory-hardness size is indicated in kibibytes (KiB), not octets. that memory-hardness size is indicated in KiB, not octets.
Argon2 is invoked with the passphrase as P, the salt as S, the values Argon2 is invoked with the passphrase as P, the salt as S, the values
of t, p and m as described above, the required key size as the tag of t, p, and m as described above, the required key size as the tag
length T, 0x13 as the version v, and Argon2id as the type. length T, 0x13 as the version v, and Argon2id as the type.
For the recommended values of t, p and m, see Section 4 of [RFC9106]. For the recommended values of t, p, and m, see Section 4 of
If the recommended value of m for a given application is not a power [RFC9106]. If the recommended value of m for a given application is
of 2, it is RECOMMENDED to round up to the next power of 2 if the not a power of 2, it is RECOMMENDED to round up to the next power of
resulting performance would be acceptable, and round down otherwise 2 if the resulting performance would be acceptable; otherwise, round
(keeping in mind that m must be at least 8*p). down (keeping in mind that m must be at least 8*p).
As an example, with the first recommended option (t=1, p=4, m=2**21), As an example, with the first recommended option (t=1, p=4, m=2^21),
the full S2K specifier would be: the full S2K Specifier would be:
04 XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 04 XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
XX 01 04 15 XX 01 04 15
(where XX represents a random octet of salt). where XX represents a random octet of salt.
3.7.2. String-to-Key Usage 3.7.2. S2K Usage
Simple S2K and Salted S2K specifiers can be brute-forced when used Simple S2K and Salted S2K Specifiers can be brute-forced when used
with a low-entropy string, such as those typically provided by users. with a low-entropy string, such as those typically provided by users.
In addition, the usage of Simple S2K can lead to key and IV reuse In addition, the usage of Simple S2K can lead to key and
(see Section 5.3). Therefore, when generating an S2K specifier, an initialization vector (IV) reuse (see Section 5.3). Therefore, when
implementation MUST NOT use Simple S2K. Furthermore, an generating an S2K Specifier, an implementation MUST NOT use Simple
implementation SHOULD NOT generate a Salted S2K unless the S2K. Furthermore, an implementation SHOULD NOT generate a Salted S2K
implementation knows that the input string is high-entropy (for unless the implementation knows that the input string is high entropy
example, it generated the string itself using a known-good source of (for example, it generated the string itself using a known good
randomness). source of randomness).
It is RECOMMENDED that implementations use Argon2. If Argon2 is not It is RECOMMENDED that implementations use Argon2. If Argon2 is not
available, Iterated and Salted S2K MAY be used if care is taken to available, Iterated and Salted S2K MAY be used if care is taken to
use a high octet count and a strong passphrase. However, this method use a high octet count and a strong passphrase. However, this method
does not provide memory-hardness, unlike Argon2. does not provide memory hardness, unlike Argon2.
3.7.2.1. Secret-Key Encryption 3.7.2.1. Secret Key Encryption
The first octet following the public key material in a secret key The first octet following the public key material in a Secret Key
packet (Section 5.5.3) indicates whether and how the secret key packet (Section 5.5.3) indicates whether and how the secret key
material is passphrase-protected. This first octet is known as the material is passphrase protected. This first octet is known as the
"S2K usage octet". "S2K usage octet".
If S2K usage octet is zero, the secret key data is unprotected. If If the S2K usage octet is zero, the secret key data is unprotected.
it is non-zero, it describes how to use a passphrase to unlock the If it is non-zero, it describes how to use a passphrase to unlock the
secret key. secret key.
Implementations predating [RFC2440] indicated a protected key by Implementations predating [RFC2440] indicated a protected key by
storing a symmetric cipher algorithm ID (see Section 9.3) in the S2K storing a Symmetric Cipher Algorithm ID (see Section 9.3) in the S2K
usage octet. In this case, the MD5 hash function was always used to usage octet. In this case, the MD5 hash function was always used to
convert the passphrase to a key for the specified cipher algorithm. convert the passphrase to a key for the specified cipher algorithm.
Later implementations indicate a protected secret key by storing a Later implementations indicate a protected secret key by storing one
special value 253 (AEAD), 254 (CFB), or 255 (MalleableCFB) in the S2K of the special values 253 (AEAD), 254 (CFB), or 255 (MalleableCFB) in
usage octet. The S2K usage octet is then followed immediately by a the S2K usage octet. The S2K usage octet is then followed
set of fields that describe how to convert a passphrase to a immediately by a set of fields that describe how to convert a
symmetric key that can unlock the secret material, plus other passphrase to a symmetric key that can unlock the secret material,
parameters relevant to the type of encryption used. plus other parameters relevant to the type of encryption used.
The wire format fields also differ based on the version of the The wire format fields also differ based on the version of the
enclosing OpenPGP packet. The table below, indexed by S2K usage enclosing OpenPGP packet. The table below, indexed by the S2K usage
octet, summarizes the specifics described in Section 5.5.3. octet, summarizes the specifics described in Section 5.5.3.
In the table below, check(x) means the "2-octet checksum" meaning the In the table below, check(x) means the "2-octet checksum", which is
sum of all octets in x mod 65536. The info and packetprefix the sum of all octets in x mod 65536. The info and packetprefix
parameters are described in detail in Section 5.5.3. parameters are described in detail in Section 5.5.3. Note that the
"Generate?" column header has been shortened to "Gen?" here.
+=========+============+============+==========================+=========+ +=========+============+============+==========================+====+
|S2K usage|Shorthand |Encryption |Encryption |Generate?| |S2K Usage|Shorthand |Encryption |Encryption |Gen?|
|octet | |parameter | | | |Octet | |Parameter | | |
| | |fields | | | | | |Fields | | |
+=========+============+============+==========================+=========+ +=========+============+============+==========================+====+
|0 |Unprotected |- |*v3 or v4 keys:* |Yes | |0 |Unprotected |- |*v3 or v4 keys:* |Yes |
| | | |[cleartext secrets || | | | | | |[cleartext secrets || | |
| | | |check(secrets)] | | | | | |check(secrets)] | |
| | | |*v6 keys:* [cleartext | | | | | |*v6 keys:* [cleartext | |
| | | |secrets] | | | | | |secrets] | |
+---------+------------+------------+--------------------------+---------+ +---------+------------+------------+--------------------------+----+
|Known |LegacyCFB |IV |CFB(MD5(passphrase), |No | |Known |LegacyCFB |IV |CFB(MD5(passphrase), |No |
|symmetric| | |secrets || check(secrets))| | |symmetric| | |secrets || check(secrets))| |
|cipher | | | | | |cipher | | | | |
|algo ID | | | | | |algo ID | | | | |
|(see | | | | | |(see | | | | |
|Section | | | | | |Section | | | | |
|9.3) | | | | | |9.3) | | | | |
+---------+------------+------------+--------------------------+---------+ +---------+------------+------------+--------------------------+----+
|253 |AEAD |params- |AEAD(HKDF(S2K(passphrase),|Yes | |253 |AEAD |params- |AEAD(HKDF(S2K(passphrase),|Yes |
| | |length |info), secrets, | | | | |length |info), secrets, | |
| | |(*v6-only*),|packetprefix) | | | | |(*v6-only*),|packetprefix) | |
| | |cipher-algo,| | | | | |cipher-algo,| | |
| | |AEAD-mode, | | | | | |AEAD-mode, | | |
| | |S2K- | | | | | |S2K- | | |
| | |specifier- | | | | | |specifier- | | |
| | |length | | | | | |length | | |
| | |(*v6-only*),| | | | | |(*v6-only*),| | |
| | |S2K- | | | | | |S2K- | | |
| | |specifier, | | | | | |specifier, | | |
| | |nonce | | | | | |nonce | | |
+---------+------------+------------+--------------------------+---------+ +---------+------------+------------+--------------------------+----+
|254 |CFB |params- |CFB(S2K(passphrase), |Yes | |254 |CFB |params- |CFB(S2K(passphrase), |Yes |
| | |length |secrets || SHA1(secrets)) | | | | |length |secrets || SHA1(secrets)) | |
| | |(*v6-only*),| | | | | |(*v6-only*),| | |
| | |cipher-algo,| | | | | |cipher-algo,| | |
| | |S2K- | | | | | |S2K- | | |
| | |specifier- | | | | | |specifier- | | |
| | |length | | | | | |length | | |
| | |(*v6-only*),| | | | | |(*v6-only*),| | |
| | |S2K- | | | | | |S2K- | | |
| | |specifier, | | | | | |specifier, | | |
| | |IV | | | | | |IV | | |
+---------+------------+------------+--------------------------+---------+ +---------+------------+------------+--------------------------+----+
|255 |MalleableCFB|cipher-algo,|CFB(S2K(passphrase), |No | |255 |MalleableCFB|cipher-algo,|CFB(S2K(passphrase), |No |
| | |S2K- |secrets || check(secrets))| | | | |S2K- |secrets || check(secrets))| |
| | |specifier, | | | | | |specifier, | | |
| | |IV | | | | | |IV | | |
+---------+------------+------------+--------------------------+---------+ +---------+------------+------------+--------------------------+----+
Table 2: OpenPGP Secret Key Encryption (S2K Usage Octet) registry Table 2: OpenPGP Secret Key Encryption (S2K Usage Octet) Registry
When emitting a secret key (with or without passphrase-protection) an When emitting a secret key (with or without passphrase protection),
implementation MUST only produce data from a row with "Generate?" an implementation MUST only produce data from a row with "Generate?"
marked as "Yes". Each row with "Generate?" marked as "No" is marked as "Yes". Each row with "Generate?" marked as "No" is
described for backward compatibility (for reading v4 and earlier keys described for backward compatibility (for reading version 4 and
only), and MUST NOT be used to generate new output. Version 6 secret earlier keys only) and MUST NOT be used to generate new output.
keys using these formats MUST be rejected. Version 6 secret keys using these formats MUST be rejected.
Note that compared to a version 4 secret key, the parameters of a Note that compared to a version 4 secret key, the parameters of a
passphrase-protected version 6 secret key are stored with an passphrase-protected version 6 secret key are stored with an
additional pair of length counts, each of which is one octet wide. additional pair of length counts, each of which is 1 octet wide.
Argon2 is only used with AEAD (S2K usage octet 253). An Argon2 is only used with Authenticated Encryption with Associated
implementation MUST NOT create and MUST reject as malformed any Data (AEAD) (S2K usage octet 253). An implementation MUST NOT create
secret key packet where the S2K usage octet is not AEAD (253) and the and MUST reject as malformed any Secret Key packet where the S2K
S2K specifier type is Argon2. usage octet is not AEAD (253) and the S2K Specifier Type is Argon2.
3.7.2.2. Symmetric-Key Message Encryption 3.7.2.2. Symmetric Key Message Encryption
OpenPGP can create a Symmetric-key Encrypted Session Key (ESK) packet OpenPGP can create a Symmetric Key Encrypted Session Key (SKESK)
at the front of a message. This is used to allow S2K specifiers to packet at the front of a message. This is used to allow S2K
be used for the passphrase conversion or to create messages with a Specifiers to be used for the passphrase conversion or to create
mix of symmetric-key ESKs and public-key ESKs. This allows a message messages with a mix of SKESK packets and PKESK packets. This allows
to be decrypted either with a passphrase or a public-key pair. a message to be decrypted with either a passphrase or a public key
pair.
Implementations predating [RFC2440] always used IDEA with Simple Implementations predating [RFC2440] always used the International
string-to-key conversion when encrypting a message with a symmetric Data Encryption Algorithm (IDEA) with Simple S2K conversion when
algorithm. See Section 5.7. This MUST NOT be generated, but MAY be encrypting a message with a symmetric algorithm; see Section 5.7.
consumed for backward-compatibility. IDEA MUST NOT be generated but MAY be consumed for backward
compatibility.
4. Packet Syntax 4. Packet Syntax
This section describes the packets used by OpenPGP. This section describes the packets used by OpenPGP.
4.1. Overview 4.1. Overview
An OpenPGP message is constructed from a number of records that are An OpenPGP Message is constructed from a number of records that are
traditionally called packets. A packet is a chunk of data that has a typically called packets. A packet is a chunk of data that has a
type ID specifying its meaning. An OpenPGP message, keyring, Type ID specifying its meaning. An OpenPGP Message, keyring,
certificate, detached signature, and so forth consists of a number of certificate, detached signature, and so forth consists of a number of
packets. Some of those packets may contain other OpenPGP packets packets. Some of those packets may contain other OpenPGP packets
(for example, a compressed data packet, when uncompressed, contains (for example, a compressed data packet, when uncompressed, contains
OpenPGP packets). OpenPGP packets).
Each packet consists of a packet header, followed by the packet body. Each packet consists of a packet header, followed by the packet body.
The packet header is of variable length. The packet header is of variable length.
When handling a stream of packets, the length information in each When handling a stream of packets, the length information in each
packet header is the canonical source of packet boundaries. An packet header is the canonical source of packet boundaries. An
skipping to change at page 21, line 41 skipping to change at line 956
the range indicated in the packet header, a parser MUST abort without the range indicated in the packet header, a parser MUST abort without
writing outside the indicated range and MUST treat the packet as writing outside the indicated range and MUST treat the packet as
malformed and unusable. malformed and unusable.
An implementation MUST NOT interpret octets outside the range An implementation MUST NOT interpret octets outside the range
indicated in the packet header as part of the contents of the packet. indicated in the packet header as part of the contents of the packet.
4.2. Packet Headers 4.2. Packet Headers
The first octet of the packet denotes the format of the rest of the The first octet of the packet denotes the format of the rest of the
header, and encodes the Packet Type ID, indicating the type of the header, and it encodes the Packet Type ID, indicating the type of the
packet (see Section 5). The remainder of the packet header is the packet (see Section 5). The remainder of the packet header is the
length of the packet. length of the packet.
There are two packet formats, the (current) OpenPGP packet format There are two packet formats: 1) the (current) OpenPGP packet format
specified by this document and its predecessors [RFC4880] and specified by this document and its predecessors [RFC4880] and
[RFC2440], and the Legacy packet format as used by implementations [RFC2440] and 2) the Legacy packet format as used by implementations
predating any IETF specification of the protocol. predating any IETF specification of OpenPGP.
Note that the most significant bit is the leftmost bit, called bit 7. Note that the most significant bit is the leftmost bit, called "bit
A mask for this bit is 0x80 in hexadecimal. 7". A mask for this bit is 0x80 in hexadecimal.
┌───────────────┐ +---------------+
Encoded Packet Type ID: │7 6 5 4 3 2 1 0│ Encoded Packet Type ID: |7 6 5 4 3 2 1 0|
└───────────────┘ +---------------+
OpenPGP format: OpenPGP format:
Bit 7 -- always one Bit 7 -- always one
Bit 6 -- always one Bit 6 -- always one
Bits 5 to 0 -- packet type ID Bits 5 to 0 -- Packet Type ID
Legacy format: Legacy format:
Bit 7 -- always one Bit 7 -- always one
Bit 6 -- always zero Bit 6 -- always zero
Bits 5 to 2 -- packet type ID Bits 5 to 2 -- Packet Type ID
Bits 1 to 0 -- length-type Bits 1 to 0 -- length-type
Bit 6 of the first octet of the packet header indicates whether the Bit 6 of the first octet of the packet header indicates whether the
packet is encoded in the OpenPGP or Legacy packet format. The Legacy packet is encoded in the OpenPGP or Legacy packet format. The Legacy
packet format MAY be used when consuming packets to facilitate packet format MAY be used when consuming packets to facilitate
interoperability and accessing archived data. The Legacy packet interoperability and accessing archived data. The Legacy packet
format SHOULD NOT be used to generate new data, unless the recipient format SHOULD NOT be used to generate new data, unless the recipient
is known to only support the Legacy packet format. This latter case is known to only support the Legacy packet format. This latter case
is extremely unlikely, as the Legacy packet format was obsoleted by is extremely unlikely, as the Legacy packet format was obsoleted by
[RFC2440] in 1998. [RFC2440] in 1998.
An implementation that consumes and re-distributes pre-existing An implementation that consumes and redistributes pre-existing
OpenPGP data (such as Transferable Public Keys) may encounter packets OpenPGP data (such as Transferable Public Keys) may encounter packets
framed with the Legacy packet format. Such an implementation MAY framed with the Legacy packet format. Such an implementation MAY
either re-distribute these packets in their Legacy format, or either redistribute these packets in their Legacy format or transform
transform them to the current OpenPGP packet format before re- them to the current OpenPGP packet format before redistribution.
distribution.
Note that Legacy format headers only have 4 bits for the packet type Note that Legacy format headers only have 4 bits for the Packet Type
ID, and hence can only encode packet type IDs less than 16, whereas ID and hence can only encode Packet Type IDs less than 16, whereas
the OpenPGP format headers can encode IDs as great as 63. the OpenPGP format headers can encode IDs as great as 63.
4.2.1. OpenPGP Format Packet Lengths 4.2.1. OpenPGP Format Packet Lengths
OpenPGP format packets have four possible ways of encoding length: OpenPGP format packets have four possible ways of encoding length:
1. A one-octet Body Length header encodes packet lengths of up to 1. A 1-octet Body Length header encodes packet lengths of up to 191
191 octets. octets.
2. A two-octet Body Length header encodes packet lengths of 192 to 2. A 2-octet Body Length header encodes packet lengths of 192 to
8383 octets. 8383 octets.
3. A five-octet Body Length header encodes packet lengths of up to 3. A 5-octet Body Length header encodes packet lengths of up to
4,294,967,295 (0xFFFFFFFF) octets in length. (This actually 4,294,967,295 (0xFFFFFFFF) octets in length. (This actually
encodes a four-octet scalar number.) encodes a 4-octet scalar number.)
4. When the length of the packet body is not known in advance by the 4. When the length of the packet body is not known in advance by the
issuer, Partial Body Length headers encode a packet of issuer, Partial Body Length headers encode a packet of
indeterminate length, effectively making it a stream. indeterminate length, effectively making it a stream.
4.2.1.1. One-Octet Lengths 4.2.1.1. 1-Octet Lengths
A one-octet Body Length header encodes a length of 0 to 191 octets. A 1-octet Body Length header encodes a length of 0 to 191 octets.
This type of length header is recognized because the one octet value This type of length header is recognized because the 1-octet value is
is less than 192. The body length is equal to: less than 192. The body length is equal to:
bodyLen = 1st_octet; bodyLen = 1st_octet;
4.2.1.2. Two-Octet Lengths 4.2.1.2. 2-Octet Lengths
A two-octet Body Length header encodes a length of 192 to 8383 A 2-octet Body Length header encodes a length of 192 to 8383 octets.
octets. It is recognized because its first octet is in the range 192 It is recognized because its first octet is in the range 192 to 223.
to 223. The body length is equal to: The body length is equal to:
bodyLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192 bodyLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192
4.2.1.3. Five-Octet Lengths 4.2.1.3. 5-Octet Lengths
A five-octet Body Length header consists of a single octet holding A 5-octet Body Length header consists of a single octet holding the
the value 255, followed by a four-octet scalar. The body length is value 255, followed by a 4-octet scalar. The body length is equal
equal to: to:
bodyLen = (2nd_octet << 24) | (3rd_octet << 16) | bodyLen = (2nd_octet << 24) | (3rd_octet << 16) |
(4th_octet << 8) | 5th_octet (4th_octet << 8) | 5th_octet
This basic set of one, two, and five-octet lengths is also used This basic set of 1-octet, 2-octet, and 5-octet lengths is also used
internally to some packets. internally to some packets.
4.2.1.4. Partial Body Lengths 4.2.1.4. Partial Body Lengths
A Partial Body Length header is one octet long and encodes the length A Partial Body Length header is 1 octet long and encodes the length
of only part of the data packet. This length is a power of 2, from 1 of only part of the data packet. This length is a power of 2, from 1
to 1,073,741,824 (2 to the 30th power). It is recognized by its one to 1,073,741,824 (2 to the 30th power). It is recognized by its
octet value that is greater than or equal to 224, and less than 255. 1-octet value that is greater than or equal to 224, and less than
The Partial Body Length is equal to: 255. The Partial Body Length is equal to:
partialBodyLen = 1 << (1st_octet & 0x1F); partialBodyLen = 1 << (1st_octet & 0x1F);
Each Partial Body Length header is followed by a portion of the Each Partial Body Length header is followed by a portion of the
packet body data. The Partial Body Length header specifies this packet body data; the Partial Body Length header specifies this
portion's length. Another length header (one octet, two-octet, five- portion's length. Another length header (1-octet, 2-octet, 5-octet,
octet, or partial) follows that portion. The last length header in or partial) follows that portion. The last length header in the
the packet MUST NOT be a Partial Body Length header. Partial Body packet MUST NOT be a Partial Body Length header. Partial Body Length
Length headers may only be used for the non-final parts of the headers may only be used for the non-final parts of the packet.
packet.
Note also that the last Body Length header can be a zero-length Note also that the last Body Length header can be a zero-length
header. header.
An implementation MAY use Partial Body Lengths for data packets, be An implementation MAY use Partial Body Lengths for data packets,
they literal, compressed, or encrypted. The first partial length whether they are literal, compressed, or encrypted. The first
MUST be at least 512 octets long. Partial Body Lengths MUST NOT be partial length MUST be at least 512 octets long. Partial Body
used for any other packet types. Lengths MUST NOT be used for any other packet types.
4.2.2. Legacy Format Packet Lengths 4.2.2. Legacy Format Packet Lengths
A zero in bit 6 of the first octet of the packet indicates a Legacy A zero in bit 6 of the first octet of the packet indicates a Legacy
packet format. Bits 1 and 0 of the first octet of a Legacy packet packet format. Bits 1 and 0 of the first octet of a Legacy packet
are the "length-type" field. The meaning of the length-type in are the "length-type" field. The meaning of length-type in Legacy
Legacy format packets is: format packets is as follows:
0 The packet has a one-octet length. The header is 2 octets long. 0 The packet has a 1-octet length. The header is 2 octets long.
1 The packet has a two-octet length. The header is 3 octets long. 1 The packet has a 2-octet length. The header is 3 octets long.
2 The packet has a four-octet length. The header is 5 octets long. 2 The packet has a 4-octet length. The header is 5 octets long.
3 The packet is of indeterminate length. The header is 1 octet 3 The packet is of indeterminate length. The header is 1 octet
long, and the implementation must determine how long the packet long, and the implementation must determine how long the packet
is. If the packet is in a file, this means that the packet is. If the packet is in a file, it means that the packet extends
extends until the end of the file. The OpenPGP format headers until the end of the file. The OpenPGP format headers have a
have a mechanism for precisely encoding data of indeterminate mechanism for precisely encoding data of indeterminate length. An
length. An implementation MUST NOT generate a Legacy format implementation MUST NOT generate a Legacy format packet with
packet with indeterminate length. An implementation MAY interpret indeterminate length. An implementation MAY interpret an
an indeterminate length Legacy format packet in order to deal with indeterminate length Legacy format packet in order to deal with
historic data, or data generated by a legacy system that predates historic data or data generated by a legacy system that predates
support for [RFC2440]. support for [RFC2440].
4.2.3. Packet Length Examples 4.2.3. Packet Length Examples
These examples show ways that OpenPGP format packets might encode the These examples show ways that OpenPGP format packets might encode the
packet body lengths. packet body lengths.
A packet body with length 100 may have its length encoded in one * A packet body with length 100 may have its length encoded in one
octet: 0x64. This is followed by 100 octets of data. octet: 0x64. This is followed by 100 octets of data.
A packet body with length 1723 may have its length encoded in two * A packet body with length 1723 may have its length encoded in two
octets: 0xC5, 0xFB. This header is followed by the 1723 octets of octets: 0xC5, 0xFB. This header is followed by the 1723 octets of
data. data.
A packet body with length 100000 may have its length encoded in five * A packet body with length 100000 may have its length encoded in
octets: 0xFF, 0x00, 0x01, 0x86, 0xA0. five octets: 0xFF, 0x00, 0x01, 0x86, 0xA0.
It might also be encoded in the following octet stream: 0xEF, first It might also be encoded in the following octet stream:
32768 octets of data; 0xE1, next two octets of data; 0xE0, next one
octet of data; 0xF0, next 65536 octets of data; 0xC5, 0xDD, last 1693 * 0xEF, first 32768 octets of data;
octets of data. This is just one possible encoding, and many
variations are possible on the size of the Partial Body Length * 0xE1, next 2 octets of data;
headers, as long as a regular Body Length header encodes the last
portion of the data. * 0xE0, next 1 octet of data;
* 0xF0, next 65536 octets of data; and
* 0xC5, 0xDD, last 1693 octets of data.
This is just one possible encoding, and many variations are possible
on the size of the Partial Body Length headers, as long as a regular
Body Length header encodes the last portion of the data.
Please note that in all of these explanations, the total length of Please note that in all of these explanations, the total length of
the packet is the length of the header(s) plus the length of the the packet is the length of the header(s) plus the length of the
body. body.
4.3. Packet Criticality 4.3. Packet Criticality
The Packet Type ID space is partitioned into critical packets and The Packet Type ID space is partitioned into critical packets and
non-critical packets. If an implementation encounters a critical non-critical packets. If an implementation encounters a critical
packet where the packet type is unknown in a packet sequence, it MUST packet where the packet type is unknown in a packet sequence, it MUST
reject the whole packet sequence (see Section 10). On the other reject the whole packet sequence (see Section 10). On the other
hand, an unknown non-critical packet MUST be ignored. hand, an unknown non-critical packet MUST be ignored.
Packets with Type IDs from 0 to 39 are critical. Packets with Type Packets with Type IDs from 0 to 39 are critical. Packets with Type
IDs from 40 to 63 are non-critical. IDs from 40 to 63 are non-critical.
5. Packet Types 5. Packet Types
The defined packet types are as follows: The defined packet types are as follows:
+====+==========+=========================+===========+===========+ +=======+==========+=====================+===========+===========+
| ID | Critical | Packet Type Description | Reference | Shorthand | | ID | Critical | Packet Type | Shorthand | Reference |
+====+==========+=========================+===========+===========+ | | | Description | | |
| 0 | yes | Reserved - a packet | | | +=======+==========+=====================+===========+===========+
| | | MUST NOT have this | | | | 0 | Yes | Reserved - this | | |
| | | packet type ID | | | | | | Packet Type ID MUST | | |
+----+----------+-------------------------+-----------+-----------+ | | | NOT be used | | |
| 1 | yes | Public-Key Encrypted | Section | PKESK | +-------+----------+---------------------+-----------+-----------+
| | | Session Key Packet | 5.1 | | | 1 | Yes | Public Key | PKESK | Section |
+----+----------+-------------------------+-----------+-----------+ | | | Encrypted Session | | 5.1 |
| 2 | yes | Signature Packet | Section | SIG | | | | Key Packet | | |
| | | | 5.2 | | +-------+----------+---------------------+-----------+-----------+
+----+----------+-------------------------+-----------+-----------+ | 2 | Yes | Signature Packet | SIG | Section |
| 3 | yes | Symmetric-Key Encrypted | Section | SKESK | | | | | | 5.2 |
| | | Session Key Packet | 5.3 | | +-------+----------+---------------------+-----------+-----------+
+----+----------+-------------------------+-----------+-----------+ | 3 | Yes | Symmetric Key | SKESK | Section |
| 4 | yes | One-Pass Signature | Section | OPS | | | | Encrypted Session | | 5.3 |
| | | Packet | 5.4 | | | | | Key Packet | | |
+----+----------+-------------------------+-----------+-----------+ +-------+----------+---------------------+-----------+-----------+
| 5 | yes | Secret-Key Packet | Section | SECKEY | | 4 | Yes | One-Pass Signature | OPS | Section |
| | | | 5.5.1.3 | | | | | Packet | | 5.4 |
+----+----------+-------------------------+-----------+-----------+ +-------+----------+---------------------+-----------+-----------+
| 6 | yes | Public-Key Packet | Section | PUBKEY | | 5 | Yes | Secret Key Packet | SECKEY | Section |
| | | | 5.5.1.1 | | | | | | | 5.5.1.3 |
+----+----------+-------------------------+-----------+-----------+ +-------+----------+---------------------+-----------+-----------+
| 7 | yes | Secret-Subkey Packet | Section | SECSUBKEY | | 6 | Yes | Public Key Packet | PUBKEY | Section |
| | | | 5.5.1.4 | | | | | | | 5.5.1.1 |
+----+----------+-------------------------+-----------+-----------+ +-------+----------+---------------------+-----------+-----------+
| 8 | yes | Compressed Data Packet | Section | COMP | | 7 | Yes | Secret Subkey | SECSUBKEY | Section |
| | | | 5.6 | | | | | Packet | | 5.5.1.4 |
+----+----------+-------------------------+-----------+-----------+ +-------+----------+---------------------+-----------+-----------+
| 9 | yes | Symmetrically Encrypted | Section | SED | | 8 | Yes | Compressed Data | COMP | Section |
| | | Data Packet | 5.7 | | | | | Packet | | 5.6 |
+----+----------+-------------------------+-----------+-----------+ +-------+----------+---------------------+-----------+-----------+
| 10 | yes | Marker Packet | Section | MARKER | | 9 | Yes | Symmetrically | SED | Section |
| | | | 5.8 | | | | | Encrypted Data | | 5.7 |
+----+----------+-------------------------+-----------+-----------+ | | | Packet | | |
| 11 | yes | Literal Data Packet | Section | LIT | +-------+----------+---------------------+-----------+-----------+
| | | | 5.9 | | | 10 | Yes | Marker Packet | MARKER | Section |
+----+----------+-------------------------+-----------+-----------+ | | | | | 5.8 |
| 12 | yes | Trust Packet | Section | TRUST | +-------+----------+---------------------+-----------+-----------+
| | | | 5.10 | | | 11 | Yes | Literal Data Packet | LIT | Section |
+----+----------+-------------------------+-----------+-----------+ | | | | | 5.9 |
| 13 | yes | User ID Packet | Section | UID | +-------+----------+---------------------+-----------+-----------+
| | | | 5.11 | | | 12 | Yes | Trust Packet | TRUST | Section |
+----+----------+-------------------------+-----------+-----------+ | | | | | 5.10 |
| 14 | yes | Public-Subkey Packet | Section | PUBSUBKEY | +-------+----------+---------------------+-----------+-----------+
| | | | 5.5.1.2 | | | 13 | Yes | User ID Packet | UID | Section |
+----+----------+-------------------------+-----------+-----------+ | | | | | 5.11 |
| 17 | yes | User Attribute Packet | Section | UAT | +-------+----------+---------------------+-----------+-----------+
| | | | 5.12 | | | 14 | Yes | Public Subkey | PUBSUBKEY | Section |
+----+----------+-------------------------+-----------+-----------+ | | | Packet | | 5.5.1.2 |
| 18 | yes | Symmetrically Encrypted | Section | SEIPD | +-------+----------+---------------------+-----------+-----------+
| | | and Integrity Protected | 5.13 | | | 17 | Yes | User Attribute | UAT | Section |
| | | Data Packet | | | | | | Packet | | 5.12 |
+----+----------+-------------------------+-----------+-----------+ +-------+----------+---------------------+-----------+-----------+
| 19 | yes | Reserved (formerly | (see | | | 18 | Yes | Symmetrically | SEIPD | Section |
| | | Modification Detection | Section | | | | | Encrypted and | | 5.13 |
| | | Code Packet) | 5.13.1) | | | | | Integrity Protected | | |
+----+----------+-------------------------+-----------+-----------+ | | | Data Packet | | |
| 20 | yes | Reserved | | | +-------+----------+---------------------+-----------+-----------+
+----+----------+-------------------------+-----------+-----------+ | 19 | Yes | Reserved (formerly | | Section |
| 21 | yes | Padding Packet | Section | PADDING | | | | Modification | | 5.13.1 |
| | | | 5.14 | | | | | Detection Code | | |
+----+----------+-------------------------+-----------+-----------+ | | | Packet) | | |
| 22 | yes | Unassigned Critical | | | +-------+----------+---------------------+-----------+-----------+
| to | | Packet | | | | 20 | Yes | Reserved | | |
| 39 | | | | | +-------+----------+---------------------+-----------+-----------+
+----+----------+-------------------------+-----------+-----------+ | 21 | Yes | Padding Packet | PADDING | Section |
| 40 | no | Unassigned Non-Critical | | | | | | | | 5.14 |
| to | | Packet | | | +-------+----------+---------------------+-----------+-----------+
| 59 | | | | | | 22-39 | Yes | Unassigned Critical | | |
+----+----------+-------------------------+-----------+-----------+ | | | Packets | | |
| 60 | no | Private or Experimental | | | +-------+----------+---------------------+-----------+-----------+
| to | | Values | | | | 40-59 | No | Unassigned Non- | | |
| 63 | | | | | | | | Critical Packets | | |
+----+----------+-------------------------+-----------+-----------+ +-------+----------+---------------------+-----------+-----------+
| 60-63 | No | Private or | | |
| | | Experimental Use | | |
+-------+----------+---------------------+-----------+-----------+
Table 3: OpenPGP Packet Types registry Table 3: OpenPGP Packet Types Registry
The labels in the "Shorthand" column are used for compact reference The labels in the "Shorthand" column are used for compact reference
elsewhere in this draft, and may also be used by implementations that elsewhere in this document, and they may also be used by
provide debugging or inspection affordances for streams of OpenPGP implementations that provide debugging or inspection affordances for
packets. streams of OpenPGP packets.
5.1. Public-Key Encrypted Session Key Packet (Type ID 1) 5.1. Public Key Encrypted Session Key Packet (Type ID 1)
Zero or more Public-Key Encrypted Session Key (PKESK) packets and/or Zero or more PKESK packets and/or SKESK packets (Section 5.3) precede
Symmetric-Key Encrypted Session Key packets (Section 5.3) precede an an encryption container (that is, a Symmetrically Encrypted and
encryption container (that is, a Symmetrically Encrypted Integrity Integrity Protected Data (SEIPD) packet or -- for historic data -- a
Protected Data packet or --- for historic data --- a Symmetrically Symmetrically Encrypted Data (SED) packet), which holds an Encrypted
Encrypted Data packet), which holds an encrypted message. The Message. The message is encrypted with the session key, and the
message is encrypted with the session key, and the session key is session key is itself encrypted and stored in the Encrypted Session
itself encrypted and stored in the Encrypted Session Key packet(s). Key packet(s). The encryption container is preceded by one Public
The encryption container is preceded by one Public-Key Encrypted Key Encrypted Session Key packet for each OpenPGP Key to which the
Session Key packet for each OpenPGP key to which the message is message is encrypted. The recipient of the message finds a session
encrypted. The recipient of the message finds a session key that is key that is encrypted to their public key, decrypts the session key,
encrypted to their public key, decrypts the session key, and then and then uses the session key to decrypt the message.
uses the session key to decrypt the message.
The body of this packet starts with a one-octet number giving the The body of this packet starts with a 1-octet number giving the
version number of the packet type. The currently defined versions version number of the packet type. The currently defined versions
are 3 and 6. The remainder of the packet depends on the version. are 3 and 6. The remainder of the packet depends on the version.
The versions differ in how they identify the recipient key, and in The versions differ in how they identify the recipient key and in
what they encode. The version of the PKESK packet must align with what they encode. The version of the PKESK packet must align with
the version of the SEIPD packet (see Section 10.3.2.1). Any new the version of the SEIPD packet (see Section 10.3.2.1). Any new
version of the PKESK packet should be registered in the registry version of the PKESK packet should be registered in the registry
established in Section 10.3.2.1. established in Section 10.3.2.1.
5.1.1. Version 3 Public-Key Encrypted Session Key Packet Format 5.1.1. Version 3 Public Key Encrypted Session Key Packet Format
A version 3 Public-Key Encrypted Session Key (PKESK) packet precedes A version 3 PKESK packet precedes a v1 SEIPD packet (see
a version 1 Symmetrically Encrypted Integrity Protected Data (v1 Section 5.13.1). In historic data, it is sometimes found preceding a
SEIPD, see Section 5.13.1) packet. In historic data, it is sometimes deprecated SED packet; see Section 5.7. A v3 PKESK packet MUST NOT
found preceding a deprecated Symmetrically Encrypted Data packet precede a v2 SEIPD packet (see Section 10.3.2.1).
(SED, see Section 5.7). A v3 PKESK packet MUST NOT precede a v2
SEIPD packet (see Section 10.3.2.1).
The v3 PKESK packet consists of: The v3 PKESK packet consists of:
* A one-octet version number with value 3. * A 1-octet version number with value 3.
* An eight-octet number that gives the Key ID of the public key to * An 8-octet number that gives the Key ID of the public key to which
which the session key is encrypted. If the session key is the session key is encrypted. If the session key is encrypted to
encrypted to a subkey, then the Key ID of this subkey is used here a subkey, then the Key ID of this subkey is used here instead of
instead of the Key ID of the primary key. The Key ID may also be the Key ID of the primary key. The Key ID may also be all zeros,
all zeros, for an "anonymous recipient" (see Section 5.1.8). for an "anonymous recipient" (see Section 5.1.8).
* A one-octet number giving the public-key algorithm used. * A 1-octet number giving the public key algorithm used.
* A series of values comprising the encrypted session key. This is * A series of values comprising the encrypted session key. This is
algorithm-specific and described below. algorithm specific and described below.
The public-key encryption algorithm (described in subsequent The public key encryption algorithm (described in subsequent
sections) is passed two values: sections) is passed two values:
* The session key. * The session key.
* The one-octet algorithm identifier that specifies the symmetric * The 1-octet algorithm identifier that specifies the symmetric key
encryption algorithm used to encrypt the following v1 SEIPD encryption algorithm used to encrypt the v1 SEIPD packet described
packet. in the following section.
5.1.2. Version 6 Public-Key Encrypted Session Key Packet Format 5.1.2. Version 6 Public Key Encrypted Session Key Packet Format
A version 6 Public-Key Encrypted Session Key (PKESK) packet precedes A v6 PKESK packet precedes a v2 SEIPD packet (see Section 5.13.2). A
a version 2 Symmetrically Encrypted Integrity Protected Data (v2 v6 PKESK packet MUST NOT precede a v1 SEIPD packet or a deprecated
SEIPD, see Section 5.13.2) packet. A v6 PKESK packet MUST NOT SED packet (see Section 10.3.2.1).
precede a v1 SEIPD packet or a deprecated Symmetrically Encrypted
Data packet (see Section 10.3.2.1).
The v6 PKESK packet consists of the following fields: The v6 PKESK packet consists of the following fields:
* A one-octet version number with value 6. * A 1-octet version number with value 6.
* A one-octet size of the following two fields. This size may be * A 1-octet size of the following two fields. This size may be
zero, if the key version number field and the fingerprint field zero, if the key version number field and the fingerprint field
are omitted for an "anonymous recipient" (see Section 5.1.8). are omitted for an "anonymous recipient" (see Section 5.1.8).
* A one octet key version number. * A 1-octet key version number.
* The fingerprint of the public key or subkey to which the session * The fingerprint of the public key or subkey to which the session
key is encrypted. Note that the length N of the fingerprint for a key is encrypted. Note that the length N of the fingerprint for a
version 4 key is 20 octets; for a version 6 key N is 32. version 4 key is 20 octets; for a version 6 key, N is 32.
* A one-octet number giving the public-key algorithm used. * A 1-octet number giving the public key algorithm used.
* A series of values comprising the encrypted session key. This is * A series of values comprising the encrypted session key. This is
algorithm-specific and described below. algorithm specific and described below.
The session key is encrypted according to the public-key algorithm The session key is encrypted according to the public key algorithm
used, as described below. No symmetric encryption algorithm used, as described below. No symmetric key encryption algorithm
identifier is passed to the public-key algorithm for a v6 PKESK identifier is passed to the public key algorithm for a v6 PKESK
packet, as it is included in the v2 SEIPD packet. packet, as it is included in the v2 SEIPD packet.
5.1.3. Algorithm-Specific Fields for RSA encryption 5.1.3. Algorithm-Specific Fields for RSA Encryption
* Multiprecision integer (MPI) of RSA-encrypted value m**e mod n. * MPI of RSA-encrypted value m^e mod n.
To produce the value "m" in the above formula, first concatenate the To produce the value "m" in the above formula, first concatenate the
following values: following values:
* The one-octet algorithm identifier, if it was passed (in the case * The 1-octet algorithm identifier, if it was passed (in the case of
of a v3 PKESK packet). a v3 PKESK packet).
* The session key. * The session key.
* A two-octet checksum of the session key, equal to the sum of the * A 2-octet checksum of the session key, equal to the sum of the
session key octets, modulo 65536. session key octets, modulo 65536.
Then, the above values are encoded using the PKCS#1 block encoding Then, the above values are encoded using the PKCS#1 block encoding
EME-PKCS1-v1_5 described in step 2 of Section 7.2.1 of [RFC8017] (see EME-PKCS1-v1_5, as described in Step 2 in Section 7.2.1 of [RFC8017]
also Section 12.1.1). When decoding "m" during decryption, an (see also Section 12.1.1). When decoding "m" during decryption, an
implementation should follow step 3 of Section 7.2.2 of [RFC8017] implementation should follow Step 3 in Section 7.2.2 of [RFC8017]
(see also Section 12.1.2). (see also Section 12.1.2).
Note that when an implementation forms several PKESKs with one Note that when an implementation forms several PKESK packets with one
session key, forming a message that can be decrypted by several keys, session key, forming a message that can be decrypted by several keys,
the implementation MUST make a new PKCS#1 encoding for each key. the implementation MUST make a new PKCS#1 encoding for each key.
This defends against attacks such as those discussed in [HASTAD]. This defends against attacks such as those discussed in [HASTAD].
5.1.4. Algorithm-Specific Fields for Elgamal encryption 5.1.4. Algorithm-Specific Fields for Elgamal Encryption
* MPI of Elgamal (Diffie-Hellman) value g**k mod p. * MPI of Elgamal (Diffie-Hellman) value g^k mod p.
* MPI of Elgamal (Diffie-Hellman) value m * y**k mod p. * MPI of Elgamal (Diffie-Hellman) value m * y^k mod p.
To produce the value "m" in the above formula, first concatenate the To produce the value "m" in the above formula, first concatenate the
following values: following values:
* The one-octet algorithm identifier, if it was passed (in the case * The 1-octet algorithm identifier, if it was passed (in the case of
of a v3 PKESK packet). a v3 PKESK packet).
* The session key. * The session key.
* A two-octet checksum of the session key, equal to the sum of the * A 2-octet checksum of the session key, equal to the sum of the
session key octets, modulo 65536. session key octets, modulo 65536.
Then, the above values are encoded using the PKCS#1 block encoding Then, the above values are encoded using the PKCS#1 block encoding
EME-PKCS1-v1_5 described in step 2 of Section 7.2.1 of [RFC8017] (see EME-PKCS1-v1_5, as described in Step 2 in Section 7.2.1 of [RFC8017]
also Section 12.1.1). When decoding "m" during decryption, an (see also Section 12.1.1). When decoding "m" during decryption, an
implementation should follow step 3 of Section 7.2.2 of [RFC8017] implementation should follow Step 3 in Section 7.2.2 of [RFC8017]
(see also Section 12.1.2). (see also Section 12.1.2).
Note that when an implementation forms several PKESKs with one Note that when an implementation forms several PKESK packets with one
session key, forming a message that can be decrypted by several keys, session key, forming a message that can be decrypted by several keys,
the implementation MUST make a new PKCS#1 encoding for each key. the implementation MUST make a new PKCS#1 encoding for each key.
This defends against attacks such as those discussed in [HASTAD]. This defends against attacks such as those discussed in [HASTAD].
An implementation MUST NOT generate ElGamal v6 PKESKs. An implementation MUST NOT generate ElGamal v6 PKESK packets.
5.1.5. Algorithm-Specific Fields for ECDH encryption 5.1.5. Algorithm-Specific Fields for ECDH Encryption
* MPI of an EC point representing an ephemeral public key, in the * MPI of an EC point representing an ephemeral public key in the
point format associated with the curve as specified in point format associated with the curve as specified in
Section 9.2. Section 9.2.
* A one-octet size, followed by a symmetric key encoded using the * A 1-octet size, followed by a symmetric key encoded using the
method described in Section 11.5. method described in Section 11.5.
5.1.6. Algorithm-Specific Fields for X25519 encryption 5.1.6. Algorithm-Specific Fields for X25519 Encryption
* 32 octets representing an ephemeral X25519 public key. * 32 octets representing an ephemeral X25519 public key.
* A one-octet size of the following fields. * A 1-octet size of the following fields.
* The one-octet algorithm identifier, if it was passed (in the case * The 1-octet algorithm identifier, if it was passed (in the case of
of a v3 PKESK packet). a v3 PKESK packet).
* The encrypted session key. * The encrypted session key.
See Section 6.1 of [RFC7748] for more details on the computation of See Section 6.1 of [RFC7748] for more details on the computation of
the ephemeral public key and the shared secret. HKDF ([RFC5869]) is the ephemeral public key and the shared secret. The HMAC-based Key
then used with SHA256 [RFC6234] and an info parameter of "OpenPGP Derivation Function (HKDF) [RFC5869] is then used with SHA256
X25519" and no salt. The input of HKDF is the concatenation of the [RFC6234] and an info parameter of "OpenPGP X25519" and no salt. The
following three values: input of HKDF is the concatenation of the following three values:
* 32 octets of the ephemeral X25519 public key from this packet. * 32 octets of the ephemeral X25519 public key from this packet.
* 32 octets of the recipient public key material. * 32 octets of the recipient public key material.
* 32 octets of the shared secret. * 32 octets of the shared secret.
The key produced from HKDF is used to encrypt the session key with The key produced from HKDF is used to encrypt the session key with
AES-128 key wrap, as defined in [RFC3394]. AES-128 key wrap, as defined in [RFC3394].
Note that unlike ECDH, no checksum or padding are appended to the Note that unlike Elliptic Curve Diffie-Hellman (ECDH), no checksum or
session key before key wrapping. Finally, note that unlike the other padding are appended to the session key before key wrapping.
public-key algorithms, in the case of a v3 PKESK packet, the Finally, note that unlike the other public key algorithms, in the
symmetric algorithm ID is not encrypted. Instead, it is prepended to case of a v3 PKESK packet, the symmetric algorithm ID is not
the encrypted session key in plaintext. In this case, the symmetric encrypted. Instead, it is prepended to the encrypted session key in
algorithm used MUST be AES-128, AES-192 or AES-256 (algorithm ID 7, 8 plaintext. In this case, the symmetric algorithm used MUST be AES-
or 9). 128, AES-192, or AES-256 (algorithm IDs 7, 8, or 9, respectively).
5.1.7. Algorithm-Specific Fields for X448 encryption 5.1.7. Algorithm-Specific Fields for X448 Encryption
* 56 octets representing an ephemeral X448 public key. * 56 octets representing an ephemeral X448 public key.
* A one-octet size of the following fields. * A 1-octet size of the following fields.
* The one-octet algorithm identifier, if it was passed (in the case * The 1-octet algorithm identifier, if it was passed (in the case of
of a v3 PKESK packet). a v3 PKESK packet).
* The encrypted session key. * The encrypted session key.
See Section 6.2 of [RFC7748] for more details on the computation of See Section 6.2 of [RFC7748] for more details on the computation of
the ephemeral public key and the shared secret. HKDF ([RFC5869]) is the ephemeral public key and the shared secret. HKDF [RFC5869] is
then used with SHA512 ([RFC6234]) and an info parameter of "OpenPGP then used with SHA512 [RFC6234] and an info parameter of "OpenPGP
X448" and no salt. The input of HKDF is the concatenation of the X448" and no salt. The input of HKDF is the concatenation of the
following three values: following three values:
* 56 octets of the ephemeral X448 public key from this packet. * 56 octets of the ephemeral X448 public key from this packet.
* 56 octets of the recipient public key material. * 56 octets of the recipient public key material.
* 56 octets of the shared secret. * 56 octets of the shared secret.
The key produced from HKDF is used to encrypt the session key with The key produced from HKDF is used to encrypt the session key with
AES-256 key wrap, as defined in [RFC3394]. AES-256 key wrap, as defined in [RFC3394].
Note that unlike ECDH, no checksum or padding are appended to the Note that unlike ECDH, no checksum or padding are appended to the
session key before key wrapping. Finally, note that unlike the other session key before key wrapping. Finally, note that unlike the other
public-key algorithms, in the case of a v3 PKESK packet, the public key algorithms, in the case of a v3 PKESK packet, the
symmetric algorithm ID is not encrypted. Instead, it is prepended to symmetric algorithm ID is not encrypted. Instead, it is prepended to
the encrypted session key in plaintext. In this case, the symmetric the encrypted session key in plaintext. In this case, the symmetric
algorithm used MUST be AES-128, AES-192 or AES-256 (algorithm ID 7, 8 algorithm used MUST be AES-128, AES-192, or AES-256 (algorithm ID 7,
or 9). 8, or 9).
5.1.8. Notes on PKESK 5.1.8. Notes on PKESK
An implementation MAY accept or use a Key ID of all zeros, or an An implementation MAY accept or use a Key ID of all zeros, or an
omitted key fingerprint, to hide the intended decryption key. In omitted key fingerprint, to hide the intended decryption key. In
this case, the receiving implementation would try all available this case, the receiving implementation would try all available
private keys, checking for a valid decrypted session key. This private keys, checking for a valid decrypted session key. This
format helps reduce traffic analysis of messages. format helps reduce traffic analysis of messages.
5.2. Signature Packet (Type ID 2) 5.2. Signature Packet (Type ID 2)
A Signature packet describes a binding between some public key and A Signature packet describes a binding between some public key and
some data. The most common signatures are a signature of a file or a some data. The most common signatures are a signature of a file or a
block of text, and a signature that is a certification of a User ID. block of text and a signature that is a certification of a User ID.
Three versions of Signature packets are defined. Version 3 provides Three versions of Signature packets are defined. Version 3 provides
basic signature information, while versions 4 and 6 provide an basic signature information, while versions 4 and 6 provide an
expandable format with subpackets that can specify more information expandable format with subpackets that can specify more information
about the signature. about the signature.
For historical reasons, versions 1, 2, and 5 of the Signature packet For historical reasons, versions 1, 2, and 5 of the Signature packet
are unspecified. Any new Signature packet version should be are unspecified. Any new Signature packet version should be
registered in the registry established in Section 10.3.2.2. registered in the registry established in Section 10.3.2.2.
An implementation MUST generate a version 6 signature when signing An implementation MUST generate a version 6 signature when signing
with a version 6 key. An implementation MUST generate a version 4 with a version 6 key. An implementation MUST generate a version 4
signature when signing with a version 4 key. Implementations MUST signature when signing with a version 4 key. Implementations MUST
NOT create version 3 signatures; they MAY accept version 3 NOT create version 3 signatures; they MAY accept version 3
signatures. See Section 10.3.2.2 for more details about packet signatures. See Section 10.3.2.2 for more details about packet
version correspondence between keys and signatures. version correspondence between keys and signatures.
5.2.1. Signature Types 5.2.1. Signature Types
There are a number of possible meanings for a signature, which are There are a number of possible meanings for a signature, which are
indicated by the signature type ID in any given signature. Please indicated by the Signature Type ID in any given signature. Please
note that the vagueness of these meanings is not a flaw, but a note that the vagueness of these meanings is not a flaw but rather a
feature of the system. Because OpenPGP places final authority for feature of the system. Because OpenPGP places final authority for
validity upon the receiver of a signature, it may be that one validity upon the receiver of a signature, it may be that one
signer's casual act might be more rigorous than some other signer's casual act might be more rigorous than some other
authority's positive act. See Section 5.2.4 for detailed information authority's positive act. See Section 5.2.4 for detailed information
on how to compute and verify signatures of each type. on how to compute and verify signatures of each type.
+======+===============================+==================+ +======+====================================+==================+
| ID | Name | Reference | | ID | Name | Reference |
+======+===============================+==================+ +======+====================================+==================+
| 0x00 | Binary Signature | Section 5.2.1.1 | | 0x00 | Binary Signature | Section 5.2.1.1 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
| 0x01 | Text Signature | Section 5.2.1.2 | | 0x01 | Text Signature | Section 5.2.1.2 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
| 0x02 | Standalone Signature | Section 5.2.1.3 | | 0x02 | Standalone Signature | Section 5.2.1.3 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
| 0x10 | Generic Certification | Section 5.2.1.4 | | 0x10 | Generic Certification Signature | Section 5.2.1.4 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
| 0x11 | Persona Certification | Section 5.2.1.5 | | 0x11 | Persona Certification Signature | Section 5.2.1.5 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
| 0x12 | Casual Certification | Section 5.2.1.6 | | 0x12 | Casual Certification Signature | Section 5.2.1.6 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
| 0x13 | Positive Certification | Section 5.2.1.7 | | 0x13 | Positive Certification Signature | Section 5.2.1.7 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
| 0x18 | Subkey Binding Signature | Section 5.2.1.8 | | 0x18 | Subkey Binding Signature | Section 5.2.1.8 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
| 0x19 | Primary Key Binding Signature | Section 5.2.1.9 | | 0x19 | Primary Key Binding Signature | Section 5.2.1.9 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
| 0x1F | Direct Key Signature | Section 5.2.1.10 | | 0x1F | Direct Key Signature | Section 5.2.1.10 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
| 0x20 | Key Revocation | Section 5.2.1.11 | | 0x20 | Key Revocation Signature | Section 5.2.1.11 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
| 0x28 | Subkey Revocation | Section 5.2.1.12 | | 0x28 | Subkey Revocation Signature | Section 5.2.1.12 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
| 0x30 | Certification Revocation | Section 5.2.1.13 | | 0x30 | Certification Revocation Signature | Section 5.2.1.13 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
| 0x40 | Timestamp Signature | Section 5.2.1.14 | | 0x40 | Timestamp Signature | Section 5.2.1.14 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
| 0x50 | Third-Party Confirmation | Section 5.2.1.15 | | 0x50 | Third-Party Confirmation Signature | Section 5.2.1.15 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
| 0xFF | Reserved | Section 5.2.1.16 | | 0xFF | Reserved | Section 5.2.1.16 |
+------+-------------------------------+------------------+ +------+------------------------------------+------------------+
Table 4: OpenPGP Signature Types registry Table 4: OpenPGP Signature Types Registry
These meanings of each signature type are described in the The meanings of each signature type are described in the subsections
subsections below. below.
5.2.1.1. Signature of a binary document (type ID 0x00) 5.2.1.1. Binary Signature (Type ID 0x00) of a Document
This means the signer owns it, created it, or certifies that it has This means the signer owns it, created it, or certifies that it has
not been modified. not been modified.
5.2.1.2. Signature of a canonical text document (type ID 0x01) 5.2.1.2. Text Signature (Type ID 0x01) of a Canonical Document
This means the signer owns it, created it, or certifies that it has This means the signer owns it, created it, or certifies that it has
not been modified. The signature is calculated over the text data not been modified. The signature is calculated over the text data
with its line endings converted to <CR><LF>. with its line endings converted to <CR><LF>.
5.2.1.3. Standalone signature (type ID 0x02) 5.2.1.3. Standalone Signature (Type ID 0x02)
This signature is a signature of only its own subpacket contents. It This signature is a signature of only its own subpacket contents. It
is calculated identically to a signature over a zero-length binary is calculated identically to a signature over a zero-length binary
document. V3 standalone signatures MUST NOT be generated and MUST be document. Version 3 Standalone signatures MUST NOT be generated and
ignored. MUST be ignored.
5.2.1.4. Generic certification of a User ID and Public-Key packet (type 5.2.1.4. Generic Certification Signature (Type ID 0x10) of a User ID
ID 0x10) and Public Key Packet
The issuer of this certification does not make any particular The issuer of this certification does not make any particular
assertion as to how well the certifier has checked that the owner of assertion as to how well the certifier has checked that the owner of
the key is in fact the person described by the User ID. the key is in fact the person described by the User ID.
5.2.1.5. Persona certification of a User ID and Public-Key packet (type 5.2.1.5. Persona Certification Signature (Type ID 0x11) of a User ID
ID 0x11) and Public Key Packet
The issuer of this certification has not done any verification of the The issuer of this certification has not done any verification of the
claim that the owner of this key is the User ID specified. claim that the owner of this key is the User ID specified.
5.2.1.6. Casual certification of a User ID and Public-Key packet (type 5.2.1.6. Casual Certification Signature (Type ID 0x12) of a User ID and
ID 0x12) Public Key Packet
The issuer of this certification has done some casual verification of The issuer of this certification has done some casual verification of
the claim of identity. the claim of identity.
5.2.1.7. Positive certification of a User ID and Public-Key packet 5.2.1.7. Positive Certification Signature (Type ID 0x13) of a User ID
(type ID 0x13) and Public Key Packet
The issuer of this certification has done substantial verification of The issuer of this certification has done substantial verification of
the claim of identity. the claim of identity.
Most OpenPGP implementations make their "key signatures" as generic Most OpenPGP implementations make their "key signatures" as generic
(type ID 0x10) certifications. Some implementations can issue (Type ID 0x10) certifications. Some implementations can issue
0x11-0x13 certifications, but few differentiate between the types. 0x11-0x13 certifications, but few differentiate between the types.
5.2.1.8. Subkey Binding Signature (type ID 0x18) 5.2.1.8. Subkey Binding Signature (Type ID 0x18)
This signature is a statement by the top-level signing key that This signature is a statement by the top-level signing key,
indicates that it owns the subkey. This signature is calculated indicating that it owns the subkey. This signature is calculated
directly on the primary key and subkey, and not on any User ID or directly on the primary key and subkey, and not on any User ID or
other packets. A signature that binds a signing subkey MUST have an other packets. A signature that binds a signing subkey MUST have an
Embedded Signature subpacket in this binding signature that contains Embedded Signature subpacket in this binding signature that contains
a 0x19 signature made by the signing subkey on the primary key and a 0x19 signature made by the signing subkey on the primary key and
subkey. subkey.
5.2.1.9. Primary Key Binding Signature (type ID 0x19) 5.2.1.9. Primary Key Binding Signature (Type ID 0x19)
This signature is a statement by a signing subkey, indicating that it This signature is a statement by a signing subkey, indicating that it
is owned by the primary key. This signature is calculated the same is owned by the primary key. This signature is calculated the same
way as a subkey binding signature (0x18): directly on the primary key way as a Subkey Binding signature (Type ID 0x18): directly on the
and subkey, and not on any User ID or other packets. primary key and subkey, and not on any User ID or other packets.
5.2.1.10. Direct Key Signature (type ID 0x1F) 5.2.1.10. Direct Key Signature (Type ID 0x1F)
This signature is calculated directly on a key. It binds the This signature is calculated directly on a key. It binds the
information in the Signature subpackets to the key, and is information in the Signature subpackets to the key and is appropriate
appropriate to be used for subpackets that provide information about to be used for subpackets that provide information about the key,
the key, such as the Key Flags subpacket or (deprecated) Revocation such as the Key Flags subpacket or the (deprecated) Revocation Key
Key. It is also appropriate for statements that non-self certifiers subpacket. It is also appropriate for statements that non-self
want to make about the key itself, rather than the binding between a certifiers want to make about the key itself rather than the binding
key and a name. between a key and a name.
5.2.1.11. Key revocation signature (type ID 0x20) 5.2.1.11. Key Revocation Signature (Type ID 0x20)
The signature is calculated directly on the key being revoked. A This signature is calculated directly on the key being revoked. A
revoked key is not to be used. Only revocation signatures by the key revoked key is not to be used. Only Revocation Signatures by the key
being revoked, or by a (deprecated) Revocation Key, should be being revoked, or by a (deprecated) Revocation Key, should be
considered valid revocation signatures. considered valid Revocation Signatures.
5.2.1.12. Subkey revocation signature (type ID 0x28) 5.2.1.12. Subkey Revocation Signature (Type ID 0x28)
The signature is calculated directly on the primary key and the This signature is calculated directly on the primary key and the
subkey being revoked. A revoked subkey is not to be used. Only subkey being revoked. A revoked subkey is not to be used. Only
revocation signatures by the top-level signature key that is bound to Revocation Signatures by the top-level signature key that is bound to
this subkey, or by a (deprecated) Revocation Key, should be this subkey, or by a (deprecated) Revocation Key, should be
considered valid revocation signatures. considered valid Revocation Signatures.
5.2.1.13. Certification revocation signature (type ID 0x30) 5.2.1.13. Certification Revocation Signature (Type ID 0x30)
This signature revokes an earlier User ID certification signature This signature revokes an earlier User ID certification signature
(signature class 0x10 through 0x13) or direct key signature (0x1F). (Type IDs 0x10 through 0x13) or Direct Key signature (Type ID 0x1F).
It should be issued by the same key that issued the revoked signature It should be issued by the same key that issued the revoked signature
or by a (deprecated) Revocation Key. The signature is computed over or by a (deprecated) Revocation Key. The signature is computed over
the same data as the certification that it revokes, and should have a the same data as the certification that it revokes, and it should
later creation date than that certification. have a later creation date than that certification.
5.2.1.14. Timestamp signature (type ID 0x40) 5.2.1.14. Timestamp Signature (Type ID 0x40)
This signature is only meaningful for the timestamp contained in it. This signature is only meaningful for the timestamp contained in it.
5.2.1.15. Third-Party Confirmation signature (type ID 0x50) 5.2.1.15. Third-Party Confirmation Signature (Type ID 0x50)
This signature is a signature over some other OpenPGP Signature This signature is a signature over another OpenPGP Signature packet.
packet(s). It is analogous to a notary seal on the signed data. A It is analogous to a notary seal on the signed data. A Third-Party
third-party signature SHOULD include Signature Target subpacket(s) to Confirmation signature SHOULD include a Signature Target subpacket
give easy identification. Note that we really do mean SHOULD. There that identifies the confirmed signature.
are plausible uses for this (such as a blind party that only sees the
signature, not the key or source document) that cannot include a
target subpacket.
5.2.1.16. Reserved (type ID 0xFF) 5.2.1.16. Reserved (Type ID 0xFF)
An implementation MUST NOT create any signature with this type, and An implementation MUST NOT create any signature with this type and
MUST NOT validate any signature made with this type. See MUST NOT validate any signature made with this type. See
Section 5.2.4.1 for more details. Section 5.2.4.1 for more details.
5.2.2. Version 3 Signature Packet Format 5.2.2. Version 3 Signature Packet Format
The body of a version 3 Signature packet contains: The body of a version 3 Signature packet contains:
* One-octet version number (3). * A 1-octet version number with value 3.
* One-octet length of following hashed material. MUST be 5. * A 1-octet length of the following hashed material; it MUST be 5:
- One-octet signature type ID. - A 1-octet Signature Type ID.
- Four-octet creation time. - A 4-octet creation time.
* Eight-octet Key ID of signer. * An 8-octet Key ID of the signer.
* One-octet public-key algorithm. * A 1-octet public key algorithm.
* One-octet hash algorithm. * A 1-octet hash algorithm.
* Two-octet field holding left 16 bits of signed hash value. * A 2-octet field holding left 16 bits of the signed hash value.
* One or more multiprecision integers comprising the signature. * One or more MPIs comprising the signature. This portion is
This portion is algorithm-specific, as described below. algorithm specific, as described below.
The concatenation of the data to be signed, the signature type, and The concatenation of the data to be signed, the signature type, and
creation time from the Signature packet (5 additional octets) is the creation time from the Signature packet (5 additional octets) is
hashed. The resulting hash value is used in the signature algorithm. hashed. The resulting hash value is used in the signature algorithm.
The high 16 bits (first two octets) of the hash are included in the The high 16 bits (first two octets) of the hash are included in the
Signature packet to provide a way to reject some invalid signatures Signature packet to provide a way to reject some invalid signatures
without performing a signature verification. without performing a signature verification.
Algorithm-Specific Fields for RSA signatures: Algorithm-specific fields for RSA signatures:
* Multiprecision integer (MPI) of RSA signature value m**d mod n. * MPI of RSA signature value m^d mod n.
Algorithm-Specific Fields for DSA signatures: Algorithm-specific fields for DSA signatures:
* MPI of DSA value r. * MPI of DSA value r.
* MPI of DSA value s. * MPI of DSA value s.
The signature calculation is based on a hash of the signed data, as The signature calculation is based on a hash of the signed data, as
described above. The details of the calculation are different for described above. The details of the calculation are different for
DSA signatures than for RSA signatures, see Section 5.2.3.1 and DSA signatures than for RSA signatures; see Sections 5.2.3.1 and
Section 5.2.3.2. 5.2.3.2.
5.2.3. Version 4 and 6 Signature Packet Formats 5.2.3. Versions 4 and 6 Signature Packet Formats
The body of a v4 or v6 Signature packet contains: The body of a version 4 or version 6 Signature packet contains:
* One-octet version number. This is 4 for v4 signatures and 6 for * A 1-octet version number. This is 4 for version 4 signatures and
v6 signatures. 6 for version 6 signatures.
* One-octet signature type ID. * A 1-octet Signature Type ID.
* One-octet public-key algorithm. * A 1-octet public key algorithm.
* One-octet hash algorithm. * A 1-octet hash algorithm.
* A scalar octet count for the hashed subpacket data that follows * A scalar octet count for the hashed subpacket data that follows
this field. For a v4 signature, this is a two-octet field. For a this field. For a version 4 signature, this is a 2-octet field.
v6 signature, this is a four-octet field. Note that this is the For a version 6 signature, this is a 4-octet field. Note that
length in octets of all of the hashed subpackets; an this is the length in octets of all of the hashed subpackets; an
implementation's pointer incremented by this number will skip over implementation's pointer incremented by this number will skip over
the hashed subpackets. the hashed subpackets.
* Hashed subpacket data set (zero or more subpackets). * A hashed subpacket data set (zero or more subpackets).
* A scalar octet count for the unhashed subpacket data that follows * A scalar octet count for the unhashed subpacket data that follows
this field. For a v4 signature, this is a two-octet field. For a this field. For a version 4 signature, this is a 2-octet field.
v6 signature, this is a four-octet field. Note that this is the For a version 6 signature, this is a 4-octet field. Note that
length in octets of all of the unhashed subpackets; an this is the length in octets of all of the unhashed subpackets; an
implementation's pointer incremented by this number will skip over implementation's pointer incremented by this number will skip over
the unhashed subpackets. the unhashed subpackets.
* Unhashed subpacket data set (zero or more subpackets). * An unhashed subpacket data set (zero or more subpackets).
* Two-octet field holding the left 16 bits of the signed hash value. * A 2-octet field holding the left 16 bits of the signed hash value.
* Only for v6 signatures, a variable-length field containing: * Only for version 6 signatures, a variable-length field containing:
- A one-octet salt size. The value MUST match the value defined - A 1-octet salt size. The value MUST match the value defined
for the hash algorithm as specified in Table 23. for the hash algorithm as specified in Table 23.
- The salt; a random value of the specified size. - The salt, which is a random value of the specified size.
* One or more multiprecision integers comprising the signature. * One or more MPIs comprising the signature. This portion is
This portion is algorithm-specific: algorithm specific.
5.2.3.1. Algorithm-Specific Fields for RSA signatures 5.2.3.1. Algorithm-Specific Fields for RSA Signatures
* Multiprecision integer (MPI) of RSA signature value m**d mod n. * MPI of RSA signature value m^d mod n.
With RSA signatures, the hash value is encoded using PKCS#1 encoding With RSA signatures, the hash value is encoded using PKCS#1 encoding
type EMSA-PKCS1-v1_5 as described in Section 9.2 of [RFC8017] (see type EMSA-PKCS1-v1_5, as described in Section 9.2 of [RFC8017] (see
also Section 12.1.3). This requires inserting the hash value as an also Section 12.1.3). This requires inserting the hash value as an
octet string into an ASN.1 structure. The object identifier (OID) octet string into an ASN.1 structure. The object identifier (OID)
for the hash algorithm itself is also included in the structure, see for the hash algorithm itself is also included in the structure; see
the OIDs in Table 24. the OIDs in Table 24.
5.2.3.2. Algorithm-Specific Fields for DSA or ECDSA signatures 5.2.3.2. Algorithm-Specific Fields for DSA or ECDSA Signatures
* MPI of DSA or ECDSA value r. * MPI of DSA or ECDSA value r.
* MPI of DSA or ECDSA value s. * MPI of DSA or ECDSA value s.
A version 3 signature MUST NOT be created and MUST NOT be used with A version 3 signature MUST NOT be created and MUST NOT be used with
ECDSA. the Elliptic Curve Digital Signature Algorithm (ECDSA).
A DSA signature MUST use a hash algorithm with a digest size of at A DSA signature MUST use a hash algorithm with a digest size of at
least the number of bits of q, the group generated by the DSA key's least the number of bits of q, the group generated by the DSA key's
generator value. generator value.
If the output size of the chosen hash is larger than the number of If the output size of the chosen hash is larger than the number of
bits of q, the hash result is truncated to fit by taking the number bits of q, the hash result is truncated to fit by taking the number
of leftmost bits equal to the number of bits of q. This (possibly of leftmost bits equal to the number of bits of q. This (possibly
truncated) hash function result is treated as a number and used truncated) hash function result is treated as a number and used
directly in the DSA signature algorithm. directly in the DSA signature algorithm.
An ECDSA signature MUST use a hash algorithm with a digest size of at An ECDSA signature MUST use a hash algorithm with a digest size of at
least the curve's "fsize" value (see Section 9.2), except in the case least the curve's "fsize" value (see Section 9.2), except in the case
of NIST P-521, for which at least a 512-bit hash algorithm MUST be of NIST P-521, for which at least a 512-bit hash algorithm MUST be
used. used.
5.2.3.3. Algorithm-Specific Fields for EdDSALegacy signatures 5.2.3.3. Algorithm-Specific Fields for EdDSALegacy Signatures
(deprecated) (Deprecated)
* Two MPI-encoded values, whose contents and formatting depend on * Two MPI-encoded values, whose contents and formatting depend on
the choice of curve used (see Section 9.2.1). the choice of curve used (see Section 9.2.1).
A version 3 signature MUST NOT be created and MUST NOT be used with A version 3 signature MUST NOT be created and MUST NOT be used with
EdDSALegacy. EdDSALegacy.
An EdDSALegacy signature MUST use a hash algorithm with a digest size An EdDSALegacy signature MUST use a hash algorithm with a digest size
of at least the curve's "fsize" value (see Section 9.2). A verifying of at least the curve's "fsize" value (see Section 9.2). A verifying
implementation MUST reject any EdDSALegacy signature that uses a hash implementation MUST reject any EdDSALegacy signature that uses a hash
algorithm with a smaller digest size. algorithm with a smaller digest size.
5.2.3.3.1. Algorithm-Specific Fields for Ed25519Legacy signatures 5.2.3.3.1. Algorithm-Specific Fields for Ed25519Legacy Signatures
(deprecated) (Deprecated)
The two MPIs for Ed25519Legacy use octet strings R and S as described The two MPIs for Ed25519Legacy represent the octet strings R and S of
in [RFC8032]. Ed25519Legacy MUST NOT be used in signature packets the Edwards-curve Digital Signature Algorithm (EdDSA) described in
version 6 or above. [RFC8032].
* MPI of an EC point R, represented as a (non-prefixed) native * MPI of an EC point R, represented as a (non-prefixed) native
(little-endian) octet string up to 32 octets. (little-endian) octet string up to 32 octets.
* MPI of EdDSA value S, also in (non-prefixed) native (little- * MPI of EdDSA value S, also in (non-prefixed) native (little-
endian) format with a length up to 32 octets. endian) format with a length up to 32 octets.
5.2.3.4. Algorithm-Specific Fields for Ed25519 signatures Ed25519Legacy MUST NOT be used in Signature packets version 6 or
above.
5.2.3.4. Algorithm-Specific Fields for Ed25519 Signatures
* 64 octets of the native signature. * 64 octets of the native signature.
For more details, see Section 12.7. For more details, see Section 12.7.
A version 3 signature MUST NOT be created and MUST NOT be used with A version 3 signature MUST NOT be created and MUST NOT be used with
Ed25519. Ed25519.
An Ed25519 signature MUST use a hash algorithm with a digest size of An Ed25519 signature MUST use a hash algorithm with a digest size of
at least 256 bits. A verifying implementation MUST reject any at least 256 bits. A verifying implementation MUST reject any
Ed25519 signature that uses a hash algorithm with a smaller digest Ed25519 signature that uses a hash algorithm with a smaller digest
size. size.
5.2.3.5. Algorithm-Specific Fields for Ed448 signatures 5.2.3.5. Algorithm-Specific Fields for Ed448 Signatures
* 114 octets of the native signature. * 114 octets of the native signature.
For more details, see Section 12.7. For more details, see Section 12.7.
A version 3 signature MUST NOT be created and MUST NOT be used with A version 3 signature MUST NOT be created and MUST NOT be used with
Ed448. Ed448.
An Ed448 signature MUST use a hash algorithm with a digest size of at An Ed448 signature MUST use a hash algorithm with a digest size of at
least 512 bits. A verifying implementation MUST reject any Ed448 least 512 bits. A verifying implementation MUST reject any Ed448
signature that uses a hash algorithm with a smaller digest size. signature that uses a hash algorithm with a smaller digest size.
5.2.3.6. Notes on Signatures 5.2.3.6. Notes on Signatures
The concatenation of the data being signed, the signature data from The concatenation of the data being signed, the signature data from
the version number through the hashed subpacket data (inclusive), and the version number through the hashed subpacket data (inclusive), and
(for signature versions later than 3) a six-octet trailer (see (for signature versions later than 3) a 6-octet trailer (see
Section 5.2.4) is hashed. The resulting hash value is what is Section 5.2.4) is hashed. The resulting hash value is what is
signed. The high 16 bits (first two octets) of the hash are included signed. The high 16 bits (first two octets) of the hash are included
in the Signature packet to provide a way to reject some invalid in the Signature packet to provide a way to reject some invalid
signatures without performing a signature verification. When signatures without performing a signature verification. When
verifying a v6 signature, an implementation MUST reject the signature verifying a version 6 signature, an implementation MUST reject the
if these octets don't match the first two octets of the computed signature if these octets do not match the first two octets of the
hash. computed hash.
There are two fields consisting of Signature subpackets. The first There are two fields consisting of Signature subpackets. The first
field is hashed with the rest of the signature data, while the second field is hashed with the rest of the signature data, while the second
is not hashed into the signature. The second set of subpackets (the is not hashed into the signature. The second set of subpackets (the
"unhashed section") is not cryptographically protected by the "unhashed section") is not cryptographically protected by the
signature and should include only advisory information. See signature and should include only advisory information. See
Section 13.13 for more information. Section 13.13 for more information.
The differences between a v4 and v6 signature are two-fold: first, a The differences between a version 4 and version 6 signature are two-
v6 signature increases the width of the fields that indicate the size fold: first, a version 6 signature increases the width of the fields
of the hashed and unhashed subpackets, making it possible to include that indicate the size of the hashed and unhashed subpackets, making
significantly more data in subpackets. Second, the hash is salted it possible to include significantly more data in subpackets.
with random data (see Section 13.2). Second, the hash is salted with random data (see Section 13.2).
The algorithms for converting the hash function result to a signature The algorithms for converting the hash function result to a signature
are described in Section 5.2.4. are described in Section 5.2.4.
5.2.3.7. Signature Subpacket Specification 5.2.3.7. Signature Subpacket Specification
A subpacket data set consists of zero or more Signature subpackets. A subpacket data set consists of zero or more Signature subpackets.
In Signature packets, the subpacket data set is preceded by a two- In Signature packets, the subpacket data set is preceded by a 2-octet
octet (for v4 signatures) or four-octet (for v6 signatures) scalar (for version 4 signatures) or 4-octet (for version 6 signatures)
count of the length in octets of all the subpackets. A pointer scalar count of the length in octets of all the subpackets. A
incremented by this number will skip over the subpacket data set. pointer incremented by this number will skip over the subpacket data
set.
Each subpacket consists of a subpacket header and a body. The header Each subpacket consists of a subpacket header and a body. The header
consists of: consists of:
* The subpacket length (1, 2, or 5 octets), * The encoded subpacket length (1, 2, or 5 octets).
* The encoded subpacket type ID (1 octet), * The encoded Subpacket Type ID (1 octet).
and is followed by the subpacket-specific data. * The subpacket-specific data.
The length includes the encoded subpacket type ID octet but not this The subpacket length field covers the encoded Subpacket Type ID and
length. Its format is similar to the OpenPGP format packet header the subpacket-specific data, and it does not include the subpacket
lengths, but cannot have Partial Body Lengths. That is: length field itself. It is encoded similarly to a 1-octet, 2-octet,
or 5-octet OpenPGP format packet header. The encoded subpacket
length can be decoded as follows:
if the 1st octet < 192, then if the 1st octet < 192, then
lengthOfLength = 1 lengthOfLength = 1
subpacketLen = 1st_octet subpacketLen = 1st_octet
if the 1st octet >= 192 and < 255, then if the 1st octet >= 192 and < 255, then
lengthOfLength = 2 lengthOfLength = 2
subpacketLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192 subpacketLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192
if the 1st octet = 255, then if the 1st octet = 255, then
lengthOfLength = 5 lengthOfLength = 5
subpacket length = [four-octet scalar starting at 2nd_octet] subpacket length = [4-octet scalar starting at 2nd_octet]
Bit 7 of the encoded subpacket type ID is the "critical" bit. If Bit 7 of the encoded Subpacket Type ID is the "critical" bit. If
set, it denotes that the subpacket is one that is critical for the set, it denotes that the subpacket is one that is critical for the
evaluator of the signature to recognize. If a subpacket is evaluator of the signature to recognize. If a subpacket is
encountered that is marked critical but is unknown to the evaluating encountered that is marked critical but is unknown to the evaluating
implementation, the evaluator SHOULD consider the signature to be in implementation, the evaluator SHOULD consider the signature to be in
error. error.
An implementation SHOULD ignore any non-critical subpacket of a type An implementation SHOULD ignore any non-critical subpacket of a type
that it does not recognize. that it does not recognize.
An evaluator may "recognize" a subpacket, but not implement it. The An evaluator may "recognize" a subpacket but not implement it. The
purpose of the critical bit is to allow the signer to tell an purpose of the critical bit is to allow the signer to tell an
evaluator that it would prefer a new, unknown feature to generate an evaluator that it would prefer a new, unknown feature to generate an
error rather than being ignored. error rather than being ignored.
The other bits of the encoded subpacket type ID (i.e. bits 6-0) The other bits of the encoded Subpacket Type ID (i.e., bits 6-0)
contain the subpacket type ID. contain the Subpacket Type ID.
The following signature subpackets are defined: The following signature subpackets are defined:
+========+===========================+==================+ +=========+===========================+==================+
| ID | Description | Reference | | ID | Description | Reference |
+========+===========================+==================+ +=========+===========================+==================+
| 0 | Reserved | | | 0 | Reserved | |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 1 | Reserved | | | 1 | Reserved | |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 2 | Signature Creation Time | Section 5.2.3.11 | | 2 | Signature Creation Time | Section 5.2.3.11 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 3 | Signature Expiration Time | Section 5.2.3.18 | | 3 | Signature Expiration Time | Section 5.2.3.18 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 4 | Exportable Certification | Section 5.2.3.19 | | 4 | Exportable Certification | Section 5.2.3.19 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 5 | Trust Signature | Section 5.2.3.21 | | 5 | Trust Signature | Section 5.2.3.21 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 6 | Regular Expression | Section 5.2.3.22 | | 6 | Regular Expression | Section 5.2.3.22 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 7 | Revocable | Section 5.2.3.20 | | 7 | Revocable | Section 5.2.3.20 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 8 | Reserved | | | 8 | Reserved | |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 9 | Key Expiration Time | Section 5.2.3.13 | | 9 | Key Expiration Time | Section 5.2.3.13 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 10 | Placeholder for backward | | | 10 | Placeholder for backward | |
| | compatibility | | | | compatibility | |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 11 | Preferred Symmetric | Section 5.2.3.14 | | 11 | Preferred Symmetric | Section 5.2.3.14 |
| | Ciphers for v1 SEIPD | | | | Ciphers for v1 SEIPD | |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 12 | Revocation Key | Section 5.2.3.23 | | 12 | Revocation Key | Section 5.2.3.23 |
| | (deprecated) | | | | (deprecated) | |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 13 to | Reserved | | | 13-15 | Reserved | |
| 15 | | | +---------+---------------------------+------------------+
+--------+---------------------------+------------------+ | 16 | Issuer Key ID | Section 5.2.3.12 |
| 16 | Issuer Key ID | Section 5.2.3.12 | +---------+---------------------------+------------------+
+--------+---------------------------+------------------+ | 17-19 | Reserved | |
| 17 to | Reserved | | +---------+---------------------------+------------------+
| 19 | | | | 20 | Notation Data | Section 5.2.3.24 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 20 | Notation Data | Section 5.2.3.24 | | 21 | Preferred Hash Algorithms | Section 5.2.3.16 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 21 | Preferred Hash Algorithms | Section 5.2.3.16 | | 22 | Preferred Compression | Section 5.2.3.17 |
+--------+---------------------------+------------------+ | | Algorithms | |
| 22 | Preferred Compression | Section 5.2.3.17 | +---------+---------------------------+------------------+
| | Algorithms | | | 23 | Key Server Preferences | Section 5.2.3.25 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 23 | Key Server Preferences | Section 5.2.3.25 | | 24 | Preferred Key Server | Section 5.2.3.26 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 24 | Preferred Key Server | Section 5.2.3.26 | | 25 | Primary User ID | Section 5.2.3.27 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 25 | Primary User ID | Section 5.2.3.27 | | 26 | Policy URI | Section 5.2.3.28 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 26 | Policy URI | Section 5.2.3.28 | | 27 | Key Flags | Section 5.2.3.29 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 27 | Key Flags | Section 5.2.3.29 | | 28 | Signer's User ID | Section 5.2.3.30 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 28 | Signer's User ID | Section 5.2.3.30 | | 29 | Reason for Revocation | Section 5.2.3.31 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 29 | Reason for Revocation | Section 5.2.3.31 | | 30 | Features | Section 5.2.3.32 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 30 | Features | Section 5.2.3.32 | | 31 | Signature Target | Section 5.2.3.33 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 31 | Signature Target | Section 5.2.3.33 | | 32 | Embedded Signature | Section 5.2.3.34 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 32 | Embedded Signature | Section 5.2.3.34 | | 33 | Issuer Fingerprint | Section 5.2.3.35 |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 33 | Issuer Fingerprint | Section 5.2.3.35 | | 34 | Reserved | |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 34 | Reserved | | | 35 | Intended Recipient | Section 5.2.3.36 |
+--------+---------------------------+------------------+ | | Fingerprint | |
| 35 | Intended Recipient | Section 5.2.3.36 | +---------+---------------------------+------------------+
| | Fingerprint | | | 37 | Reserved (Attested | |
+--------+---------------------------+------------------+ | | Certifications) | |
| 37 | Reserved (Attested | | +---------+---------------------------+------------------+
| | Certifications) | | | 38 | Reserved (Key Block) | |
+--------+---------------------------+------------------+ +---------+---------------------------+------------------+
| 38 | Reserved (Key Block) | | | 39 | Preferred AEAD | Section 5.2.3.15 |
+--------+---------------------------+------------------+ | | Ciphersuites | |
| 39 | Preferred AEAD | Section 5.2.3.15 | +---------+---------------------------+------------------+
| | Ciphersuites | | | 100-110 | Private or Experimental | |
+--------+---------------------------+------------------+ | | Use | |
| 100 to | Private or experimental | | +---------+---------------------------+------------------+
| 110 | | |
+--------+---------------------------+------------------+
Table 5: OpenPGP Signature Subpacket Types registry Table 5: OpenPGP Signature Subpacket Types Registry
Implementations SHOULD implement the four preferred algorithm Implementations SHOULD implement the four preferred algorithm
subpackets (11, 21, 22, and 39), as well as the "Features" subpacket subpackets (11, 21, 22, and 39), as well as the "Features" (30) and
and the "Reason for Revocation" subpacket. To avoid surreptitious "Reason for Revocation" (29) subpackets. To avoid surreptitious
forwarding (see Section 13.12), implementations SHOULD also implement forwarding (see Section 13.12), implementations SHOULD also implement
the "Intended Recipients" subpacket. Note that if an implementation the "Intended Recipients Fingerprint" (35) subpacket. Note that if
chooses not to implement some of the preferences subpackets, it MUST an implementation chooses not to implement some of the preferences
default to the mandatory-to-implement algorithms to ensure subpackets, it MUST default to the mandatory-to-implement algorithms
interoperability. An encrypting implementation that does not to ensure interoperability. An encrypting implementation that does
implement the "Features" subpacket SHOULD select the type of not implement the "Features" (30) subpacket SHOULD select the type of
encrypted data format based instead on the versions of the recipient encrypted data format based on the versions of the recipient keys or
keys or external inference (see Section 13.7 for more details). external inference (see Section 13.7 for more details).
5.2.3.8. Signature Subpacket Types 5.2.3.8. Signature Subpacket Types
A number of subpackets are currently defined for OpenPGP signatures. A number of subpackets are currently defined for OpenPGP signatures.
Some subpackets apply to the signature itself and some are attributes Some subpackets apply to the signature itself and some are attributes
of the key. Subpackets that are found on a self-signature are placed of the key. Subpackets that are found on a self-signature are placed
on a certification made by the key itself. Note that a key may have on a certification made by the key itself. Note that a key may have
more than one User ID, and thus may have more than one self- more than one User ID and thus may have more than one self-signature
signature, and differing subpackets. and differing subpackets.
A subpacket may be found either in the hashed or unhashed subpacket A subpacket may be found in either the hashed or the unhashed
sections of a signature. If a subpacket is not hashed, then the subpacket sections of a signature. If a subpacket is not hashed,
information in it cannot be considered definitive because it is not then the information in it cannot be considered definitive because it
part of the signature proper. See Section 13.13 for more discussion is not covered by the cryptographic signature. See Section 13.13 for
about hashed and unhashed subpackets. more discussion about hashed and unhashed subpackets.
5.2.3.9. Notes on Subpackets 5.2.3.9. Notes on Subpackets
It is certainly possible for a signature to contain conflicting It is certainly possible for a signature to contain conflicting
information in subpackets. For example, a signature may contain information in subpackets. For example, a signature may contain
multiple copies of a preference or multiple expiration times. In multiple copies of a preference or multiple expiration times. In
most cases, an implementation SHOULD use the last subpacket in the most cases, an implementation SHOULD use the last subpacket in the
hashed section of the signature, but MAY use any conflict resolution hashed section of the signature, but it MAY use any conflict
scheme that makes more sense. Please note that we are intentionally resolution scheme that makes more sense. Please note that conflict
leaving conflict resolution to the implementer; most conflicts are resolution is intentionally left to the implementer; most conflicts
simply syntax errors, and the wishy-washy language here allows a are simply syntax errors, and the ambiguous language here allows a
receiver to be generous in what they accept, while putting pressure receiver to be generous in what they accept, while putting pressure
on a creator to be stingy in what they generate. on a creator to be stingy in what they generate.
Some apparent conflicts may actually make sense --- for example, Some apparent conflicts may actually make sense. For example,
suppose a keyholder has a v3 key and a v4 key that share the same RSA suppose a keyholder has a version 3 key and a version 4 key that
key material. Either of these keys can verify a signature created by share the same RSA key material. Either of these keys can verify a
the other, and it may be reasonable for a signature to contain an signature created by the other, and it may be reasonable for a
Issuer Key ID subpacket (Section 5.2.3.12) for each key, as a way of signature to contain an Issuer Key ID subpacket (Section 5.2.3.12)
explicitly tying those keys to the signature. for each key, as a way of explicitly tying those keys to the
signature.
5.2.3.10. Notes on Self-Signatures 5.2.3.10. Notes on Self-Signatures
A self-signature is a binding signature made by the key to which the A self-signature is a binding signature made by the key to which the
signature refers. There are three types of self-signatures, the signature refers. There are three types of self-signatures: the
certification signatures (type IDs 0x10-0x13), the direct key certification signatures (Type IDs 0x10-0x13), the Direct Key
signature (type ID 0x1F), and the subkey binding signature (type ID signature (Type ID 0x1F), and the Subkey Binding signature (Type ID
0x18). A cryptographically-valid self-signature should be accepted 0x18). A cryptographically valid self-signature should be accepted
from any primary key, regardless of what Key Flags (Section 5.2.3.29) from any primary key, regardless of what Key Flags (Section 5.2.3.29)
apply to the primary key. In particular, a primary key does not need apply to the primary key. In particular, a primary key does not need
to have 0x01 set in the first octet of Key Flags order to make a to have 0x01 set in the first octet of the Key Flags order to make a
valid self-signature. valid self-signature.
For certification self-signatures, each User ID MAY have a self- For certification self-signatures, each User ID MAY have a self-
signature, and thus different subpackets in those self-signatures. signature and thus different subpackets in those self-signatures.
For subkey binding signatures, each subkey MUST have a self- For Subkey Binding signatures, each subkey MUST have a self-
signature. Subpackets that appear in a certification self-signature signature. Subpackets that appear in a certification self-signature
apply to the User ID, and subpackets that appear in the subkey self- apply to the User ID, and subpackets that appear in the subkey self-
signature apply to the subkey. Lastly, subpackets on the direct key signature apply to the subkey. Lastly, subpackets on the Direct Key
signature apply to the entire key. signature apply to the entire key.
An implementation should interpret a self-signature's preference An implementation should interpret a self-signature's preference
subpackets as narrowly as possible. For example, suppose a key has subpackets as narrowly as possible. For example, suppose a key has
two user names, Alice and Bob. Suppose that Alice prefers the AEAD two user names, Alice and Bob. Suppose that Alice prefers the AEAD
ciphersuite AES-256 with OCB, and Bob prefers Camellia-256 with GCM. ciphersuite AES-256 with OCB, and Bob prefers Camellia-256 with GCM.
If the implementation locates this key via Alice's name, then the If the implementation locates this key via Alice's name, then the
preferred AEAD ciphersuite is AES-256 with OCB; if the implementation preferred AEAD ciphersuite is AES-256 with OCB; if the implementation
locates the key via Bob's name, then the preferred algorithm is locates the key via Bob's name, then the preferred algorithm is
Camellia-256 with GCM. If the key is located by Key ID, the Camellia-256 with GCM. If the key is located by Key ID, the
algorithm of the primary User ID of the key provides the preferred algorithm of the Primary User ID of the key provides the preferred
AEAD ciphersuite. AEAD ciphersuite.
Revoking a self-signature or allowing it to expire has a semantic Revoking a self-signature or allowing it to expire has a semantic
meaning that varies with the signature type. Revoking the self- meaning that varies with the signature type. Revoking the self-
signature on a User ID effectively retires that user name. The self- signature on a User ID effectively retires that user name. The self-
signature is a statement, "My name X is tied to my signing key K" and signature is a statement, "My name X is tied to my signing key K",
is corroborated by other users' certifications. If another user and it is corroborated by other users' certifications. If another
revokes their certification, they are effectively saying that they no user revokes their certification, they are effectively saying that
longer believe that name and that key are tied together. Similarly, they no longer believe that name and that key are tied together.
if the users themselves revoke their self-signature, then the users Similarly, if the users themselves revoke their self-signature, then
no longer go by that name, no longer have that email address, etc. the users no longer go by that name, no longer have that email
Revoking a binding signature effectively retires that subkey. address, etc. Revoking a binding signature effectively retires that
Revoking a direct key signature cancels that signature. Please see subkey. Revoking a Direct Key signature cancels that signature.
Section 5.2.3.31 for more relevant detail. Please see Section 5.2.3.31 for more relevant details.
Since a self-signature contains important information about the key's Since a self-signature contains important information about the key's
use, an implementation SHOULD allow the user to rewrite the self- use, an implementation SHOULD allow the user to rewrite the self-
signature, and important information in it, such as preferences and signature and important information in it, such as preferences and
key expiration. key expiration.
When an implementation imports a secret key, it SHOULD verify that When an implementation imports a secret key, it SHOULD verify that
the key's internal self-signatures do not advertise features or the key's internal self-signatures do not advertise features or
algorithms that the implementation doesn't support. If an algorithms that the implementation doesn't support. If an
implementation observes such a mismatch, it SHOULD warn the user and implementation observes such a mismatch, it SHOULD warn the user and
offer to create new self-signatures that advertise the actual set of offer to create new self-signatures that advertise the actual set of
features and algorithms supported by the implementation. features and algorithms supported by the implementation.
An implementation that encounters multiple self-signatures on the An implementation that encounters multiple self-signatures on the
same object MUST select the most recent valid self-signature, and same object MUST select the most recent valid self-signature and
ignore all other self-signatures. ignore all other self-signatures.
By convention, a version 4 key stores information about the primary By convention, a version 4 key stores information about the primary
Public-Key (key flags, key expiration, etc.) and the Transferable Public Key (key flags, key expiration, etc.) and the Transferable
Public Key as a whole (features, algorithm preferences, etc.) in a Public Key as a whole (features, algorithm preferences, etc.) in a
User ID self-signature of type 0x10 or 0x13. Some implementations User ID self-signature of type 0x10 or 0x13. To use a version 4 key,
require at least one User ID with a valid self-signature to be some implementations require at least one User ID with a valid self-
present to use a v4 key. For this reason, it is RECOMMENDED to signature to be present. For this reason, it is RECOMMENDED to
include at least one User ID with a self-signature in v4 keys. include at least one User ID with a self-signature in version 4 keys.
For version 6 keys, it is RECOMMENDED to store information about the For version 6 keys, it is RECOMMENDED to store information about the
primary Public-Key as well as the Transferable Public Key as a whole primary Public Key as well as the Transferable Public Key as a whole
(key flags, key expiration, features, algorithm preferences, etc.) in (key flags, key expiration, features, algorithm preferences, etc.) in
a direct key signature (type ID 0x1F) over the Public-Key instead of a Direct Key signature (Type ID 0x1F) over the Public Key, instead of
placing that information in a User ID self-signature. An placing that information in a User ID self-signature. An
implementation MUST ensure that a valid direct key signature is implementation MUST ensure that a valid Direct Key signature is
present before using a v6 key. This prevents certain attacks where present before using a version 6 key. This prevents certain attacks
an adversary strips a self-signature specifying a key expiration time where an adversary strips a self-signature specifying a Key
or certain preferences. Expiration Time or certain preferences.
An implementation SHOULD NOT require a User ID self-signature to be An implementation SHOULD NOT require a User ID self-signature to be
present in order to consume or use a key, unless the particular use present in order to consume or use a key, unless the particular use
is contingent on the keyholder identifying themselves with the is contingent on the keyholder identifying themselves with the
textual label in the User ID. For example, when refreshing a key to textual label in the User ID. For example, when refreshing a key to
learn about changes in expiration, advertised features, algorithm learn about changes in expiration, advertised features, algorithm
preferences, revocation, subkey rotation, and so forth, there is no preferences, revocation, subkey rotation, and so forth, there is no
need to require a User ID self-signature. On the other hand, when need to require a User ID self-signature. On the other hand, when
verifying a signature over an e-mail message, an implementation MAY verifying a signature over an email message, an implementation MAY
choose to only accept a signature from a key that has a valid self- choose to only accept a signature from a key that has a valid self-
signature over a User ID that matches the message's From: header, as signature over a User ID that matches the message's From: header, as
a way to avoid a signature transplant attack. a way to avoid a signature transplant attack.
5.2.3.11. Signature Creation Time 5.2.3.11. Signature Creation Time
(4-octet time field) (4-octet time field)
The time the signature was made. The time the signature was made.
skipping to change at page 47, line 26 skipping to change at line 2167
Note: in previous versions of this specification, this subpacket was Note: in previous versions of this specification, this subpacket was
simply known as the "Issuer" subpacket. simply known as the "Issuer" subpacket.
5.2.3.13. Key Expiration Time 5.2.3.13. Key Expiration Time
(4-octet time field) (4-octet time field)
The validity period of the key. This is the number of seconds after The validity period of the key. This is the number of seconds after
the key creation time that the key expires. For a direct or the key creation time that the key expires. For a direct or
certification self-signature, the key creation time is that of the certification self-signature, the key creation time is that of the
primary key. For a subkey binding signature, the key creation time primary key. For a Subkey Binding signature, the key creation time
is that of the subkey. If this is not present or has a value of is that of the subkey. If this is not present or has a value of
zero, the key never expires. This is found only on a self-signature. zero, the key never expires. This is found only on a self-signature.
When an implementation generates this subpacket, it SHOULD be marked When an implementation generates this subpacket, it SHOULD be marked
as critical. as critical.
5.2.3.14. Preferred Symmetric Ciphers for v1 SEIPD 5.2.3.14. Preferred Symmetric Ciphers for v1 SEIPD
(array of one-octet values) (array of 1-octet values)
A series of symmetric cipher algorithm IDs indicating how the A series of Symmetric Cipher Algorithm IDs indicating how the
keyholder prefers to receive version 1 Symmetrically Encrypted keyholder prefers to receive the version 1 Symmetrically Encrypted
Integrity Protected Data (Section 5.13.1). The subpacket body is an and Integrity Protected Data packet (Section 5.13.1). The subpacket
ordered list of octets with the most preferred listed first. It is body is an ordered list of octets with the most preferred listed
assumed that only algorithms listed are supported by the recipient's first. It is assumed that only the algorithms listed are supported
implementation. Algorithm IDs are defined in Section 9.3. This is by the recipient's implementation. Algorithm IDs are defined in
only found on a self-signature. Section 9.3. This is only found on a self-signature.
When generating a v2 SEIPD packet, this preference list is not When generating a v2 SEIPD packet, this preference list is not
relevant. See Section 5.2.3.15 instead. relevant. See Section 5.2.3.15 instead.
5.2.3.15. Preferred AEAD Ciphersuites 5.2.3.15. Preferred AEAD Ciphersuites
(array of pairs of octets indicating Symmetric Cipher and AEAD (array of pairs of octets indicating Symmetric Cipher and AEAD
algorithms) algorithms)
A series of paired algorithm IDs indicating how the keyholder prefers A series of paired algorithm IDs indicating how the keyholder prefers
to receive version 2 Symmetrically Encrypted Integrity Protected Data to receive the version 2 Symmetrically Encrypted and Integrity
(Section 5.13.2). Each pair of octets indicates a combination of a Protected Data packet (Section 5.13.2). Each pair of octets
symmetric cipher and an AEAD mode that the keyholder prefers to use. indicates a combination of a symmetric cipher and an AEAD mode that
The symmetric cipher algorithm ID precedes the AEAD algorithm ID in the keyholder prefers to use. The Symmetric Cipher Algorithm ID
each pair. The subpacket body is an ordered list of pairs of octets precedes the AEAD algorithm ID in each pair. The subpacket body is
with the most preferred algorithm combination listed first. an ordered list of pairs of octets with the most preferred algorithm
combination listed first.
It is assumed that only the combinations of algorithms listed are It is assumed that only the combinations of algorithms listed are
supported by the recipient's implementation, with the exception of supported by the recipient's implementation, with the exception of
the mandatory-to-implement combination of AES-128 and OCB. If the mandatory-to-implement combination of AES-128 and OCB. If
AES-128 and OCB are not found in the subpacket, it is implicitly AES-128 and OCB are not found in the subpacket, it is implicitly
listed at the end. listed at the end.
AEAD algorithm IDs are listed in Section 9.6. Symmetric cipher AEAD algorithm IDs are listed in Section 9.6. Symmetric Cipher
algorithm IDs are listed in Section 9.3. Algorithm IDs are listed in Section 9.3.
For example, a subpacket with content of these six octets: For example, a subpacket containing the six octets
09 02 09 03 13 02 09 02 09 03 13 02
Indicates that the keyholder prefers to receive v2 SEIPD using indicates that the keyholder prefers to receive v2 SEIPD using
AES-256 with OCB, then AES-256 with GCM, then Camellia-256 with OCB, AES-256 with OCB, then AES-256 with GCM, then Camellia-256 with OCB,
and finally the implicit AES-128 with OCB. and finally the implicit AES-128 with OCB.
Note that support for version 2 of the Symmetrically Encrypted Note that support for the version 2 Symmetrically Encrypted and
Integrity Protected Data packet (Section 5.13.2) in general is Integrity Protected Data packet (Section 5.13.2) in general is
indicated by a Features Flag (Section 5.2.3.32). indicated by a Features Flag (Section 5.2.3.32).
This subpacket is only found on a self-signature. This subpacket is only found on a self-signature.
When generating a v1 SEIPD packet, this preference list is not When generating a v1 SEIPD packet, this preference list is not
relevant. See Section 5.2.3.14 instead. relevant. See Section 5.2.3.14 instead.
5.2.3.16. Preferred Hash Algorithms 5.2.3.16. Preferred Hash Algorithms
(array of one-octet values) (array of 1-octet values)
Message digest algorithm IDs that indicate which algorithms the Message digest algorithm IDs that indicate which algorithms the
keyholder prefers to receive. Like the preferred AEAD ciphersuites, keyholder prefers to receive. Like the Preferred AEAD Ciphersuites,
the list is ordered. Algorithm IDs are defined in Section 9.5. This the list is ordered. Algorithm IDs are defined in Section 9.5. This
is only found on a self-signature. is only found on a self-signature.
5.2.3.17. Preferred Compression Algorithms 5.2.3.17. Preferred Compression Algorithms
(array of one-octet values) (array of 1-octet values)
Compression algorithm IDs that indicate which algorithms the Compression algorithm IDs that indicate which algorithms the
keyholder prefers to use. Like the preferred AEAD ciphersuites, the keyholder prefers to use. Like the Preferred AEAD Ciphersuites, the
list is ordered. Algorithm IDs are defined in Section 9.4. A zero, list is ordered. Algorithm IDs are defined in Section 9.4. A zero,
or the absence of this subpacket, denotes that uncompressed data is or the absence of this subpacket, denotes that uncompressed data is
preferred; the keyholder's implementation might have no compression preferred; the keyholder's implementation might have no compression
support available. This is only found on a self-signature. support available. This is only found on a self-signature.
5.2.3.18. Signature Expiration Time 5.2.3.18. Signature Expiration Time
(4-octet time field) (4-octet time field)
The validity period of the signature. This is the number of seconds The validity period of the signature. This is the number of seconds
after the signature creation time that the signature expires. If after the Signature Creation Time that the signature expires. If
this is not present or has a value of zero, it never expires. this is not present or has a value of zero, it never expires.
When an implementation generates this subpacket, it SHOULD be marked When an implementation generates this subpacket, it SHOULD be marked
as critical. as critical.
5.2.3.19. Exportable Certification 5.2.3.19. Exportable Certification
(1 octet of exportability, 0 for not, 1 for exportable) (1 octet of exportability, 0 for not, 1 for exportable)
This subpacket denotes whether a certification signature is This subpacket denotes whether a certification signature is
"exportable", to be used by other users than the signature's issuer. "exportable"; it is intended for use by users other than the
The packet body contains a Boolean flag indicating whether the signature's issuer. The packet body contains a Boolean flag
signature is exportable. If this packet is not present, the indicating whether the signature is exportable. If this packet is
certification is exportable; it is equivalent to a flag containing a not present, the certification is exportable; it is equivalent to a
1. flag containing a 1.
Non-exportable, or "local", certifications are signatures made by a Non-exportable, or "local", certifications are signatures made by a
user to mark a key as valid within that user's implementation only. user to mark a key as valid within that user's implementation only.
Thus, when an implementation prepares a user's copy of a key for Thus, when an implementation prepares a user's copy of a key for
transport to another user (this is the process of "exporting" the transport to another user (this is the process of "exporting" the
key), any local certification signatures are deleted from the key. key), any local certification signatures are deleted from the key.
The receiver of a transported key "imports" it, and likewise trims The receiver of a transported key "imports" it and likewise trims any
any local certifications. In normal operation, there won't be any, local certifications. In normal operation, there won't be any local
assuming the import is performed on an exported key. However, there certifications, assuming the import is performed on an exported key.
are instances where this can reasonably happen. For example, if an However, there are instances where this can reasonably happen. For
implementation allows keys to be imported from a key database in example, if an implementation allows keys to be imported from a key
addition to an exported key, then this situation can arise. database in addition to an exported key, then this situation can
arise.
Some implementations do not represent the interest of a single user Some implementations do not represent the interest of a single user
(for example, a key server). Such implementations always trim local (for example, a key server). Such implementations always trim local
certifications from any key they handle. certifications from any key they handle.
When an implementation generates this subpacket and denotes the When an implementation generates this subpacket and denotes the
signature as non-exportable, the subpacket MUST be marked as signature as non-exportable, the subpacket MUST be marked as
critical. critical.
5.2.3.20. Revocable 5.2.3.20. Revocable
(1 octet of revocability, 0 for not, 1 for revocable) (1 octet of revocability, 0 for not, 1 for revocable)
Signature's revocability status. The packet body contains a Boolean A Signature's revocability status. The packet body contains a
flag indicating whether the signature is revocable. Signatures that Boolean flag indicating whether the signature is revocable.
are not revocable have any later revocation signatures ignored. They Signatures that are not revocable ignore any later Revocation
represent a commitment by the signer that he cannot revoke his Signatures. They represent the signer's commitment that its
signature for the life of his key. If this packet is not present, signature cannot be revoked for the life of its key. If this packet
the signature is revocable. is not present, the signature is revocable.
5.2.3.21. Trust Signature 5.2.3.21. Trust Signature
(1 octet "level" (depth), 1 octet of trust amount) (1 octet "level" (depth), 1 octet of trust amount)
Signer asserts that the key is not only valid but also trustworthy at The signer asserts that the key is not only valid but also
the specified level. Level 0 has the same meaning as an ordinary trustworthy at the specified level. Level 0 has the same meaning as
validity signature. Level 1 means that the signed key is asserted to an ordinary validity signature. Level 1 means that the signed key is
be a valid trusted introducer, with the 2nd octet of the body asserted to be a valid trusted introducer, with the 2nd octet of the
specifying the degree of trust. Level 2 means that the signed key is body specifying the degree of trust. Level 2 means that the signed
asserted to be trusted to issue level 1 trust signatures; that is, key is asserted to be trusted to issue level 1 Trust Signatures; that
the signed key is a "meta introducer". Generally, a level n trust is, the signed key is a "meta introducer". Generally, a level n
signature asserts that a key is trusted to issue level n-1 trust Trust Signature asserts that a key is trusted to issue level n-1
signatures. The trust amount is in a range from 0-255, interpreted Trust Signatures. The trust amount is in a range from 0-255,
such that values less than 120 indicate partial trust and values of interpreted such that values less than 120 indicate partial trust and
120 or greater indicate complete trust. Implementations SHOULD emit values of 120 or greater indicate complete trust. Implementations
values of 60 for partial trust and 120 for complete trust. SHOULD emit values of 60 for partial trust and 120 for complete
trust.
5.2.3.22. Regular Expression 5.2.3.22. Regular Expression
(null-terminated UTF-8 encoded regular expression) (null-terminated UTF-8 encoded Regular Expression)
Used in conjunction with trust Signature packets (of level > 0) to Used in conjunction with Trust Signature packets (of level > 0) to
limit the scope of trust that is extended. Only signatures by the limit the scope of trust that is extended. Only signatures by the
target key on User IDs that match the regular expression in the body target key on User IDs that match the Regular Expression in the body
of this packet have trust extended by the trust Signature subpacket. of this packet have trust extended by the Trust Signature subpacket.
The regular expression uses the same syntax as Henry Spencer's The Regular Expression uses the same syntax as Henry Spencer's
"almost public domain" regular expression [REGEX] package. A "almost public domain" Regular Expression [REGEX] package. A
description of the syntax is found in Section 8. The regular description of the syntax is found in Section 8. The Regular
expression matches (or does not match) a sequence of UTF-8-encoded Expression matches (or does not match) a sequence of UTF-8-encoded
Unicode characters from User IDs. The expression itself is also Unicode characters from User IDs. The expression itself is also
written with UTF-8 characters. written with UTF-8 characters.
For historical reasons, this subpacket includes a null character For historical reasons, this subpacket includes a null character (an
(octet with value zero) after the regular expression. When an octet with value zero) after the Regular Expression. When an
implementation parses a regular expression subpacket, it MUST remove implementation parses a Regular Expression subpacket, it MUST remove
this octet; if it is not present, it MUST reject the subpacket (i.e. this octet; if it is not present, it MUST reject the subpacket (i.e.,
ignore the subpacket if it's non-critical and reject the signature if ignore the subpacket if it's non-critical and reject the signature if
it's critical). When an implementation generates a regular it's critical). When an implementation generates a Regular
expression subpacket, it MUST include the null terminator. Expression subpacket, it MUST include the null terminator.
When generating this subpacket, it SHOULD be marked as critical. When generating this subpacket, it SHOULD be marked as critical.
5.2.3.23. Revocation Key 5.2.3.23. Revocation Key (Deprecated)
(1 octet of class, 1 octet of public-key algorithm ID, 20 octets of (1 octet of class, 1 octet of public key algorithm ID, 20 octets of
v4 fingerprint) version 4 fingerprint)
This mechanism is deprecated. Applications MUST NOT generate such a This mechanism is deprecated. Applications MUST NOT generate such a
subpacket. subpacket.
An application that wants the functionality of delegating revocation An application that wants the functionality of delegating revocation
can use an escrowed Revocation Signature. See Section 13.9 for more can use an escrowed Revocation Signature. See Section 13.9 for more
details. details.
The remainder of this section describes how some implementations The remainder of this section describes how some implementations
attempt to interpret this deprecated subpacket. attempt to interpret this deprecated subpacket.
This packet was intended to authorize the specified key to issue This packet was intended to authorize the specified key to issue
revocation signatures for this key. Class octet must have bit 0x80 Revocation Signatures for this key. The class octet must have bit
set. If the bit 0x40 is set, then this means that the revocation 0x80 set. If bit 0x40 is set, it means the revocation information is
information is sensitive. Other bits are for future expansion to sensitive. Other bits are for future expansion to other kinds of
other kinds of authorizations. This is only found on a direct key authorizations. This is only found on a Direct Key self-signature
self-signature (type ID 0x1F). The use on other types of self- (Type ID 0x1F). The use on other types of self-signatures is
signatures is unspecified. unspecified.
If the "sensitive" flag is set, the keyholder feels this subpacket If the "sensitive" flag is set, the keyholder feels this subpacket
contains private trust information that describes a real-world contains private trust information that describes a real-world
sensitive relationship. If this flag is set, implementations SHOULD sensitive relationship. If this flag is set, implementations SHOULD
NOT export this signature to other users except in cases where the NOT export this signature to other users except in cases where the
data needs to be available: when the signature is being sent to the data needs to be available, i.e., when the signature is being sent to
designated revoker, or when it is accompanied by a revocation the designated revoker or when it is accompanied by a Revocation
signature from that revoker. Note that it may be appropriate to Signature from that revoker. Note that it may be appropriate to
isolate this subpacket within a separate signature so that it is not isolate this subpacket within a separate signature so that it is not
combined with other subpackets that need to be exported. combined with other subpackets that need to be exported.
5.2.3.24. Notation Data 5.2.3.24. Notation Data
(4 octets of flags, 2 octets of name length (M), 2 octets of value (4 octets of flags, 2 octets of name length (M), 2 octets of value
length (N), M octets of name data, N octets of value data) length (N), M octets of name data, N octets of value data)
This subpacket describes a "notation" on the signature that the This subpacket describes a "notation" on the signature that the
issuer wishes to make. The notation has a name and a value, each of issuer wishes to make. The notation has a name and a value, each of
which are strings of octets. There may be more than one notation in which are strings of octets. There may be more than one notation in
a signature. Notations can be used for any extension the issuer of a signature. Notations can be used for any extension the issuer of
the signature cares to make. The "flags" field holds four octets of the signature cares to make. The "flags" field holds 4 octets of
flags. flags.
All undefined flags MUST be zero. Defined flags are as follows: All undefined flags MUST be zero. Defined flags are as follows:
+=====================+================+================+===========+ +=======================+================+================+
| Flag Position | Shorthand | Description | Reference | | Flag Position | Shorthand | Description |
+=====================+================+================+===========+ +=======================+================+================+
| 0x80000000 (first | human-readable | Notation | This | | 0x80000000 (first bit | human-readable | Notation value |
| bit of first octet) | | value is | document | | of the first octet) | | is UTF-8 text |
| | | UTF-8 text. | | +-----------------------+----------------+----------------+
+---------------------+----------------+----------------+-----------+
Table 6: OpenPGP Signature Notation Data Subpacket Notation Flags Table 6: OpenPGP Signature Notation Data Subpacket
registry Notation Flags Registry
Notation names are arbitrary strings encoded in UTF-8. They reside Notation names are arbitrary strings encoded in UTF-8. They reside
in two namespaces: The IETF namespace and the user namespace. in two namespaces: the IETF namespace and the user namespace.
The IETF namespace is registered with IANA. These names MUST NOT The IETF namespace is registered with IANA. These names MUST NOT
contain the "@" character (0x40). This is a tag for the user contain the "@" character (0x40). This is a tag for the user
namespace. namespace.
+===============+===========+================+===========+ +===============+===========+================+
| Notation Name | Data Type | Allowed Values | Reference | | Notation Name | Data Type | Allowed Values |
+===============+===========+================+===========+ +===============+===========+================+
+---------------+-----------+----------------+-----------+ | No registrations at this time. |
+============================================+
Table 7: OpenPGP Signature Notation Data Subpacket Table 7: OpenPGP Signature Notation Data
Types registry Subpacket Types Registry
This registry is initially empty. This registry is initially empty.
Names in the user namespace consist of a UTF-8 string tag followed by Names in the user namespace consist of a UTF-8 string tag followed by
"@" followed by a DNS domain name. Note that the tag MUST NOT "@", followed by a DNS domain name. Note that the tag MUST NOT
contain an "@" character. For example, the "sample" tag used by contain an "@" character. For example, the "sample" tag used by
Example Corporation could be "sample@example.com". Example Corporation could be "sample@example.com".
Names in a user space are owned and controlled by the owners of that Names in a user space are owned and controlled by the owners of that
domain. Obviously, it's bad form to create a new name in a DNS space domain. Obviously, it's bad form to create a new name in a DNS space
that you don't own. that you don't own.
Since the user namespace is in the form of an email address, Since the user namespace is in the form of an email address,
implementers MAY wish to arrange for that address to reach a person implementers MAY wish to arrange for that address to reach a person
who can be consulted about the use of the named tag. Note that due who can be consulted about the use of the named tag. Note that due
to UTF-8 encoding, not all valid user space name tags are valid email to UTF-8 encoding, not all valid user space name tags are valid email
addresses. addresses.
If there is a critical notation, the criticality applies to that If there is a critical notation, the criticality applies to that
specific notation and not to notations in general. specific notation and not to notations in general.
5.2.3.25. Key Server Preferences 5.2.3.25. Key Server Preferences
(N octets of flags) (N octets of flags)
This is a list of one-bit flags that indicate preferences that the This is a list of 1-bit flags that indicates preferences that the
keyholder has about how the key is handled on a key server. All keyholder has about how the key is handled on a key server. All
undefined flags MUST be zero. undefined flags MUST be zero.
+=========+===========+===========================================+ +=========+===========+===========================================+
| Flag | Shorthand | Definition | | Flag | Shorthand | Definition |
+=========+===========+===========================================+ +=========+===========+===========================================+
| 0x80... | No-modify | The keyholder requests that this key only | | 0x80... | No-modify | The keyholder requests that this key only |
| | | be modified or updated by the keyholder | | | | be modified or updated by the keyholder |
| | | or an administrator of the key server. | | | | or an administrator of the key server. |
+---------+-----------+-------------------------------------------+ +---------+-----------+-------------------------------------------+
Table 8: OpenPGP Key Server Preference Flags registry Table 8: OpenPGP Key Server Preference Flags Registry
This is found only on a self-signature. This is found only on a self-signature.
5.2.3.26. Preferred Key Server 5.2.3.26. Preferred Key Server
(String) (String)
This is a URI of a key server that the keyholder prefers be used for This is a URI of a key server that the keyholder prefers be used for
updates. Note that keys with multiple User IDs can have a preferred updates. Note that keys with multiple User IDs can have a Preferred
key server for each User ID. Note also that since this is a URI, the Key Server for each User ID. Note also that since this is a URI, the
key server can actually be a copy of the key retrieved by https, ftp, key server can actually be a copy of the key retrieved by https, ftp,
http, etc. http, etc.
5.2.3.27. Primary User ID 5.2.3.27. Primary User ID
(1 octet, Boolean) (1 octet, Boolean)
This is a flag in a User ID's self-signature that states whether this This is a flag in a User ID's self-signature that states whether this
User ID is the main User ID for this key. It is reasonable for an User ID is the main User ID for this key. It is reasonable for an
implementation to resolve ambiguities in preferences, for example, by implementation to resolve ambiguities in preferences, for example, by
referring to the primary User ID. If this flag is absent, its value referring to the Primary User ID. If this flag is absent, its value
is zero. If more than one User ID in a key is marked as primary, the is zero. If more than one User ID in a key is marked as primary, the
implementation may resolve the ambiguity in any way it sees fit, but implementation may resolve the ambiguity in any way it sees fit, but
it is RECOMMENDED that priority be given to the User ID with the most it is RECOMMENDED that priority be given to the User ID with the most
recent self-signature. recent self-signature.
When appearing on a self-signature on a User ID packet, this When appearing on a self-signature on a User ID packet, this
subpacket applies only to User ID packets. When appearing on a self- subpacket applies only to User ID packets. When appearing on a self-
signature on a User Attribute packet, this subpacket applies only to signature on a User Attribute packet, this subpacket applies only to
User Attribute packets. That is to say, there are two different and User Attribute packets. That is, there are two different and
independent "primaries" --- one for User IDs, and one for User independent "primaries" -- one for User IDs and one for User
Attributes. Attributes.
5.2.3.28. Policy URI 5.2.3.28. Policy URI
(String) (String)
This subpacket contains a URI of a document that describes the policy This subpacket contains a URI of a document that describes the policy
under which the signature was issued. under which the signature was issued.
5.2.3.29. Key Flags 5.2.3.29. Key Flags
(N octets of flags) (N octets of flags)
This subpacket contains a list of binary flags that hold information This subpacket contains a list of binary flags that hold information
about a key. It is a string of octets, and an implementation MUST about a key. It is a string of octets, and an implementation MUST
NOT assume a fixed size. This is so it can grow over time. If a NOT assume a fixed size, so that it can grow over time. If a list is
list is shorter than an implementation expects, the unstated flags shorter than an implementation expects, the unstated flags are
are considered to be zero. The defined flags are as follows: considered to be zero. The defined flags are as follows:
+===========+======================================================+ +===========+======================================================+
| Flag | Definition | | Flag | Definition |
+===========+======================================================+ +===========+======================================================+
| 0x01... | This key may be used to make User ID certifications | | 0x01... | This key may be used to make User ID certifications |
| | (signature type IDs 0x10-0x13) or direct key | | | (Signature Type IDs 0x10-0x13) or Direct Key |
| | signatures (signature type ID 0x1F) over other keys. | | | signatures (Signature Type ID 0x1F) over other keys. |
+-----------+------------------------------------------------------+ +-----------+------------------------------------------------------+
| 0x02... | This key may be used to sign data. | | 0x02... | This key may be used to sign data. |
+-----------+------------------------------------------------------+ +-----------+------------------------------------------------------+
| 0x04... | This key may be used to encrypt communications. | | 0x04... | This key may be used to encrypt communications. |
+-----------+------------------------------------------------------+ +-----------+------------------------------------------------------+
| 0x08... | This key may be used to encrypt storage. | | 0x08... | This key may be used to encrypt storage. |
+-----------+------------------------------------------------------+ +-----------+------------------------------------------------------+
| 0x10... | The private component of this key may have been | | 0x10... | The private component of this key may have been |
| | split by a secret-sharing mechanism. | | | split by a secret-sharing mechanism. |
+-----------+------------------------------------------------------+ +-----------+------------------------------------------------------+
| 0x20... | This key may be used for authentication. | | 0x20... | This key may be used for authentication. |
+-----------+------------------------------------------------------+ +-----------+------------------------------------------------------+
| 0x80... | The private component of this key may be in the | | 0x80... | The private component of this key may be in the |
| | possession of more than one person. | | | possession of more than one person. |
+-----------+------------------------------------------------------+ +-----------+------------------------------------------------------+
| 0x0004... | Reserved (ADSK). | | 0x0004... | Reserved (ADSK) |
+-----------+------------------------------------------------------+ +-----------+------------------------------------------------------+
| 0x0008... | Reserved (timestamping). | | 0x0008... | Reserved (timestamping) |
+-----------+------------------------------------------------------+ +-----------+------------------------------------------------------+
Table 9: OpenPGP Key Flags registry Table 9: OpenPGP Key Flags Registry
Usage notes: Usage notes:
The flags in this packet may appear in self-signatures or in The flags in this packet may appear in self-signatures or in
certification signatures. They mean different things depending on certification signatures. They mean different things depending on
who is making the statement --- for example, a certification who is making the statement. For example, a certification signature
signature that has the "sign data" flag is stating that the that has the "sign data" flag is stating that the certification is
certification is for that use. On the other hand, the for that use. On the other hand, the "communications encryption"
"communications encryption" flag in a self-signature is stating a flag in a self-signature is stating a preference that a given key be
preference that a given key be used for communications. Note used for communications. However, note that determining what is
however, that it is a thorny issue to determine what is "communications" and what is "storage" is a thorny issue. This
"communications" and what is "storage". This decision is left wholly decision is left wholly up to the implementation; the authors of this
up to the implementation; the authors of this document do not claim document do not claim any special wisdom on the issue and realize
any special wisdom on the issue and realize that accepted opinion may that accepted opinion may change.
change.
The "split key" (0x10) and "group key" (0x80) flags are placed on a The "split key" (0x10) and "group key" (0x80) flags are placed on a
self-signature only; they are meaningless on a certification self-signature only; they are meaningless on a certification
signature. They SHOULD be placed only on a direct key signature signature. They SHOULD be placed only on a Direct Key signature
(type ID 0x1F) or a subkey signature (type ID 0x18), one that refers (Type ID 0x1F) or a Subkey Binding signature (Type ID 0x18), one that
to the key the flag applies to. refers to the key the flag applies to.
When an implementation generates this subpacket, it SHOULD be marked When an implementation generates this subpacket, it SHOULD be marked
as critical. as critical.
5.2.3.30. Signer's User ID 5.2.3.30. Signer's User ID
(String) (String)
This subpacket allows a keyholder to state which User ID is This subpacket allows a keyholder to state which User ID is
responsible for the signing. Many keyholders use a single key for responsible for the signing. Many keyholders use a single key for
skipping to change at page 56, line 25 skipping to change at line 2576
personal communications. This subpacket allows such a keyholder to personal communications. This subpacket allows such a keyholder to
state which of their roles is making a signature. state which of their roles is making a signature.
This subpacket is not appropriate to use to refer to a User Attribute This subpacket is not appropriate to use to refer to a User Attribute
packet. packet.
5.2.3.31. Reason for Revocation 5.2.3.31. Reason for Revocation
(1 octet of revocation code, N octets of reason string) (1 octet of revocation code, N octets of reason string)
This subpacket is used only in key revocation and certification This subpacket is used only in Key Revocation and Certification
revocation signatures. It describes the reason why the key or Revocation signatures. It describes the reason why the key or
certification was revoked. certification was revoked.
The first octet contains a machine-readable code that denotes the The first octet contains a machine-readable code that denotes the
reason for the revocation: reason for the revocation:
+=========+==================================+ +=========+========================================+
| Code | Reason | | Code | Reason |
+=========+==================================+ +=========+========================================+
| 0 | No reason specified (key | | 0 | No reason specified (Key Revocation or |
| | revocations or cert revocations) | | | Certification Revocation signatures) |
+---------+----------------------------------+ +---------+----------------------------------------+
| 1 | Key is superseded (key | | 1 | Key is superseded (Key Revocation |
| | revocations) | | | signatures) |
+---------+----------------------------------+ +---------+----------------------------------------+
| 2 | Key material has been | | 2 | Key material has been compromised (Key |
| | compromised (key revocations) | | | Revocation signatures) |
+---------+----------------------------------+ +---------+----------------------------------------+
| 3 | Key is retired and no longer | | 3 | Key is retired and no longer used (Key |
| | used (key revocations) | | | Revocation signatures) |
+---------+----------------------------------+ +---------+----------------------------------------+
| 32 | User ID information is no longer | | 32 | User ID information is no longer valid |
| | valid (cert revocations) | | | (Certification Revocation signatures) |
+---------+----------------------------------+ +---------+----------------------------------------+
| 100-110 | Private Use | | 100-110 | Private Use |
+---------+----------------------------------+ +---------+----------------------------------------+
Table 10: OpenPGP Reason for Revocation Table 10: OpenPGP Reason for Revocation
Code registry (Revocation Octet) Registry
Following the revocation code is a string of octets that gives Following the revocation code is a string of octets that gives
information about the Reason for Revocation in human-readable form information about the Reason for Revocation in human-readable form
(UTF-8). The string may be null (of zero length). The length of the (UTF-8). The string may be null (of zero length). The length of the
subpacket is the length of the reason string plus one. An subpacket is the length of the reason string plus one. An
implementation SHOULD implement this subpacket, include it in all implementation SHOULD implement this subpacket, include it in all
revocation signatures, and interpret revocations appropriately. Revocation Signatures, and interpret revocations appropriately.
There are important semantic differences between the reasons, and There are important semantic differences between the reasons, and
there are thus important reasons for revoking signatures. there are thus important reasons for revoking signatures.
If a key has been revoked because of a compromise, all signatures If a key has been revoked because of a compromise, all signatures
created by that key are suspect. However, if it was merely created by that key are suspect. However, if it was merely
superseded or retired, old signatures are still valid. If the superseded or retired, old signatures are still valid. If the
revoked signature is the self-signature for certifying a User ID, a revoked signature is the self-signature for certifying a User ID, a
revocation denotes that that user name is no longer in use. Such a revocation denotes that that user name is no longer in use. Such a
signature revocation SHOULD include a Reason for Revocation subpacket signature revocation SHOULD include a Reason for Revocation subpacket
containing code 32. containing code 32.
Note that any signature may be revoked, including a certification on Note that any certification may be revoked, including a certification
some other person's key. There are many good reasons for revoking a on some other person's key. There are many good reasons for revoking
certification signature, such as the case where the keyholder leaves a certification signature, such as the case where the keyholder
the employ of a business with an email address. A revoked leaves the employ of a business with an email address. A revoked
certification is no longer a part of validity calculations. certification is no longer a part of validity calculations.
5.2.3.32. Features 5.2.3.32. Features
(N octets of flags) (N octets of flags)
The Features subpacket denotes which advanced OpenPGP features a The Features subpacket denotes which advanced OpenPGP features a
user's implementation supports. This is so that as features are user's implementation supports. This is so that as features are
added to OpenPGP that cannot be backwards-compatible, a user can added to OpenPGP that cannot be backward compatible, a user can state
state that they can use that feature. The flags are single bits that that they can use that feature. The flags are single bits that
indicate that a given feature is supported. indicate that a given feature is supported.
This subpacket is similar to a preferences subpacket, and only This subpacket is similar to a preferences subpacket and only appears
appears in a self-signature. in a self-signature.
An implementation SHOULD NOT use a feature listed when sending to a An implementation SHOULD NOT use a feature listed when sending to a
user who does not state that they can use it, unless the user who does not state that they can use it, unless the
implementation can infer support for the feature from another implementation can infer support for the feature from another
implementation-dependent mechanism. implementation-dependent mechanism.
Defined features are as follows: Defined features are as follows:
First octet: First octet:
+=========+===================================+===========+ +=========+=====================================+===========+
| Feature | Definition | Reference | | Feature | Definition | Reference |
+=========+===================================+===========+ +=========+=====================================+===========+
| 0x01... | Symmetrically Encrypted Integrity | Section | | 0x01... | Version 1 Symmetrically Encrypted | Section |
| | Protected Data packet version 1 | 5.13.1 | | | and Integrity Protected Data packet | 5.13.1 |
+---------+-----------------------------------+-----------+ +---------+-------------------------------------+-----------+
| 0x02... | Reserved | | | 0x02... | Reserved | |
+---------+-----------------------------------+-----------+ +---------+-------------------------------------+-----------+
| 0x04... | Reserved | | | 0x04... | Reserved | |
+---------+-----------------------------------+-----------+ +---------+-------------------------------------+-----------+
| 0x08... | Symmetrically Encrypted Integrity | Section | | 0x08... | Version 2 Symmetrically Encrypted | Section |
| | Protected Data packet version 2 | 5.13.2 | | | and Integrity Protected Data packet | 5.13.2 |
+---------+-----------------------------------+-----------+ +---------+-------------------------------------+-----------+
Table 11: OpenPGP Features Flags registry Table 11: OpenPGP Features Flags Registry
If an implementation implements any of the defined features, it If an implementation implements any of the defined features, it
SHOULD implement the Features subpacket, too. SHOULD implement the Features subpacket, too.
See Section 13.7 for details about how to use the Features subpacket See Section 13.7 for details about how to use the Features subpacket
when generating encryption data. when generating encryption data.
5.2.3.33. Signature Target 5.2.3.33. Signature Target
(1 octet public-key algorithm, 1 octet hash algorithm, N octets hash) (1 octet public key algorithm, 1 octet hash algorithm, N octets hash)
This subpacket identifies a specific target signature to which a This subpacket identifies a specific target signature to which a
signature refers. For revocation signatures, this subpacket provides signature refers. For Revocation Signatures, this subpacket provides
explicit designation of which signature is being revoked. For a explicit designation of which signature is being revoked. For a
third-party or timestamp signature, this designates what signature is Third-Party Confirmation or Timestamp signature, this designates what
signed. All arguments are an identifier of that target signature. signature is signed. All arguments are an identifier of that target
signature.
The N octets of hash data MUST be the size of the hash of the The N octets of hash data MUST be the size of the signature's hash.
signature. For example, a target signature with a SHA-1 hash MUST For example, a target signature with a SHA-1 hash MUST have 20 octets
have 20 octets of hash data. of hash data.
5.2.3.34. Embedded Signature 5.2.3.34. Embedded Signature
(1 signature packet body) (1 Signature packet body)
This subpacket contains a complete Signature packet body as specified This subpacket contains a complete Signature packet body as specified
in Section 5.2. It is useful when one signature needs to refer to, in Section 5.2. It is useful when one signature needs to refer to,
or be incorporated in, another signature. or be incorporated in, another signature.
5.2.3.35. Issuer Fingerprint 5.2.3.35. Issuer Fingerprint
(1 octet key version number, N octets of fingerprint) (1 octet key version number, N octets of fingerprint)
The OpenPGP Key fingerprint of the key issuing the signature. This The OpenPGP Key fingerprint of the key issuing the signature. This
subpacket SHOULD be included in all signatures. If the version of subpacket SHOULD be included in all signatures. If the version of
the issuing key is 4 and an Issuer Key ID subpacket the issuing key is 4 and an Issuer Key ID subpacket
(Section 5.2.3.12) is also included in the signature, the key ID of (Section 5.2.3.12) is also included in the signature, the Key ID of
the Issuer Key ID subpacket MUST match the low 64 bits of the the Issuer Key ID subpacket MUST match the low 64 bits of the
fingerprint. fingerprint.
Note that the length N of the fingerprint for a version 4 key is 20 Note that the length N of the fingerprint for a version 4 key is 20
octets; for a version 6 key N is 32. Since the version of the octets; for a version 6 key, N is 32. Since the version of the
signature is bound to the version of the key, the version octet here signature is bound to the version of the key, the version octet here
MUST match the version of the signature. If the version octet does MUST match the version of the signature. If the version octet does
not match the signature version, the receiving implementation MUST not match the signature version, the receiving implementation MUST
treat it as a malformed signature (see Section 5.2.5). treat it as a malformed signature (see Section 5.2.5).
5.2.3.36. Intended Recipient Fingerprint 5.2.3.36. Intended Recipient Fingerprint
(1 octet key version number, N octets of fingerprint) (1 octet key version number, N octets of fingerprint)
The OpenPGP Key fingerprint of the intended recipient primary key. The OpenPGP Key fingerprint of the intended recipient primary key.
If one or more subpackets of this type are included in a signature, If one or more subpackets of this type are included in a signature,
it SHOULD be considered valid only in an encrypted context, where the it SHOULD be considered valid only in an encrypted context, where the
key it was encrypted to is one of the indicated primary keys, or one key it was encrypted to is one of the indicated primary keys or one
of their subkeys. This can be used to prevent forwarding a signature of their subkeys. This can be used to prevent forwarding a signature
outside of its intended, encrypted context (see Section 13.12). outside of its intended, encrypted context (see Section 13.12).
Note that the length N of the fingerprint for a version 4 key is 20 Note that the length N of the fingerprint for a version 4 key is 20
octets; for a version 6 key N is 32. octets; for a version 6 key, N is 32.
An implementation SHOULD generate this subpacket when creating a An implementation SHOULD generate this subpacket when creating a
signed and encrypted message. signed and encrypted message.
When generating this subpacket in a v6 signature, it SHOULD be marked When generating this subpacket in a version 6 signature, it SHOULD be
as critical. marked as critical.
5.2.4. Computing Signatures 5.2.4. Computing Signatures
All signatures are formed by producing a hash over the signature All signatures are formed by producing a hash over the signature data
data, and then using the resulting hash in the signature algorithm. and then using the resulting hash in the signature algorithm.
When creating or verifying a v6 signature, the salt is fed into the When creating or verifying a version 6 signature, the salt is fed
hash context before any other data. into the hash context before any other data.
For binary document signatures (type ID 0x00), the document data is For binary document signatures (Type ID 0x00), the document data is
hashed directly. For text document signatures (type ID 0x01), the hashed directly. For text document signatures (Type ID 0x01), the
implementation MUST first canonicalize the document by converting implementation MUST first canonicalize the document by converting
line endings to <CR><LF> and encoding it in UTF-8 (see [RFC3629]). line endings to <CR><LF> and encoding it in UTF-8 (see [RFC3629]).
The resulting UTF-8 bytestream is hashed. The resulting UTF-8 byte stream is hashed.
When a v4 signature is made over a key, the hash data starts with the When a version 4 signature is made over a key, the hash data starts
octet 0x99, followed by a two-octet length of the key, and then the with the octet 0x99, followed by a 2-octet length of the key,
body of the key packet. When a v6 signature is made over a key, the followed by the body of the key packet. When a version 6 signature
hash data starts with the salt, then octet 0x9B, followed by a four- is made over a key, the hash data starts with the salt and then octet
octet length of the key, and then the body of the key packet. 0x9B, followed by a 4-octet length of the key, followed by the body
of the key packet.
A subkey binding signature (type ID 0x18) or primary key binding A Subkey Binding signature (Type ID 0x18) or Primary Key Binding
signature (type ID 0x19) then hashes the subkey using the same format signature (Type ID 0x19) then hashes the subkey using the same format
as the main key (also using 0x99 or 0x9B as the first octet). as the main key (also using 0x99 or 0x9B as the first octet).
Primary key revocation signatures (type ID 0x20) hash only the key Primary Key Revocation signatures (Type ID 0x20) hash only the key
being revoked. Subkey revocation signature (type ID 0x28) hash first being revoked. A Subkey Revocation signature (Type ID 0x28) first
the primary key and then the subkey being revoked. hashes the primary key and then the subkey being revoked.
A certification signature (type ID 0x10 through 0x13) hashes the User A Certification signature (Type IDs 0x10 through 0x13) hashes the
ID being bound to the key into the hash context after the above data. User ID that is bound to the key into the hash context after the
A v3 certification hashes the contents of the User ID or User above data. A version 3 certification hashes the contents of the
Attribute packet, without the packet header. A v4 or v6 User ID or User Attribute packet without the packet header. A
certification hashes the constant 0xB4 for User ID certifications or version 4 or version 6 certification hashes the constant 0xB4 for
the constant 0xD1 for User Attribute certifications, followed by a User ID certifications or the constant 0xD1 for User Attribute
four-octet number giving the length of the User ID or User Attribute certifications, followed by a 4-octet number giving the length of the
data, and then the User ID or User Attribute data. User ID or User Attribute data, followed by the User ID or User
Attribute data.
When a signature is made over a Signature packet (type ID 0x50, A Third-Party Confirmation signature (Type ID 0x50) hashes the salt
"Third-Party Confirmation signature"), the hash data starts with the (version 6 signatures only), followed by the octet 0x88, followed by
salt (v6 signatures only), followed by the octet 0x88, followed by the 4-octet length of the signature, and then the body of the
the four-octet length of the signature, and then the body of the
Signature packet. (Note that this is a Legacy packet header for a Signature packet. (Note that this is a Legacy packet header for a
Signature packet with the length-of-length field set to zero.) The Signature packet with the length-of-length field set to zero.) The
unhashed subpacket data of the Signature packet being hashed is not unhashed subpacket data of the Signature packet being hashed is not
included in the hash, and the unhashed subpacket data length value is included in the hash, and the unhashed subpacket data length value is
set to zero. set to zero.
Once the data body is hashed, then a trailer is hashed. This trailer Once the data body is hashed, then a trailer is hashed. This trailer
depends on the version of the signature. depends on the version of the signature.
* A v3 signature hashes five octets of the packet body, starting * A version 3 signature hashes five octets of the packet body,
from the signature type field. This data is the signature type, starting from the signature type field. This data is the
followed by the four-octet signature creation time. signature type, followed by the 4-octet Signature Creation Time.
* A v4 or v6 signature hashes the packet body starting from its * A version 4 or version 6 signature hashes the packet body starting
first field, the version number, through the end of the hashed from its first field, the version number, through the end of the
subpacket data and a final extra trailer. Thus, the hashed fields hashed subpacket data and a final extra trailer. Thus, the hashed
are: fields are:
- An octet indicating the signature version (0x04 for v4, 0x06 - an octet indicating the signature version (0x04 for version 4,
for v6), and 0x06 for version 6),
- The signature type, - the signature type,
- The public-key algorithm, - the public key algorithm,
- The hash algorithm, - the hash algorithm,
- The hashed subpacket length, - the hashed subpacket length,
- The hashed subpacket body, - the hashed subpacket body,
- A second version octet (0x04 for v4, 0x06 for v6) - a second version octet (0x04 for version 4, and 0x06 for
version 6),
- A single octet 0xFF, - a single octet 0xFF, and
- A number representing the length (in octets) of the hashed data - a number representing the length (in octets) of the hashed data
from the Signature packet through the hashed subpacket body. from the Signature packet through the hashed subpacket body.
This a four-octet big-endian unsigned integer of the length This a 4-octet big-endian unsigned integer of the length modulo
modulo 2**32. 2^32.
After all this has been hashed in a single hash context, the After all this has been hashed in a single hash context, the
resulting hash field is used in the signature algorithm and its first resulting hash field is used in the signature algorithm, and its
two octets are placed in the Signature packet, as described in first two octets are placed in the Signature packet, as described in
Section 5.2.3. Section 5.2.3.
For worked examples of the data hashed during a signature, see For worked examples of the data hashed during a signature, see
Appendix A.3.1. Appendix A.3.1.
5.2.4.1. Notes About Signature Computation 5.2.4.1. Notes about Signature Computation
The data actually hashed by OpenPGP varies depending on signature The data actually hashed by OpenPGP varies depending on the signature
version, in order to ensure that a signature made using one version version, in order to ensure that a signature made using one version
cannot be repurposed as a signature with a different version over cannot be repurposed as a signature with a different version over
subtly different data. The hashed data streams differ based on their subtly different data. The hashed data streams differ based on their
trailer, most critically in the fifth and sixth octets from the end trailer, most critically in the fifth and sixth octets from the end
of the stream. In particular: of the stream. In particular:
* A v3 signature uses the fifth octet from the end to store its * A version 3 signature uses the fifth octet from the end to store
signature type ID. This MUST NOT be signature type ID 0xFF. its Signature Type ID. This MUST NOT be Signature Type ID 0xFF.
* All signature versions later than v3 always use a literal 0xFF in * All signature versions later than version 3 always use a literal
the fifth octet from the end. For these later signature versions, 0xFF in the fifth octet from the end. For these later signature
the sixth octet from the end (the octet before the 0xFF) stores versions, the sixth octet from the end (the octet before the 0xFF)
the signature version number. stores the signature version number.
5.2.5. Malformed and Unknown Signatures 5.2.5. Malformed and Unknown Signatures
In some cases, a signature packet (or its corresponding One-Pass In some cases, a Signature packet (or its corresponding One-Pass
Signature packet, see Section 5.4) may be malformed or unknown. For Signature packet; see Section 5.4) may be malformed or unknown. For
example, it might encounter any of the following problems (this is example, it might encounter any of the following problems (this is
not an exhaustive list): not an exhaustive list):
* An unknown signature type * An unknown signature type
* An unknown signature version * An unknown signature version
* An unsupported signature version * An unsupported signature version
* An unknown "critical" subpacket (see Section 5.2.3.7) in the * An unknown "critical" subpacket (see Section 5.2.3.7) in the
hashed area hashed area
* A subpacket with a length that diverges from the expected length * A subpacket with a length that diverges from the expected length
* A hashed subpacket area with length that exceeds the length of the * A hashed subpacket area with length that exceeds the length of the
signature packet itself Signature packet itself
* A known-weak hash algorithm (e.g. MD5) * A hash algorithm known to be weak (e.g., MD5)
* A mismatch between the hash algorithm expected salt length and the * A mismatch between the expected salt length of the hash algorithm
actual salt length and the actual salt length
* A mismatch between the One-Pass Signature version and the * A mismatch between the One-Pass Signature version and the
Signature version (see Section 10.3.2.2) Signature version (see Section 10.3.2.2)
* A signature with a version other than 6, made by a v6 key * A signature with a version other than 6, made by a version 6 key
When an implementation encounters such a malformed or unknown When an implementation encounters such a malformed or unknown
signature, it MUST ignore the signature for validation purposes. It signature, it MUST ignore the signature for validation purposes. It
MUST NOT indicate a successful signature validation for such a MUST NOT indicate a successful signature validation for such a
signature. At the same time, it MUST NOT halt processing on the signature. At the same time, it MUST NOT halt processing on the
packet stream or reject other signatures in the same packet stream packet stream or reject other signatures in the same packet stream
just because an unknown or invalid signature exists. just because an unknown or invalid signature exists.
This requirement is necessary for forward-compatibility. Producing This requirement is necessary for forward compatibility. Producing
an output that indicates that no successful signatures were found is an output that indicates that no successful signatures were found is
preferable to aborting processing entirely. preferable to aborting processing entirely.
5.3. Symmetric-Key Encrypted Session Key Packet (Type ID 3) 5.3. Symmetric Key Encrypted Session Key Packet (Type ID 3)
The Symmetric-Key Encrypted Session Key (SKESK) packet holds the The Symmetric Key Encrypted Session Key (SKESK) packet holds the
symmetric-key encryption of a session key used to encrypt a message. symmetric key encryption of a session key used to encrypt a message.
Zero or more Public-Key Encrypted Session Key packets (Section 5.1) Zero or more Public Key Encrypted Session Key packets (Section 5.1)
and/or Symmetric-Key Encrypted Session Key packets precede an and/or Symmetric Key Encrypted Session Key packets precede an
encryption container (that is, a Symmetrically Encrypted Integrity encryption container (that is, a Symmetrically Encrypted and
Protected Data packet or --- for historic data --- a Symmetrically Integrity Protected Data packet or -- for historic data -- a
Encrypted Data packet) that holds an encrypted message. The message Symmetrically Encrypted Data packet) that holds an Encrypted Message.
is encrypted with a session key, and the session key is itself The message is encrypted with a session key, and the session key is
encrypted and stored in the Encrypted Session Key packet(s). itself encrypted and stored in the Encrypted Session Key packet(s).
If the encryption container is preceded by one or more Symmetric-Key If the encryption container is preceded by one or more Symmetric Key
Encrypted Session Key packets, each specifies a passphrase that may Encrypted Session Key packets, each specifies a passphrase that may
be used to decrypt the message. This allows a message to be be used to decrypt the message. This allows a message to be
encrypted to a number of public keys, and also to one or more encrypted to a number of public keys, and also to one or more
passphrases. passphrases.
The body of this packet starts with a one-octet number giving the The body of this packet starts with a 1-octet number giving the
version number of the packet type. The currently defined versions version number of the packet type. The currently defined versions
are 4 and 6. The remainder of the packet depends on the version. are 4 and 6. The remainder of the packet depends on the version.
The versions differ in how they encrypt the session key with the The versions differ in how they encrypt the session key with the
passphrase, and in what they encode. The version of the SKESK packet passphrase and in what they encode. The version of the SKESK packet
must align with the version of the SEIPD packet (see must align with the version of the SEIPD packet (see
Section 10.3.2.1). Any new version of the SKESK packet should be Section 10.3.2.1). Any new version of the SKESK packet should be
registered in the registry established in Section 10.3.2.1. registered in the registry established in Section 10.3.2.1.
5.3.1. Version 4 Symmetric-Key Encrypted Session Key Packet Format 5.3.1. Version 4 Symmetric Key Encrypted Session Key Packet Format
A version 4 Symmetric-Key Encrypted Session Key (SKESK) packet A v4 SKESK packet precedes a v1 SEIPD (see Section 5.13.1). In
precedes a version 1 Symmetrically Encrypted Integrity Protected Data historic data, it is sometimes found preceding a deprecated SED
(v1 SEIPD, see Section 5.13.1) packet. In historic data, it is packet (see Section 5.7). A v4 SKESK packet MUST NOT precede a v2
sometimes found preceding a deprecated Symmetrically Encrypted Data SEIPD packet (see Section 10.3.2.1).
packet (SED, see Section 5.7). A v4 SKESK packet MUST NOT precede a
v2 SEIPD packet (see Section 10.3.2.1).
A version 4 Symmetric-Key Encrypted Session Key packet consists of: A version 4 Symmetric Key Encrypted Session Key packet consists of:
* A one-octet version number with value 4. * A 1-octet version number with value 4.
* A one-octet number describing the symmetric algorithm used. * A 1-octet number describing the symmetric algorithm used.
* A string-to-key (S2K) specifier. The length of the string-to-key * An S2K Specifier. The length of the S2K Specifier depends on its
specifier depends on its type (see Section 3.7.1). type (see Section 3.7.1).
* Optionally, the encrypted session key itself, which is decrypted * Optionally, the encrypted session key itself, which is decrypted
with the string-to-key object. with the S2K object.
If the encrypted session key is not present (which can be detected on If the encrypted session key is not present (which can be detected on
the basis of packet length and S2K specifier size), then the S2K the basis of packet length and S2K Specifier size), then the S2K
algorithm applied to the passphrase produces the session key for algorithm applied to the passphrase produces the session key for
decrypting the message, using the symmetric cipher algorithm from the decrypting the message, using the Symmetric Cipher Algorithm ID from
Symmetric-Key Encrypted Session Key packet. the Symmetric Key Encrypted Session Key packet.
If the encrypted session key is present, the result of applying the If the encrypted session key is present, the result of applying the
S2K algorithm to the passphrase is used to decrypt just that S2K algorithm to the passphrase is used to decrypt just that
encrypted session key field, using CFB mode with an IV of all zeros. encrypted session key field, using CFB mode with an IV of all zeros.
The decryption result consists of a one-octet algorithm identifier The decryption result consists of a 1-octet algorithm identifier that
that specifies the symmetric-key encryption algorithm used to encrypt specifies the symmetric key encryption algorithm used to encrypt the
the following encryption container, followed by the session key following encryption container, followed by the session key octets
octets themselves. themselves.
Note: because an all-zero IV is used for this decryption, the S2K Note: because an all-zero IV is used for this decryption, the S2K
specifier MUST use a salt value, either a Salted S2K, an Iterated- Specifier MUST use a salt value, a Salted S2K, an Iterated and Salted
Salted S2K, or Argon2. The salt value will ensure that the S2K, or Argon2. The salt value will ensure that the decryption key
decryption key is not repeated even if the passphrase is reused. is not repeated even if the passphrase is reused.
5.3.2. Version 6 Symmetric-Key Encrypted Session Key Packet Format 5.3.2. Version 6 Symmetric Key Encrypted Session Key Packet Format
A version 6 Symmetric-Key Encrypted Session Key (SKESK) packet A v6 SKESK packet precedes a v2 SEIPD packet (see Section 5.13.2). A
precedes a version 2 Symmetrically Encrypted Integrity Protected Data v6 SKESK packet MUST NOT precede a v1 SEIPD packet or a deprecated
(v2 SEIPD, see Section 5.13.2) packet. A v6 SKESK packet MUST NOT Symmetrically Encrypted Data packet (see Section 10.3.2.1).
precede a v1 SEIPD packet or a deprecated Symmetrically Encrypted
Data packet (see Section 10.3.2.1).
A version 6 Symmetric-Key Encrypted Session Key packet consists of: A version 6 Symmetric Key Encrypted Session Key packet consists of:
* A one-octet version number with value 6. * A 1-octet version number with value 6.
* A one-octet scalar octet count for the 5 fields following this * A 1-octet scalar octet count for the 5 fields following this
octet. octet.
* A one-octet symmetric cipher algorithm ID from Table 21. * A 1-octet Symmetric Cipher Algorithm ID (from Table 21).
* A one-octet AEAD algorithm identifier from Table 25. * A 1-octet AEAD algorithm identifier (from Table 25).
* A one-octet scalar octet count of the following field. * A 1-octet scalar octet count of the following field.
* A string-to-key (S2K) specifier. The length of the string-to-key * An S2K Specifier. The length of the S2K Specifier depends on its
specifier depends on its type (see Section 3.7.1). type (see Section 3.7.1).
* A starting initialization vector of size specified by the AEAD * A starting IV of the size specified by the AEAD algorithm.
algorithm.
* The encrypted session key itself. * The encrypted session key itself.
* An authentication tag for the AEAD mode. * An authentication tag for the AEAD mode.
A key-encryption key is derived using HKDF ([RFC5869]) with SHA256 A key-encryption key (KEK) is derived using HKDF [RFC5869] with
([RFC6234]) as the hash algorithm. The Initial Keying Material (IKM) SHA256 [RFC6234] as the hash algorithm. The Initial Keying Material
for HKDF is the key derived from S2K. No salt is used. The info (IKM) for HKDF is the key derived from S2K. No salt is used. The
parameter is comprised of the Packet Type ID in OpenPGP format info parameter is comprised of the Packet Type ID in OpenPGP format
encoding (bits 7 and 6 set, bits 5-0 carry the packet type ID), the encoding (bits 7 and 6 are set, and bits 5-0 carry the Packet Type
packet version, and the cipher-algo and AEAD-mode used to encrypt the ID), the packet version, and the cipher-algo and AEAD-mode used to
key material. encrypt the key material.
Then, the session key is encrypted using the resulting key, with the Then, the session key is encrypted using the resulting key, with the
AEAD algorithm specified for version 2 of the Symmetrically Encrypted AEAD algorithm specified for the version 2 Symmetrically Encrypted
Integrity Protected Data packet. Note that no chunks are used and and Integrity Protected Data packet. Note that no chunks are used
that there is only one authentication tag. The Packet Type ID and that there is only one authentication tag. The Packet Type ID
encoded in OpenPGP format (bits 7 and 6 set, bits 5-0 carry the encoded in OpenPGP format (bits 7 and 6 are set, and bits 5-0 carry
packet type ID), the packet version number, the cipher algorithm ID, the Packet Type ID), the packet version number, the cipher algorithm
and the AEAD algorithm ID are given as additional data. For example, ID, and the AEAD algorithm ID are given as additional data. For
the additional data used with AES-128 with OCB consists of the octets example, the additional data used with AES-128 with OCB consists of
0xC3, 0x06, 0x07, and 0x02. the octets 0xC3, 0x06, 0x07, and 0x02.
5.4. One-Pass Signature Packet (Type ID 4) 5.4. One-Pass Signature Packet (Type ID 4)
The One-Pass Signature packet precedes the signed data and contains The One-Pass Signature packet precedes the signed data and contains
enough information to allow the receiver to begin calculating any enough information to allow the receiver to begin calculating any
hashes needed to verify the signature. It allows the Signature hashes needed to verify the signature. It allows the Signature
packet to be placed at the end of the message, so that the signer can packet to be placed at the end of the message so that the signer can
compute the entire signed message in one pass. compute the entire signed message in one pass.
The body of this packet consists of: The body of this packet consists of:
* A one-octet version number. The currently defined versions are 3 * A 1-octet version number. The currently defined versions are 3
and 6. Any new One-Pass Signature packet version should be and 6. Any new One-Pass Signature packet version should be
registered in the registry established in Section 10.3.2.2. registered in the registry established in Section 10.3.2.2.
* A one-octet signature type ID. Signature types are described in * A 1-octet Signature Type ID. Signature types are described in
Section 5.2.1. Section 5.2.1.
* A one-octet number describing the hash algorithm used. * A 1-octet number describing the hash algorithm used.
* A one-octet number describing the public-key algorithm used. * A 1-octet number describing the public key algorithm used.
* Only for v6 packets, a variable-length field containing: * Only for version 6 packets, a variable-length field containing:
- A one-octet salt size. The value MUST match the value defined - A 1-octet salt size. The value MUST match the value defined
for the hash algorithm as specified in Table 23. for the hash algorithm as specified in Table 23.
- The salt; a random value of the specified size. The value MUST - The salt; a random value of the specified size. The value MUST
match the salt field of the corresponding Signature packet. match the salt field of the corresponding Signature packet.
* Only for v3 packets, an eight-octet number holding the Key ID of * Only for v3 packets, an 8-octet number holding the Key ID of the
the signing key. signing key.
* Only for v6 packets, 32 octets of the fingerprint of the signing * Only for version 6 packets, 32 octets of the fingerprint of the
key. Since a v6 signature can only be made by a v6 key, the signing key. Since a version 6 signature can only be made by a
length of the fingerprint is fixed. version 6 key, the length of the fingerprint is fixed.
* A one-octet number holding a flag showing whether the signature is * A 1-octet number holding a flag showing whether the signature is
nested. A zero value indicates that the next packet is another nested. A zero value indicates that the next packet is another
One-Pass Signature packet that describes another signature to be One-Pass Signature packet that describes another signature to be
applied to the same message data. applied to the same message data.
When generating a one-pass signature, the OPS packet version MUST When generating a one-pass signature, the OPS packet version MUST
correspond to the version of the associated signature packet, except correspond to the version of the associated Signature packet, except
for the historical accident that v4 keys use a v3 one-pass signature for the historical accident that version 4 keys use a version 3 One-
packet (there is no v4 OPS). See Section 10.3.2.2 for the full Pass Signature packet (there is no version 4 OPS). See
correspondence of versions between Keys, Signatures, and One-Pass Section 10.3.2.2 for the full correspondence of versions between
Signatures. Keys, Signatures, and One-Pass Signatures.
Note that if a message contains more than one one-pass signature, Note that if a message contains more than one one-pass signature,
then the Signature packets bracket the message; that is, the first then the Signature packets bracket the message; that is, the first
Signature packet after the message corresponds to the last one-pass Signature packet after the message corresponds to the last One-Pass
packet and the final Signature packet corresponds to the first one- Signature packet and the final Signature packet corresponds to the
pass packet. first One-Pass Signature packet.
5.5. Key Material Packets 5.5. Key Material Packets
A key material packet contains all the information about a public or A key material packet contains all the information about a public or
private key. There are four variants of this packet type, two major private key. There are four variants of this packet type: two major
versions (versions 4 and 6), and two strongly deprecated versions versions (versions 4 and 6) and two strongly deprecated versions
(versions 2 and 3). Consequently, this section is complex. (versions 2 and 3). Consequently, this section is complex.
For historical reasons, versions 1 and 5 of the key packets are For historical reasons, versions 1 and 5 of the key packets are
unspecified. unspecified.
5.5.1. Key Packet Variants 5.5.1. Key Packet Variants
5.5.1.1. Public-Key Packet (Type ID 6) 5.5.1.1. Public Key Packet (Type ID 6)
A Public-Key packet starts a series of packets that forms an OpenPGP A Public Key packet starts a series of packets that forms an OpenPGP
key (sometimes called an OpenPGP certificate). Key (sometimes called an OpenPGP certificate).
5.5.1.2. Public-Subkey Packet (Type ID 14) 5.5.1.2. Public Subkey Packet (Type ID 14)
A Public-Subkey packet (type ID 14) has exactly the same format as a A Public Subkey packet (Type ID 14) has exactly the same format as a
Public-Key packet, but denotes a subkey. One or more subkeys may be Public Key packet, but it denotes a subkey. One or more subkeys may
associated with a top-level key. By convention, the top-level key be associated with a top-level key. By convention, the top-level key
offers certification capability, but does not provide encryption offers certification capability, but it does not provide encryption
services, while a dedicated subkey provides encryption (see services, while a dedicated subkey provides encryption (see
Section 10.1.5). Section 10.1.5).
5.5.1.3. Secret-Key Packet (Type ID 5) 5.5.1.3. Secret Key Packet (Type ID 5)
A Secret-Key packet contains all the information that is found in a A Secret Key packet contains all the information that is found in a
Public-Key packet, including the public-key material, but also Public Key packet, including the public key material, but it also
includes the secret-key material after all the public-key fields. includes the secret key material after all the public key fields.
5.5.1.4. Secret-Subkey Packet (Type ID 7) 5.5.1.4. Secret Subkey Packet (Type ID 7)
A Secret-Subkey packet (type ID 7) is the subkey analog of the A Secret Subkey packet (Type ID 7) is the subkey analog of the Secret
Secret-Key packet and has exactly the same format. Key packet and has exactly the same format.
5.5.2. Public-Key Packet Formats 5.5.2. Public Key Packet Formats
There are four versions of key-material packets. The V2 and V3 There are four versions of key material packets. Versions 2 and 3
versions have been deprecated since 1998. The V4 version has been have been deprecated since 1998. Version 4 has been deprecated by
deprecated by this document in 2023. this document.
OpenPGP implementations SHOULD create keys with version 6 format. V4 OpenPGP implementations SHOULD create keys with version 6 format.
keys are deprecated; an implementation SHOULD NOT generate a v4 key, Version 4 keys are deprecated; an implementation SHOULD NOT generate
but SHOULD accept it. V3 keys are deprecated; an implementation MUST a version 4 key but SHOULD accept it. Version 3 keys are deprecated;
NOT generate a v3 key, but MAY accept it. V2 keys are deprecated; an an implementation MUST NOT generate a version 3 key but MAY accept
implementation MUST NOT generate a v2 key, but MAY accept it. it. Version 2 keys are deprecated; an implementation MUST NOT
generate a version 2 key but MAY accept it.
Any new Key version must be registered in the registry established in Any new Key Version must be registered in the registry established in
Section 10.3.2.2. Section 10.3.2.2.
5.5.2.1. Version 3 Public Keys 5.5.2.1. Version 3 Public Keys
V2 keys are identical to v3 keys except for the version number. A Version 2 keys are identical to version 3 keys except for the version
version 3 public key or public-subkey packet contains: number. A version 3 Public Key or Public Subkey packet contains:
* A one-octet version number (3). * A 1-octet version number (3).
* A four-octet number denoting the time that the key was created. * A 4-octet number denoting the time that the key was created.
* A two-octet number denoting the time in days that this key is * A 2-octet number denoting the time in days that the key is valid.
valid. If this number is zero, then it does not expire. If this number is zero, then it does not expire.
* A one-octet number denoting the public-key algorithm of this key. * A 1-octet number denoting the public key algorithm of the key.
* A series of multiprecision integers comprising the key material: * A series of multiprecision integers comprising the key material:
- A multiprecision integer (MPI) of RSA public modulus n; - MPI of RSA public modulus n.
- An MPI of RSA public encryption exponent e. - MPI of RSA public encryption exponent e.
V3 keys are deprecated. They contain three weaknesses. First, it is Version 3 keys are deprecated. They contain three weaknesses.
relatively easy to construct a v3 key that has the same Key ID as any First, it is relatively easy to construct a version 3 key that has
other key because the Key ID is simply the low 64 bits of the public the same Key ID as any other key because the Key ID is simply the low
modulus. Secondly, because the fingerprint of a v3 key hashes the 64 bits of the public modulus. Second, because the fingerprint of a
key material, but not its length, there is an increased opportunity version 3 key hashes the key material, but not its length, there is
for fingerprint collisions. Third, there are weaknesses in the MD5 an increased opportunity for fingerprint collisions. Third, there
hash algorithm that make developers prefer other algorithms. See are weaknesses in the MD5 hash algorithm that cause developers to
Section 5.5.4 for a fuller discussion of Key IDs and fingerprints. prefer other algorithms. See Section 5.5.4 for a fuller discussion
of Key IDs and fingerprints.
5.5.2.2. Version 4 Public Keys 5.5.2.2. Version 4 Public Keys
The version 4 format is similar to the version 3 format except for The version 4 format is similar to the version 3 format except for
the absence of a validity period. This has been moved to the the absence of a validity period. This has been moved to the
Signature packet. In addition, fingerprints of version 4 keys are Signature packet. In addition, fingerprints of version 4 keys are
calculated differently from version 3 keys, as described in calculated differently from version 3 keys, as described in
Section 5.5.4. Section 5.5.4.
A version 4 packet contains: A version 4 packet contains:
* A one-octet version number (4). * A 1-octet version number (4).
* A four-octet number denoting the time that the key was created. * A 4-octet number denoting the time that the key was created.
* A one-octet number denoting the public-key algorithm of this key. * A 1-octet number denoting the public key algorithm of the key.
* A series of values comprising the key material. This is * A series of values comprising the key material. This is algorithm
algorithm-specific and described in Section 5.5.5. specific and described in Section 5.5.5.
5.5.2.3. Version 6 Public Keys 5.5.2.3. Version 6 Public Keys
The version 6 format is similar to the version 4 format except for The version 6 format is similar to the version 4 format except for
the addition of a count for the key material. This count helps the addition of a count for the key material. This count helps
parsing secret key packets (which are an extension of the public key parsing Secret Key packets (which are an extension of the Public Key
packet format) in the case of an unknown algorithm. In addition, packet format) in the case of an unknown algorithm. In addition,
fingerprints of version 6 keys are calculated differently from fingerprints of version 6 keys are calculated differently from
version 4 keys, as described in Section 5.5.4. version 4 keys, as described in Section 5.5.4.
A version 6 packet contains: A version 6 packet contains:
* A one-octet version number (6). * A 1-octet version number (6).
* A four-octet number denoting the time that the key was created. * A 4-octet number denoting the time that the key was created.
* A one-octet number denoting the public-key algorithm of this key. * A 1-octet number denoting the public key algorithm of the key.
* A four-octet scalar octet count for the following public key * A 4-octet scalar octet count for the public key material specified
material. in the next field.
* A series of values comprising the public key material. This is * A series of values comprising the public key material. This is
algorithm-specific and described in Section 5.5.5. algorithm specific and described in Section 5.5.5.
5.5.3. Secret-Key Packet Formats 5.5.3. Secret Key Packet Formats
The Secret-Key and Secret-Subkey packets contain all the data of the The Secret Key and Secret Subkey packets contain all the data of the
Public-Key and Public-Subkey packets, with additional algorithm- Public Key and Public Subkey packets, with additional algorithm-
specific secret-key data appended, usually in encrypted form. specific secret key data appended, usually in encrypted form.
The packet contains: The packet contains:
* The fields of a Public-Key or Public-Subkey packet, as described * The fields of a Public Key or Public Subkey packet, as described
above. above.
* One octet (the "S2K usage octet") indicating whether and how the * One octet (the "S2K usage octet") indicating whether and how the
secret key material is protected by a passphrase. Zero indicates secret key material is protected by a passphrase. Zero indicates
that the secret-key data is not encrypted. 255 (MalleableCFB), 254 that the secret key data is not encrypted. 253 (AEAD), 254 (CFB),
(CFB), or 253 (AEAD) indicates that a string-to-key specifier and or 255 (MalleableCFB) indicates that an S2K Specifier and other
other parameters will follow. Any other value is a symmetric-key parameters will follow. Any other value is a symmetric key
encryption algorithm identifier. A version 6 packet MUST NOT use encryption algorithm identifier. A version 6 packet MUST NOT use
the value 255 (MalleableCFB). the value 255 (MalleableCFB).
* Only for a version 6 packet where the secret key material is * Only for a version 6 packet where the secret key material is
encrypted (that is, where the previous octet is not zero), a one- encrypted (that is, where the previous octet is not zero), a
octet scalar octet count of the cumulative length of all the 1-octet scalar octet count of the cumulative length of all the
following conditionally included string-to-key parameter fields. following conditionally included S2K parameter fields.
* Conditionally included string-to-key parameter fields: * Conditionally included S2K parameter fields:
- If string-to-key usage octet was 255, 254, or 253, a one-octet - If the S2K usage octet was 253, 254, or 255, a 1-octet
symmetric encryption algorithm. symmetric key encryption algorithm.
- If string-to-key usage octet was 253 (AEAD), a one-octet AEAD - If the S2K usage octet was 253 (AEAD), a 1-octet AEAD
algorithm. algorithm.
- Only for a version 6 packet, and if string-to-key usage octet - Only for a version 6 packet, and if the S2K usage octet was 253
was 254, or 253, a one-octet count of the size of the one field or 254, a 1-octet count of the size of the one field following
following this octet. this octet.
- If string-to-key usage octet was 255, 254, or 253, a string-to- - If the S2K usage octet was 253, 254, or 255, an S2K Specifier.
key (S2K) specifier. The length of the string-to-key specifier The length of the S2K Specifier depends on its type (see
depends on its type (see Section 3.7.1). Section 3.7.1).
- If string-to-key usage octet was 253 (AEAD), an initialization - If the S2K usage octet was 253 (AEAD), an IV of a size
vector (IV) of size specified by the AEAD algorithm (see specified by the AEAD algorithm (see Section 5.13.2), which is
Section 5.13.2), which is used as the nonce for the AEAD used as the nonce for the AEAD algorithm.
algorithm.
- If string-to-key usage octet was 255, 254, or a cipher - If the S2K usage octet was 254, 255, or a cipher algorithm ID
algorithm ID (that is, the secret data uses some form of CFB (that is, the secret data uses some form of CFB encryption), an
encryption), an initialization vector (IV) of the same length IV of the same length as the cipher's block size.
as the cipher's block size.
* Plain or encrypted multiprecision integers comprising the secret * Plain or encrypted multiprecision integers comprising the secret
key data. This is algorithm-specific and described in key data. This is algorithm specific and described in
Section 5.5.5. If the string-to-key usage octet is 253 (AEAD), Section 5.5.5. If the S2K usage octet is 253 (AEAD), then an AEAD
then an AEAD authentication tag is at the end of that data. If authentication tag is at the end of that data. If the S2K usage
the string-to-key usage octet is 254 (CFB), a 20-octet SHA-1 hash octet is 254 (CFB), a 20-octet SHA-1 hash of the plaintext of the
of the plaintext of the algorithm-specific portion is appended to algorithm-specific portion is appended to plaintext and encrypted
plaintext and encrypted with it. If the string-to-key usage octet with it. If the S2K usage octet is 255 (MalleableCFB) or another
is 255 (MalleableCFB) or another nonzero value (that is, a non-zero value (that is, a symmetric key encryption algorithm
symmetric-key encryption algorithm identifier), a two-octet identifier), a 2-octet checksum of the plaintext of the algorithm-
checksum of the plaintext of the algorithm-specific portion (sum specific portion (sum of all octets, mod 65536) is appended to
of all octets, mod 65536) is appended to plaintext and encrypted plaintext and encrypted with it. (This is deprecated and SHOULD
with it. (This is deprecated and SHOULD NOT be used, see below.) NOT be used; see below.)
* Only for a version 3 or 4 packet where the string-to-key usage * Only for a version 3 or 4 packet where the S2K usage octet is
octet is zero, a two-octet checksum of the algorithm-specific zero, a 2-octet checksum of the algorithm-specific portion (sum of
portion (sum of all octets, mod 65536). all octets, mod 65536).
The details about storing algorithm-specific secrets above are The details about storing algorithm-specific secrets above are
summarized in Table 2. summarized in Table 2.
Note that the version 6 packet format adds two count values to help Note that the version 6 packet format adds two count values to help
parsing packets with unknown S2K or public key algorithms. parsing packets with unknown S2K or public key algorithms.
Secret MPI values can be encrypted using a passphrase. If a string- Secret MPI values can be encrypted using a passphrase. If an S2K
to-key specifier is given, that describes the algorithm for Specifier is given, it describes the algorithm for converting the
converting the passphrase to a key, else a simple MD5 hash of the passphrase to a key; otherwise, a simple MD5 hash of the passphrase
passphrase is used. An implementation producing a passphrase- is used. An implementation producing a passphrase-protected Secret
protected secret key packet MUST use a string-to-key specifier; the Key packet MUST use an S2K Specifier; the simple hash is for read-
simple hash is for read-only backward compatibility, though only backward compatibility, though implementations MAY continue to
implementations MAY continue to use existing private keys in the old use existing private keys in the old format. The cipher for
format. The cipher for encrypting the MPIs is specified in the encrypting the MPIs is specified in the Secret Key packet.
Secret-Key packet.
Encryption/decryption of the secret data is done using the key Encryption/decryption of the secret data is done using the key
created from the passphrase and the initialization vector from the created from the passphrase and the IV from the packet. If the S2K
packet. If the string-to-key usage octet is not 253, CFB mode is usage octet is not 253, CFB mode is used. A different mode is used
used. A different mode is used with v3 keys (which are only RSA) with version 3 keys (which are only RSA) than with other key formats.
than with other key formats. With v3 keys, the MPI bit count prefix With version 3 keys, the MPI bit count prefix (that is, the first two
(that is, the first two octets) is not encrypted. Only the MPI non- octets) is not encrypted. Only the MPI non-prefix data is encrypted.
prefix data is encrypted. Furthermore, the CFB state is Furthermore, the CFB state is resynchronized at the beginning of each
resynchronized at the beginning of each new MPI value, so that the new MPI value so that the CFB block boundary is aligned with the
CFB block boundary is aligned with the start of the MPI data. start of the MPI data.
With v4 and v6 keys, a simpler method is used. All secret MPI values With version 4 and version 6 keys, a simpler method is used. All
are encrypted, including the MPI bitcount prefix. secret MPI values are encrypted, including the MPI bit count prefix.
If the string-to-key usage octet is 253, the key encryption key is If the S2K usage octet is 253, the KEK is derived using HKDF
derived using HKDF ([RFC5869]) to provide key separation. SHA256 [RFC5869] to provide key separation. SHA256 [RFC6234] is used as the
([RFC6234]) is used as the hash algorithm for HKDF. The Initial hash algorithm for HKDF. IKM for HKDF is the key derived from S2K.
Keying Material (IKM) for HKDF is the key derived from S2K. No salt No salt is used. The info parameter is comprised of the Packet Type
is used. The info parameter is comprised of the Packet Type ID ID encoded in OpenPGP format (bits 7 and 6 are set, and bits 5-0
encoded in OpenPGP format (bits 7 and 6 set, bits 5-0 carry the carry the Packet Type ID), the packet version, and the cipher-algo
packet type ID), the packet version, and the cipher-algo and AEAD- and AEAD-mode used to encrypt the key material.
mode used to encrypt the key material.
Then, the encrypted MPI values are encrypted as one combined Then, the encrypted MPI values are encrypted as one combined
plaintext using one of the AEAD algorithms specified for version 2 of plaintext using one of the AEAD algorithms specified for the version
the Symmetrically Encrypted Integrity Protected Data packet. Note 2 Symmetrically Encrypted and Integrity Protected Data packet. Note
that no chunks are used and that there is only one authentication that no chunks are used and that there is only one authentication
tag. As additional data, the Packet Type ID in OpenPGP format tag. As additional data, the Packet Type ID in OpenPGP format
encoding (bits 7 and 6 set, bits 5-0 carry the packet type ID), encoding (bits 7 and 6 are set, and bits 5-0 carry the Packet Type
followed by the public key packet fields, starting with the packet ID), followed by the Public Key packet fields, starting with the
version number, are passed to the AEAD algorithm. For example, the packet version number, are passed to the AEAD algorithm. For
additional data used with a Secret-Key packet of version 4 consists example, the additional data used with a Secret Key packet of version
of the octets 0xC5, 0x04, followed by four octets of creation time, 4 consists of the octets 0xC5, 0x04, followed by four octets of
one octet denoting the public-key algorithm, and the algorithm- creation time, one octet denoting the public key algorithm, and the
specific public-key parameters. For a Secret-Subkey packet, the algorithm-specific public key parameters. For a Secret Subkey
first octet would be 0xC7. For a version 6 key packet, the second packet, the first octet would be 0xC7. For a version 6 key packet,
octet would be 0x06, and the four-octet octet count of the public key the second octet would be 0x06, and the 4-octet octet count of the
material would be included as well (see Section 5.5.2). public key material would be included as well (see Section 5.5.2).
The two-octet checksum that follows the algorithm-specific portion is The 2-octet checksum that follows the algorithm-specific portion is
the algebraic sum, mod 65536, of the plaintext of all the algorithm- the algebraic sum, mod 65536, of the plaintext of all the algorithm-
specific octets (including MPI prefix and data). With v3 keys, the specific octets (including the MPI prefix and data). With version 3
checksum is stored in the clear. With v4 keys, the checksum is keys, the checksum is stored in the clear. With version 4 keys, the
encrypted like the algorithm-specific data. This value is used to checksum is encrypted like the algorithm-specific data. This value
check that the passphrase was correct. However, this checksum is is used to check that the passphrase was correct. However, this
deprecated; an implementation SHOULD NOT use it, but should rather checksum is deprecated, and an implementation SHOULD NOT use it;
use the SHA-1 hash denoted with a usage octet of 254. The reason for instead, an implementation should use the SHA-1 hash denoted with a
this is that there are some attacks that involve undetectably usage octet of 254. The reason for this is that there are some
modifying the secret key. If the string-to-key usage octet is 253 no attacks that involve modifying the secret key undetected. If the S2K
checksum or SHA-1 hash is used but the authentication tag of the AEAD usage octet is 253, no checksum or SHA-1 hash is used, but the
algorithm follows. authentication tag of the AEAD algorithm follows.
When decrypting the secret key material using any of these schemes When decrypting the secret key material using any of these schemes
(that is, where the usage octet is non-zero), the resulting cleartext (that is, where the usage octet is non-zero), the resulting cleartext
octet stream must be well-formed. In particular, an implementation octet stream must be well formed. In particular, an implementation
MUST NOT interpret octets beyond the unwrapped cleartext octet stream MUST NOT interpret octets beyond the unwrapped cleartext octet stream
as part of any of the unwrapped MPI objects. Furthermore, an as part of any of the unwrapped MPI objects. Furthermore, an
implementation MUST reject as unusable any secret key material whose implementation MUST reject any secret key material whose cleartext
cleartext length does not align with the lengths of the unwrapped MPI length does not align with the lengths of the unwrapped MPI objects
objects. as unusable.
5.5.4. Key IDs and Fingerprints 5.5.4. Key IDs and Fingerprints
Every OpenPGP key has a fingerprint and a key ID. The computation of Every OpenPGP Key has a fingerprint and a Key ID. The computation of
these values differs based on the key version. The fingerprint these values differs based on the key version. The fingerprint
length varies with the key version, but the key ID (which is only length varies with the key version, but the Key ID (which is only
used in v3 PKESK packets, see Section 5.1.1) is always 64 bits. The used in v3 PKESK packets; see Section 5.1.1) is always 64 bits. The
following registry represents the subsections below: following registry represents the subsections below:
+=======+===================+===============+=============+=========+ +=======+===================+===============+=============+=========+
|Key | Fingerprint | Fingerprint | Key ID |Reference| |Key | Fingerprint | Fingerprint | Key ID |Reference|
|Version| | Length | | | |Version| | Length | | |
| | | (bits) | | | | | | (Bits) | | |
+=======+===================+===============+=============+=========+ +=======+===================+===============+=============+=========+
|3 | MD5(MPIs without | 128 | low 64 bits |Section | |3 | MD5(MPIs without | 128 | low 64 bits |Section |
| | length octets) | | of RSA |5.5.4.1 | | | length octets) | | of RSA |5.5.4.1 |
| | | | modulus | | | | | | modulus | |
+-------+-------------------+---------------+-------------+---------+ +-------+-------------------+---------------+-------------+---------+
|4 | SHA1(normalized | 160 | last 64 |Section | |4 | SHA1(normalized | 160 | last 64 |Section |
| | pubkey packet) | | bits of |5.5.4.2 | | | pubkey packet) | | bits of |5.5.4.2 |
| | | | fingerprint | | | | | | fingerprint | |
+-------+-------------------+---------------+-------------+---------+ +-------+-------------------+---------------+-------------+---------+
|6 | SHA256(normalized | 256 | first 64 |Section | |6 | SHA256(normalized | 256 | first 64 |Section |
| | pubkey packet) | | bits of |5.5.4.3 | | | pubkey packet) | | bits of |5.5.4.3 |
| | | | fingerprint | | | | | | fingerprint | |
+-------+-------------------+---------------+-------------+---------+ +-------+-------------------+---------------+-------------+---------+
Table 12: OpenPGP Key ID and Fingerprint registry Table 12: OpenPGP Key IDs and Fingerprints Registry
5.5.4.1. Version 3 Key ID and Fingerprint 5.5.4.1. Version 3 Key ID and Fingerprint
For a v3 key, the eight-octet Key ID consists of the low 64 bits of For a version 3 key, the 8-octet Key ID consists of the low 64 bits
the public modulus of the RSA key. of the public modulus of the RSA key.
The fingerprint of a v3 key is formed by hashing the body (but not The fingerprint of a version 3 key is formed by hashing the body (but
the two-octet length) of the MPIs that form the key material (public not the 2-octet length) of the MPIs that form the key material
modulus n, followed by exponent e) with MD5. Note that both v3 keys (public modulus n, followed by exponent e) with MD5. Note that both
and MD5 are deprecated. version 3 keys and MD5 are deprecated.
5.5.4.2. Version 4 Key ID and Fingerprint 5.5.4.2. Version 4 Key ID and Fingerprint
A v4 fingerprint is the 160-bit SHA-1 hash of the octet 0x99, A version 4 fingerprint is the 160-bit SHA-1 hash of the octet 0x99,
followed by the two-octet packet length, followed by the entire followed by the 2-octet packet length, followed by the entire Public
Public-Key packet starting with the version field. The Key ID is the Key packet starting with the version field. The Key ID is the low-
low-order 64 bits of the fingerprint. Here are the fields of the order 64 bits of the fingerprint. Here are the fields of the hash
hash material, with the example of an Ed25519 key: material, including an example of an Ed25519 key:
a.1) 0x99 (1 octet) a.1) 0x99 (1 octet)
a.2) two-octet, big-endian scalar octet count of (b)-(e) a.2) 2-octet, big-endian scalar octet count of (b)-(e)
b) version number = 4 (1 octet); b) version number = 4 (1 octet)
c) timestamp of key creation (4 octets); c) timestamp of key creation (4 octets)
d) algorithm (1 octet): 27 = Ed25519 (example); d) algorithm (1 octet): 27 = Ed25519 (example)
e) Algorithm-specific fields.
Algorithm-Specific Fields for Ed25519 keys (example): e) algorithm-specific fields
e.1) 32 octets representing the public key. Algorithm-specific fields for Ed25519 keys (example):
e.1) 32 octets representing the public key
5.5.4.3. Version 6 Key ID and Fingerprint 5.5.4.3. Version 6 Key ID and Fingerprint
A v6 fingerprint is the 256-bit SHA2-256 hash of the octet 0x9B, A version 6 fingerprint is the 256-bit SHA2-256 hash of the octet
followed by the four-octet packet length, followed by the entire 0x9B, followed by the 4-octet packet length, followed by the entire
Public-Key packet starting with the version field. The Key ID is the Public Key packet starting with the version field. The Key ID is the
high-order 64 bits of the fingerprint. Here are the fields of the high-order 64 bits of the fingerprint. Here are the fields of the
hash material, with the example of an Ed25519 key: hash material, including an example of an Ed25519 key:
a.1) 0x9B (1 octet) a.1) 0x9B (1 octet)
a.2) four-octet scalar octet count of (b)-(f) a.2) 4-octet scalar octet count of (b)-(f)
b) version number = 6 (1 octet); b) version number = 6 (1 octet)
c) timestamp of key creation (4 octets); c) timestamp of key creation (4 octets)
d) algorithm (1 octet): 27 = Ed25519 (example); d) algorithm (1 octet): 27 = Ed25519 (example)
e) four-octet scalar octet count for the following key material; e) 4-octet scalar octet count for the key material specified in the
next field
f) algorithm-specific fields. f) algorithm-specific public key material
Algorithm-Specific Fields for Ed25519 keys (example): Algorithm-specific fields for Ed25519 keys (example):
e.1) 32 octets representing the public key. f.1) 32 octets representing the public key
Note that it is possible for there to be collisions of Key IDs --- Note that it is possible for there to be collisions of Key IDs --
two different keys with the same Key ID. Note that there is a much that is, two different keys with the same Key ID. Note that there is
smaller, but still non-zero, probability that two different keys have a much smaller, but still non-zero, probability that two different
the same fingerprint. keys have the same fingerprint.
Also note that if v3, v4, and v6 format keys share the same RSA key Also note that if version 3, version 4, and version 6 format keys
material, they will have different Key IDs as well as different share the same RSA key material, they will have different Key IDs as
fingerprints. well as different fingerprints.
Finally, the Key ID and fingerprint of a subkey are calculated in the Finally, the Key ID and fingerprint of a subkey are calculated in the
same way as for a primary key, including the 0x99 (v4 key) or 0x9B same way as for a primary key, including the 0x99 (version 4 key) or
(v6 key) as the first octet (even though this is not a valid packet 0x9B (version 6 key) as the first octet (even though this is not a
type ID for a public subkey). valid Packet Type ID for a public subkey).
5.5.5. Algorithm-specific Parts of Keys 5.5.5. Algorithm-Specific Parts of Keys
The public and secret key format specifies algorithm-specific parts The public and secret key formats specify algorithm-specific parts of
of a key. The following sections describe them in detail. a key. The following sections describe them in detail.
5.5.5.1. Algorithm-Specific Part for RSA Keys 5.5.5.1. Algorithm-Specific Part for RSA Keys
The public key is this series of multiprecision integers: For RSA keys, the public key consists of this series of
multiprecision integers:
* MPI of RSA public modulus n; * MPI of RSA public modulus n,
* MPI of RSA public encryption exponent e. * MPI of RSA public encryption exponent e.
The secret key is this series of multiprecision integers: The secret key consists of this series of multiprecision integers:
* MPI of RSA secret exponent d; * MPI of RSA secret exponent d;
* MPI of RSA secret prime value p; * MPI of RSA secret prime value p;
* MPI of RSA secret prime value q (p < q); * MPI of RSA secret prime value q (p < q); and
* MPI of u, the multiplicative inverse of p, mod q. * MPI of u, the multiplicative inverse of p, mod q.
5.5.5.2. Algorithm-Specific Part for DSA Keys 5.5.5.2. Algorithm-Specific Part for DSA Keys
The public key is this series of multiprecision integers: For DSA keys, the public key consists of this series of
multiprecision integers:
* MPI of DSA prime p; * MPI of DSA prime p;
* MPI of DSA group order q (q is a prime divisor of p-1); * MPI of DSA group order q (q is a prime divisor of p-1);
* MPI of DSA group generator g; * MPI of DSA group generator g; and
* MPI of DSA public-key value y (= g**x mod p where x is secret). * MPI of DSA public key value y (= g^x mod p where x is secret).
The secret key is this single multiprecision integer: The secret key consists of this single multiprecision integer:
* MPI of DSA secret exponent x. * MPI of DSA secret exponent x.
5.5.5.3. Algorithm-Specific Part for Elgamal Keys 5.5.5.3. Algorithm-Specific Part for Elgamal Keys
The public key is this series of multiprecision integers: For Elgamal keys, the public key consists of this series of
multiprecision integers:
* MPI of Elgamal prime p; * MPI of Elgamal prime p;
* MPI of Elgamal group generator g; * MPI of Elgamal group generator g; and
* MPI of Elgamal public key value y (= g**x mod p where x is
secret).
The secret key is this single multiprecision integer: * MPI of Elgamal public key value y (= g^x mod p where x is secret).
The secret key consists of this single multiprecision integer:
* MPI of Elgamal secret exponent x. * MPI of Elgamal secret exponent x.
5.5.5.4. Algorithm-Specific Part for ECDSA Keys 5.5.5.4. Algorithm-Specific Part for ECDSA Keys
The public key is this series of values: For ECDSA keys, the public key consists of this series of values:
* A variable-length field containing a curve OID, which is formatted * A variable-length field containing a curve OID, which is formatted
as follows: as follows:
- A one-octet size of the following field; values 0 and 0xFF are - A 1-octet size of the following field; values 0 and 0xFF are
reserved for future extensions, reserved for future extensions.
- The octets representing a curve OID (defined in Section 9.2); - The octets representing a curve OID, as defined in Section 9.2.
* MPI of an EC point representing a public key. * An MPI of an EC point representing a public key.
The secret key is this single multiprecision integer: The secret key consists of this single multiprecision integer:
* MPI of an integer representing the secret key, which is a scalar * An MPI of an integer representing the secret key, which is a
of the public EC point. scalar of the public EC point.
5.5.5.5. Algorithm-Specific Part for EdDSALegacy Keys (deprecated) 5.5.5.5. Algorithm-Specific Part for EdDSALegacy Keys (Deprecated)
The public key is this series of values: For EdDSALegacy keys (deprecated), the public key consists of this
series of values:
* A variable-length field containing a curve OID, formatted as * A variable-length field containing a curve OID, formatted as
follows: follows:
- A one-octet size of the following field; values 0 and 0xFF are - A 1-octet size of the following field; values 0 and 0xFF are
reserved for future extensions, reserved for future extensions.
- The octets representing a curve OID, defined in Section 9.2; - The octets representing a curve OID, as defined in Section 9.2.
* An MPI of an EC point representing a public key Q in prefixed * An MPI of an EC point representing a public key Q in prefixed
native form (see Section 11.2.2). native form (see Section 11.2.2).
The secret key is this single multiprecision integer: The secret key consists of this single multiprecision integer:
* An MPI-encoded octet string representing the native form of the * An MPI-encoded octet string representing the native form of the
secret key, in the curve-specific format described in secret key in the curve-specific format, as described in
Section 9.2.1. Section 9.2.1.
Note that the native form for an EdDSA secret key is a fixed-width Note that the native form for an EdDSA secret key is a fixed-width
sequence of unstructured random octets, with size corresponding to sequence of unstructured random octets, with size corresponding to
the specific curve. That sequence of random octets is used with a the specific curve. That sequence of random octets is used with a
cryptographic digest to produce both a curve-specific secret scalar cryptographic digest to produce both a curve-specific secret scalar
and a prefix used when making a signature. See Section 5.1.5 of and a prefix used when making a signature. See Section 5.1.5 of
[RFC8032] for more details about how to use the native octet strings [RFC8032] for more details about how to use the native octet strings
for Ed25519Legacy. The value stored in an OpenPGP EdDSALegacy secret for Ed25519Legacy. The value stored in an OpenPGP EdDSALegacy Secret
key packet is the original sequence of random octets. Key packet is the original sequence of random octets.
Note that the only curve defined for use with EdDSALegacy is the Note that the only curve defined for use with EdDSALegacy is the
Ed25519Legacy OID. Ed25519Legacy OID.
5.5.5.6. Algorithm-Specific Part for ECDH Keys 5.5.5.6. Algorithm-Specific Part for ECDH Keys
The public key is this series of values: For ECDH keys, the public key consists of this series of values:
* A variable-length field containing a curve OID, which is formatted * A variable-length field containing a curve OID, which is formatted
as follows: as follows:
- A one-octet size of the following field; values 0 and 0xFF are - A 1-octet size of the following field; values 0 and 0xFF are
reserved for future extensions, reserved for future extensions.
- Octets representing a curve OID, defined in Section 9.2; - The octets representing a curve OID, as defined in Section 9.2.
* MPI of an EC point representing a public key, in the point format * An MPI of an EC point representing a public key, in the point
associated with the curve as specified in Section 9.2.1. format associated with the curve, as specified in Section 9.2.1.
* A variable-length field containing KDF parameters, which is * A variable-length field containing key derivation function (KDF)
formatted as follows: parameters, which is formatted as follows:
- A one-octet size of the following fields; values 0 and 0xFF are - A 1-octet size of the following fields; values 0 and 0xFF are
reserved for future extensions, reserved for future extensions.
- A one-octet value 1, reserved for future extensions, - A 1-octet value 1, reserved for future extensions.
- A one-octet hash function ID used with a KDF, - A 1-octet hash function ID used with a KDF.
- A one-octet algorithm ID for the symmetric algorithm used to - A 1-octet algorithm ID for the symmetric algorithm that is used
wrap the symmetric key used for the message encryption; see to wrap the symmetric key for message encryption; see
Section 11.5 for details. Section 11.5 for details.
The secret key is this single multiprecision integer: The secret key consists of this single multiprecision integer:
* An MPI representing the secret key, in the curve-specific format * An MPI representing the secret key, in the curve-specific format
described in Section 9.2.1. described in Section 9.2.1.
5.5.5.6.1. ECDH Secret Key Material 5.5.5.6.1. ECDH Secret Key Material
When curve NIST P-256, NIST P-384, NIST P-521, brainpoolP256r1, When curve NIST P-256, NIST P-384, NIST P-521, brainpoolP256r1,
brainpoolP384r1, or brainpoolP512r1 are used in ECDH, their secret brainpoolP384r1, or brainpoolP512r1 are used in ECDH, their secret
keys are represented as a simple integer in standard MPI form. Other keys are represented as a simple integer in standard MPI form. Other
curves are presented on the wire differently (though still as a curves are presented on the wire differently (though still as a
single MPI), as described below and in Section 9.2.1. single MPI), as described below and in Section 9.2.1.
5.5.5.6.1.1. Curve25519Legacy ECDH Secret Key Material (deprecated) 5.5.5.6.1.1. Curve25519Legacy ECDH Secret Key Material (Deprecated)
A Curve25519Legacy secret key is stored as a standard integer in big- A Curve25519Legacy secret key is stored as a standard integer in big-
endian MPI form. Curve25519Legacy MUST NOT be used in key packets endian MPI form. Curve25519Legacy MUST NOT be used in key packets
version 6 or above. Note that this form is in reverse octet order version 6 or above. Note that this form is in reverse octet order
from the little-endian "native" form found in [RFC7748]. from the little-endian "native" form found in [RFC7748].
Note also that the integer for a Curve25519Legacy secret key for Note also that the integer for a Curve25519Legacy secret key for
OpenPGP MUST have the appropriate form: that is, it MUST be divisible OpenPGP MUST have the appropriate form; that is, it MUST be divisible
by 8, MUST be at least 2**254, and MUST be less than 2**255. The by 8, MUST be at least 2^254, and MUST be less than 2^255. The
length of this MPI in bits is by definition always 255, so the two length of this MPI in bits is by definition always 255, so the two
leading octets of the MPI will always be 00 FF and reversing the leading octets of the MPI will always be 00 FF, and reversing the
following 32 octets from the wire will produce the "native" form. following 32 octets from the wire will produce the "native" form.
When generating a new Curve25519Legacy secret key from 32 fully- When generating a new Curve25519Legacy secret key from 32 fully
random octets, the following pseudocode produces the MPI wire format random octets, the following pseudocode produces the MPI wire format
(note the similarity to decodeScalar25519 from [RFC7748]): (note the similarity to decodeScalar25519 as described in [RFC7748]):
def curve25519Legacy_MPI_from_random(octet_list): def curve25519Legacy_MPI_from_random(octet_list):
octet_list[0] &= 248 octet_list[0] &= 248
octet_list[31] &= 127 octet_list[31] &= 127
octet_list[31] |= 64 octet_list[31] |= 64
mpi_header = [ 0x00, 0xFF ] mpi_header = [ 0x00, 0xFF ]
return mpi_header || reversed(octet_list) return mpi_header || reversed(octet_list)
5.5.5.7. Algorithm-Specific Part for X25519 Keys 5.5.5.7. Algorithm-Specific Part for X25519 Keys
The public key is this single value: For X25519 keys, the public key consists of this single value:
* 32 octets of the native public key. * 32 octets of the native public key.
The secret key is this single value: The secret key consists of this single value:
* 32 octets of the native secret key. * 32 octets of the native secret key.
See Section 6.1 of [RFC7748] for more details about how to use the See Section 6.1 of [RFC7748] for more details about how to use the
native octet strings. The value stored in an OpenPGP X25519 secret native octet strings. The value stored in an OpenPGP X25519 Secret
key packet is the original sequence of random octets. The value Key packet is the original sequence of random octets. The value
stored in an OpenPGP X25519 public key packet is the value stored in an OpenPGP X25519 Public Key packet is the value
X25519(secretKey, 9). X25519(secretKey, 9).
5.5.5.8. Algorithm-Specific Part for X448 Keys 5.5.5.8. Algorithm-Specific Part for X448 Keys
The public key is this single value: For X448 keys, the public key consists of this single value:
* 56 octets of the native public key. * 56 octets of the native public key.
The secret key is this single value: The secret key consists of this single value:
* 56 octets of the native secret key. * 56 octets of the native secret key.
See Section 6.2 of [RFC7748] for more details about how to use the See Section 6.2 of [RFC7748] for more details about how to use the
native octet strings. The value stored in an OpenPGP X448 secret key native octet strings. The value stored in an OpenPGP X448 Secret Key
packet is the original sequence of random octets. The value stored packet is the original sequence of random octets. The value stored
in an OpenPGP X448 public key packet is the value X448(secretKey, 5). in an OpenPGP X448 Public Key packet is the value X448(secretKey, 5).
5.5.5.9. Algorithm-Specific Part for Ed25519 Keys 5.5.5.9. Algorithm-Specific Part for Ed25519 Keys
The public key is this single value: For Ed25519 keys, the public key consists of this single value:
* 32 octets of the native public key. * 32 octets of the native public key.
The secret key is this single value: The secret key consists of this single value:
* 32 octets of the native secret key. * 32 octets of the native secret key.
See Section 5.1.5 of [RFC8032] for more details about how to use the See Section 5.1.5 of [RFC8032] for more details about how to use the
native octet strings. The value stored in an OpenPGP Ed25519 secret native octet strings. The value stored in an OpenPGP Ed25519 Secret
key packet is the original sequence of random octets. Key packet is the original sequence of random octets.
5.5.5.10. Algorithm-Specific Part for Ed448 Keys 5.5.5.10. Algorithm-Specific Part for Ed448 Keys
The public key is this single value: For Ed448 keys, the public key consists of this single value:
* 57 octets of the native public key. * 57 octets of the native public key.
The secret key is this single value: The secret key consists of this single value:
* 57 octets of the native secret key. * 57 octets of the native secret key.
See Section 5.2.5 of [RFC8032] for more details about how to use the See Section 5.2.5 of [RFC8032] for more details about how to use the
native octet strings. The value stored in an OpenPGP Ed448 secret native octet strings. The value stored in an OpenPGP Ed448 Secret
key packet is the original sequence of random octets. Key packet is the original sequence of random octets.
5.6. Compressed Data Packet (Type ID 8) 5.6. Compressed Data Packet (Type ID 8)
The Compressed Data packet contains compressed data. Typically, this The Compressed Data packet contains compressed data. Typically, this
packet is found as the contents of an encrypted packet, or following packet is found as the contents of an encrypted packet, or following
a Signature or One-Pass Signature packet, and contains a literal data a Signature or One-Pass Signature packet, and contains a Literal Data
packet. packet.
The body of this packet consists of: The body of this packet consists of:
* One octet that gives the algorithm used to compress the packet. * One octet specifying the algorithm used to compress the packet.
* Compressed data, which makes up the remainder of the packet. * Compressed data, which makes up the remainder of the packet.
A Compressed Data packet's body contains data that is a compression A Compressed Data packet's body contains data that is a compression
of a series of OpenPGP packets. See Section 10 for details on how of a series of OpenPGP packets. See Section 10 for details on how
messages are formed. messages are formed.
A ZIP-compressed series of packets is compressed into raw [RFC1951] A ZIP-compressed series of packets is compressed into raw DEFLATE
DEFLATE blocks. blocks [RFC1951].
A ZLIB-compressed series of packets is compressed with raw [RFC1950] A ZLIB-compressed series of packets is compressed with raw ZLIB-style
ZLIB-style blocks. blocks [RFC1950].
A BZip2-compressed series of packets is compressed using the BZip2 A BZip2-compressed series of packets is compressed using the BZip2
[BZ2] algorithm. [BZ2] algorithm.
An implementation that generates a Compressed Data packet MUST use An implementation that generates a Compressed Data packet MUST use
the non-legacy format for packet framing (see Section 4.2.1). It the OpenPGP format for packet framing (see Section 4.2.1). It MUST
MUST NOT generate a Compressed Data packet with Legacy format NOT generate a Compressed Data packet with Legacy format
(Section 4.2.2) (Section 4.2.2).
An implementation that deals with either historic data or data An implementation that deals with either historic data or data
generated by legacy implementations predating support for [RFC2440] generated by legacy implementations predating support for [RFC2440]
MAY interpret Compressed Data packets that use the Legacy format for MAY interpret Compressed Data packets that use the Legacy format for
packet framing. packet framing.
5.7. Symmetrically Encrypted Data Packet (Type ID 9) 5.7. Symmetrically Encrypted Data Packet (Type ID 9)
The Symmetrically Encrypted Data packet contains data encrypted with The Symmetrically Encrypted Data packet contains data encrypted with
a symmetric-key algorithm. When it has been decrypted, it contains a symmetric key algorithm. When it has been decrypted, it contains
other packets (usually a literal data packet or compressed data other packets (usually a Literal Data packet or compressed data
packet, but in theory other Symmetrically Encrypted Data packets or packet, but in theory, it could be another sequence of packets that
sequences of packets that form whole OpenPGP messages). forms a valid OpenPGP Message).
This packet is obsolete. An implementation MUST NOT create this This packet is obsolete. An implementation MUST NOT create this
packet. An implementation SHOULD reject such a packet and stop packet. An implementation SHOULD reject such a packet and stop
processing the message. If an implementation chooses to process the processing the message. If an implementation chooses to process the
packet anyway, it MUST return a clear warning that a non-integrity packet anyway, it MUST return a clear warning that a non-integrity-
protected packet has been processed. protected packet has been processed.
This packet format is impossible to handle safely in general because This packet format is impossible to handle safely in general because
the ciphertext it provides is malleable. See Section 13.7 about the ciphertext it provides is malleable. See Section 13.7 about
selecting a better OpenPGP encryption container that does not have selecting a better OpenPGP encryption container that does not have
this flaw. this flaw.
The body of this packet consists of: The body of this packet consists of:
* A random prefix, containing block-size random octets (for example, * A random prefix, containing block-size random octets (for example,
16 octets for a 128-bit block length) followed by a copy of the 16 octets for a 128-bit block length) followed by a copy of the
last two octets, encrypted together using Cipher Feedback (CFB) last two octets, encrypted together using Cipher Feedback (CFB)
mode, with an Initial Vector (IV) of all zeros. mode, with an IV of all zeros.
* Data encrypted using CFB mode, with the last block-size octets of * Data encrypted using CFB mode, with the last block-size octets of
the first ciphertext as the IV. the first ciphertext as the IV.
The symmetric cipher used may be specified in a Public-Key or The symmetric cipher used may be specified in a Public Key or
Symmetric-Key Encrypted Session Key packet that precedes the Symmetric Key Encrypted Session Key packet that precedes the
Symmetrically Encrypted Data packet. In that case, the cipher Symmetrically Encrypted Data packet. In that case, the cipher
algorithm ID is prefixed to the session key before it is encrypted. algorithm ID is prefixed to the session key before it is encrypted.
If no packets of these types precede the encrypted data, the IDEA If no packets of these types precede the encrypted data, the IDEA
algorithm is used with the session key calculated as the MD5 hash of algorithm is used with the session key calculated as the MD5 hash of
the passphrase, though this use is deprecated. the passphrase, though this use is deprecated.
The data is encrypted in CFB mode (see Section 12.9). For the random The data is encrypted in CFB mode (see Section 12.9). For the random
prefix, the Initial Vector (IV) is specified as all zeros. Instead prefix, the IV is specified as all zeros. Instead of achieving
of achieving randomized encryption through an IV, a string of length randomized encryption through an IV, a string of length equal to the
equal to the block size of the cipher plus two is encrypted for this block size of the cipher plus two is encrypted for this purpose. The
purpose. The first block-size octets (for example, 16 octets for a first block-size octets (for example, 16 octets for a 128-bit block
128-bit block length) are random, and the following two octets are length) are random, and the following two octets are copies of the
copies of the last two octets of the first block-size random octets. last two octets of the first block-size random octets. For example,
For example, for a 16-octet block length, octet 17 is a copy of octet for a 16-octet block length, octet 17 is a copy of octet 15, and
15 and octet 18 is a copy of octet 16. For a cipher of block length octet 18 is a copy of octet 16. For a cipher of block length 8,
8, octet 9 is a copy of octet 7, and octet 10 is a copy of octet 8. octet 9 is a copy of octet 7, and octet 10 is a copy of octet 8. (In
(In both these examples, we consider the first octet to be numbered both of these examples, we consider the first octet to be numbered
1.) 1.)
After encrypting these block-size-plus-two octets, a new CFB context After encrypting these block-size-plus-two octets, a new CFB context
is created for the encryption of the data, with the last block-size is created for the encryption of the data, with the last block-size
octets of the first ciphertext as the IV. (Alternatively and octets of the first ciphertext as the IV. (Alternatively and
equivalently, the CFB state is resynchronized: the last block-size equivalently, the CFB state is resynchronized: the last block-size
octets of ciphertext are passed through the cipher and the block octets of ciphertext are passed through the cipher, and the block
boundary is reset.) boundary is reset.)
The repetition of two octets in the random prefix allows the receiver The repetition of two octets in the random prefix allows the receiver
to immediately check whether the session key is incorrect. See to immediately check whether the session key is incorrect. See
Section 13.4 for hints on the proper use of this "quick check". Section 13.4 for hints on the proper use of this "quick check".
5.8. Marker Packet (Type ID 10) 5.8. Marker Packet (Type ID 10)
The body of this packet consists of: The body of the Marker packet consists of:
* The three octets 0x50, 0x47, 0x50 (which spell "PGP" in UTF-8). * The three octets 0x50, 0x47, 0x50 (which spell "PGP" in UTF-8).
Such a packet MUST be ignored when received. Such a packet MUST be ignored when received.
5.9. Literal Data Packet (Type ID 11) 5.9. Literal Data Packet (Type ID 11)
A Literal Data packet contains the body of a message; data that is A Literal Data packet contains the body of a message; that is, data
not to be further interpreted. that is not to be further interpreted.
The body of this packet consists of: The body of this packet consists of:
* A one-octet field that describes how the data is formatted. * A 1-octet field that describes how the data is formatted.
If it is a b (0x62), then the Literal packet contains binary data. If it is a b (0x62), then the Literal Data packet contains binary
If it is a u (0x75), then the Literal packet contains UTF- data. If it is a u (0x75), then the Literal Data packet contains
8-encoded text data, and thus may need line ends converted to UTF-8-encoded text data and thus may need line ends converted to
local form, or other text mode changes. local form or other text mode changes.
Older versions of OpenPGP used t (0x74) to indicate textual data, Previous versions of the OpenPGP specification used t (0x74) to
but did not specify the character encoding. Implementations indicate textual data but did not specify the character encoding.
SHOULD NOT emit this value. An implementation that receives a Implementations SHOULD NOT emit this value. An implementation
literal data packet with this value in the format field SHOULD that receives a Literal Data packet with this value in the format
interpret the packet data as UTF-8 encoded text, unless reliable field SHOULD interpret the packet data as UTF-8 encoded text,
(not attacker-controlled) context indicates a specific alternate unless reliable (not attacker-controlled) context indicates a
text encoding. This mode is deprecated due to its ambiguity. specific alternate text encoding. This mode is deprecated due to
its ambiguity.
Some implementations predating [RFC2440] also defined a value of l Some implementations predating [RFC2440] also defined a value of l
as a 'local' mode for machine-local conversions. [RFC1991] as a "local" mode for machine-local conversions. [RFC1991]
incorrectly stated this local mode flag as 1 (ASCII numeral one). incorrectly states that this local mode flag is 1 (ASCII numeral
Both of these local modes are deprecated. one). Both of these local modes are deprecated.
* File name as a string (one-octet length, followed by a file name). * The file name as a string (1-octet length, followed by a file
This may be a zero-length string. Commonly, if the source of the name). This may be a zero-length string. Commonly, if the source
encrypted data is a file, this will be the name of the encrypted of the encrypted data is a file, it will be the name of the
file. An implementation MAY consider the file name in the Literal encrypted file. An implementation MAY consider the file name in
packet to be a more authoritative name than the actual file name. the Literal Data packet to be a more authoritative name than the
actual file name.
* A four-octet number that indicates a date associated with the * A 4-octet number that indicates a date associated with the literal
literal data. Commonly, the date might be the modification date data. Commonly, the date might be the modification date of a
of a file, or the time the packet was created, or a zero that file, or the time the packet was created, or a zero that indicates
indicates no specific time. no specific time.
* The remainder of the packet is literal data. * The remainder of the packet is literal data.
Text data MUST be encoded with UTF-8 (see [RFC3629]) and stored Text data MUST be encoded with UTF-8 (see [RFC3629]) and stored
with <CR><LF> text endings (that is, network-normal line endings). with <CR><LF> text endings (that is, network-normal line endings).
These should be converted to native line endings by the receiving These should be converted to native line endings by the receiving
implementation. implementation.
Note that OpenPGP signatures do not include the formatting octet, the Note that OpenPGP signatures do not include the formatting octet, the
file name, and the date field of the literal packet in a signature file name, and the date field of the Literal Data packet in a
hash and thus those fields are not protected against tampering in a signature hash; therefore, those fields are not protected against
signed document. A receiving implementation MUST NOT treat those tampering in a signed document. A receiving implementation MUST NOT
fields as though they were cryptographically secured by the treat those fields as though they were cryptographically secured by
surrounding signature either when representing them to the user or the surrounding signature when either representing them to the user
acting on them. or acting on them.
Due to their inherent malleability, an implementation that generates Due to their inherent malleability, an implementation that generates
a literal data packet SHOULD avoid storing any significant data in a Literal Data packet SHOULD avoid storing any significant data in
these fields. If the implementation is certain that the data is these fields. If the implementation is certain that the data is
textual and is encoded with UTF-8 (for example, if it will follow textual and is encoded with UTF-8 (for example, if it will follow
this literal data packet with a signature packet of type 0x01 (see this Literal Data packet with a Signature packet of type 0x01 (see
Section 5.2.1), it MAY set the format octet to u. Otherwise, it MUST Section 5.2.1), it MAY set the format octet to u. Otherwise, it MUST
set the format octet to b. It SHOULD set the filename to the empty set the format octet to b. It SHOULD set the filename to the empty
string (encoded as a single zero octet), and the timestamp to zero string (encoded as a single zero octet) and the timestamp to zero
(encoded as four zero octets). (encoded as four zero octets).
An application that wishes to include such filesystem metadata within An application that wishes to include such filesystem metadata within
a signature is advised to sign an encapsulated archive (for example, a signature is advised to sign an encapsulated archive (for example,
[PAX]). [PAX]).
An implementation that generates a Literal Data packet MUST use the An implementation that generates a Literal Data packet MUST use the
OpenPGP format for packet framing (see Section 4.2.1). It MUST NOT OpenPGP format for packet framing (see Section 4.2.1). It MUST NOT
generate a Literal Data packet with Legacy format (Section 4.2.2) generate a Literal Data packet with Legacy format (Section 4.2.2).
An implementation that deals with either historic data or data An implementation that deals with either historic data or data
generated by an implementation that predates support for [RFC2440] generated by an implementation that predates support for [RFC2440]
MAY interpret Literal Data packets that use the Legacy format for MAY interpret Literal Data packets that use the Legacy format for
packet framing. packet framing.
5.9.1. Special Filename _CONSOLE (Deprecated) 5.9.1. Special Filename _CONSOLE (Deprecated)
The Literal Data packet's filename field has a historical special The Literal Data packet's filename field has a historical special
case for the special name _CONSOLE. When the filename field is case for the special name _CONSOLE. When the filename field is
_CONSOLE, the message is considered to be "for your eyes only". This _CONSOLE, the message is considered to be "for your eyes only". This
advises that the message data is unusually sensitive, and the advises that the message data is unusually sensitive, and the
receiving program should process it more carefully, perhaps avoiding receiving program should process it more carefully, perhaps avoiding
storing the received data to disk, for example. storing the received data to disk, for example.
An OpenPGP deployment that generates literal data packets MUST NOT An OpenPGP deployment that generates Literal Data packets MUST NOT
depend on this indicator being honored in any particular way. It depend on this indicator being honored in any particular way. It
cannot be enforced, and the field itself is not covered by any cannot be enforced, and the field itself is not covered by any
cryptographic signature. cryptographic signature.
It is NOT RECOMMENDED to use this special filename in a newly- It is NOT RECOMMENDED to use this special filename in a newly
generated literal data packet. generated Literal Data packet.
5.10. Trust Packet (Type ID 12) 5.10. Trust Packet (Type ID 12)
The Trust packet is used only within keyrings and is not normally The Trust packet is used only within keyrings and is not normally
exported. Trust packets contain data that record the user's exported. Trust packets contain data that record the user's
specifications of which keyholders are trustworthy introducers, along specifications of which keyholders are trustworthy introducers, along
with other information that implementation uses for trust with other information that implementation uses for trust
information. The format of Trust packets is defined by a given information. The format of Trust packets is defined by a given
implementation. implementation.
Trust packets SHOULD NOT be emitted to output streams that are Trust packets SHOULD NOT be emitted to output streams that are
transferred to other users, and they SHOULD be ignored on any input transferred to other users, and they SHOULD be ignored on any input
other than local keyring files. other than local keyring files.
5.11. User ID Packet (Type ID 13) 5.11. User ID Packet (Type ID 13)
A User ID packet consists of UTF-8 text that is intended to represent A User ID packet consists of UTF-8 text that is intended to represent
the name and email address of the keyholder. By convention, it the name and email address of the keyholder. By convention, it
includes an [RFC2822] mail name-addr, but there are no restrictions includes a mail name-addr as described in [RFC2822], but there are no
on its content. The packet length in the header specifies the length restrictions on its content. The packet length in the header
of the User ID. specifies the length of the User ID.
5.12. User Attribute Packet (Type ID 17) 5.12. User Attribute Packet (Type ID 17)
The User Attribute packet is a variation of the User ID packet. It The User Attribute packet is a variation of the User ID packet. It
is capable of storing more types of data than the User ID packet, is capable of storing more types of data than the User ID packet,
which is limited to text. Like the User ID packet, a User Attribute which is limited to text. Like the User ID packet, a User Attribute
packet may be certified by the key owner ("self-signed") or any other packet may be certified by the key owner ("self-signed") or any other
key owner who cares to certify it. Except as noted, a User Attribute key owner who cares to certify it. Except as noted, a User Attribute
packet may be used anywhere that a User ID packet may be used. packet may be used anywhere that a User ID packet may be used.
While User Attribute packets are not a required part of the OpenPGP While User Attribute packets are not a required part of the OpenPGP
standard, implementations SHOULD provide at least enough specification, implementations SHOULD provide at least enough
compatibility to properly handle a certification signature on the compatibility to properly handle a certification signature on the
User Attribute packet. A simple way to do this is by treating the User Attribute packet. A simple way to do this is by treating the
User Attribute packet as a User ID packet with opaque contents, but User Attribute packet as a User ID packet with opaque contents, but
an implementation may use any method desired. an implementation may use any method desired.
The User Attribute packet is made up of one or more attribute The User Attribute packet is made up of one or more attribute
subpackets. Each subpacket consists of a subpacket header and a subpackets. Each subpacket consists of a subpacket header and a
body. The header consists of: body. The header consists of:
* The subpacket length (1, 2, or 5 octets) * the subpacket length (1, 2, or 5 octets)
* The subpacket type ID (1 octet) * the Subpacket Type ID (1 octet)
and is followed by the subpacket specific data. and is followed by the subpacket specific data.
The following table lists the currently known subpackets: The following table lists the currently known subpackets:
+=========+===========================+================+ +=========+=============================+================+
| ID | Attribute Subpacket | Reference | | ID | Attribute Subpacket | Reference |
+=========+===========================+================+ +=========+=============================+================+
| 1 | Image Attribute Subpacket | Section 5.12.1 | | 0 | Reserved | |
+---------+---------------------------+----------------+ +---------+-----------------------------+----------------+
| 100-110 | Private/Experimental Use | | | 1 | Image Attribute Subpacket | Section 5.12.1 |
+---------+---------------------------+----------------+ +---------+-----------------------------+----------------+
| 100-110 | Private or Experimental Use | |
+---------+-----------------------------+----------------+
Table 13: OpenPGP User Attribute Subpacket Types Table 13: OpenPGP User Attribute Subpacket Types Registry
registry
An implementation SHOULD ignore any subpacket of a type that it does An implementation SHOULD ignore any subpacket of a type that it does
not recognize. not recognize.
5.12.1. The Image Attribute Subpacket 5.12.1. Image Attribute Subpacket
The Image Attribute subpacket is used to encode an image, presumably The Image Attribute subpacket is used to encode an image, presumably
(but not required to be) that of the key owner. (but not required to be) that of the key owner.
The Image Attribute subpacket begins with an image header. The first The Image Attribute subpacket begins with an image header. The first
two octets of the image header contain the length of the image two octets of the image header contain the length of the image
header. Note that unlike other multi-octet numerical values in this header. Note that unlike other multi-octet numerical values in this
document, due to a historical accident this value is encoded as a document, due to a historical accident, this value is encoded as a
little-endian number. The image header length is followed by a little-endian number. The image header length is followed by a
single octet for the image header version. The only currently single octet for the image header version. The only currently
defined version of the image header is 1, which is a 16-octet image defined version of the image header is 1, which is a 16-octet image
header. The first three octets of a version 1 image header are thus header. The first three octets of a version 1 image header are thus
0x10, 0x00, 0x01. 0x10, 0x00, 0x01.
+=========+================+ +=========+================+
| Version | Reference | | Version | Reference |
+=========+================+ +=========+================+
| 1 | Section 5.12.1 | | 1 | Section 5.12.1 |
+---------+----------------+ +---------+----------------+
Table 14: OpenPGP Image Table 14: OpenPGP Image
Attribute Version Attribute Versions
registry Registry
The fourth octet of a version 1 image header designates the encoding The fourth octet of a version 1 image header designates the encoding
format of the image. The only currently defined encoding format is format of the image. The only currently defined encoding format is
the value 1 to indicate JPEG. Image format IDs 100 through 110 are the value 1 to indicate JPEG. Image format IDs 100 through 110 are
reserved for private or experimental use. The rest of the version 1 reserved for Private or Experimental Use. The rest of the version 1
image header is made up of 12 reserved octets, all of which MUST be image header is made up of 12 reserved octets, all of which MUST be
set to 0. set to 0.
+=========+==================+=======================+ +=========+=============================+
| ID | Encoding | Reference | | ID | Encoding |
+=========+==================+=======================+ +=========+=============================+
| 1 | JPEG | JPEG File Interchange | | 0 | Reserved |
| | | Format ([JFIF]) | +---------+-----------------------------+
+---------+------------------+-----------------------+ | 1 | JPEG [JFIF] |
| 100-110 | Private/ | | +---------+-----------------------------+
| | Experimental use | | | 100-110 | Private or Experimental Use |
+---------+------------------+-----------------------+ +---------+-----------------------------+
Table 15: OpenPGP Image Attribute Encoding Format Table 15: OpenPGP Image Attribute
registry Encoding Format Registry
The rest of the image subpacket contains the image itself. As the The rest of the image subpacket contains the image itself. As the
only currently defined image type is JPEG, the image is encoded in only currently defined image type is JPEG, the image is encoded in
the JPEG File Interchange Format (JFIF), a standard file format for the JPEG File Interchange Format (JFIF), a standard file format for
JPEG images [JFIF]. JPEG images [JFIF].
An implementation MAY try to determine the type of an image by An implementation MAY try to determine the type of an image by
examination of the image data if it is unable to handle a particular examination of the image data if it is unable to handle a particular
version of the image header or if a specified encoding format value version of the image header or if a specified encoding format value
is not recognized. is not recognized.
5.13. Symmetrically Encrypted Integrity Protected Data Packet (Type ID 5.13. Symmetrically Encrypted and Integrity Protected Data Packet (Type
18) ID 18)
This packet (the "SEIPD" packet) contains integrity protected and The SEIPD packet contains integrity-protected and encrypted data.
encrypted data. When it has been decrypted, it will contain other When it has been decrypted, it will contain other packets forming an
packets forming an OpenPGP Message (see Section 10.3). OpenPGP Message (see Section 10.3).
The first octet of this packet is always used to indicate the version The first octet of this packet is always used to indicate the version
number, but different versions contain differently-structured number, but different versions contain ciphertext that is structured
ciphertext. Version 1 of this packet contains data encrypted with a differently. Version 1 of this packet contains data encrypted with a
symmetric-key algorithm and protected against modification by the symmetric key algorithm and is thus protected against modification by
SHA-1 hash algorithm. This mechanism was introduced in [RFC4880] and the SHA-1 hash algorithm. This mechanism was introduced in [RFC4880]
offers some protections against ciphertext malleability. and offers some protections against ciphertext malleability.
Version 2 of this packet contains data encrypted with an Version 2 of this packet contains data encrypted with an AEAD
authenticated encryption and additional data (AEAD) construction. construction. This offers a more cryptographically rigorous defense
This offers a more cryptographically rigorous defense against against ciphertext malleability. See Section 13.7 for more details
ciphertext malleability. See Section 13.7 for more details on on choosing between these formats.
choosing between these formats.
Any new version of the SEIPD packet should be registered in the Any new version of the SEIPD packet should be registered in the
registry established in Section 10.3.2.1. registry established in Section 10.3.2.1.
5.13.1. Version 1 Symmetrically Encrypted Integrity Protected Data 5.13.1. Version 1 Symmetrically Encrypted and Integrity Protected Data
Packet Format Packet Format
A version 1 Symmetrically Encrypted Integrity Protected Data packet A version 1 Symmetrically Encrypted and Integrity Protected Data
consists of: packet consists of:
* A one-octet version number with value 1. * A 1-octet version number with value 1.
* Encrypted data, the output of the selected symmetric-key cipher * Encrypted data -- the output of the selected symmetric key cipher
operating in Cipher Feedback (CFB) mode. operating in CFB mode.
The symmetric cipher used MUST be specified in a Public-Key or The symmetric cipher used MUST be specified in a Public Key or
Symmetric-Key Encrypted Session Key packet that precedes the Symmetric Key Encrypted Session Key packet that precedes the
Symmetrically Encrypted Integrity Protected Data packet. In either Symmetrically Encrypted and Integrity Protected Data packet. In
case, the cipher algorithm ID is prefixed to the session key before either case, the cipher algorithm ID is prefixed to the session key
it is encrypted. before it is encrypted.
The data is encrypted in CFB mode (see Section 12.9). The Initial The data is encrypted in CFB mode (see Section 12.9). The IV is
Vector (IV) is specified as all zeros. Instead of achieving specified as all zeros. Instead of achieving randomized encryption
randomized encryption through an IV, OpenPGP prefixes an octet string through an IV, OpenPGP prefixes an octet string to the data before it
to the data before it is encrypted for this purpose. The length of is encrypted for this purpose. The length of the octet string equals
the octet string equals the block size of the cipher in octets, plus the block size of the cipher in octets, plus two. The first octets
two. The first octets in the group, of length equal to the block in the group, of length equal to the block size of the cipher, are
size of the cipher, are random; the last two octets are each copies random; the last two octets are each copies of their 2nd preceding
of their 2nd preceding octet. For example, with a cipher whose block octet. For example, with a cipher whose block size is 128 bits or 16
size is 128 bits or 16 octets, the prefix data will contain 16 random octets, the prefix data will contain 16 random octets, then two more
octets, then two more octets, which are copies of the 15th and 16th octets, which are copies of the 15th and 16th octets, respectively.
octets, respectively. Unlike the deprecated Symmetrically Encrypted Unlike the deprecated Symmetrically Encrypted Data packet
Data packet (Section 5.7), this prefix data is encrypted in the same (Section 5.7), this prefix data is encrypted in the same CFB context,
CFB context, and no special CFB resynchronization is done. and no special CFB resynchronization is done.
The repetition of 16 bits in the random data prefixed to the message The repetition of 16 bits in the random data prefixed to the message
allows the receiver to immediately check whether the session key is allows the receiver to immediately check whether the session key is
incorrect. See Section 13.4 for hints on the proper use of this incorrect. See Section 13.4 for hints on the proper use of this
"quick check". "quick check".
Two constant octets with the values 0xD3 and 0x14 are appended to the Two constant octets with the values 0xD3 and 0x14 are appended to the
plaintext. Then, the plaintext of the data to be encrypted is passed plaintext. Then, the plaintext of the data to be encrypted is passed
through the SHA-1 hash function. The input to the hash function through the SHA-1 hash function. The input to the hash function is
includes the prefix data described above; it includes all of the comprised of the prefix data described above and all of the
plaintext, including the trailing constant octets 0xD3, 0x14. The 20 plaintext, including the trailing constant octets 0xD3, 0x14. The 20
octets of the SHA-1 hash are then appended to the plaintext (after octets of the SHA-1 hash are then appended to the plaintext (after
the constant octets 0xD3, 0x14) and encrypted along with the the constant octets 0xD3, 0x14) and encrypted along with the
plaintext using the same CFB context. This trailing checksum is plaintext using the same CFB context. This trailing checksum is
known as the Modification Detection Code (MDC). known as the Modification Detection Code (MDC).
During decryption, the plaintext data should be hashed with SHA-1, During decryption, the plaintext data should be hashed with SHA-1,
including the prefix data as well as the trailing constant octets including the prefix data as well as the trailing constant octets
0xD3, 0x14, but excluding the last 20 octets containing the SHA-1 0xD3, 0x14, but excluding the last 20 octets containing the SHA-1
hash. The computed SHA-1 hash is then compared with the last 20 hash. The computed SHA-1 hash is then compared with the last 20
octets of plaintext. A mismatch of the hash indicates that the octets of plaintext. A mismatch of the hash indicates that the
message has been modified and MUST be treated as a security problem. message has been modified and MUST be treated as a security problem.
Any failure SHOULD be reported to the user. Any failure SHOULD be reported to the user.
NON-NORMATIVE EXPLANATION NON-NORMATIVE EXPLANATION
The Modification Detection Code (MDC) system, as the integrity The MDC system, as the integrity protection mechanism of the
protection mechanism of version 1 of the Symmetrically Encrypted version 1 Symmetrically Encrypted and Integrity Protected Data
Integrity Protected Data packet is called, was created to provide packet is called, was created to provide an integrity mechanism
an integrity mechanism that is less strong than a signature, yet that is less strong than a signature, yet stronger than bare CFB
stronger than bare CFB encryption. encryption.
It is a limitation of CFB encryption that damage to the ciphertext CFB encryption has a limitation as damage to the ciphertext will
will corrupt the affected cipher blocks and the block following. corrupt the affected cipher blocks and the block following.
Additionally, if data is removed from the end of a CFB-encrypted Additionally, if data is removed from the end of a CFB-encrypted
block, that removal is undetectable. (Note also that CBC mode has block, that removal is undetectable. (Note also that CBC mode has
a similar limitation, but data removed from the front of the block a similar limitation, but data removed from the front of the block
is undetectable.) is undetectable.)
The obvious way to protect or authenticate an encrypted block is The obvious way to protect or authenticate an encrypted block is
to digitally sign it. However, many people do not wish to to digitally sign it. However, many people do not wish to
habitually sign data, for a large number of reasons beyond the habitually sign data for a large number of reasons that are beyond
scope of this document. Suffice it to say that many people the scope of this document. Suffice it to say that many people
consider properties such as deniability to be as valuable as consider properties such as deniability to be as valuable as
integrity. integrity.
OpenPGP addresses this desire to have more security than raw OpenPGP addresses this desire to have more security than raw
encryption and yet preserve deniability with the MDC system. An encryption and yet preserve deniability with the MDC system. An
MDC is intentionally not a MAC. Its name was not selected by MDC is intentionally not a Message Authentication Code (MAC). Its
accident. It is analogous to a checksum. name was not selected by accident. It is analogous to a checksum.
Despite the fact that it is a relatively modest system, it has Despite the fact that it is a relatively modest system, it has
proved itself in the real world. It is an effective defense to proved itself in the real world. It is an effective defense to
several attacks that have surfaced since it has been created. It several attacks that have surfaced since it has been created. It
has met its modest goals admirably. has met its modest goals admirably.
Consequently, because it is a modest security system, it has Consequently, because it is a modest security system, it has
modest requirements on the hash function(s) it employs. It does modest requirements on the hash function(s) it employs. It does
not rely on a hash function being collision-free, it relies on a not rely on a hash function being collision-free; it relies on a
hash function being one-way. If a forger, Frank, wishes to send hash function being one-way. If a forger, Frank, wishes to send
Alice a (digitally) unsigned message that says, "I've always Alice a (digitally) unsigned message that says, "I've always
secretly loved you, signed Bob", it is far easier for him to secretly loved you, signed Bob", it is far easier for him to
construct a new message than it is to modify anything intercepted construct a new message than it is to modify anything intercepted
from Bob. (Note also that if Bob wishes to communicate secretly from Bob. (Note also that if Bob wishes to communicate secretly
with Alice, but without authentication or identification and with with Alice, but without authentication or identification and with
a threat model that includes forgers, he has a problem that a threat model that includes forgers, he has a problem that
transcends mere cryptography.) transcends mere cryptography.)
Note also that unlike nearly every other OpenPGP subsystem, there Note also that unlike nearly every other OpenPGP subsystem, there
are no parameters in the MDC system. It hard-defines SHA-1 as its are no parameters in the MDC system. It hard-defines SHA-1 as its
hash function. This is not an accident. It is an intentional hash function. This is not an accident. It is an intentional
choice to avoid downgrade and cross-grade attacks while making a choice to avoid downgrade and cross-grade attacks while making a
simple, fast system. (A downgrade attack would be an attack that simple, fast system. (A downgrade attack is an attack that would
replaced SHA2-256 with SHA-1, for example. A cross-grade attack replace SHA2-256 with SHA-1, for example. A cross-grade attack
would replace SHA-1 with another 160-bit hash, such as RIPEMD-160, would replace SHA-1 with another 160-bit hash, such as RIPEMD-160,
for example.) for example.)
However, no update will be needed because the MDC has been However, no update will be needed because the MDC has been
replaced by the AEAD encryption described in this document. replaced by the AEAD encryption described in this document.
5.13.2. Version 2 Symmetrically Encrypted Integrity Protected Data 5.13.2. Version 2 Symmetrically Encrypted and Integrity Protected Data
Packet Format Packet Format
A version 2 Symmetrically Encrypted Integrity Protected Data packet A version 2 Symmetrically Encrypted and Integrity Protected Data
consists of: packet consists of:
* A one-octet version number with value 2. * A 1-octet version number with value 2.
* A one-octet cipher algorithm ID. * A 1-octet cipher algorithm ID.
* A one-octet AEAD algorithm identifier. * A 1-octet AEAD algorithm identifier.
* A one-octet chunk size. * A 1-octet chunk size.
* Thirty-two octets of salt. The salt is used to derive the message * 32 octets of salt. The salt is used to derive the message key and
key and MUST be securely generated (See Section 13.10). MUST be securely generated (see Section 13.10).
* Encrypted data, the output of the selected symmetric-key cipher * Encrypted data; that is, the output of the selected symmetric key
operating in the given AEAD mode. cipher operating in the given AEAD mode.
* A final, summary authentication tag for the AEAD mode. * A final summary authentication tag for the AEAD mode.
The decrypted session key and the salt are used to derive an M-bit The decrypted session key and the salt are used to derive an M-bit
message key and N-64 bits used as initialization vector, where M is message key and N-64 bits used as the IV, where M is the key size of
the key size of the symmetric algorithm and N is the nonce size of the symmetric algorithm and N is the nonce size of the AEAD
the AEAD algorithm. M + N - 64 bits are derived using HKDF (see algorithm. M + N - 64 bits are derived using HKDF (see [RFC5869]).
[RFC5869]). The left-most M bits are used as symmetric algorithm The leftmost M bits are used as a symmetric algorithm key, and the
key, the remaining N - 64 bits are used as initialization vector. remaining N - 64 bits are used as an IV. HKDF is used with SHA256
HKDF is used with SHA256 ([RFC6234]) as hash algorithm, the session [RFC6234] as hash algorithm. The session key is used as IKM and the
key as Initial Keying Material (IKM), the salt as salt, and the salt as salt. The Packet Type ID in OpenPGP format encoding (bits 7
Packet Type ID in OpenPGP format encoding (bits 7 and 6 set, bits 5-0 and 6 are set, and bits 5-0 carry the Packet Type ID), version
carry the packet type ID), version number, cipher algorithm ID, AEAD number, cipher algorithm ID, AEAD algorithm ID, and chunk size octet
algorithm ID, and chunk size octet as info parameter. are used as info parameter.
The KDF mechanism provides key separation between cipher and AEAD The KDF mechanism provides key separation between cipher and AEAD
algorithms. Furthermore, an implementation can securely reply to a algorithms. Furthermore, an implementation can securely reply to a
message even if a recipient's certificate is unknown by reusing the message even if a recipient's certificate is unknown by reusing the
encrypted session key packets and replying with a different salt Encrypted Session Key packets and replying with a different salt that
yielding a new, unique message key. See Section 13.8 for guidance on yields a new, unique message key. See Section 13.8 for guidance on
how applications can securely implement this feature. how applications can securely implement this feature.
A v2 SEIPD packet consists of one or more chunks of data. The A v2 SEIPD packet consists of one or more chunks of data. The
plaintext of each chunk is of a size specified using the chunk size plaintext of each chunk is of a size specified by the chunk size
octet using the method specified below. octet using the method specified below.
The encrypted data consists of the encryption of each chunk of The encrypted data consists of the encryption of each chunk of
plaintext, followed immediately by the relevant authentication tag. plaintext, followed immediately by the relevant authentication tag.
If the last chunk of plaintext is smaller than the chunk size, the If the last chunk of plaintext is smaller than the chunk size, the
ciphertext for that data may be shorter; it is nevertheless followed ciphertext for that data may be shorter; nevertheless, it is followed
by a full authentication tag. by a full authentication tag.
For each chunk, the AEAD construction is given the Packet Type ID For each chunk, the AEAD construction is given the Packet Type ID
encoded in OpenPGP format (bits 7 and 6 set, bits 5-0 carry the encoded in OpenPGP format (bits 7 and 6 are set, and bits 5-0 carry
packet type ID), version number, cipher algorithm ID, AEAD algorithm the Packet Type ID), version number, cipher algorithm ID, AEAD
ID, and chunk size octet as additional data. For example, the algorithm ID, and chunk size octet as additional data. For example,
additional data of the first chunk using EAX and AES-128 with a chunk the additional data of the first chunk using EAX and AES-128 with a
size of 2**22 octets consists of the octets 0xD2, 0x02, 0x07, 0x01, chunk size of 2^22 octets consists of the octets 0xD2, 0x02, 0x07,
and 0x10. 0x01, and 0x10.
After the final chunk, the AEAD algorithm is used to produce a final After the final chunk, the AEAD algorithm is used to produce a final
authentication tag encrypting the empty string. This AEAD instance authentication tag encrypting the empty string. This AEAD instance
is given the additional data specified above, plus an eight-octet, is given the additional data specified above, plus an 8-octet, big-
big-endian value specifying the total number of plaintext octets endian value specifying the total number of plaintext octets
encrypted. This allows detection of a truncated ciphertext. encrypted. This allows detection of a truncated ciphertext.
The chunk size octet specifies the size of chunks using the following The chunk size octet specifies the size of chunks using the following
formula (in [C99]), where c is the chunk size octet: formula (in C [C99]), where c is the chunk size octet:
chunk_size = (uint32_t) 1 << (c + 6) chunk_size = (uint32_t) 1 << (c + 6)
An implementation MUST accept chunk size octets with values from 0 to An implementation MUST accept chunk size octets with values from 0 to
16. An implementation MUST NOT create data with a chunk size octet 16. An implementation MUST NOT create data with a chunk size octet
value larger than 16 (4 MiB chunks). value larger than 16 (4 MiB chunks).
The nonce for AEAD mode consists of two parts. Let N be the size of The nonce for AEAD mode consists of two parts. Let N be the size of
the nonce. The left-most N - 64 bits are the initialization vector the nonce. The leftmost N - 64 bits are the IV derived using HKDF.
derived using HKDF. The right-most 64 bits are the chunk index as The rightmost 64 bits are the chunk index as a big-endian value. The
big-endian value. The index of the first chunk is zero. index of the first chunk is zero.
5.13.3. EAX Mode 5.13.3. EAX Mode
The EAX AEAD Algorithm used in this document is defined in [EAX]. The EAX AEAD algorithm used in this document is defined in [EAX].
The EAX algorithm can only use block ciphers with 16-octet blocks. The EAX algorithm can only use block ciphers with 16-octet blocks.
The nonce is 16 octets long. EAX authentication tags are 16 octets The nonce is 16 octets long. EAX authentication tags are 16 octets
long. long.
5.13.4. OCB Mode 5.13.4. OCB Mode
The OCB AEAD Algorithm used in this document is defined in [RFC7253]. The OCB AEAD algorithm used in this document is defined in [RFC7253].
The OCB algorithm can only use block ciphers with 16-octet blocks. The OCB algorithm can only use block ciphers with 16-octet blocks.
The nonce is 15 octets long. OCB authentication tags are 16 octets The nonce is 15 octets long. OCB authentication tags are 16 octets
long. long.
5.13.5. GCM Mode 5.13.5. GCM Mode
The GCM AEAD Algorithm used in this document is defined in The GCM AEAD algorithm used in this document is defined in
[SP800-38D]. [SP800-38D].
The GCM algorithm can only use block ciphers with 16-octet blocks. The GCM algorithm can only use block ciphers with 16-octet blocks.
The nonce is 12 octets long. GCM authentication tags are 16 octets The nonce is 12 octets long. GCM authentication tags are 16 octets
long. long.
5.14. Padding Packet (Type ID 21) 5.14. Padding Packet (Type ID 21)
The Padding packet contains random data, and can be used to defend The Padding packet contains random data and can be used to defend
against traffic analysis (see Section 13.11) on version 2 SEIPD against traffic analysis (see Section 13.11) on v2 SEIPD messages
messages (see Section 5.13.2) and Transferable Public Keys (see (see Section 5.13.2) and Transferable Public Keys (see Section 10.1).
Section 10.1).
Such a packet MUST be ignored when received. Such a packet MUST be ignored when received.
Its contents SHOULD be random octets to make the length obfuscation Its contents SHOULD be random octets to make the length obfuscation
it provides more robust even when compressed. it provides more robust even when compressed.
An implementation adding padding to an OpenPGP stream SHOULD place An implementation adding padding to an OpenPGP stream SHOULD place
such a packet: such a packet:
* At the end of a v6 Transferable Public Key that is transferred * At the end of a version 6 Transferable Public Key that is
over an encrypted channel (see Section 10.1). transferred over an encrypted channel (see Section 10.1).
* As the last packet of an Optionally Padded Message within a * As the last packet of an Optionally Padded Message within a
version 2 Symmetrically Encrypted Integrity Protected Data packet version 2 Symmetrically Encrypted and Integrity Protected Data
(see Section 10.3.1). packet (see Section 10.3.1).
An implementation MUST be able to process padding packets anywhere An implementation MUST be able to process Padding packets anywhere
else in an OpenPGP stream, so that future revisions of this document else in an OpenPGP stream so that future revisions of this document
may specify further locations for padding. may specify further locations for padding.
Policy about how large to make such a packet to defend against Policy about how large to make such a packet to defend against
traffic analysis is beyond the scope of this document. traffic analysis is beyond the scope of this document.
6. Base64 Conversions 6. Base64 Conversions
As stated in the introduction, OpenPGP's underlying native As stated in the introduction, OpenPGP's underlying representation
representation for objects is a stream of arbitrary octets, and some for objects is a stream of arbitrary octets, and some systems desire
systems desire these objects to be immune to damage caused by these objects to be immune to damage caused by character set
character set translation, data conversions, etc. translation, data conversions, etc.
In principle, any printable encoding scheme that met the requirements In principle, any printable encoding scheme that met the requirements
of the unsafe channel would suffice, since it would not change the of the unsafe channel would suffice, since it would not change the
underlying binary bit streams of the native OpenPGP data structures. underlying binary bit streams of the OpenPGP data structures. The
The OpenPGP standard specifies one such printable encoding scheme to OpenPGP specification specifies one such printable encoding scheme to
ensure interoperability, Section 6.2. ensure interoperability; see Section 6.2.
The encoding is composed of two parts: a base64 encoding of the The encoding is composed of two parts: a base64 encoding of the
binary data and an optional checksum. The base64 encoding used is binary data and an optional checksum. The base64 encoding used is
described in Section 4 of [RFC4648], and it is wrapped into lines of described in Section 4 of [RFC4648], and it is wrapped into lines of
no more than 76 characters each. no more than 76 characters each.
When decoding base64, an OpenPGP implementation MUST ignore all white When decoding base64, an OpenPGP implementation MUST ignore all
space. whitespace.
6.1. Optional checksum 6.1. Optional Checksum
The optional checksum is a 24-bit Cyclic Redundancy Check (CRC) The optional checksum is a 24-bit Cyclic Redundancy Check (CRC)
converted to four characters of base64 encoding by the same MIME converted to four characters of base64 encoding by the same MIME
base64 transformation, preceded by an equal sign (=). The CRC is base64 transformation, preceded by an equal sign (=). The CRC is
computed by using the generator 0x864CFB and an initialization of computed by using the generator 0x864CFB and an initialization of
0xB704CE. The accumulation is done on the data before it is 0xB704CE. The accumulation is done on the data before it is
converted to base64, rather than on the converted data. A sample converted to base64 rather than on the converted data. A sample
implementation of this algorithm is in Section 6.1.1. implementation of this algorithm is in Section 6.1.1.
If present, the checksum with its leading equal sign MUST appear on If present, the checksum with its leading equal sign MUST appear on
the next line after the base64 encoded data. the next line after the base64-encoded data.
An implementation MUST NOT reject an OpenPGP object when the CRC24 An implementation MUST NOT reject an OpenPGP object when the CRC24
footer is present, missing, malformed, or disagrees with the computed footer is present, missing, malformed, or disagrees with the computed
CRC24 sum. When forming ASCII Armor, the CRC24 footer SHOULD NOT be CRC24 sum. When forming ASCII Armor, the CRC24 footer SHOULD NOT be
generated, unless interoperability with implementations that require generated, unless interoperability with implementations that require
the CRC24 footer to be present is a concern. the CRC24 footer to be present is a concern.
The CRC24 footer MUST NOT be generated if it can be determined by The CRC24 footer MUST NOT be generated if it can be determined by the
context or by the OpenPGP object being encoded that the consuming context or by the OpenPGP object being encoded that the consuming
implementation accepts base64 encoded blocks without CRC24 footer. implementation accepts base64-encoded blocks without a CRC24 footer.
Notably: Notably:
* An ASCII-armored Encrypted Message packet sequence that ends in an * An ASCII-armored Encrypted Message packet sequence that ends in a
v2 SEIPD packet MUST NOT contain a CRC24 footer. v2 SEIPD packet MUST NOT contain a CRC24 footer.
* An ASCII-armored sequence of Signature packets that only includes * An ASCII-armored sequence of Signature packets that only includes
v6 Signature packets MUST NOT contain a CRC24 footer. version 6 Signature packets MUST NOT contain a CRC24 footer.
* An ASCII-armored Transferable Public Key packet sequence of a v6 * An ASCII-armored Transferable Public Key packet sequence of a
key MUST NOT contain a CRC24 footer. version 6 key MUST NOT contain a CRC24 footer.
* An ASCII-armored keyring consisting of only v6 keys MUST NOT * An ASCII-armored keyring consisting of only version 6 keys MUST
contain a CRC24 footer. NOT contain a CRC24 footer.
Rationale: Previous versions of this document state that the CRC24 Rationale: Previous draft versions of this document stated that the
footer is optional, but the text was ambiguous. In practice, very CRC24 footer is optional, but the text was ambiguous. In practice,
few implementations require the CRC24 footer to be present. very few implementations require the CRC24 footer to be present.
Computing the CRC24 incurs a significant cost, while providing no Computing the CRC24 incurs a significant cost, while providing no
meaningful integrity protection. Therefore, generating it is now meaningful integrity protection. Therefore, generating it is now
discouraged. discouraged.
6.1.1. An Implementation of the CRC-24 in "C" 6.1.1. An Implementation of the CRC24 in "C"
The following code is written in [C99]. The following code is written in [C99].
#define CRC24_INIT 0xB704CEL #define CRC24_INIT 0xB704CEL
#define CRC24_GENERATOR 0x864CFBL #define CRC24_GENERATOR 0x864CFBL
typedef unsigned long crc24; typedef unsigned long crc24;
crc24 crc_octets(unsigned char *octets, size_t len) crc24 crc_octets(unsigned char *octets, size_t len)
{ {
crc24 crc = CRC24_INIT; crc24 crc = CRC24_INIT;
skipping to change at page 94, line 33 skipping to change at line 4327
crc ^= CRC24_GENERATOR; crc ^= CRC24_GENERATOR;
} }
} }
} }
return crc & 0xFFFFFFL; return crc & 0xFFFFFFL;
} }
6.2. Forming ASCII Armor 6.2. Forming ASCII Armor
When OpenPGP encodes data into ASCII Armor, it puts specific headers When OpenPGP encodes data into ASCII Armor, it puts specific headers
around the base64 encoded data, so OpenPGP can reconstruct the data around the base64-encoded data, so OpenPGP can reconstruct the data
later. An OpenPGP implementation MAY use ASCII armor to protect raw later. An OpenPGP implementation MAY use ASCII Armor to protect raw
binary data. OpenPGP informs the user what kind of data is encoded binary data. OpenPGP informs the user what kind of data is encoded
in the ASCII armor through the use of the headers. in the ASCII Armor through the use of the headers.
Concatenating the following data creates ASCII Armor: Concatenating the following data creates ASCII Armor:
* An Armor Header Line, appropriate for the type of data * An Armor Header Line, appropriate for the type of data
* Armor Headers * Armor Headers
* A blank (zero-length, or containing only whitespace) line * A blank (zero length or containing only whitespace) line
* The ASCII-Armored data * The ASCII-Armored data
* An optional Armor Checksum (discouraged, see Section 6.1) * An optional Armor Checksum (discouraged; see Section 6.1)
* The Armor Tail, which depends on the Armor Header Line * The Armor Tail, which depends on the Armor Header Line
6.2.1. Armor Header Line 6.2.1. Armor Header Line
An Armor Header Line consists of the appropriate header line text An Armor Header Line consists of the appropriate header line text
surrounded by five (5) dashes (-, 0x2D) on either side of the header surrounded by five (5) dashes (-, 0x2D) on either side of the header
line text. The header line text is chosen based upon the type of line text. The header line text is chosen based on the type of data
data that is being encoded in Armor, and how it is being encoded. being encoded in Armor and how it is being encoded. Header line
Header line texts include the following strings: texts include the following strings:
+===================+============================================+ +===================+============================================+
| Armor Header | Use | | Armor Header | Use |
+===================+============================================+ +===================+============================================+
| BEGIN PGP MESSAGE | Used for signed, encrypted, or compressed | | BEGIN PGP MESSAGE | Used for signed, encrypted, or compressed |
| | files. | | | files. |
+-------------------+--------------------------------------------+ +-------------------+--------------------------------------------+
| BEGIN PGP PUBLIC | Used for armoring public keys. | | BEGIN PGP PUBLIC | Used for armoring public keys. |
| KEY BLOCK | | | KEY BLOCK | |
+-------------------+--------------------------------------------+ +-------------------+--------------------------------------------+
| BEGIN PGP PRIVATE | Used for armoring private keys. | | BEGIN PGP PRIVATE | Used for armoring private keys. |
| KEY BLOCK | | | KEY BLOCK | |
+-------------------+--------------------------------------------+ +-------------------+--------------------------------------------+
| BEGIN PGP | Used for detached signatures, OpenPGP/MIME | | BEGIN PGP | Used for detached signatures, OpenPGP/MIME |
| SIGNATURE | signatures, and cleartext signatures. | | SIGNATURE | signatures, and cleartext signatures. |
+-------------------+--------------------------------------------+ +-------------------+--------------------------------------------+
Table 16: OpenPGP Armor Header Line registry Table 16: OpenPGP Armor Header Lines Registry
Note that all these Armor Header Lines are to consist of a complete Note that all of these Armor Header Lines are to consist of a
line. The header lines, therefore, MUST start at the beginning of a complete line. Therefore, the header lines MUST start at the
line, and MUST NOT have text other than whitespace following them on beginning of a line and MUST NOT have text other than whitespace
the same line. following them on the same line.
6.2.2. Armor Headers 6.2.2. Armor Headers
The Armor Headers are pairs of strings that can give the user or the The Armor Headers are pairs of strings that can give the user or the
receiving OpenPGP implementation some information about how to decode receiving OpenPGP implementation some information about how to decode
or use the message. The Armor Headers are a part of the armor, not a or use the message. The Armor Headers are a part of the armor, not
part of the message, and hence are not protected by any signatures the message, and hence are not protected by any signatures applied to
applied to the message. the message.
The format of an Armor Header is that of a key-value pair. A colon The format of an Armor Header is that of a key-value pair. A colon
(: 0x3A) and a single space (0x20) separate the key and value. An (: 0x3A) and a single space (0x20) separate the key and value. An
OpenPGP implementation may consider improperly formatted Armor OpenPGP implementation may consider improperly formatted Armor
Headers to be corruption of the ASCII Armor, but SHOULD make an Headers to be a corruption of the ASCII Armor, but it SHOULD make an
effort to recover. Unknown keys should be silently ignored, and an effort to recover. Unknown keys should be silently ignored, and an
OpenPGP implementation SHOULD continue to process the message. OpenPGP implementation SHOULD continue to process the message.
Note that some transport methods are sensitive to line length. For Note that some transport methods are sensitive to line length. For
example, the SMTP protocol that transports email messages has a line example, the SMTP protocol that transports email messages has a line
length limit of 998 characters (see Section 2.1.1 of [RFC5322]). length limit of 998 characters (see Section 2.1.1 of [RFC5322]).
While there is a limit of 76 characters for the base64 data While there is a limit of 76 characters for the base64 data
(Section 6), there is no limit to the length of Armor Headers. Care (Section 6), there is no limit for the length of Armor Headers. Care
should be taken that the Armor Headers are short enough to survive should be taken to ensure that the Armor Headers are short enough to
transport. One way to do this is to repeat an Armor Header Key survive transport. One way to do this is to repeat an Armor Header
multiple times with different values for each so that no one line is Key multiple times with different values for each so that no one line
overly long. is overly long.
Currently defined Armor Header Keys are as follows: Currently defined Armor Header Keys are as follows:
+=========+==============================+=================+ +=========+==============================+=================+
| Key | Summary | Reference | | Key | Summary | Reference |
+=========+==============================+=================+ +=========+==============================+=================+
| Version | Implementation information | Section 6.2.2.1 | | Version | Implementation information | Section 6.2.2.1 |
+---------+------------------------------+-----------------+ +---------+------------------------------+-----------------+
| Comment | Arbitrary text | Section 6.2.2.2 | | Comment | Arbitrary text | Section 6.2.2.2 |
+---------+------------------------------+-----------------+ +---------+------------------------------+-----------------+
| Hash | Hash algorithms used in some | Section 6.2.2.3 | | Hash | Hash algorithms used in some | Section 6.2.2.3 |
| | v4 cleartext signed messages | | | | v4 cleartext signed messages | |
+---------+------------------------------+-----------------+ +---------+------------------------------+-----------------+
| Charset | Character set | Section 6.2.2.4 | | Charset | Character set | Section 6.2.2.4 |
+---------+------------------------------+-----------------+ +---------+------------------------------+-----------------+
Table 17: OpenPGP Armor Header Key registry Table 17: OpenPGP Armor Header Keys Registry
6.2.2.1. "Version" Armor Header 6.2.2.1. "Version" Armor Header
The armor header key Version describes the OpenPGP implementation and The Armor Header Key Version describes the OpenPGP implementation and
version used to encode the message. To minimize metadata, version used to encode the message. To minimize metadata,
implementations SHOULD NOT emit this key and its corresponding value implementations SHOULD NOT emit this key and its corresponding value
except for debugging purposes with explicit user consent. except for debugging purposes with explicit user consent.
6.2.2.2. "Comment" Armor Header 6.2.2.2. "Comment" Armor Header
The armor header key Comment supplies a user-defined comment. The Armor Header Key Comment supplies a user-defined comment.
OpenPGP defines all text to be in UTF-8. A comment may be any UTF-8 OpenPGP defines all text to be in UTF-8. A comment may be any UTF-8
string. However, the whole point of armoring is to provide seven- string. However, the whole point of armoring is to provide 7-bit
bit-clean data. Consequently, if a comment has characters that are clean data. Consequently, if a comment has characters that are
outside the US-ASCII range of UTF, they may very well not survive outside the ASCII range of UTF-8, they may very well not survive
transport. transport.
6.2.2.3. "Hash" Armor Header 6.2.2.3. "Hash" Armor Header
This header is deprecated, but some older implementations expect it The Armor Header Key Hash is deprecated, but some older
in messages using the Cleartext Signature Framework (Section 7). implementations expect it in messages using the Cleartext Signature
When present, The armor header key Hash contains a comma-separated Framework (Section 7). When present, this Armor Header Key contains
list of hash algorithms used in the signatures on message, with a comma-separated list of hash algorithms used in the signatures on
digest names as specified in "Text Name" column in Table 23. These message, with digest names as specified in the "Text Name" column in
headers SHOULD NOT be emitted unless: Table 23. These headers SHOULD NOT be emitted unless:
* The cleartext signed message contains a v4 signature made using a * the cleartext signed message contains a version 4 signature made
SHA2-based digest (SHA224, SHA256, SHA384, or SHA512), and using a SHA2-based digest (SHA224, SHA256, SHA384, or SHA512), and
* The cleartext signed message might be verified by a legacy OpenPGP * the cleartext signed message might be verified by a legacy OpenPGP
implementation that requires this header. implementation that requires this header.
A verifying application MUST decline to validate any signature in a A verifying application MUST decline to validate any signature in a
message with a non-conformant Hash header (that is, a Hash header message with a non-conformant Hash header (that is, a Hash header
that contains anything other than a comma-separated list of hash that contains anything other than a comma-separated list of hash
algorithms). When a conformant Hash header is present, a verifying algorithms). When a conformant Hash header is present, a verifying
application MUST ignore its contents, deferring to the hash algorithm application MUST ignore its contents, deferring to the hash algorithm
indicated in the embedded signature. indicated in the Embedded Signature.
6.2.2.4. "Charset" Armor Header 6.2.2.4. "Charset" Armor Header
The armor header key Charset contains a description of the character The Armor Header Key Charset contains a description of the character
set that the plaintext is in (see [RFC2978]). Please note that set that the plaintext is in (see [RFC2978]). Please note that
OpenPGP defines text to be in UTF-8. An implementation will get best OpenPGP defines text to be in UTF-8. An implementation will get the
results by translating into and out of UTF-8. However, there are best results by translating into and out of UTF-8. However, there
many instances where this is easier said than done. Also, there are are many instances where this is easier said than done. Also, there
communities of users who have no need for UTF-8 because they are all are communities of users who have no need for UTF-8 because they are
happy with a character set like ISO Latin-5 or a Japanese character all happy with a character set like ISO Latin-5 or a Japanese
set. In such instances, an implementation MAY override the UTF-8 character set. In such instances, an implementation MAY override the
default by using this header key. An implementation MAY implement UTF-8 default by using this header key. An implementation MAY
this key and any translations it cares to; an implementation MAY implement this key and any translations it cares to; an
ignore it and assume all text is UTF-8. implementation MAY ignore it and assume all text is UTF-8.
6.2.3. Armor Tail Line 6.2.3. Armor Tail Line
The Armor Tail Line is composed in the same manner as the Armor The Armor Tail Line is composed in the same manner as the Armor
Header Line, except the string "BEGIN" is replaced by the string Header Line, except the string "BEGIN" is replaced by the string
"END". "END".
7. Cleartext Signature Framework 7. Cleartext Signature Framework
It is desirable to be able to sign a textual octet stream without It is desirable to be able to sign a textual octet stream without
ASCII armoring the stream itself, so the signed text is still ASCII armoring the stream itself, so the signed text is still
readable with any tool capable of rendering text. In order to bind a readable with any tool capable of rendering text. In order to bind a
signature to such a cleartext, this framework is used, which follows signature to such a cleartext, the Cleartext Signature Framework is
the same basic format and restrictions as the ASCII armoring used, which follows the same basic format and restrictions as the
described in Section 6.2. (Note that this framework is not intended ASCII armoring described in Section 6.2. (Note that this framework
to be reversible. [RFC3156] defines another way to sign cleartext is not intended to be reversible. [RFC3156] defines another way to
messages for environments that support MIME.) sign cleartext messages for environments that support MIME.)
7.1. Cleartext Signed Message Structure 7.1. Cleartext Signed Message Structure
An OpenPGP cleartext signed message consists of: An OpenPGP cleartext signed message consists of:
* The cleartext header -----BEGIN PGP SIGNED MESSAGE----- on a * The cleartext header -----BEGIN PGP SIGNED MESSAGE----- on a
single line, single line.
* Some implementations MAY include one or more legacy Hash Armor * One or more legacy Hash Armor Headers that MAY be included by some
Headers, which MUST be ignored when well-formed (see implementations and MUST be ignored when well formed (see
Section 6.2.2.3), Section 6.2.2.3).
* An empty line (not included into the message digest), * An empty line (not included in the message digest).
* The dash-escaped cleartext, * The dash-escaped cleartext.
* A line ending separating the cleartext and following armored * A line ending separating the cleartext and following armored
signature (not included into the message digest), signature (not included in the message digest).
* The ASCII armored signature(s) including the -----BEGIN PGP * The ASCII-armored signature(s), including the -----BEGIN PGP
SIGNATURE----- Armor Header and Armor Tail Lines. SIGNATURE----- Armor Header and Armor Tail Lines.
As with any other text signature (Section 5.2.1.2), a cleartext As with any other Text signature (Section 5.2.1.2), a cleartext
signature is calculated on the text using canonical <CR><LF> line signature is calculated on the text using canonical <CR><LF> line
endings. As described above, the line ending before the -----BEGIN endings. As described above, the line ending before the -----BEGIN
PGP SIGNATURE----- Armor Header Line of the armored signature is not PGP SIGNATURE----- Armor Header Line of the armored signature is not
considered part of the signed text. considered part of the signed text.
Also, any trailing whitespace --- spaces (0x20) and tabs (0x09) --- Also, any trailing whitespace -- spaces (0x20) and tabs (0x09) -- at
at the end of any line is removed before signing or verifying a the end of any line is removed before signing or verifying a
cleartext signed message. cleartext signed message.
Between the -----BEGIN PGP SIGNED MESSAGE----- line and the first Between the -----BEGIN PGP SIGNED MESSAGE----- line and the first
empty line, the only Armor Header permitted is a well-formed Hash empty line, the only Armor Header permitted is a well-formed Hash
Armor Header (see Section 6.2.2.3). To reduce the risk of confusion Armor Header (see Section 6.2.2.3). To reduce the risk of confusion
about what has been signed, a verifying implementation MUST decline about what has been signed, a verifying implementation MUST decline
to validate any signature in a cleartext message if that message has to validate any signature in a cleartext message if that message has
any other Armor Header present in this location. any other Armor Header present in this location.
7.2. Dash-Escaped Text 7.2. Dash-Escaped Text
The cleartext content of the message must also be dash-escaped. The cleartext content of the message must also be dash-escaped.
Dash-escaped cleartext is the ordinary cleartext where every line Dash-escaped cleartext is the ordinary cleartext where every line
starting with a "-" (HYPHEN-MINUS, U+002D) is prefixed by the starting with a "-" (HYPHEN-MINUS, U+002D) is prefixed by the
sequence "-" (HYPHEN-MINUS, U+002D) and " " (SPACE, U+0020). This sequence "-" (HYPHEN-MINUS, U+002D) and " " (SPACE, U+0020). This
prevents the parser from recognizing armor headers of the cleartext prevents the parser from recognizing Armor Headers of the cleartext
itself. An implementation MAY dash-escape any line, SHOULD dash- itself. An implementation MAY dash-escape any line, SHOULD dash-
escape lines commencing "From" followed by a space, and MUST dash- escape lines commencing in "From" followed by a space, and MUST dash-
escape any line commencing in a dash. The message digest is computed escape any line commencing in a dash. The message digest is computed
using the cleartext itself, not the dash-escaped form. using the cleartext itself, not the dash-escaped form.
When reversing dash-escaping, an implementation MUST strip the string When reversing dash-escaping, an implementation MUST strip the string
- if it occurs at the beginning of a line, and SHOULD warn on - and - if it occurs at the beginning of a line, and it SHOULD provide a
any character other than a space at the beginning of a line. warning for - and any character other than a space at the beginning
of a line.
7.3. Issues with the Cleartext Signature Framework 7.3. Issues with the Cleartext Signature Framework
Since creating a cleartext signed message involves trimming trailing Since creating a cleartext signed message involves trimming trailing
whitespace on every line, the Cleartext Signature Framework will fail whitespace on every line, the Cleartext Signature Framework will fail
to safely round-trip any textual stream that may include semantically to safely round-trip any textual stream that may include semantically
meaningful whitespace. meaningful whitespace.
For example, the Unified Diff format [UNIFIED-DIFF] contains For example, the Unified Diff format [UNIFIED-DIFF] contains
semantically meaningful whitespace: an empty line of context will semantically meaningful whitespace: an empty line of context will
consist of a line with a single " " (SPACE, U+0020) character, and consist of a line with a single " " (SPACE, U+0020) character, and
any line that has trailing whitespace added or removed will represent any line that has trailing whitespace added or removed will represent
such a change with semantically meaningful whitespace. such a change with semantically meaningful whitespace.
Furthermore, a Cleartext Signature Framework message that is very Furthermore, a Cleartext Signature Framework message that is very
large is unlikely to work well. In particular, it will be difficult large is unlikely to work well. In particular, it will be difficult
for any human reading the message to know which part of the message for any human reading the message to know which part is covered by
is covered by the signature because they can't understand the whole the signature because they can't understand the whole message at
message at once, in case an Armor Header line is placed somewhere in once, especially in the case where an Armor Header line is placed
the body. And, very large Cleartext Signature Framework messages somewhere in the body. And, very large Cleartext Signature Framework
cannot be processed in a single pass, since the signature salt and messages cannot be processed in a single pass, since the signature
digest algorithms are only discovered at the end. salt and digest algorithms are only discovered at the end.
An implementation that knows it is working with a textual stream with An implementation that knows it is working with a textual stream with
any of the above characteristics SHOULD NOT use the Cleartext any of the above characteristics SHOULD NOT use the Cleartext
Signature Framework. Safe alternatives for a semantically meaningful Signature Framework. Safe alternatives for a semantically meaningful
OpenPGP signature over such a file format are: OpenPGP signature over such a file format are:
* A Signed Message, as described in Section 10.3. * A signed message, as described in Section 10.3.
* A Detached Signature as described in Section 10.4. * A detached signature, as described in Section 10.4.
Either of these alternatives may be ASCII-armored (see Section 6.2) Either of these alternatives may be ASCII-armored (see Section 6.2)
if they need to be transmitted across a text-only (or 7-bit clean) if they need to be transmitted across a text-only (or 7-bit clean)
channel. channel.
Finally, when a Cleartext Signature Framework message is presented to Finally, when a Cleartext Signature Framework message is presented to
the user as-is, an attacker can include additional text in the Hash the user as is, an attacker can include additional text in the Hash
header, which may mislead the user into thinking it is part of the header, which may mislead the user into thinking it is part of the
signed text. The signature validation constraints described in signed text. The signature validation constraints described in
Section 6.2.2.3 and Section 7.1 help to mitigate the risk of Sections 6.2.2.3 and 7.1 help to mitigate the risk of arbitrary or
arbitrary or misleading text in the Armor Headers. misleading text in the Armor Headers.
8. Regular Expressions 8. Regular Expressions
A regular expression is zero or more branches, separated by |. It This section describes Regular Expressions.
matches anything that matches one of the branches.
A branch is zero or more pieces, concatenated. It matches a match Regular Expression: Zero or more branches, separated by |. It
for the first, followed by a match for the second, etc. matches anything that matches one of the branches.
A piece is an atom possibly followed by *, +, or ?. An atom followed Branch: Zero or more pieces, concatenated. It matches a match for
by * matches a sequence of 0 or more matches of the atom. An atom the first, followed by a match for the second, etc.
followed by + matches a sequence of 1 or more matches of the atom.
An atom followed by ? matches a match of the atom, or the null
string.
An atom is a regular expression in parentheses (matching a match for Piece: An atom possibly followed by *, +, or ?. An atom followed by
the regular expression), a range (see below), . (matching any single * matches a sequence of 0 or more matches of the atom. An atom
Unicode character), ^ (matching the null string at the beginning of followed by + matches a sequence of 1 or more matches of the atom.
the input string), $ (matching the null string at the end of the An atom followed by ? matches a match of the atom or the null
input string), a \ followed by a single Unicode character (matching string.
that character), or a single Unicode character with no other
significance (matching that character).
A range is a sequence of characters enclosed in []. It normally Atom: A Regular Expression in parentheses (matching a match for the
matches any single character from the sequence. If the sequence Regular Expression), a range (see below), a . (matching any single
begins with ^, it matches any single Unicode character not from the Unicode character), a ^ (matching the null string at the beginning
rest of the sequence. If two characters in the sequence are of the input string), a $ (matching the null string at the end of
separated by -, this is shorthand for the full list of Unicode the input string), a \ followed by a single Unicode character
characters between them in codepoint order (for example, [0-9] (matching that character), or a single Unicode character with no
matches any decimal digit). To include a literal ] in the sequence, other significance (matching that character).
make it the first character (following a possible ^). To include a
literal -, make it the first or last character. Range: A sequence of characters enclosed in []. It normally matches
any single character from the sequence. If the sequence begins
with ^, it matches any single Unicode character not from the rest
of the sequence. If two characters in the sequence are separated
by -, this is shorthand for the full list of Unicode characters
between them in codepoint order (for example, [0-9] matches any
decimal digit). To include a literal ] in the sequence, make it
the first character (following a possible ^). To include a
literal -, make it the first or last character.
9. Constants 9. Constants
This section describes the constants used in OpenPGP. This section describes the constants used in OpenPGP.
Note that these tables are not exhaustive lists; an implementation Note that these tables are not exhaustive lists; an implementation
MAY implement an algorithm not on these lists, so long as the MAY implement an algorithm that is not on these lists, as long as the
algorithm IDs are chosen from the private or experimental algorithm algorithm IDs are chosen from the Private or Experimental Use
range. algorithm range.
See Section 12 for more discussion of the algorithms. See Section 12 for more discussion of the algorithms.
9.1. Public-Key Algorithms 9.1. Public Key Algorithms
+===+==============+=========+============+===========+=============+ +===+==============+=========+============+===========+=============+
| ID| Algorithm |Public | Secret Key | Signature | PKESK | | ID| Algorithm |Public | Secret Key | Signature | PKESK |
| | |Key | Format | Format | Format | | | |Key | Format | Format | Format |
| | |Format | | | | | | |Format | | | |
+===+==============+=========+============+===========+=============+ +===+==============+=========+============+===========+=============+
| 0| Reserved | | | | | | 0| Reserved | | | | |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 1| RSA (Encrypt |MPI(n), | MPI(d), | MPI(m**d | MPI(m**e | | 1| RSA (Encrypt |MPI(n), | MPI(d), | MPI(m^d | MPI(m^e |
| | or Sign) |MPI(e) | MPI(p), | mod n) | mod n) | | | or Sign) |MPI(e) | MPI(p), | mod n) | mod n) |
| | [FIPS186] |[Section | MPI(q), | [Section | [Section | | | [FIPS186] |[Section | MPI(q), | [Section | [Section |
| | |5.5.5.1] | MPI(u) | 5.2.3.1] | 5.1.3] | | | |5.5.5.1] | MPI(u) | 5.2.3.1] | 5.1.3] |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 2| RSA Encrypt- |MPI(n), | MPI(d), | N/A | MPI(m**e | | 2| RSA Encrypt- |MPI(n), | MPI(d), | N/A | MPI(m^e |
| | Only |MPI(e) | MPI(p), | | mod n) | | | Only |MPI(e) | MPI(p), | | mod n) |
| | [FIPS186] |[Section | MPI(q), | | [Section | | | [FIPS186] |[Section | MPI(q), | | [Section |
| | |5.5.5.1] | MPI(u) | | 5.1.3] | | | |5.5.5.1] | MPI(u) | | 5.1.3] |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 3| RSA Sign- |MPI(n), | MPI(d), | MPI(m**d | N/A | | 3| RSA Sign- |MPI(n), | MPI(d), | MPI(m^d | N/A |
| | Only |MPI(e) | MPI(p), | mod n) | | | | Only |MPI(e) | MPI(p), | mod n) | |
| | [FIPS186] |[Section | MPI(q), | [Section | | | | [FIPS186] |[Section | MPI(q), | [Section | |
| | |5.5.5.1] | MPI(u) | 5.2.3.1] | | | | |5.5.5.1] | MPI(u) | 5.2.3.1] | |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 16| Elgamal |MPI(p), | MPI(x) | N/A | MPI(g**k | | 16| Elgamal |MPI(p), | MPI(x) | N/A | MPI(g^k |
| | (Encrypt- |MPI(g), | | | mod p), | | | (Encrypt- |MPI(g), | | | mod p), |
| | Only) |MPI(y) | | | MPI (m * | | | Only) |MPI(y) | | | MPI(m * |
| | [ELGAMAL] |[Section | | | y**k mod | | | [ELGAMAL] |[Section | | | y^k mod |
| | |5.5.5.3] | | | p) | | | |5.5.5.3] | | | p) |
| | | | | | [Section | | | | | | | [Section |
| | | | | | 5.1.4] | | | | | | | 5.1.4] |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 17| DSA (Digital |MPI(p), | MPI(x) | MPI(r), | N/A | | 17| DSA (Digital |MPI(p), | MPI(x) | MPI(r), | N/A |
| | Signature |MPI(q), | | MPI(s) | | | | Signature |MPI(q), | | MPI(s) | |
| | Algorithm) |MPI(g), | | [Section | | | | Algorithm) |MPI(g), | | [Section | |
| | [FIPS186] |MPI(y) | | 5.2.3.2] | | | | [FIPS186] |MPI(y) | | 5.2.3.2] | |
| | |[Section | | | | | | |[Section | | | |
| | |5.5.5.2] | | | | | | |5.5.5.2] | | | |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 18| ECDH public |OID, | MPI(value | N/A | MPI(point | | 18| ECDH public |OID, | MPI(value | N/A | MPI(point |
| | key |MPI(point| in curve- | | in curve- | | | key |MPI(point| in curve- | | in curve- |
| | algorithm |in curve-| specific | | specific | | | algorithm |in curve-| specific | | specific |
| | |specific | format) | | point | | | |specific | format) | | point |
| | |point | [Section | | format), | | | |point | [Section | | format), |
| | |format), | 9.2.1] | | size | | | |format), | 9.2.1] | | size |
| | |KDFParams| | | octet, | | | |KDFParams| | | octet, |
| | |[see | | | encoded | | | |[Sections| | | encoded |
| | |Section | | | key | | | |9.2.1 and| | | key |
| | |9.2.1, | | | [Section | | | |5.5.5.6] | | | [Sections |
| | |Section | | | 9.2.1, | | | | | | | 9.2.1, |
| | |5.5.5.6] | | | Section |
| | | | | | 5.1.5, | | | | | | | 5.1.5, |
| | | | | | Section | | | | | | | and 11.5] |
| | | | | | 11.5] |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 19| ECDSA public |OID, | MPI(value) | MPI(r), | N/A | | 19| ECDSA public |OID, | MPI(value) | MPI(r), | N/A |
| | key |MPI(point| | MPI(s) | | | | key |MPI(point| | MPI(s) | |
| | algorithm |in SEC1 | | [Section | | | | algorithm |in SEC1 | | [Section | |
| | [FIPS186] |format) | | 5.2.3.2] | | | | [FIPS186] |format) | | 5.2.3.2] | |
| | |[Section | | | | | | |[Section | | | |
| | |5.5.5.4] | | | | | | |5.5.5.4] | | | |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 20| Reserved | | | | | | 20| Reserved | | | | |
| | (formerly | | | | | | | (formerly | | | | |
skipping to change at page 102, line 39 skipping to change at line 4706
| | Sign) | | | | | | | Sign) | | | | |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 21| Reserved for | | | | | | 21| Reserved for | | | | |
| | Diffie- | | | | | | | Diffie- | | | | |
| | Hellman | | | | | | | Hellman | | | | |
| | (X9.42, as | | | | | | | (X9.42, as | | | | |
| | defined for | | | | | | | defined for | | | | |
| | IETF-S/MIME) | | | | | | | IETF-S/MIME) | | | | |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 22| EdDSALegacy |OID, | MPI(value | MPI, MPI | N/A | | 22| EdDSALegacy |OID, | MPI(value | MPI, MPI | N/A |
| | (deprecated) |MPI(point| in curve- | [see | | | | (deprecated) |MPI(point| in curve- | [Sections | |
| | |in | specific | Section | | | | |in | specific | 9.2.1 and | |
| | |prefixed | format) | 9.2.1, | | | | |prefixed | format) | 5.2.3.3] | |
| | |native | [see | Section | | | | |native | [Section | | |
| | |format) | Section | 5.2.3.3] | | | | |format) | 9.2.1] | | |
| | |[see | 9.2.1] | | | | | |[Sections| | | |
| | |Section | | | | | | |11.2.2 | | | |
| | |11.2.2, | | | | | | |and | | | |
| | |Section | | | |
| | |5.5.5.5] | | | | | | |5.5.5.5] | | | |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 23| Reserved | | | | | | 23| Reserved | | | | |
| | (AEDH) | | | | | | | (AEDH) | | | | |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 24| Reserved | | | | | | 24| Reserved | | | | |
| | (AEDSA) | | | | | | | (AEDSA) | | | | |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 25| X25519 |32 octets| 32 octets | N/A | 32 | | 25| X25519 |32 octets| 32 octets | N/A | 32 |
| | |[see | | | octets, | | | |[Section | | | octets, |
| | |Section | | | size | | | |5.5.5.7] | | | size |
| | |5.5.5.7] | | | octet, | | | | | | | octet, |
| | | | | | encoded | | | | | | | encoded |
| | | | | | key [see | | | | | | | key |
| | | | | | Section | | | | | | | [Section |
| | | | | | 5.1.6] | | | | | | | 5.1.6] |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 26| X448 |56 octets| 56 octets | N/A | 56 | | 26| X448 |56 octets| 56 octets | N/A | 56 |
| | |[see | | | octets, | | | |[Section | | | octets, |
| | |Section | | | size | | | |5.5.5.8] | | | size |
| | |5.5.5.8] | | | octet, | | | | | | | octet, |
| | | | | | encoded | | | | | | | encoded |
| | | | | | key [see | | | | | | | key |
| | | | | | Section | | | | | | | [Section |
| | | | | | 5.1.7] | | | | | | | 5.1.7] |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 27| Ed25519 |32 octets| 32 octets | 64 octets | | | 27| Ed25519 |32 octets| 32 octets | 64 octets | |
| | |[see | | [see | | | | |[Section | | [Section | |
| | |Section | | Section | |
| | |5.5.5.9] | | 5.2.3.4] | | | | |5.5.5.9] | | 5.2.3.4] | |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
| 28| Ed448 |57 octets| 57 octets | 114 | | | 28| Ed448 |57 octets| 57 octets | 114 | |
| | |[see | | octets | | | | |[Section | | octets | |
| | |Section | | [see | | | | |5.5.5.10]| | [Section | |
| | |5.5.5.10]| | Section | |
| | | | | 5.2.3.5] | | | | | | | 5.2.3.5] | |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
|100| Private/ | | | | | |100| Private or | | | | |
| to| Experimental | | | | | | to| Experimental | | | | |
|110| algorithm | | | | | |110| Use | | | | |
+---+--------------+---------+------------+-----------+-------------+ +---+--------------+---------+------------+-----------+-------------+
Table 18: OpenPGP Public Key Algorithms registry Table 18: OpenPGP Public Key Algorithms Registry
Implementations MUST implement Ed25519 (27) for signatures, and Implementations MUST implement Ed25519 (27) for signatures and X25519
X25519 (25) for encryption. Implementations SHOULD implement Ed448 (25) for encryption. Implementations SHOULD implement Ed448 (28) and
(28) and X448 (26). X448 (26).
RSA (1) keys are deprecated and SHOULD NOT be generated, but may be RSA (1) keys are deprecated and SHOULD NOT be generated but may be
interpreted. RSA Encrypt-Only (2) and RSA Sign-Only (3) are interpreted. RSA Encrypt-Only (2) and RSA Sign-Only (3) are
deprecated and MUST NOT be generated. See Section 12.4. Elgamal deprecated and MUST NOT be generated (see Section 12.4). Elgamal
(16) keys are deprecated and MUST NOT be generated (see (16) keys are deprecated and MUST NOT be generated (see
Section 12.6). DSA (17) keys are deprecated and MUST NOT be Section 12.6). DSA (17) keys are deprecated and MUST NOT be
generated (see Section 12.5). See Section 12.8 for notes on Elgamal generated (see Section 12.5). For notes on Elgamal Encrypt or Sign
Encrypt or Sign (20), and X9.42 (21). Implementations MAY implement (20) and X9.42 (21), see Section 12.8. Implementations MAY implement
any other algorithm. any other algorithm.
Note that an implementation conforming to the previous version of Note that an implementation conforming to the previous version of
this standard ([RFC4880]) has only DSA (17) and Elgamal (16) as its this specification [RFC4880] has only DSA (17) and Elgamal (16) as
MUST-implement algorithms. the algorithms that MUST be implemented.
A compatible specification of ECDSA is given in [RFC6090] as "KT-I A compatible specification of ECDSA is given in [RFC6090] (as "KT-I
Signatures" and in [SEC1]; ECDH is defined in Section 11.5 of this Signatures") and in [SEC1]; ECDH is defined in Section 11.5 of this
document. document.
9.2. ECC Curves for OpenPGP 9.2. ECC Curves for OpenPGP
The parameter curve OID is an array of octets that defines a named The parameter curve OID is an array of octets that defines a named
curve. curve.
The table below specifies the exact sequence of octets for each named The table below specifies the exact sequence of octets for each named
curve referenced in this document. It also specifies which public curve referenced in this document. It also specifies which public
key algorithms the curve can be used with, as well as the size of key algorithms the curve can be used with, as well as the size of
expected elements in octets: expected elements in octets. Note that there is a break in
"EdDSALegacy" for display purposes only.
+======================+===+======+================+===========+=======+ +======================+===+========+================+======+=======+
|ASN.1 Object |OID|Curve |Curve name |Usage |Field | |ASN.1 Object |OID| Curve |Curve Name |Usage |Field |
|Identifier |len|OID | | |Size | |Identifier |Len| OID | | |Size |
| | |octets| | |(fsize)| | | | Octets | | |(fsize)|
| | |in hex| | | | +======================+===+========+================+======+=======+
+======================+===+======+================+===========+=======+ |1.2.840.10045.3.1.7 |8 | 2A 86 |NIST P-256 |ECDSA,|32 |
|1.2.840.10045.3.1.7 |8 |2A 86 |NIST P-256 |ECDSA, ECDH|32 | | | | 48 CE | |ECDH | |
| | |48 CE | | | | | | | 3D 03 | | | |
| | |3D 03 | | | | | | | 01 07 | | | |
| | |01 07 | | | | +----------------------+---+--------+----------------+------+-------+
+----------------------+---+------+----------------+-----------+-------+ |1.3.132.0.34 |5 | 2B 81 |NIST P-384 |ECDSA,|48 |
|1.3.132.0.34 |5 |2B 81 |NIST P-384 |ECDSA, ECDH|48 | | | | 04 00 | |ECDH | |
| | |04 00 | | | | | | | 22 | | | |
| | |22 | | | | +----------------------+---+--------+----------------+------+-------+
+----------------------+---+------+----------------+-----------+-------+ |1.3.132.0.35 |5 | 2B 81 |NIST P-521 |ECDSA,|66 |
|1.3.132.0.35 |5 |2B 81 |NIST P-521 |ECDSA, ECDH|66 | | | | 04 00 | |ECDH | |
| | |04 00 | | | | | | | 23 | | | |
| | |23 | | | | +----------------------+---+--------+----------------+------+-------+
+----------------------+---+------+----------------+-----------+-------+ |1.3.36.3.3.2.8.1.1.7 |9 | 2B 24 |brainpoolP256r1 |ECDSA,|32 |
|1.3.36.3.3.2.8.1.1.7 |9 |2B 24 |brainpoolP256r1 |ECDSA, ECDH|32 | | | | 03 03 | |ECDH | |
| | |03 03 | | | | | | | 02 08 | | | |
| | |02 08 | | | | | | | 01 01 | | | |
| | |01 01 | | | | | | | 07 | | | |
| | |07 | | | | +----------------------+---+--------+----------------+------+-------+
+----------------------+---+------+----------------+-----------+-------+ |1.3.36.3.3.2.8.1.1.11 |9 | 2B 24 |brainpoolP384r1 |ECDSA,|48 |
|1.3.36.3.3.2.8.1.1.11 |9 |2B 24 |brainpoolP384r1 |ECDSA, ECDH|48 | | | | 03 03 | |ECDH | |
| | |03 03 | | | | | | | 02 08 | | | |
| | |02 08 | | | | | | | 01 01 | | | |
| | |01 01 | | | | | | | 0B | | | |
| | |0B | | | | +----------------------+---+--------+----------------+------+-------+
+----------------------+---+------+----------------+-----------+-------+ |1.3.36.3.3.2.8.1.1.13 |9 | 2B 24 |brainpoolP512r1 |ECDSA,|64 |
|1.3.36.3.3.2.8.1.1.13 |9 |2B 24 |brainpoolP512r1 |ECDSA, ECDH|64 | | | | 03 03 | |ECDH | |
| | |03 03 | | | | | | | 02 08 | | | |
| | |02 08 | | | | | | | 01 01 | | | |
| | |01 01 | | | | | | | 0D | | | |
| | |0D | | | | +----------------------+---+--------+----------------+------+-------+
+----------------------+---+------+----------------+-----------+-------+ |1.3.6.1.4.1.11591.15.1|9 | 2B 06 |Ed25519Legacy |EdDSA |32 |
|1.3.6.1.4.1.11591.15.1|9 |2B 06 |Ed25519Legacy |EdDSALegacy|32 | | | | 01 04 | |Legacy| |
| | |01 04 | | | | | | | 01 DA | | | |
| | |01 DA | | | | | | | 47 0F | | | |
| | |47 0F | | | | | | | 01 | | | |
| | |01 | | | | +----------------------+---+--------+----------------+------+-------+
+----------------------+---+------+----------------+-----------+-------+ |1.3.6.1.4.1.3029.1.5.1|10 | 2B 06 |Curve25519Legacy|ECDH |32 |
|1.3.6.1.4.1.3029.1.5.1|10 |2B 06 |Curve25519Legacy|ECDH |32 | | | | 01 04 | | | |
| | |01 04 | | | | | | | 01 97 | | | |
| | |01 97 | | | | | | | 55 01 | | | |
| | |55 01 | | | | | | | 05 01 | | | |
| | |05 01 | | | | +----------------------+---+--------+----------------+------+-------+
+----------------------+---+------+----------------+-----------+-------+
Table 19: OpenPGP ECC Curve OID and Usage registry Table 19: OpenPGP ECC Curve OIDs and Usage Registry
The "Field Size (fsize)" column represents the field size of the The "Field Size (fsize)" column represents the field size of the
group in number of octets, rounded up, such that x or y coordinates group in number of octets, rounded up, such that x or y coordinates
for a point on the curve or native point representations for the for a point on the curve or native point representations for the
curve can be represented in that many octets. For the curves curve can be represented in that many octets. The curves specified
specified here, also scalars such as the base point order and the here, and scalars such as the base point order and the private key,
private key can be represented in fsize octets. Note that, however, can be represented in fsize octets. However, note that curves exist
there exist curves outside this specification where the outside this specification where the representation of scalars
representation of scalars requires an additional octet. requires an additional octet.
The sequence of octets in the third column is the result of applying The sequence of octets in the third column is the result of applying
the Distinguished Encoding Rules (DER) to the ASN.1 Object Identifier the Distinguished Encoding Rules (DER) to the ASN.1 Object Identifier
with subsequent truncation. The truncation removes the two fields of with subsequent truncation. The truncation removes the two fields of
encoded Object Identifier. The first omitted field is one octet encoded Object Identifier. The first omitted field is 1 octet
representing the Object Identifier tag, and the second omitted field representing the Object Identifier tag, and the second omitted field
is the length of the Object Identifier body. For example, the is the length of the Object Identifier body. For example, the
complete ASN.1 DER encoding for the NIST P-256 curve OID is "06 08 2A complete ASN.1 DER encoding for the NIST P-256 curve OID is "06 08 2A
86 48 CE 3D 03 01 07", from which the first entry in the table above 86 48 CE 3D 03 01 07", from which the first entry in the table above
is constructed by omitting the first two octets. Only the truncated is constructed by omitting the first two octets. Only the truncated
sequence of octets is the valid representation of a curve OID. sequence of octets is the valid representation of a curve OID.
The deprecated OIDs for Ed25519Legacy and Curve25519Legacy are used The deprecated OIDs for Ed25519Legacy and Curve25519Legacy are used
only in version 4 keys and signatures. Implementations MAY implement only in version 4 keys and signatures. Implementations MAY implement
these variants for compatibility with existing v4 key material and these variants for compatibility with existing version 4 key material
signatures. Implementations MUST NOT accept or generate v6 key and signatures. Implementations MUST NOT accept or generate version
material using the deprecated OIDs. 6 key material using the deprecated OIDs.
9.2.1. Curve-Specific Wire Formats 9.2.1. Curve-Specific Wire Formats
Some Elliptic Curve Public Key Algorithms use different conventions Some elliptic curve public key algorithms use different conventions
for specific fields depending on the curve in use. Each field is for specific fields depending on the curve in use. Each field is
always formatted as an MPI, but with a curve-specific framing. This always formatted as an MPI, but with a curve-specific framing. This
table summarizes those distinctions. table summarizes those distinctions.
+================+========+============+=======+=========+==========+ +================+========+============+=======+=========+==========+
|Curve |ECDH |ECDH Secret |EdDSA |EdDSA |EdDSA | |Curve |ECDH |ECDH Secret |EdDSA |EdDSA |EdDSA |
| |Point |Key MPI |Secret |Signature|Signature | | |Point |Key MPI |Secret |Signature|Signature |
| |Format | |Key MPI|first MPI|second | | |Format | |Key MPI|first MPI|second |
| | | | | |MPI | | | | | | |MPI |
+================+========+============+=======+=========+==========+ +================+========+============+=======+=========+==========+
skipping to change at page 106, line 41 skipping to change at line 4895
+----------------+--------+------------+-------+---------+----------+ +----------------+--------+------------+-------+---------+----------+
|brainpoolP384r1 |SEC1 |integer |N/A |N/A |N/A | |brainpoolP384r1 |SEC1 |integer |N/A |N/A |N/A |
+----------------+--------+------------+-------+---------+----------+ +----------------+--------+------------+-------+---------+----------+
|brainpoolP512r1 |SEC1 |integer |N/A |N/A |N/A | |brainpoolP512r1 |SEC1 |integer |N/A |N/A |N/A |
+----------------+--------+------------+-------+---------+----------+ +----------------+--------+------------+-------+---------+----------+
|Ed25519Legacy |N/A |N/A |32 |32 octets|32 octets | |Ed25519Legacy |N/A |N/A |32 |32 octets|32 octets |
| | | |octets |of R |of S | | | | |octets |of R |of S |
| | | |of | | | | | | |of | | |
| | | |secret | | | | | | |secret | | |
+----------------+--------+------------+-------+---------+----------+ +----------------+--------+------------+-------+---------+----------+
|Curve25519Legacy|prefixed|integer (see|N/A |N/A |N/A | |Curve25519Legacy|prefixed|integer |N/A |N/A |N/A |
| |native |Section | | | | | |native |(Section | | | |
| | |5.5.5.6.1.1)| | | | | | |5.5.5.6.1.1)| | | |
+----------------+--------+------------+-------+---------+----------+ +----------------+--------+------------+-------+---------+----------+
Table 20: OpenPGP ECC Curve-specific Wire Formats registry Table 20: OpenPGP ECC Curve-Specific Wire Formats Registry
For the native octet-string forms of Ed25519Legacy values, see For the native octet-string forms of Ed25519Legacy values, see
[RFC8032]. For the native octet-string forms of Curve25519Legacy [RFC8032]. For the native octet-string forms of Curve25519Legacy
secret scalars and points, see [RFC7748]. secret scalars and points, see [RFC7748].
9.3. Symmetric-Key Algorithms 9.3. Symmetric Key Algorithms
+==========+=============================================+ +=========+============================================+
| ID | Algorithm | | ID | Algorithm |
+==========+=============================================+ +=========+============================================+
| 0 | Plaintext or unencrypted data | | 0 | Plaintext or unencrypted data |
+----------+---------------------------------------------+ +---------+--------------------------------------------+
| 1 | IDEA [IDEA] | | 1 | IDEA [IDEA] |
+----------+---------------------------------------------+ +---------+--------------------------------------------+
| 2 | TripleDES (DES-EDE, [SP800-67] - 168 bit | | 2 | TripleDES (or DES-EDE) [SP800-67] with |
| | key derived from 192) | | | 168-bit key derived from 192 |
+----------+---------------------------------------------+ +---------+--------------------------------------------+
| 3 | CAST5 (128 bit key, as per [RFC2144]) | | 3 | CAST5 with 128-bit key [RFC2144] |
+----------+---------------------------------------------+ +---------+--------------------------------------------+
| 4 | Blowfish (128 bit key, 16 rounds) | | 4 | Blowfish with 128-bit key, 16 rounds |
| | [BLOWFISH] | | | [BLOWFISH] |
+----------+---------------------------------------------+ +---------+--------------------------------------------+
| 5 | Reserved | | 5 | Reserved |
+----------+---------------------------------------------+ +---------+--------------------------------------------+
| 6 | Reserved | | 6 | Reserved |
+----------+---------------------------------------------+ +---------+--------------------------------------------+
| 7 | AES with 128-bit key [AES] | | 7 | AES with 128-bit key [AES] |
+----------+---------------------------------------------+ +---------+--------------------------------------------+
| 8 | AES with 192-bit key | | 8 | AES with 192-bit key |
+----------+---------------------------------------------+ +---------+--------------------------------------------+
| 9 | AES with 256-bit key | | 9 | AES with 256-bit key |
+----------+---------------------------------------------+ +---------+--------------------------------------------+
| 10 | Twofish with 256-bit key [TWOFISH] | | 10 | Twofish with 256-bit key [TWOFISH] |
+----------+---------------------------------------------+ +---------+--------------------------------------------+
| 11 | Camellia with 128-bit key [RFC3713] | | 11 | Camellia with 128-bit key [RFC3713] |
+----------+---------------------------------------------+ +---------+--------------------------------------------+
| 12 | Camellia with 192-bit key | | 12 | Camellia with 192-bit key |
+----------+---------------------------------------------+ +---------+--------------------------------------------+
| 13 | Camellia with 256-bit key | | 13 | Camellia with 256-bit key |
+----------+---------------------------------------------+ +---------+--------------------------------------------+
| 100 to | Private/Experimental algorithm | | 100-110 | Private or Experimental Use |
| 110 | | +---------+--------------------------------------------+
+----------+---------------------------------------------+ | 253-255 | Reserved to avoid collision with Secret |
| 253, 254 | Reserved to avoid collision with Secret Key | | | Key Encryption (Table 2 and Section 5.5.3) |
| and 255 | Encryption (see Table 2 and Section 5.5.3) | +---------+--------------------------------------------+
+----------+---------------------------------------------+
Table 21: OpenPGP Symmetric Key Algorithms registry Table 21: OpenPGP Symmetric Key Algorithms Registry
Implementations MUST implement AES-128. Implementations SHOULD Implementations MUST implement AES-128. Implementations SHOULD
implement AES-256. Implementations MUST NOT encrypt data with IDEA, implement AES-256. Implementations MUST NOT encrypt data with IDEA,
TripleDES, or CAST5. Implementations MAY decrypt data that uses TripleDES, or CAST5. Implementations MAY decrypt data that uses
IDEA, TripleDES, or CAST5 for the sake of reading older messages or IDEA, TripleDES, or CAST5 for the sake of reading older messages or
new messages from implementations predating support for [RFC2440]. new messages from implementations predating support for [RFC2440].
An Implementation that decrypts data using IDEA, TripleDES, or CAST5 An Implementation that decrypts data using IDEA, TripleDES, or CAST5
SHOULD generate a deprecation warning about the symmetric algorithm, SHOULD generate a deprecation warning about the symmetric algorithm,
indicating that message confidentiality is suspect. Implementations indicating that message confidentiality is suspect. Implementations
MAY implement any other algorithm. MAY implement any other algorithm.
9.4. Compression Algorithms 9.4. Compression Algorithms
+============+================================+ +=========+=============================+
| ID | Algorithm | | ID | Algorithm |
+============+================================+ +=========+=============================+
| 0 | Uncompressed | | 0 | Uncompressed |
+------------+--------------------------------+ +---------+-----------------------------+
| 1 | ZIP [RFC1951] | | 1 | ZIP [RFC1951] |
+------------+--------------------------------+ +---------+-----------------------------+
| 2 | ZLIB [RFC1950] | | 2 | ZLIB [RFC1950] |
+------------+--------------------------------+ +---------+-----------------------------+
| 3 | BZip2 [BZ2] | | 3 | BZip2 [BZ2] |
+------------+--------------------------------+ +---------+-----------------------------+
| 100 to 110 | Private/Experimental algorithm | | 100-110 | Private or Experimental Use |
+------------+--------------------------------+ +---------+-----------------------------+
Table 22: OpenPGP Compression Algorithms Table 22: OpenPGP Compression
registry Algorithms Registry
Implementations MUST implement uncompressed data. Implementations Implementations MUST implement uncompressed data. Implementations
SHOULD implement ZLIB. For interoperability reasons implementations SHOULD implement ZLIB. For interoperability reasons, implementations
SHOULD be able to decompress using ZIP. Implementations MAY SHOULD be able to decompress using ZIP. Implementations MAY
implement any other algorithm. implement any other algorithm.
9.5. Hash Algorithms 9.5. Hash Algorithms
+========+======================+=============+==============+ +=========+==================+=============+========================+
| ID | Algorithm | Text Name | V6 signature | | ID | Algorithm | Text Name | V6 Signature |
| | | | salt size | | | | | Salt Size |
+========+======================+=============+==============+ +=========+==================+=============+========================+
| 1 | MD5 [RFC1321] | "MD5" | N/A | | 0 | Reserved | | |
+--------+----------------------+-------------+--------------+ +---------+------------------+-------------+------------------------+
| 2 | SHA-1 [FIPS180], | "SHA1" | N/A | | 1 | MD5 [RFC1321] | "MD5" | N/A |
| | Section 13.1 | | | +---------+------------------+-------------+------------------------+
+--------+----------------------+-------------+--------------+ | 2 | SHA-1 [FIPS180] | "SHA1" | N/A |
| 3 | RIPEMD-160 | "RIPEMD160" | N/A | +---------+------------------+-------------+------------------------+
| | [RIPEMD-160] | | | | 3 | RIPEMD-160 | "RIPEMD160" | N/A |
+--------+----------------------+-------------+--------------+ | | [RIPEMD-160] | | |
| 4 | Reserved | | | +---------+------------------+-------------+------------------------+
+--------+----------------------+-------------+--------------+ | 4 | Reserved | | |
| 5 | Reserved | | | +---------+------------------+-------------+------------------------+
+--------+----------------------+-------------+--------------+ | 5 | Reserved | | |
| 6 | Reserved | | | +---------+------------------+-------------+------------------------+
+--------+----------------------+-------------+--------------+ | 6 | Reserved | | |
| 7 | Reserved | | | +---------+------------------+-------------+------------------------+
+--------+----------------------+-------------+--------------+ | 7 | Reserved | | |
| 8 | SHA2-256 [FIPS180] | "SHA256" | 16 | +---------+------------------+-------------+------------------------+
+--------+----------------------+-------------+--------------+ | 8 | SHA2-256 | "SHA256" | 16 |
| 9 | SHA2-384 [FIPS180] | "SHA384" | 24 | | | [FIPS180] | | |
+--------+----------------------+-------------+--------------+ +---------+------------------+-------------+------------------------+
| 10 | SHA2-512 [FIPS180] | "SHA512" | 32 | | 9 | SHA2-384 | "SHA384" | 24 |
+--------+----------------------+-------------+--------------+ | | [FIPS180] | | |
| 11 | SHA2-224 [FIPS180] | "SHA224" | 16 | +---------+------------------+-------------+------------------------+
+--------+----------------------+-------------+--------------+ | 10 | SHA2-512 | "SHA512" | 32 |
| 12 | SHA3-256 [FIPS202] | "SHA3-256" | 16 | | | [FIPS180] | | |
+--------+----------------------+-------------+--------------+ +---------+------------------+-------------+------------------------+
| 13 | Reserved | | | | 11 | SHA2-224 | "SHA224" | 16 |
+--------+----------------------+-------------+--------------+ | | [FIPS180] | | |
| 14 | SHA3-512 [FIPS202] | "SHA3-512" | 32 | +---------+------------------+-------------+------------------------+
+--------+----------------------+-------------+--------------+ | 12 | SHA3-256 | "SHA3-256" | 16 |
| 100 to | Private/Experimental | | | | | [FIPS202] | | |
| 110 | algorithm | | | +---------+------------------+-------------+------------------------+
+--------+----------------------+-------------+--------------+ | 13 | Reserved | | |
+---------+------------------+-------------+------------------------+
| 14 | SHA3-512 | "SHA3-512" | 32 |
| | [FIPS202] | | |
+---------+------------------+-------------+------------------------+
| 100-110 | Private or | | |
| | Experimental Use | | |
+---------+------------------+-------------+------------------------+
Table 23: OpenPGP Hash Algorithms registry Table 23: OpenPGP Hash Algorithms Registry
+============+=========================+=========================+ +============+=========================+=========================+
| Hash | OID | Full hash prefix | | Hash | OID | Full Hash Prefix |
| Algorithm | | | | Algorithm | | |
+============+=========================+=========================+ +============+=========================+=========================+
| MD5 | 1.2.840.113549.2.5 | 0x30, 0x20, 0x30, 0x0C, | | MD5 | 1.2.840.113549.2.5 | 0x30, 0x20, 0x30, 0x0C, |
| | | 0x06, 0x08, 0x2A, 0x86, | | | | 0x06, 0x08, 0x2A, 0x86, |
| | | 0x48, 0x86, 0xF7, 0x0D, | | | | 0x48, 0x86, 0xF7, 0x0D, |
| | | 0x02, 0x05, 0x05, 0x00, | | | | 0x02, 0x05, 0x05, 0x00, |
| | | 0x04, 0x10 | | | | 0x04, 0x10 |
+------------+-------------------------+-------------------------+ +------------+-------------------------+-------------------------+
| SHA-1 | 1.3.14.3.2.26 | 0x30, 0x21, 0x30, 0x09, | | SHA-1 | 1.3.14.3.2.26 | 0x30, 0x21, 0x30, 0x09, |
| | | 0x06, 0x05, 0x2B, 0x0E, | | | | 0x06, 0x05, 0x2B, 0x0E, |
skipping to change at page 110, line 38 skipping to change at line 5090
| | | 0x00, 0x04, 0x20 | | | | 0x00, 0x04, 0x20 |
+------------+-------------------------+-------------------------+ +------------+-------------------------+-------------------------+
| SHA3-512 | 2.16.840.1.101.3.4.2.10 | 0x30, 0x51, 0x30, 0x0D, | | SHA3-512 | 2.16.840.1.101.3.4.2.10 | 0x30, 0x51, 0x30, 0x0D, |
| | | 0x06, 0x09, 0x60, 0x86, | | | | 0x06, 0x09, 0x60, 0x86, |
| | | 0x48, 0x01, 0x65, 0x03, | | | | 0x48, 0x01, 0x65, 0x03, |
| | | 0x04, 0x02, 0x0a, 0x05, | | | | 0x04, 0x02, 0x0a, 0x05, |
| | | 0x00, 0x04, 0x40 | | | | 0x00, 0x04, 0x40 |
+------------+-------------------------+-------------------------+ +------------+-------------------------+-------------------------+
Table 24: OpenPGP Hash Algorithm Identifiers for RSA Table 24: OpenPGP Hash Algorithm Identifiers for RSA
Signatures use of EMSA- PKCS1-v1_5 Padding registry Signatures' Use of EMSA-PKCS1-v1_5 Padding Registry
Implementations MUST implement SHA2-256. Implementations SHOULD Implementations MUST implement SHA2-256. Implementations SHOULD
implement SHA2-384 and SHA2-512. Implementations MAY implement other implement SHA2-384 and SHA2-512. Implementations MAY implement other
algorithms. Implementations SHOULD NOT create messages which require algorithms. Implementations SHOULD NOT create messages that require
the use of SHA-1 with the exception of computing version 4 key the use of SHA-1, with the exception of computing version 4 key
fingerprints and for purposes of the Modification Detection Code fingerprints for purposes of the MDC in version 1 Symmetrically
(MDC) in version 1 Symmetrically Encrypted Integrity Protected Data Encrypted and Integrity Protected Data packets. Implementations MUST
packets. Implementations MUST NOT generate signatures with MD5, SHA- NOT generate signatures with MD5, SHA-1, or RIPEMD-160.
1, or RIPEMD-160. Implementations MUST NOT use MD5, SHA-1, or Implementations MUST NOT use MD5, SHA-1, or RIPEMD-160 as a hash
RIPEMD-160 as a hash function in an ECDH KDF. Implementations MUST function in an ECDH KDF. Implementations MUST NOT generate packets
NOT generate packets using MD5, SHA-1, or RIPEMD-160 as a hash using MD5, SHA-1, or RIPEMD-160 as a hash function in an S2K KDF.
function in an S2K KDF. Implementations MUST NOT decrypt a secret Implementations MUST NOT decrypt a secret using MD5, SHA-1, or
using MD5, SHA-1, or RIPEMD-160 as a hash function in an S2K KDF in a RIPEMD-160 as a hash function in an S2K KDF in a version 6 (or later)
version 6 (or later) packet. Implementations MUST NOT validate any packet. Implementations MUST NOT validate any recent signature that
recent signature that depends on MD5, SHA-1, or RIPEMD-160. depends on MD5, SHA-1, or RIPEMD-160. Implementations SHOULD NOT
Implementations SHOULD NOT validate any old signature that depends on validate any old signature that depends on MD5, SHA-1, or RIPEMD-160
MD5, SHA-1, or RIPEMD-160 unless the signature's creation date unless the signature's creation date predates known weakness of the
predates known weakness of the algorithm used, and the implementation algorithm used, and the implementation is confident that the message
is confident that the message has been in the secure custody of the has been in the secure custody of the user the whole time.
user the whole time.
9.6. AEAD Algorithms 9.6. AEAD Algorithms
+=====+==============+=============+==============+================+ +=========+==================+==============+====================+
| ID | Name | Reference | Nonce length | authentication | | ID | Name | Nonce Length | Authentication Tag |
| | | | (octets) | tag length | | | | (Octets) | Length (Octets) |
| | | | | (octets) | +=========+==================+==============+====================+
+=====+==============+=============+==============+================+ | 0 | Reserved | | |
| 1 | EAX | [EAX] | 16 | 16 | +---------+------------------+--------------+--------------------+
+-----+--------------+-------------+--------------+----------------+ | 1 | EAX [EAX] | 16 | 16 |
| 2 | OCB | [RFC7253] | 15 | 16 | +---------+------------------+--------------+--------------------+
+-----+--------------+-------------+--------------+----------------+ | 2 | OCB [RFC7253] | 15 | 16 |
| 3 | GCM | [SP800-38D] | 12 | 16 | +---------+------------------+--------------+--------------------+
+-----+--------------+-------------+--------------+----------------+ | 3 | GCM [SP800-38D] | 12 | 16 |
| 100 | Private/ | | | | +---------+------------------+--------------+--------------------+
| to | Experimental | | | | | 100-110 | Private or | | |
| 110 | algorithm | | | | | | Experimental Use | | |
+-----+--------------+-------------+--------------+----------------+ +---------+------------------+--------------+--------------------+
Table 25: OpenPGP AEAD Algorithms registry Table 25: OpenPGP AEAD Algorithms Registry
Implementations MUST implement OCB. Implementations MAY implement Implementations MUST implement OCB. Implementations MAY implement
EAX, GCM and other algorithms. EAX, GCM, and other algorithms.
10. Packet Sequence Composition 10. Packet Sequence Composition
OpenPGP packets are assembled into sequences in order to create OpenPGP packets are assembled into sequences in order to create
messages and to transfer keys. Not all possible packet sequences are messages and to transfer keys. Not all possible packet sequences are
meaningful and correct. This section describes the rules for how meaningful and correct. This section describes the rules for how
packets should be placed into sequences. packets should be placed into sequences.
There are three distinct sequences of packets: There are three distinct sequences of packets:
skipping to change at page 112, line 4 skipping to change at line 5149
packets should be placed into sequences. packets should be placed into sequences.
There are three distinct sequences of packets: There are three distinct sequences of packets:
* Transferable Public Keys (Section 10.1) and their close * Transferable Public Keys (Section 10.1) and their close
counterpart, Transferable Secret Keys (Section 10.2) counterpart, Transferable Secret Keys (Section 10.2)
* OpenPGP Messages (Section 10.3) * OpenPGP Messages (Section 10.3)
* Detached Signatures (Section 10.4) * Detached Signatures (Section 10.4)
Each sequence has an explicit grammar of what packet types (Table 3) Each sequence has an explicit grammar of what packet types (Table 3)
can appear in what place. The presence of an unknown critical can appear in what place. The presence of an unknown critical
packet, or a known but unexpected packet is a critical error, packet, or a known but unexpected packet, is a critical error,
invalidating the entire sequence (see Section 4.3). On the other invalidating the entire sequence (see Section 4.3). On the other
hand, unknown non-critical packets can appear anywhere within any hand, unknown non-critical packets can appear anywhere within any
sequence. This provides a structured way to introduce new packets sequence. This provides a structured way to introduce new packets
into the protocol, while making sure that certain packets will be into OpenPGP, while making sure that certain packets will be handled
handled strictly. strictly.
An implementation may "recognize" a packet, but not implement it. An implementation may "recognize" a packet but not implement it. The
The purpose of Packet Criticality is to allow the producer to tell purpose of Packet Criticality is to allow the producer to tell the
the consumer whether it would prefer a new, unknown packet to consumer whether it would prefer a new, unknown packet to generate an
generate an error or be ignored. error or be ignored.
Note that previous versions of this document did not have a concept Note that previous versions of this document did not have a concept
of Packet Criticality, and did not give clear guidance on what to do of Packet Criticality and did not give clear guidance on what to do
when unknown packets are encountered. Therefore, implementations of when unknown packets are encountered. Therefore, implementations of
older versions of this document may reject unknown non-critical the previous versions may reject unknown non-critical packets or
packets, or accept unknown critical packets. accept unknown critical packets.
When generating a sequence of OpenPGP packets according to one of the When generating a sequence of OpenPGP packets according to one of the
three grammars, an implementation MUST NOT inject a critical packet three grammars, an implementation MUST NOT inject a critical packet
of a type that does not adhere to the grammar. of a type that does not adhere to the grammar.
When consuming a sequence of OpenPGP packets according to one of the When consuming a sequence of OpenPGP packets, if an implementation
three grammars, an implementation MUST reject the sequence with an encounters a critical packet of an inappropriate type according to
error if it encounters a critical packet of inappropriate type the relevant grammar, the implementation MUST reject the sequence
according to the grammar. with an error.
10.1. Transferable Public Keys 10.1. Transferable Public Keys
OpenPGP users may transfer public keys. This section describes the OpenPGP users may transfer public keys. This section describes the
structure of public keys in transit to ensure interoperability. An structure of public keys in transit to ensure interoperability. An
OpenPGP Transferable Public Key is also known as an OpenPGP OpenPGP Transferable Public Key is also known as an OpenPGP
certificate, in order to distinguish it from both its constituent certificate, in order to distinguish it from both its constituent
Public-Key packets (Section 5.5.1.1 and Section 5.5.1.2) and the Public Key packets (Sections 5.5.1.1 and 5.5.1.2) and the underlying
underlying cryptographic key material. cryptographic key material.
10.1.1. OpenPGP v6 Certificate Structure 10.1.1. OpenPGP Version 6 Certificate Structure
The format of an OpenPGP v6 certificate is as follows. Entries in The format of an OpenPGP version 6 certificate is as follows.
square brackets are optional and ellipses indicate repetition. Entries in square brackets are optional and ellipses indicate
repetition.
Primary Key Primary Key
[Revocation Signature...] [Revocation Signature...]
Direct Key Signature... Direct Key Signature...
[User ID or User Attribute [User ID or User Attribute
[Certification Revocation Signature...] [Certification Revocation Signature...]
[Certification Signature...]]... [Certification Signature...]]...
[Subkey [Subkey Revocation Signature...] [Subkey [Subkey Revocation Signature...]
Subkey Binding Signature...]... Subkey Binding Signature...]...
[Padding] [Padding]
In addition to these rules, a marker packet (Section 5.8) can appear In addition to these rules, a Marker packet (Section 5.8) can appear
anywhere in the sequence. anywhere in the sequence.
Note, that a v6 key uses a self-signed direct key signature to store Note that a version 6 key uses a self-signed Direct Key signature to
algorithm preferences. store algorithm preferences.
Every subkey for a v6 primary key MUST be a v6 subkey. Every subkey Every subkey for a version 6 primary key MUST be a version 6 subkey.
MUST have at least one subkey binding signature. Every subkey Every subkey MUST have at least one Subkey Binding signature. Every
binding signature MUST be a self-signature (that is, made by the v6 Subkey Binding signature MUST be a self-signature (that is, made by
primary key). Like all other signatures, every self-signature made the version 6 primary key). Like all other signatures, every self-
by a v6 key MUST be a v6 signature. signature made by a version 6 key MUST be a version 6 signature.
10.1.2. OpenPGP v6 Revocation Certificate 10.1.2. OpenPGP Version 6 Revocation Certificate
When a primary v6 Public Key is revoked, it is sometimes distributed When a primary version 6 Public Key is revoked, it is sometimes
with only the revocation signature: distributed with only the Revocation Signature:
Primary Key Primary Key
Revocation Signature Revocation Signature
In this case, the direct key signature is no longer necessary, since In this case, the Direct Key signature is no longer necessary, since
the primary key itself has been marked as unusable. the primary key itself has been marked as unusable.
10.1.3. OpenPGP v4 Certificate Structure 10.1.3. OpenPGP Version 4 Certificate Structure
The format of an OpenPGP v4 key is as follows. The format of an OpenPGP version 4 key is as follows.
Primary Key Primary Key
[Revocation Signature] [Revocation Signature]
[Direct Key Signature...] [Direct Key Signature...]
[User ID or User Attribute [Signature...]]... [User ID or User Attribute [Signature...]]...
[Subkey [Subkey Revocation Signature...] [Subkey [Subkey Revocation Signature...]
Subkey Binding Signature...]... Subkey Binding Signature...]...
In addition to these rules, a marker packet (Section 5.8) can appear In addition to these rules, a Marker packet (Section 5.8) can appear
anywhere in the sequence. anywhere in the sequence.
A subkey always has at least one subkey binding signature after it A subkey always has at least one Subkey Binding signature after it
that is issued using the primary key to tie the two keys together. that is issued using the primary key to tie the two keys together.
These binding signatures may be in either v3 or v4 format, but SHOULD These binding signatures may be in either version 3 or version 4
be in v4 format. Subkeys that can issue signatures MUST have a v4 format, but they SHOULD be in version 4 format. Subkeys that can
binding signature due to the REQUIRED embedded primary key binding issue signatures MUST have a version 4 binding signature due to the
signature. REQUIRED embedded Primary Key Binding signature.
Every subkey for a v4 primary key MUST be a v4 subkey. Every subkey for a version 4 primary key MUST be a version 4 subkey.
When a primary v4 Public Key is revoked, the revocation signature is When a primary version 4 Public Key is revoked, the Revocation
sometimes distributed by itself, without the primary key packet it Signature is sometimes distributed by itself, without the primary key
applies to. This is referred to as a "revocation certificate". packet it applies to. This is referred to as a "revocation
Instead, a v6 revocation certificate MUST include the primary key certificate". Instead, a version 6 revocation certificate MUST
packet, as described in Section 10.1.2. include the primary key packet, as described in Section 10.1.2.
10.1.4. OpenPGP v3 Key Structure 10.1.4. OpenPGP Version 3 Key Structure
The format of an OpenPGP v3 key is as follows. The format of an OpenPGP version 3 key is as follows.
RSA Public Key RSA Public Key
[Revocation Signature] [Revocation Signature]
User ID [Signature...] User ID [Signature...]
[User ID [Signature...]]... [User ID [Signature...]]...
In addition to these rules, a marker packet (Section 5.8) can appear In addition to these rules, a Marker packet (Section 5.8) can appear
anywhere in the sequence. anywhere in the sequence.
Each signature certifies the RSA public key and the preceding User Each signature certifies the RSA public key and the preceding User
ID. The RSA public key can have many User IDs and each User ID can ID. The RSA public key can have many User IDs, and each User ID can
have many signatures. V3 keys are deprecated. Implementations MUST have many signatures. Version 3 keys are deprecated.
NOT generate new v3 keys, but MAY continue to use existing ones. Implementations MUST NOT generate new version 3 keys but MAY continue
to use existing ones.
V3 keys MUST NOT have subkeys. Version 3 keys MUST NOT have subkeys.
10.1.5. Common requirements 10.1.5. Common Requirements
The Public-Key packet occurs first. The Public Key packet occurs first.
The primary key MUST be an algorithm capable of making signatures The primary key MUST be an algorithm capable of making signatures
(that is, not an encryption-only algorithm). This is because the (that is, not an encryption-only algorithm). This is because the
primary key needs to be able to create self-signatures (see primary key needs to be able to create self-signatures (see
Section 5.2.3.10). The subkeys may be keys of any type. For Section 5.2.3.10). The subkeys may be keys of any type. For
example, there may be a single-key RSA key, an Ed25519 primary key example, there may be a single-key RSA key, an Ed25519 primary key
with an RSA encryption subkey, or an Ed25519 primary key with an with an RSA encryption subkey, an Ed25519 primary key with an X25519
X25519 subkey, etc. subkey, etc.
Each of the following User ID packets provides the identity of the Each of the following User ID packets provides the identity of the
owner of this public key. If there are multiple User ID packets, owner of this public key. If there are multiple User ID packets,
this corresponds to multiple means of identifying the same unique this corresponds to multiple means of identifying the same unique
individual user; for example, a user may have more than one email individual user; for example, a user may have more than one email
address, and construct a User ID for each one. A transferable public address and construct a User ID for each one. A Transferable Public
key SHOULD include at least one User ID packet unless storage Key SHOULD include at least one User ID packet unless storage
requirements prohibit this. requirements prohibit this.
Immediately following each User ID packet, there are zero or more Immediately following each User ID packet, there are zero or more
Signature packets. Each Signature packet is calculated on the Signature packets. Each Signature packet is calculated on the
immediately preceding User ID packet and the initial Public-Key immediately preceding User ID packet and the initial Public Key
packet. The signature serves to certify the corresponding public key packet. The signature serves to certify the corresponding public key
and User ID. In effect, the signer is testifying to his or her and User ID. In effect, the signer is testifying to the belief that
belief that this public key belongs to the user identified by this this public key belongs to the user identified by this User ID.
User ID.
Within the same section as the User ID packets, there are zero or Within the same section as the User ID packets, there are zero or
more User Attribute packets. Like the User ID packets, a User more User Attribute packets. Like the User ID packets, a User
Attribute packet is followed by zero or more Signature packets Attribute packet is followed by zero or more Signature packets
calculated on the immediately preceding User Attribute packet and the calculated on the immediately preceding User Attribute packet and the
initial Public-Key packet. initial Public Key packet.
User Attribute packets and User ID packets may be freely intermixed User Attribute packets and User ID packets may be freely intermixed
in this section, so long as the signatures that follow them are in this section, as long as the signatures that follow them are
maintained on the proper User Attribute or User ID packet. maintained on the proper User Attribute or User ID packet.
After the sequence of User ID packets and Attribute packets and their After the sequence of User ID packets and Attribute packets and their
associated signatures, zero or more Subkey packets follow, each with associated signatures, zero or more Subkey packets follow, each with
their own signatures. In general, subkeys are provided in cases their own signatures. In general, subkeys are provided in cases
where the top-level public key is a certification-only key. However, where the top-level public key is a certification-only key. However,
any v4 or v6 key may have subkeys, and the subkeys may be encryption any version 4 or version 6 key may have subkeys, and the subkeys may
keys, signing keys, authentication keys, etc. It is good practice to be encryption keys, signing keys, authentication keys, etc. It is
use separate subkeys for every operation (i.e. signature-only, good practice to use separate subkeys for every operation (i.e.,
encryption-only, authentication-only keys, etc.). signature-only, encryption-only, authentication-only keys, etc.).
Each Subkey packet MUST be followed by one Signature packet, which Each Subkey packet MUST be followed by one Signature packet, which
should be a subkey binding signature issued by the top-level key. should be a Subkey Binding signature issued by the top-level key.
For subkeys that can issue signatures, the subkey binding signature For subkeys that can issue signatures, the Subkey Binding signature
MUST contain an Embedded Signature subpacket with a primary key MUST contain an Embedded Signature subpacket with a Primary Key
binding signature (0x19) issued by the subkey on the top-level key. Binding signature (Type ID 0x19) issued by the subkey on the top-
level key.
Subkey and Key packets may each be followed by a revocation Signature Subkey and Key packets may each be followed by a Revocation Signature
packet to indicate that the key is revoked. Revocation signatures packet to indicate that the key is revoked. Revocation Signatures
are only accepted if they are issued by the key itself, or by a key are only accepted if they are issued by the key itself or by a key
that is authorized to issue revocations via a Revocation Key that is authorized to issue revocations via a Revocation Key
subpacket in a self-signature by the top-level key. subpacket in a self-signature by the top-level key.
The optional trailing Padding packet is a mechanism to defend against The optional trailing Padding packet is a mechanism to defend against
traffic analysis (see Section 13.11). For maximum interoperability, traffic analysis (see Section 13.11). For maximum interoperability,
if the Public-Key packet is a v4 key, the optional Padding packet if the Public Key packet is a version 4 key, the optional Padding
SHOULD NOT be present unless the recipient has indicated that they packet SHOULD NOT be present unless the recipient has indicated that
are capable of ignoring it successfully. An implementation that is they are capable of ignoring it successfully. An implementation that
capable of receiving a transferable public key with a v6 Public-Key is capable of receiving a Transferable Public Key with a version 6
primary key MUST be able to accept (and ignore) the trailing optional Public Key primary key MUST be able to accept (and ignore) the
Padding packet. trailing optional Padding packet.
Transferable public-key packet sequences may be concatenated to allow Transferable Public Key packet sequences may be concatenated to allow
transferring multiple public keys in one operation (see Section 3.6). transferring multiple public keys in one operation (see Section 3.6).
10.2. Transferable Secret Keys 10.2. Transferable Secret Keys
OpenPGP users may transfer secret keys. The format of a transferable OpenPGP users may transfer secret keys. The format of a Transferable
secret key is the same as a transferable public key except that Secret Key is the same as a Transferable Public Key except that
Secret-Key and Secret-Subkey packets can be used in addition to the Secret Key and Secret Subkey packets can be used in addition to the
Public-Key and Public-Subkey packets. If a single Secret-Key or Public Key and Public Subkey packets. If a single Secret Key or
Secret-Subkey packet is included in a packet sequence, it is a Secret Subkey packet is included in a packet sequence, it is a
transferable secret key and should be handled and marked as such (see Transferable Secret Key and should be handled and marked as such (see
Section 6.2). An implementation SHOULD include self-signatures on Section 6.2.1). An implementation SHOULD include self-signatures on
any User IDs and subkeys, as this allows for a complete public key to any User IDs and subkeys, as this allows for a complete public key to
be automatically extracted from the transferable secret key. An be automatically extracted from the Transferable Secret Key. An
implementation MAY choose to omit the self-signatures, especially if implementation MAY choose to omit the self-signatures, especially if
a transferable public key accompanies the transferable secret key. a Transferable Public Key accompanies the Transferable Secret Key.
10.3. OpenPGP Messages 10.3. OpenPGP Messages
An OpenPGP message is a packet or sequence of packets that An OpenPGP Message is a packet or sequence of packets that adheres to
corresponds to the following grammatical rules (comma (,) represents the following grammatical rules (a comma (,) represents sequential
sequential composition, and vertical bar (|) separates alternatives): composition, and a vertical bar (|) separates alternatives):
OpenPGP Message :- Encrypted Message | Signed Message | Compressed OpenPGP Message: Encrypted Message | Signed Message | Compressed
Message | Literal Message. Message | Literal Message.
Compressed Message :- Compressed Data Packet. Compressed Message: Compressed Data Packet.
Literal Message :- Literal Data Packet. Literal Message: Literal Data Packet.
ESK :- Public-Key Encrypted Session Key Packet | Symmetric-Key ESK: Public Key Encrypted Session Key Packet | Symmetric Key
Encrypted Session Key Packet. Encrypted Session Key Packet.
ESK Sequence :- ESK | ESK Sequence, ESK. ESK Sequence: ESK | ESK Sequence, ESK.
Encrypted Data :- Symmetrically Encrypted Data Packet | Encrypted Data: Symmetrically Encrypted Data Packet | Symmetrically
Symmetrically Encrypted Integrity Protected Data Packet Encrypted and Integrity Protected Data Packet.
Encrypted Message :- Encrypted Data | ESK Sequence, Encrypted Data. Encrypted Message: Encrypted Data | ESK Sequence, Encrypted Data.
One-Pass Signed Message :- One-Pass Signature Packet, OpenPGP One-Pass Signed Message: One-Pass Signature Packet, OpenPGP Message,
Message, Corresponding Signature Packet. Corresponding Signature Packet.
Signed Message :- Signature Packet, OpenPGP Message | One-Pass Signed Message: Signature Packet, OpenPGP Message | One-Pass Signed
Signed Message. Message.
Optionally Padded Message :- OpenPGP Message | OpenPGP Message, Optionally Padded Message: OpenPGP Message | OpenPGP Message,
Padding Packet. Padding Packet.
In addition to these rules, a marker packet (Section 5.8) can appear In addition to these rules, a Marker packet (Section 5.8) can appear
anywhere in the sequence. anywhere in the sequence.
10.3.1. Unwrapping Encrypted and Compressed Messages 10.3.1. Unwrapping Encrypted and Compressed Messages
In addition to the above grammar, certain messages can be "unwrapped" In addition to the above grammar, certain messages can be "unwrapped"
to yield new messages. In particular: to yield new messages. In particular:
* Decrypting a version 2 Symmetrically Encrypted and Integrity * Decrypting a version 2 Symmetrically Encrypted and Integrity
Protected Data packet MUST yield a valid Optionally Padded Protected Data packet MUST yield a valid Optionally Padded
Message. Message.
* Decrypting a version 1 Symmetrically Encrypted and Integrity * Decrypting a version 1 Symmetrically Encrypted and Integrity
Protected Data packet or --- for historic data --- a Symmetrically Protected Data packet or -- for historic data -- a Symmetrically
Encrypted Data packet MUST yield a valid OpenPGP Message. Encrypted Data packet MUST yield a valid OpenPGP Message.
* Decompressing a Compressed Data packet MUST also yield a valid * Decompressing a Compressed Data packet MUST also yield a valid
OpenPGP Message. OpenPGP Message.
When any unwrapping is performed, the resulting stream of octets is When any unwrapping is performed, the resulting stream of octets is
parsed into a series of OpenPGP packets like any other stream of parsed into a series of OpenPGP packets like any other stream of
octets. The packet boundaries found in the series of octets are octets. The packet boundaries found in the series of octets are
expected to align with the length of the unwrapped octet stream. An expected to align with the length of the unwrapped octet stream. An
implementation MUST NOT interpret octets beyond the boundaries of the implementation MUST NOT interpret octets beyond the boundaries of the
skipping to change at page 118, line 8 skipping to change at line 5430
the implementation MUST reject that packet as malformed and unusable. the implementation MUST reject that packet as malformed and unusable.
10.3.2. Additional Constraints on Packet Sequences 10.3.2. Additional Constraints on Packet Sequences
Note that some subtle combinations that are formally acceptable by Note that some subtle combinations that are formally acceptable by
this grammar are nonetheless unacceptable. this grammar are nonetheless unacceptable.
10.3.2.1. Packet Versions in Encrypted Messages 10.3.2.1. Packet Versions in Encrypted Messages
As noted above, an Encrypted Message is a sequence of zero or more As noted above, an Encrypted Message is a sequence of zero or more
PKESKs (Section 5.1) and SKESKs (Section 5.3), followed by an SEIPD PKESK packets (Section 5.1) and SKESK packets (Section 5.3), followed
(Section 5.13) payload. In some historic data, the payload may be a by an SEIPD (Section 5.13) payload. In some historic data, the
deprecated SED (Section 5.7) packet instead of SEIPD, though payload may be a deprecated SED packet (Section 5.7) instead of
implementations MUST NOT generate SED packets (see Section 13.7). SEIPD, though implementations MUST NOT generate SED packets (see
The versions of the preceding ESK packets within an Encrypted Message Section 13.7). The versions of the preceding ESK packets within an
MUST align with the version of the payload SEIPD packet, as described Encrypted Message MUST align with the version of the payload SEIPD
in this section. packet, as described in this section.
v3 PKESK and v4 SKESK packets both contain in their cleartext the v3 PKESK and v4 SKESK packets both contain the Symmetric Cipher
symmetric cipher algorithm ID in addition to the session key for the Algorithm ID and the session key for the subsequent SEIPD packet in
subsequent SEIPD packet. Since a v1 SEIPD does not contain a their cleartext. Since a v1 SEIPD does not contain a symmetric
symmetric algorithm ID, all ESK packets preceding a v1 SEIPD payload algorithm ID, all ESK packets preceding a v1 SEIPD payload MUST be
MUST be either v3 PKESK or v4 SKESK. either v3 PKESK or v4 SKESK.
On the other hand, the cleartext of the v6 ESK packets (either PKESK On the other hand, the cleartext of the v6 ESK packets (either PKESK
or SKESK) do not contain a symmetric cipher algorithm ID, so they or SKESK) do not contain a Symmetric Cipher Algorithm ID, so they
cannot be used in combination with a v1 SEIPD payload. The payload cannot be used in combination with a v1 SEIPD payload. The payload
following any v6 PKESK or v6 SKESK packet MUST be a v2 SEIPD. following any v6 PKESK or v6 SKESK packet MUST be a v2 SEIPD.
Additionally, to avoid potentially conflicting cipher algorithm IDs, Additionally, to avoid potentially conflicting cipher algorithm IDs,
and for simplicity, implementations MUST NOT precede a v2 SEIPD and for simplicity, implementations MUST NOT precede a v2 SEIPD
payload with either v3 PKESK or v4 SKESK packets. payload with either v3 PKESK or v4 SKESK packets.
The versions of packets found in an Encrypted Message are summarized The versions of packets found in an Encrypted Message are summarized
in the following table. An implementation MUST only generate an in the following table. An implementation MUST only generate an
Encrypted Message using packet versions that match a row with "Yes" Encrypted Message using packet versions that match a row with "Yes"
in the "Generate?" column. Other rows are provided for the purpose in the "Generate?" column. Other rows are provided for the purpose
of historic interoperability. A conforming implementation MUST only of historic interoperability. A conforming implementation MUST only
generate an Encrypted Message using packets whose versions correspond generate an Encrypted Message using packets whose versions correspond
to a single row. to a single row.
+==============+======================+==============+===========+ +==============+=====================+==================+===========+
| Version of | Version of preceding | Version of | Generate? | | Version of | Version of | Version of | Generate? |
| Encrypted | Symmetric-Key ESK | preceding | | | Encrypted | Preceding Symmetric | Preceding | |
| Data payload | (if any) | Public-Key | | | Data Payload | Key ESK (If Any) | Public Key | |
| | | ESK (if any) | | | | | ESK (If Any) | |
+==============+======================+==============+===========+ +==============+=====================+==================+===========+
| SED (Section | - | v2 PKESK | No | | SED (Section | - | v2 PKESK | No |
| 5.7) | | ([RFC2440]) | | | 5.7) | | [RFC2440] | |
+--------------+----------------------+--------------+-----------+ +--------------+---------------------+------------------+-----------+
| SED (Section | v4 SKESK | v3 PKESK | No | | SED (Section | v4 SKESK | v3 PKESK | No |
| 5.7) | (Section 5.3.1) | (Section | | | 5.7) | (Section 5.3.1) | (Section | |
| | | 5.1.1) | | | | | 5.1.1) | |
+--------------+----------------------+--------------+-----------+ +--------------+---------------------+------------------+-----------+
| v1 SEIPD | v4 SKESK | v3 PKESK | Yes | | v1 SEIPD | v4 SKESK | v3 PKESK | Yes |
| (Section | (Section 5.3.1) | (Section | | | (Section | (Section 5.3.1) | (Section | |
| 5.13.1) | | 5.1.1) | | | 5.13.1) | | 5.1.1) | |
+--------------+----------------------+--------------+-----------+ +--------------+---------------------+------------------+-----------+
| v2 SEIPD | v6 SKESK | v6 PKESK | Yes | | v2 SEIPD | v6 SKESK | v6 PKESK | Yes |
| (Section | (Section 5.3.2) | (Section | | | (Section | (Section 5.3.2) | (Section | |
| 5.13.2) | | 5.1.2) | | | 5.13.2) | | 5.1.2) | |
+--------------+----------------------+--------------+-----------+ +--------------+---------------------+------------------+-----------+
Table 26: OpenPGP Encrypted Message Packet Versions registry Table 26: OpenPGP Encrypted Message Packet Versions Registry
An implementation processing an Encrypted Message MUST discard any An implementation processing an Encrypted Message MUST discard any
preceding ESK packet with a version that does not align with the preceding ESK packet with a version that does not align with the
version of the payload. version of the payload.
10.3.2.2. Packet Versions in Signatures 10.3.2.2. Packet Versions in Signatures
OpenPGP key packets and signature packets are also versioned. The OpenPGP Key packets and Signature packets are also versioned. The
version of a Signature typically matches the version of the signing version of a Signature typically matches the version of the signing
key. When a v6 key produces a signature packet, it MUST produce a key. When a version 6 key produces a Signature packet, it MUST
version 6 signature packet, regardless of the signature packet type. produce a version 6 Signature packet, regardless of the Signature
When a message is signed or verified using the one-pass construction, packet type. When a message is signed or verified using the one-pass
the version of the One-Pass Signature packet (Section 5.4) should construction, the version of the One-Pass Signature packet
also be aligned to the other versions. (Section 5.4) should also be aligned to the other versions.
Some legacy implementations have produced unaligned signature Some legacy implementations have produced unaligned signature
versions for older key material, which are also described in the versions for older key material, which are also described in the
table below for purpose of historic interoperability. A conforming table below for the purpose of historic interoperability. A
implementation MUST only generate signature packets with version conforming implementation MUST only generate Signature packets with
numbers matching rows with "Yes" in the "Generate?" column. version numbers matching rows with "Yes" in the "Generate?" column.
+=====================+================+============+===========+ +=====================+================+============+===========+
| Signing key version | Signature | OPS packet | Generate? | | Signing Key Version | Signature | OPS Packet | Generate? |
| | packet version | version | | | | Packet Version | Version | |
+=====================+================+============+===========+ +=====================+================+============+===========+
| 3 (Section 5.5.2.1) | 3 (Section | 3 Section | No | | 3 (Section 5.5.2.1) | 3 (Section | 3 (Section | No |
| | 5.2.2) | 5.4 | | | | 5.2.2) | 5.4) | |
+---------------------+----------------+------------+-----------+ +---------------------+----------------+------------+-----------+
| 4 (Section 5.5.2.2) | 3 (Section | 3 Section | No | | 4 (Section 5.5.2.2) | 3 (Section | 3 (Section | No |
| | 5.2.2) | 5.4 | | | | 5.2.2) | 5.4) | |
+---------------------+----------------+------------+-----------+ +---------------------+----------------+------------+-----------+
| 4 (Section 5.5.2.2) | 4 (Section | 3 Section | Yes | | 4 (Section 5.5.2.2) | 4 (Section | 3 (Section | Yes |
| | 5.2.3) | 5.4 | | | | 5.2.3) | 5.4) | |
+---------------------+----------------+------------+-----------+ +---------------------+----------------+------------+-----------+
| 6 (Section 5.5.2.3) | 6 (Section | 6 Section | Yes | | 6 (Section 5.5.2.3) | 6 (Section | 6 (Section | Yes |
| | 5.2.3) | 5.4 | | | | 5.2.3) | 5.4) | |
+---------------------+----------------+------------+-----------+ +---------------------+----------------+------------+-----------+
Table 27: OpenPGP Key and Signature Versions registry Table 27: OpenPGP Key and Signature Versions Registry
Note, however, that a version mismatch between these packets does not Note, however, that a version mismatch between these packets does not
invalidate the packet sequence as a whole, it merely invalidates the invalidate the packet sequence as a whole; it merely invalidates the
signature, as a signature with an unknown version SHOULD be discarded signature, as a signature with an unknown version SHOULD be discarded
(see Section 5.2.5). (see Section 5.2.5).
10.4. Detached Signatures 10.4. Detached Signatures
Some OpenPGP applications use so-called "detached signatures". For Some OpenPGP applications use so-called "detached signatures". For
example, a program bundle may contain a file, and with it a second example, a program bundle may contain a file, and with it a second
file that is a detached signature of the first file. These detached file that is a detached signature of the first file. These detached
signatures are simply one or more Signature packets stored separately signatures are simply one or more Signature packets stored separately
from the data for which they are a signature. from the data for which they are a signature.
In addition, a marker packet (Section 5.8) and a padding packet In addition, a Marker packet (Section 5.8) and a Padding packet
(Section 5.14) can appear anywhere in the sequence. (Section 5.14) can appear anywhere in the sequence.
11. Elliptic Curve Cryptography 11. Elliptic Curve Cryptography
This section describes algorithms and parameters used with Elliptic This section describes algorithms and parameters used with Elliptic
Curve Cryptography (ECC) keys. A thorough introduction to ECC can be Curve Cryptography (ECC) keys. A thorough introduction to ECC can be
found in [KOBLITZ]. found in [KOBLITZ]. Refer to [FIPS186], Appendix B.4, for the
methods to generate a uniformly distributed ECC private key.
None of the ECC methods described in this document are allowed with None of the ECC methods described in this document are allowed with
deprecated v3 keys. Refer to [FIPS186], B.4.1, for the method to deprecated version 3 keys.
generate a uniformly distributed ECC private key.
11.1. ECC Curves 11.1. ECC Curves
This document references three named prime field curves defined in This document references three named prime field curves defined in
[FIPS186] as "Curve P-256", "Curve P-384", and "Curve P-521"; and [FIPS186] as "Curve P-256", "Curve P-384", and "Curve P-521" and
three named prime field curves defined in [RFC5639] as three named prime field curves defined in [RFC5639] as
"brainpoolP256r1", "brainpoolP384r1", and "brainpoolP512r1". The "brainpoolP256r1", "brainpoolP384r1", and "brainpoolP512r1". All six
three [FIPS186] curves and the three [RFC5639] curves can be used curves can be used with ECDSA and ECDH public key algorithms. They
with ECDSA and ECDH public key algorithms. They are referenced using are referenced using a sequence of octets, referred to as the curve
a sequence of octets, referred to as the curve OID. Section 9.2 OID. Section 9.2 describes in detail how this sequence of octets is
describes in detail how this sequence of octets is formed. formed.
Separate algorithms are also defined for the use of X25519 and X448, Separate algorithms are also defined for the use of X25519 and X448
defined in [RFC7748]; and Ed25519 and Ed448, defined in [RFC8032]. [RFC7748] and Ed25519 and Ed448 [RFC8032]. Additionally, legacy OIDs
Additionally, legacy OIDs are defined for "Curve25519Legacy" (for are defined for "Curve25519Legacy" (for encryption using the ECDH
encryption using the ECDH algorithm) and "Ed25519Legacy" (for signing algorithm) and "Ed25519Legacy" (for signing using the EdDSALegacy
using the EdDSALegacy algorithm). algorithm).
11.2. EC Point Wire Formats 11.2. EC Point Wire Formats
A point on an elliptic curve will always be represented on the wire A point on an elliptic curve will always be represented on the wire
as an MPI. Each curve uses a specific point format for the data as an MPI. Each curve uses a specific point format for the data
within the MPI itself. Each format uses a designated prefix octet to within the MPI itself. Each format uses a designated prefix octet to
ensure that the high octet has at least one bit set to make the MPI a ensure that the high octet has at least 1 bit set to make the MPI a
constant size. constant size.
+=================+================+================+ +=================+================+================+
| Name | Wire Format | Reference | | Name | Wire Format | Reference |
+=================+================+================+ +=================+================+================+
| SEC1 | 0x04 || x || y | Section 11.2.1 | | SEC1 | 0x04 || x || y | Section 11.2.1 |
+-----------------+----------------+----------------+ +-----------------+----------------+----------------+
| Prefixed native | 0x40 || native | Section 11.2.2 | | Prefixed native | 0x40 || native | Section 11.2.2 |
+-----------------+----------------+----------------+ +-----------------+----------------+----------------+
Table 28: OpenPGP Elliptic Curve Point Wire Table 28: OpenPGP Elliptic Curve Point Wire
Formats registry Formats Registry
11.2.1. SEC1 EC Point Wire Format 11.2.1. SEC1 EC Point Wire Format
For a SEC1-encoded (uncompressed) point the content of the MPI is: For a SEC1-encoded (uncompressed) point, the content of the MPI is:
B = 04 || x || y B = 04 || x || y
where x and y are coordinates of the point P = (x, y), and each is where x and y are coordinates of the point P = (x, y), and each is
encoded in the big-endian format and zero-padded to the adjusted encoded in the big-endian format and zero-padded to the adjusted
underlying field size. The adjusted underlying field size is the underlying field size. The adjusted underlying field size is the
underlying field size rounded up to the nearest 8-bit boundary, as underlying field size rounded up to the nearest 8-bit boundary, as
noted in the "fsize" column in Section 9.2. This encoding is noted in the "fsize" column in Section 9.2. This encoding is
compatible with the definition given in [SEC1]. compatible with the definition given in [SEC1].
11.2.2. Prefixed Native EC Point Wire Format 11.2.2. Prefixed Native EC Point Wire Format
For a custom compressed point the content of the MPI is: For a custom compressed point, the content of the MPI is:
B = 40 || p B = 40 || p
where p is the public key of the point encoded using the rules where p is the public key of the point encoded using the rules
defined for the specified curve. This format is used for ECDH keys defined for the specified curve. This format is used for ECDH keys
based on curves expressed in Montgomery form, and for points when based on curves expressed in Montgomery form and for points when
using EdDSA. using EdDSA.
11.2.3. Notes on EC Point Wire Formats 11.2.3. Notes on EC Point Wire Formats
Given the above definitions, the exact size of the MPI payload for an Given the above definitions, the exact size of the MPI payload for an
encoded point is 515 bits for both NIST P-256 and brainpoolP256r1, encoded point is 515 bits for both NIST P-256 and brainpoolP256r1,
771 for both NIST P-384 and brainpoolP384r1, 1059 for NIST P-521, 771 for both NIST P-384 and brainpoolP384r1, 1059 for NIST P-521,
1027 for brainpoolP512r1, and 263 for both Curve25519Legacy and 1027 for brainpoolP512r1, and 263 for both Curve25519Legacy and
Ed25519Legacy. For example, the length of a EdDSALegacy public key Ed25519Legacy. For example, the length of an EdDSALegacy public key
for the curve Ed25519Legacy is 263 bits: 7 bits to represent the 0x40 for the curve Ed25519Legacy is 263 bits: 7 bits to represent the 0x40
prefix octet and 32 octets for the native value of the public key. prefix octet and 32 octets for the native value of the public key.
Even though the zero point, also called the point at infinity, may Even though the zero point (also called the "point at infinity") may
occur as a result of arithmetic operations on points of an elliptic occur as a result of arithmetic operations on points of an elliptic
curve, it SHALL NOT appear in data structures defined in this curve, it SHALL NOT appear in data structures defined in this
document. document.
Each particular curve uses a designated wire format for the point Each particular curve uses a designated wire format for the point
found in its public key or ECDH data structure. An implementation found in its public key or ECDH data structure. An implementation
MUST NOT use a different wire format for a point than the wire format MUST NOT use a different wire format for a point other than the wire
associated with the curve. format associated with the curve.
11.3. EC Scalar Wire Formats 11.3. EC Scalar Wire Formats
Some non-curve values in elliptic curve cryptography (for example, Some non-curve values in elliptic curve cryptography (for example,
secret keys and signature components) are not points on a curve, but secret keys and signature components) are not points on a curve, but
are also encoded on the wire in OpenPGP as an MPI. they are also encoded on the wire in OpenPGP as an MPI.
Because of different patterns of deployment, some curves treat these Because of different patterns of deployment, some curves treat these
values as opaque bit strings with the high bit set, while others are values as opaque bit strings with the high bit set, while others are
treated as actual integers, encoded in the standard OpenPGP big- treated as actual integers, encoded in the standard OpenPGP big-
endian form. The choice of encoding is specific to the public key endian form. The choice of encoding is specific to the public key
algorithm in use. algorithm in use.
+==========+===========================================+===========+ +==========+===========================================+===========+
| Type | Description | Reference | | Type | Description | Reference |
+==========+===========================================+===========+ +==========+===========================================+===========+
| integer | An integer, big-endian encoded as a | Section | | integer | An integer encoded in big-endian format | Section |
| | standard OpenPGP MPI | 3.2 | | | as a standard OpenPGP MPI | 3.2 |
+----------+-------------------------------------------+-----------+ +----------+-------------------------------------------+-----------+
| octet | An octet string of fixed length, that may | Section | | octet | An octet string of fixed length that may | Section |
| string | be shorter on the wire due to leading | 11.3.1 | | string | be shorter on the wire due to leading | 11.3.1 |
| | zeros being stripped by the MPI encoding, | | | | zeros being stripped by the MPI encoding | |
| | and may need to be zero-padded before use | | | | and may need to be zero-padded before use | |
+----------+-------------------------------------------+-----------+ +----------+-------------------------------------------+-----------+
| prefixed | An octet string of fixed length N, | Section | | prefixed | An octet string of fixed length N, | Section |
| N octets | prefixed with octet 0x40 to ensure no | 11.3.2 | | N octets | prefixed with octet 0x40 to ensure no | 11.3.2 |
| | leading zero octet | | | | leading zero octet | |
+----------+-------------------------------------------+-----------+ +----------+-------------------------------------------+-----------+
Table 29: OpenPGP Elliptic Curve Scalar Encodings registry Table 29: OpenPGP Elliptic Curve Scalar Encodings Registry
11.3.1. EC Octet String Wire Format 11.3.1. EC Octet String Wire Format
Some opaque strings of octets are represented on the wire as an MPI Some opaque strings of octets are represented on the wire as an MPI
by simply stripping the leading zeros and counting the remaining by simply stripping the leading zeros and counting the remaining
bits. These strings are of known, fixed length. They are bits. These strings are of known, fixed length. They are
represented in this document as MPI(N octets of X) where N is the represented in this document as MPI(N octets of X), where N is the
expected length in octets of the octet string. expected length in octets of the octet string.
For example, a five-octet opaque string (MPI(5 octets of X)) where X For example, a 5-octet opaque string (MPI(5 octets of X)) where X has
has the value 00 02 EE 19 00 would be represented on the wire as an the value 00 02 EE 19 00 would be represented on the wire as an MPI
MPI like so: 00 1A 02 EE 19 00. like so: 00 1A 02 EE 19 00.
To encode X to the wire format, we set the MPI's two-octet bit To encode X to the wire format, set the MPI's 2-octet bit counter to
counter to the value of the highest set bit (bit 26, or 0x001A), and the value of the highest set bit (bit 26, or 0x001A), and do not
do not transfer the leading all-zero octet to the wire. transfer the leading all-zero octet to the wire.
To reverse the process, an implementation that knows this value has To reverse the process, an implementation can take the following
an expected length of 5 octets can take the following steps: steps, if it knows that X has an expected lenth of, for example, 5
octets:
* Ensure that the MPI's two-octet bitcount is less than or equal to * Ensure that the MPI's 2-octet bit count is less than or equal to
40 (5 octets of 8 bits) 40 (5 octets of 8 bits)
* Allocate 5 octets, setting all to zero initially * Allocate 5 octets, setting all to zero initially
* Copy the MPI data octets (without the two count octets) into the * Copy the MPI data octets (without the two count octets) into the
lower octets of the allocated space lower octets of the allocated space
11.3.2. Elliptic Curve Prefixed Octet String Wire Format 11.3.2. EC Prefixed Octet String Wire Format
Another way to ensure that a fixed-length bytestring is encoded Another way to ensure that a fixed-length bytes string is encoded
simply to the wire while remaining in MPI format is to prefix the simply to the wire while remaining in MPI format is to prefix the
bytestring with a dedicated non-zero octet. This specification uses byte string with a dedicated non-zero octet. This specification uses
0x40 as the prefix octet. This is represented in this standard as 0x40 as the prefix octet. This is represented in this specification
MPI(prefixed N octets of X), where N is the known bytestring length. as MPI(prefixed N octets of X), where N is the known byte string
length.
For example, a five-octet opaque string using MPI(prefixed 5 octets For example, a 5-octet opaque string using MPI(prefixed 5 octets of
of X) where X has the value 00 02 EE 19 00 would be written to the X) where X has the value 00 02 EE 19 00 would be written to the wire
wire form as: 00 2F 40 00 02 EE 19 00. form as: 00 2F 40 00 02 EE 19 00.
To encode the string, we prefix it with the octet 0x40 (whose 7th bit To encode the string, prefix it with the octet 0x40 (whose 7th bit is
is set), then set the MPI's two-octet bit counter to 47 (0x002F, 7 set), and then set the MPI's 2-octet bit counter to 47 (0x002F -- 7
bits for the prefix octet and 40 bits for the string). bits for the prefix octet and 40 bits for the string).
To decode the string from the wire, an implementation that knows that To decode the string from the wire, an implementation that knows that
the variable is formed in this way can: the variable is formed in this way can:
* Ensure that the first three octets of the MPI (the two bit-count * ensure that the first three octets of the MPI (the 2-bit count
octets plus the prefix octet) are 00 2F 40, and octets plus the prefix octet) are 00 2F 40, and
* Use the remainder of the MPI directly off the wire. * use the remainder of the MPI directly off the wire.
Note that this is a similar approach to that used in the EC point Note that this is a similar approach to that used in the EC point
encodings found in Section 11.2.2. encodings found in Section 11.2.2.
11.4. Key Derivation Function 11.4. Key Derivation Function
A key derivation function (KDF) is necessary to implement EC A key derivation function (KDF) is necessary to implement EC
encryption. The Concatenation Key Derivation Function (Approved encryption. The Concatenation Key Derivation Function (Approved
Alternative 1) [SP800-56A] with the KDF hash function that is Alternative 1) [SP800-56A] with the KDF hash function that is
SHA2-256 [FIPS180] or stronger is REQUIRED. SHA2-256 [FIPS180] or stronger is REQUIRED.
skipping to change at page 125, line 21 skipping to change at line 5744
// Convert the point X to the octet string: // Convert the point X to the octet string:
// ZB' = 04 || x || y // ZB' = 04 || x || y
// and extract the x portion from ZB' // and extract the x portion from ZB'
ZB = x; ZB = x;
MB = Hash ( 00 || 00 || 00 || 01 || ZB || Param ); MB = Hash ( 00 || 00 || 00 || 01 || ZB || Param );
return oBits leftmost bits of MB. return oBits leftmost bits of MB.
Note that ZB in the KDF description above is the compact Note that ZB in the KDF description above is the compact
representation of X as defined in Section 4.2 of [RFC6090]. representation of X as defined in Section 4.2 of [RFC6090].
11.5. EC DH Algorithm (ECDH) 11.5. ECDH Algorithm
The method is a combination of an ECC Diffie-Hellman method to This section describes the One-Pass Diffie-Hellman method, which is a
establish a shared secret, a key derivation method to process the combination of the ECC Diffie-Hellman method that establishes a
shared secret into a derived key, and a key wrapping method that uses shared secret and the key derivation method that processes the shared
the derived key to protect a session key used to encrypt a message. secret into a derived key. Additionally, this section describes a
key wrapping method that uses the derived key to protect a session
key used to encrypt a message.
The One-Pass Diffie-Hellman method C(1, 1, ECC CDH) [SP800-56A] MUST The One-Pass Diffie-Hellman method C(1, 1, ECC CDH) [SP800-56A] MUST
be implemented with the following restrictions: the ECC CDH primitive be implemented with the following restrictions: the ECC Cofactor
employed by this method is modified to always assume the cofactor is Diffie-Hellman (CDH) primitive employed by this method is modified to
1, the KDF specified in Section 11.4 is used, and the KDF parameters always assume the cofactor is 1, the KDF specified in Section 11.4 is
specified below are used. used, and the KDF parameters specified below are used.
The KDF parameters are encoded as a concatenation of the following 5 The KDF parameters are encoded as a concatenation of the following 5
variable-length and fixed-length fields, which are compatible with variable-length and fixed-length fields, which are compatible with
the definition of the OtherInfo bitstring [SP800-56A]: the definition of the OtherInfo bit string [SP800-56A]:
* A variable-length field containing a curve OID, which is formatted * A variable-length field containing a curve OID, which is formatted
as follows: as follows:
- A one-octet size of the following field, - A 1-octet size of the following field.
- The octets representing a curve OID defined in Section 9.2; - The octets representing a curve OID, as defined in Section 9.2.
* A one-octet public key algorithm ID defined in Section 9.1; * A 1-octet public key algorithm ID, as defined in Section 9.1.
* A variable-length field containing KDF parameters, which are * A variable-length field containing KDF parameters, which are
identical to the corresponding field in the ECDH public key, and identical to the corresponding field in the ECDH public key and
are formatted as follows: formatted as follows:
- A one-octet size of the following fields; values 0 and 0xFF are - A 1-octet size of the following fields; values 0 and 0xFF are
reserved for future extensions, reserved for future extensions.
- A one-octet value 0x01, reserved for future extensions, - A 1-octet value 0x01, reserved for future extensions.
- A one-octet hash function ID used with the KDF, - A 1-octet hash function ID used with the KDF.
- A one-octet algorithm ID for the symmetric algorithm used to - A 1-octet algorithm ID for the symmetric algorithm that is used
wrap the symmetric key for message encryption; see Section 11.5 to wrap the symmetric key for message encryption; see
for details; Section 11.5 for details.
* 20 octets representing the UTF-8 encoding of the string Anonymous * 20 octets representing the UTF-8 encoding of the string "Anonymous
Sender , which is the octet sequence 41 6E 6F 6E 79 6D 6F 75 73 Sender" padded at the end with spaces (0x20) to 20 octets, which
20 53 65 6E 64 65 72 20 20 20 20; is the octet sequence 41 6E 6F 6E 79 6D 6F 75 73 20 53 65 6E 64 65
72 20 20 20 20.
* A variable-length field containing the fingerprint of the * A variable-length field containing the fingerprint of the
recipient encryption subkey identifying the key material that is recipient encryption subkey identifying the key material that is
needed for decryption. For version 4 keys, this field is 20 needed for decryption. For version 4 keys, this field is 20
octets. For version 6 keys, this field is 32 octets. octets. For version 6 keys, this field is 32 octets.
The size in octets of the KDF parameters sequence, defined above, for The size in octets of the KDF parameters sequence, as defined above,
encrypting to a v4 key is either 54 for curve NIST P-256, 51 for for encrypting to a version 4 key is 54 for curve NIST P-256; 51 for
curves NIST P-384 and NIST P-521, 55 for curves brainpoolP256r1, curves NIST P-384 and NIST P-521; 55 for curves brainpoolP256r1,
brainpoolP384r1 and brainpoolP512r1, or 56 for Curve25519Legacy. For brainpoolP384r1, and brainpoolP512r1; or 56 for Curve25519Legacy.
encrypting to a v6 key, the size of the sequence is either 66 for For encrypting to a version 6 key, the size of the sequence is 66 for
curve NIST P-256, 63 for curves NIST P-384 and NIST P-521, or 67 for curve NIST P-256; 63 for curves NIST P-384 and NIST P-521; or 67 for
curves brainpoolP256r1, brainpoolP384r1 and brainpoolP512r1. curves brainpoolP256r1, brainpoolP384r1, and brainpoolP512r1.
The key wrapping method is described in [RFC3394]. The KDF produces The key wrapping method is described in [RFC3394]. The KDF produces
a symmetric key that is used as a key-encryption key (KEK) as a symmetric key that is used as a KEK as specified in [RFC3394].
specified in [RFC3394]. Refer to Section 11.5.1 for the details Refer to Section 11.5.1 for the details regarding the choice of the
regarding the choice of the KEK algorithm, which SHOULD be one of the KEK algorithm, which SHOULD be one of the three AES algorithms. Key
three AES algorithms. Key wrapping and unwrapping is performed with wrapping and unwrapping is performed with the default initial value
the default initial value of [RFC3394]. of [RFC3394].
To produce the input to the key wrapping method, first concatenate To produce the input to the key wrapping method, first concatenate
the following values: the following values:
* The one-octet algorithm identifier, if it was passed (in the case * The 1-octet algorithm identifier, if it was passed (in the case of
of a v3 PKESK packet). a v3 PKESK packet).
* The session key. * The session key.
* A two-octet checksum of the session key, equal to the sum of the * A 2-octet checksum of the session key, equal to the sum of the
session key octets, modulo 65536. session key octets, modulo 65536.
Then, the above values are padded using the method described in Then, the above values are padded to an 8-octet granularity using the
[RFC2898] to an 8-octet granularity. method described in [RFC8018].
For example, in a v3 Public-Key Encrypted Session Key packet, an For example, in a version 3 Public Key Encrypted Session Key packet,
AES-256 session key is encoded as follows, forming a 40 octet an AES-256 session key is encoded as follows, forming a 40-octet
sequence: sequence:
09 k0 k1 ... k31 s0 s1 05 05 05 05 05 09 k0 k1 ... k31 s0 s1 05 05 05 05 05
The octets k0 to k31 above denote the session key, and the octets s0 The octets k0 to k31 above denote the session key, and the octets s0
and s1 denote the checksum of the session key octets. This encoding and s1 denote the checksum of the session key octets. This encoding
allows the sender to obfuscate the size of the symmetric encryption allows the sender to obfuscate the size of the symmetric encryption
key used to encrypt the data. For example, assuming that an AES key used to encrypt the data. For example, assuming that an AES
algorithm is used for the session key, the sender MAY use 21, 13, and algorithm is used for the session key, the sender MAY use 21, 13, and
5 octets of padding for AES-128, AES-192, and AES-256, respectively, 5 octets of padding for AES-128, AES-192, and AES-256, respectively,
to provide the same number of octets, 40 total, as an input to the to provide the same number of octets, 40 total, as an input to the
key wrapping method. key wrapping method.
In a v6 Public-Key Encrypted Session Key packet, the symmetric In a version 6 Public Key Encrypted Session Key packet, the symmetric
algorithm is not included, as described in Section 5.1. For example, algorithm is not included, as described in Section 5.1. For example,
an AES-256 session key would be composed as follows: an AES-256 session key would be composed as follows:
k0 k1 ... k31 s0 s1 06 06 06 06 06 06 k0 k1 ... k31 s0 s1 06 06 06 06 06 06
The octets k0 to k31 above again denote the session key, and the The octets k0 to k31 above again denote the session key, and the
octets s0 and s1 denote the checksum. In this case, assuming that an octets s0 and s1 denote the checksum. In this case, assuming that an
AES algorithm is used for the session key, the sender MAY use 22, 14, AES algorithm is used for the session key, the sender MAY use 22, 14,
and 6 octets of padding for AES-128, AES-192, and AES-256, and 6 octets of padding for AES-128, AES-192, and AES-256,
respectively, to provide the same number of octets, 40 total, as an respectively, to provide the same number of octets, 40 total, as an
input to the key wrapping method. input to the key wrapping method.
The output of the method consists of two fields. The first field is The output of the method consists of two fields. The first field is
the MPI containing the ephemeral key used to establish the shared the MPI containing the ephemeral key used to establish the shared
secret. The second field is composed of the following two subfields: secret. The second field is composed of the following two subfields:
* One octet encoding the size in octets of the result of the key * One octet encoding the size in octets of the result of the key
wrapping method; the value 255 is reserved for future extensions; wrapping method; the value 255 is reserved for future extensions.
* Up to 254 octets representing the result of the key wrapping * Up to 254 octets representing the result of the key wrapping
method, applied to the 8-octet padded session key, as described method, applied to the 8-octet padded session key, as described
above. above.
Note that for session key sizes 128, 192, and 256 bits, the size of Note that for session key sizes 128, 192, and 256 bits, the size of
the result of the key wrapping method is, respectively, 32, 40, and the result of the key wrapping method is, respectively, 32, 40, and
48 octets, unless size obfuscation is used. 48 octets, unless size obfuscation is used.
For convenience, the synopsis of the encoding method is given below; For convenience, the synopsis of the encoding method is given below;
skipping to change at page 128, line 4 skipping to change at line 5874
Note that for session key sizes 128, 192, and 256 bits, the size of Note that for session key sizes 128, 192, and 256 bits, the size of
the result of the key wrapping method is, respectively, 32, 40, and the result of the key wrapping method is, respectively, 32, 40, and
48 octets, unless size obfuscation is used. 48 octets, unless size obfuscation is used.
For convenience, the synopsis of the encoding method is given below; For convenience, the synopsis of the encoding method is given below;
however, this section, [SP800-56A], and [RFC3394] are the normative however, this section, [SP800-56A], and [RFC3394] are the normative
sources of the definition. sources of the definition.
* Obtain the authenticated recipient public key R * Obtain the authenticated recipient public key R
* Generate an ephemeral, single-use key pair {v, V=vG} * Generate an ephemeral, single-use key pair {v, V=vG}
* Compute the shared point S = vR; * Compute the shared point S = vR
* m = symm_alg_ID || session key || checksum || pkcs5_padding; * m = symm_alg_ID || session key || checksum || pkcs5_padding
* curve_OID_len = (octet)len(curve_OID); * curve_OID_len = (octet)len(curve_OID)
* Param = curve_OID_len || curve_OID || public_key_alg_ID || 03 || * Param = curve_OID_len || curve_OID || public_key_alg_ID || 03 ||
01 || KDF_hash_ID || KEK_alg_ID for AESKeyWrap || Anonymous 01 || KDF_hash_ID || KEK_alg_ID for AESKeyWrap || 41 6E 6F 6E 79
Sender || recipient_fingerprint; 6D 6F 75 73 20 53 65 6E 64 65 72 20 20 20 20 ||
recipient_fingerprint
* Z_len = the key size for the KEK_alg_ID used with AESKeyWrap * Z_len = the key size for the KEK_alg_ID used with AESKeyWrap
* Compute Z = KDF( S, Z_len, Param ); * Compute Z = KDF( S, Z_len, Param )
* Compute C = AESKeyWrap( Z, m ); (as per [RFC3394]) * Compute C = AESKeyWrap( Z, m ) (per [RFC3394])
* Wipe the memory that contained S, v, and Z to avoid leaking * Wipe the memory that contained S, v, and Z to avoid leaking
ephemeral secrets ephemeral secrets
* VB = convert point V to the octet string * VB = convert point V to the octet string
* Output (MPI(VB) || len(C) || C). * Output (MPI(VB) || len(C) || C)
The decryption is the inverse of the method given. Note that the The decryption is the inverse of the method given. Note that the
recipient with key pair (r,R) obtains the shared secret by recipient with key pair (r,R) obtains the shared secret by
calculating: calculating:
S = rV = rvG S = rV = rvG
11.5.1. ECDH Parameters 11.5.1. ECDH Parameters
ECDH keys have a hash algorithm parameter for key derivation and a ECDH keys have a hash algorithm parameter for key derivation and a
symmetric algorithm for key encapsulation. symmetric algorithm for key encapsulation.
For v6 keys, the following algorithms MUST be used depending on the For version 6 keys, the following algorithms MUST be used depending
curve. An implementation MUST NOT generate a v6 ECDH key over any on the curve. An implementation MUST NOT generate a version 6 ECDH
listed curve that uses different KDF or KEK parameters. An key over any listed curve that uses different KDF or KEK parameters.
implementation MUST NOT encrypt any message to a v6 ECDH key over a An implementation MUST NOT encrypt any message to a version 6 ECDH
listed curve that announces a different KDF or KEK parameter. key over a listed curve that announces a different KDF or KEK
parameter.
For v4 keys, the following algorithms SHOULD be used depending on the For version 4 keys, the following algorithms SHOULD be used depending
curve. An implementation SHOULD only use an AES algorithm as a KEK on the curve. An implementation SHOULD only use an AES algorithm as
algorithm. a KEK algorithm.
+==================+================+=====================+ +==================+================+=====================+
| Curve | Hash algorithm | Symmetric algorithm | | Curve | Hash Algorithm | Symmetric Algorithm |
+==================+================+=====================+ +==================+================+=====================+
| NIST P-256 | SHA2-256 | AES-128 | | NIST P-256 | SHA2-256 | AES-128 |
+------------------+----------------+---------------------+ +------------------+----------------+---------------------+
| NIST P-384 | SHA2-384 | AES-192 | | NIST P-384 | SHA2-384 | AES-192 |
+------------------+----------------+---------------------+ +------------------+----------------+---------------------+
| NIST P-521 | SHA2-512 | AES-256 | | NIST P-521 | SHA2-512 | AES-256 |
+------------------+----------------+---------------------+ +------------------+----------------+---------------------+
| brainpoolP256r1 | SHA2-256 | AES-128 | | brainpoolP256r1 | SHA2-256 | AES-128 |
+------------------+----------------+---------------------+ +------------------+----------------+---------------------+
| brainpoolP384r1 | SHA2-384 | AES-192 | | brainpoolP384r1 | SHA2-384 | AES-192 |
+------------------+----------------+---------------------+ +------------------+----------------+---------------------+
| brainpoolP512r1 | SHA2-512 | AES-256 | | brainpoolP512r1 | SHA2-512 | AES-256 |
+------------------+----------------+---------------------+ +------------------+----------------+---------------------+
| Curve25519Legacy | SHA2-256 | AES-128 | | Curve25519Legacy | SHA2-256 | AES-128 |
+------------------+----------------+---------------------+ +------------------+----------------+---------------------+
Table 30: OpenPGP ECDH KDF and KEK Parameters registry Table 30: OpenPGP ECDH KDF and KEK Parameters Registry
12. Notes on Algorithms 12. Notes on Algorithms
12.1. PKCS#1 Encoding in OpenPGP 12.1. PKCS#1 Encoding in OpenPGP
This standard makes use of the PKCS#1 functions EME-PKCS1-v1_5 and This specification makes use of the PKCS#1 functions EME-PKCS1-v1_5
EMSA-PKCS1-v1_5. However, the calling conventions of these functions and EMSA-PKCS1-v1_5. However, the calling conventions of these
has changed in the past. To avoid potential confusion and functions have changed in the past. To avoid potential confusion and
interoperability problems, we are including local copies in this interoperability problems, we are including local copies in this
document, adapted from those in PKCS#1 v2.1 [RFC8017]. [RFC8017] document, adapted from those in PKCS#1 v2.1 [RFC8017]. [RFC8017]
should be treated as the ultimate authority on PKCS#1 for OpenPGP. should be treated as the ultimate authority on PKCS#1 for OpenPGP.
Nonetheless, we believe that there is value in having a self- Nonetheless, we believe that there is value in having a self-
contained document that avoids problems in the future with needed contained document that avoids problems in the future with needed
changes in the conventions. changes in the conventions.
12.1.1. EME-PKCS1-v1_5-ENCODE 12.1.1. EME-PKCS1-v1_5-ENCODE
Input: Input:
k = the length in octets of the key modulus. k = key modulus length in octets.
M = message to be encoded, an octet string of length mLen, where M = message to be encoded; an octet string of length mLen, where
mLen <= k - 11. mLen <= k - 11.
Output: Output:
EM = encoded message, an octet string of length k. EM = encoded message; an octet string of length k.
Error: "message too long". Error: "message too long".
1. Length checking: If mLen > k - 11, output "message too long" and 1. Length checking: If mLen > k - 11, output "message too long" and
stop. stop.
2. Generate an octet string PS of length k - mLen - 3 consisting of 2. Generate an octet string PS of length k - mLen - 3 consisting of
pseudo-randomly generated nonzero octets. The length of PS will pseudorandomly generated non-zero octets. The length of PS will
be at least eight octets. be at least 8 octets.
3. Concatenate PS, the message M, and other padding to form an 3. Concatenate PS, the message M, and other padding to form an
encoded message EM of length k octets as encoded message EM of length k octets as
EM = 0x00 || 0x02 || PS || 0x00 || M. EM = 0x00 || 0x02 || PS || 0x00 || M.
4. Output EM. 4. Output EM.
12.1.2. EME-PKCS1-v1_5-DECODE 12.1.2. EME-PKCS1-v1_5-DECODE
Input: Input:
EM = encoded message, an octet string EM = encoded message; an octet string.
Output: Output:
M = message, an octet string. M = decoded message; an octet string.
Error: "decryption error". Error: "decryption error".
To decode an EME-PKCS1_v1_5 message, separate the encoded message EM To decode an EME-PKCS1_v1_5 message, separate the encoded message EM
into an octet string PS consisting of nonzero octets and a message M into an octet string PS consisting of non-zero octets and a message M
as follows as follows
EM = 0x00 || 0x02 || PS || 0x00 || M. EM = 0x00 || 0x02 || PS || 0x00 || M.
If the first octet of EM does not have hexadecimal value 0x00, if the If the first octet of EM does not have hexadecimal value 0x00, the
second octet of EM does not have hexadecimal value 0x02, if there is second octet of EM does not have hexadecimal value 0x02, there is no
no octet with hexadecimal value 0x00 to separate PS from M, or if the octet with hexadecimal value 0x00 to separate PS from M, or the
length of PS is less than 8 octets, output "decryption error" and length of PS is less than 8 octets, output "decryption error" and
stop. See also Section 13.5 regarding differences in reporting stop. See also Section 13.5 regarding differences in reporting
between a decryption error and a padding error. between a decryption error and a padding error.
12.1.3. EMSA-PKCS1-v1_5 12.1.3. EMSA-PKCS1-v1_5
This encoding method is deterministic and only has an encoding This encoding method is deterministic and only has an encoding
operation. operation.
Option:
Hash - a hash function in which hLen denotes the length in octets of
the hash function output.
Input: Input:
Hash = hash function to be used.
M = message to be encoded. M = message to be encoded.
emLen = intended length in octets of the encoded message, at least emLen = intended length of the encoded message in octets, at least
tLen + 11, where tLen is the octet length of the DER encoding T of tLen + 11, where tLen is the octet length of the DER encoding T of
a certain value computed during the encoding operation. a certain value computed during the encoding operation.
Output: Output:
EM = encoded message, an octet string of length emLen. EM = encoded message; an octet string of length emLen.
Errors: "message too long"; "intended encoded message length too Errors: "message too long"; "intended encoded message length too
short". short".
Steps: Steps:
1. Apply the hash function to the message M to produce a hash value 1. Apply the hash function to the message M to produce hash value H:
H:
H = Hash(M). H = Hash(M).
If the hash function outputs "message too long," output "message If the hash function outputs "message too long," output "message
too long" and stop. too long" and stop.
2. Using the list in Section 9.5, produce an ASN.1 DER value for the 2. Let T be the Full Hash Prefix from Table 24 for the given hash
hash function used. Let T be the full hash prefix from the list, function, concatenated with the hash digest H (representing an
and let tLen be the length in octets of T. ASN.1 DER value for the hash function used and the hash digest).
Let tLen be the length in octets of T.
3. If emLen < tLen + 11, output "intended encoded message length too 3. If emLen < tLen + 11, output "intended encoded message length too
short" and stop. short" and stop.
4. Generate an octet string PS consisting of emLen - tLen - 3 octets 4. Generate an octet string PS consisting of emLen - tLen - 3 octets
with hexadecimal value 0xFF. The length of PS will be at least 8 with hexadecimal value 0xFF. The length of PS will be at least 8
octets. octets.
5. Concatenate PS, the hash prefix T, and other padding to form the 5. Concatenate PS, the hash prefix T, and other padding to form the
encoded message EM as encoded message EM as
skipping to change at page 132, line 15 skipping to change at line 6071
12.2. Symmetric Algorithm Preferences 12.2. Symmetric Algorithm Preferences
The symmetric algorithm preference is an ordered list of algorithms The symmetric algorithm preference is an ordered list of algorithms
that the keyholder accepts. Since it is found on a self-signature, that the keyholder accepts. Since it is found on a self-signature,
it is possible that a keyholder may have multiple, different it is possible that a keyholder may have multiple, different
preferences. For example, Alice may have AES-128 only specified for preferences. For example, Alice may have AES-128 only specified for
"alice@work.com" but Camellia-256, Twofish, and AES-128 specified for "alice@work.com" but Camellia-256, Twofish, and AES-128 specified for
"alice@home.org". Note that it is also possible for preferences to "alice@home.org". Note that it is also possible for preferences to
be in a subkey's binding signature. be in a subkey's binding signature.
Since AES-128 is the MUST-implement algorithm, if it is not Since AES-128 is the algorithm that MUST be implemented, if it is not
explicitly in the list, it is tacitly at the end. However, it is explicitly in the list, it is tacitly at the end. However, it is
good form to place it there explicitly. Note also that if an good form to place it there explicitly. Note also that if an
implementation does not implement the preference, then it is implementation does not implement the preference, then it is
implicitly an AES-128-only implementation. Note further that implicitly an AES-128-only implementation. Furthermore, note that
implementations conforming to previous versions of this standard implementations conforming to the previous version of this
[RFC4880] have TripleDES as its only MUST-implement algorithm. specification [RFC4880] have TripleDES as the only algorithm that
MUST be implemented.
An implementation MUST NOT use a symmetric algorithm that is not in An implementation MUST NOT use a symmetric algorithm that is not in
the recipient's preference list. When encrypting to more than one the recipient's preference list. When encrypting to more than one
recipient, the implementation finds a suitable algorithm by taking recipient, the implementation finds a suitable algorithm by taking
the intersection of the preferences of the recipients. Note that the the intersection of the preferences of the recipients. Note that
MUST-implement algorithm, AES-128, ensures that the intersection is since the AES-128 algorithm MUST be implemented, the intersection is
non-empty. The implementation may use any mechanism to pick an guaranteed to be non-empty.
algorithm in the intersection.
If an implementation can decrypt a message that a keyholder doesn't If an implementation can decrypt a message that a keyholder doesn't
have in their preferences, the implementation SHOULD decrypt the have in their preferences, the implementation SHOULD decrypt the
message anyway, but MUST warn the keyholder that the protocol has message anyway, but it MUST warn the keyholder. For example, suppose
been violated. For example, suppose that Alice, above, has an that Alice (above) has an implementation that implements all
implementation that implements all algorithms in this specification. algorithms in this specification. Nonetheless, she prefers subsets
Nonetheless, she prefers subsets for work or home. If she is sent a for work or home. If she is sent a message encrypted with IDEA,
message encrypted with IDEA, which is not in her preferences, the which is not in her preferences, the implementation warns her that
implementation warns her that someone sent her an IDEA-encrypted someone sent an IDEA-encrypted message, but it would ideally decrypt
message, but it would ideally decrypt it anyway. it anyway.
12.2.1. Plaintext 12.2.1. Plaintext
Algorithm 0, "plaintext", may only be used to denote secret keys that Algorithm 0, "plaintext", may only be used to denote secret keys that
are stored in the clear. An implementation MUST NOT use algorithm 0 are stored in the clear. An implementation MUST NOT use algorithm 0
as the indicated symmetric cipher for an encrypted data packet as the indicated symmetric cipher for an encrypted data packet
(Section 5.7 or Section 5.13); it can use a Literal Data packet (Sections 5.7 or 5.13); it can use a Literal Data packet
(Section 5.9) to encode unencrypted literal data. (Section 5.9) to encode unencrypted literal data.
12.3. Other Algorithm Preferences 12.3. Other Algorithm Preferences
Other algorithm preferences work similarly to the symmetric algorithm Other algorithm preferences work similarly to the symmetric algorithm
preference, in that they specify which algorithms the keyholder preference in that they specify which algorithms the keyholder
accepts. There are two interesting cases that other comments need to accepts. There are two interesting cases in which further comments
be made about, though, the compression preferences and the hash are needed: the compression preferences and the hash preferences.
preferences.
12.3.1. Compression Preferences 12.3.1. Compression Preferences
Like the algorithm preferences, an implementation MUST NOT use an Like the algorithm preferences, an implementation MUST NOT use an
algorithm that is not in the preference vector. If Uncompressed (0) algorithm that is not in the preference vector. If Uncompressed (0)
is not explicitly in the list, it is tacitly at the end. That is, is not explicitly in the list, it is tacitly at the end. That is,
uncompressed messages may always be sent. uncompressed messages may always be sent.
Note that earlier implementations may assume that the absence of Note that earlier implementations may assume that the absence of
compression preferences means that [ZIP(1), Uncompressed(0)] are compression preferences means that [ZIP(1), Uncompressed(0)] are
preferred, and default to ZIP compression. Therefore, an preferred, and default to ZIP compression. Therefore, an
implementation that prefers uncompressed data SHOULD explicitly state implementation that prefers uncompressed data SHOULD explicitly state
this in the preferred compression algorithms. this in the Preferred Compression Algorithms.
12.3.1.1. Uncompressed 12.3.1.1. Uncompressed
Algorithm 0, "uncompressed", may only be used to denote a preference Algorithm 0, "uncompressed", may only be used to denote a preference
for uncompressed data. An implementation MUST NOT use algorithm 0 as for uncompressed data. An implementation MUST NOT use algorithm 0 as
the indicated compression algorithm in a Compressed Data packet the indicated compression algorithm in a Compressed Data packet
(Section 5.6); it can use a Literal Data packet (Section 5.9) to (Section 5.6); it can use a Literal Data packet (Section 5.9) to
encode uncompressed literal data. encode uncompressed literal data.
12.3.2. Hash Algorithm Preferences 12.3.2. Hash Algorithm Preferences
Typically, the choice of a hash algorithm is something the signer Typically, the signer chooses which hash algorithm to use, rather
does, rather than the verifier, because a signer rarely knows who is than the verifier, because a signer rarely knows who is going to be
going to be verifying the signature. This preference, though, allows verifying the signature. This preference allows a protocol based
a protocol based upon digital signatures ease in negotiation. upon digital signatures ease in negotiation.
Thus, if Alice is authenticating herself to Bob with a signature, it Thus, if Alice is authenticating herself to Bob with a signature, it
makes sense for her to use a hash algorithm that Bob's implementation makes sense for her to use a hash algorithm that Bob's implementation
uses. This preference allows Bob to state in his key which uses. This preference allows Bob to state which algorithms Alice may
algorithms Alice may use. use in his key.
Since SHA2-256 is the MUST-implement hash algorithm, if it is not Since SHA2-256 is the hash algorithm that MUST be implemented, if it
explicitly in the list, it is tacitly at the end. However, it is is not explicitly in the list, it is tacitly at the end. However, it
good form to place it there explicitly. is good form to place it there explicitly.
12.4. RSA 12.4. RSA
The PKCS1-v1_5 padding scheme, used by the RSA algorithms defined in The PKCS1-v1_5 padding scheme, used by the RSA algorithms defined in
this document, is no longer recommended, and its use is deprecated by this document, is no longer recommended, and its use is deprecated by
[SP800-131A]. Therefore, an implementation SHOULD NOT generate RSA [SP800-131A]. Therefore, an implementation SHOULD NOT generate RSA
keys. keys.
There are algorithm types for RSA Sign-Only, and RSA Encrypt-Only There are algorithm types for RSA Sign-Only and RSA Encrypt-Only
keys. These types are deprecated. The "key flags" subpacket in a keys. These types are deprecated in favor of the Key Flags signature
signature is a much better way to express the same idea, and subpacket. An implementation MUST NOT create such a key, but it MAY
generalizes it to all algorithms. An implementation MUST NOT create interpret it.
such a key, but MAY interpret it.
An implementation MUST NOT generate RSA keys of size less than 3072 An implementation MUST NOT generate RSA keys of a size less than 3072
bits. An implementation SHOULD NOT encrypt, sign or verify using RSA bits. An implementation SHOULD NOT encrypt, sign, or verify using
keys of size less than 3072 bits. An implementation MUST NOT RSA keys of a size less than 3072 bits. An implementation MUST NOT
encrypt, sign or verify using RSA keys of size less than 2048 bits. encrypt, sign, or verify using RSA keys of a size less than 2048
An implementation that decrypts a message using an RSA secret key of bits. An implementation that decrypts a message using an RSA secret
size less than 3072 bits SHOULD generate a deprecation warning that key of a size less than 3072 bits SHOULD generate a deprecation
the key is too weak for modern use. warning that the key is too weak for modern use.
12.5. DSA 12.5. DSA
DSA is no longer recommended. It has also been deprecated in DSA is no longer recommended. It has also been deprecated in
[FIPS186]. Therefore, an implementation MUST NOT generate DSA keys. [FIPS186]. Therefore, an implementation MUST NOT generate DSA keys.
An implementation MUST NOT sign or verify using DSA keys. An implementation MUST NOT sign or verify using DSA keys.
12.6. Elgamal 12.6. Elgamal
skipping to change at page 134, line 48 skipping to change at line 6191
Elgamal keys. Elgamal keys.
An implementation MUST NOT encrypt using Elgamal keys. An An implementation MUST NOT encrypt using Elgamal keys. An
implementation that decrypts a message using an Elgamal secret key implementation that decrypts a message using an Elgamal secret key
SHOULD generate a deprecation warning that the key is too weak for SHOULD generate a deprecation warning that the key is too weak for
modern use. modern use.
12.7. EdDSA 12.7. EdDSA
Although the EdDSA algorithm allows arbitrary data as input, its use Although the EdDSA algorithm allows arbitrary data as input, its use
with OpenPGP requires that a digest of the message is used as input with OpenPGP requires that a digest of the message be used as input
(pre-hashed). See Section 5.2.4 for details. Truncation of the (pre-hashed). See Section 5.2.4 for details. Truncation of the
resulting digest is never applied; the resulting digest value is used resulting digest is never applied; the resulting digest value is used
verbatim as input to the EdDSA algorithm. verbatim as input to the EdDSA algorithm.
For clarity: while [RFC8032] describes different variants of EdDSA, For clarity: while [RFC8032] describes different variants of EdDSA,
OpenPGP uses the "pure" variant (PureEdDSA). The hashing that OpenPGP uses the "pure" variant (PureEdDSA). The hashing that
happens with OpenPGP is done as part of the standard OpenPGP happens with OpenPGP is done as part of the standard OpenPGP
signature process, and that hash itself is fed as the input message signature process, and that hash itself is fed as the input message
to the PureEdDSA algorithm. to the PureEdDSA algorithm.
As specified in [RFC8032], Ed448 also expects a "context string". In As specified in [RFC8032], Ed448 also expects a "context string". In
OpenPGP, Ed448 is used with the empty string as a context string. OpenPGP, Ed448 is used with the empty string as a context string.
12.8. Reserved Algorithm IDs 12.8. Reserved Algorithm IDs
A number of algorithm IDs have been reserved for algorithms that A number of algorithm IDs have been reserved for algorithms that
would be useful to use in an OpenPGP implementation, yet there are would be useful to use in an OpenPGP implementation, yet there are
issues that prevent an implementer from actually implementing the issues that prevent an implementer from actually implementing the
algorithm. These are marked as reserved in Section 9.1. algorithm. These are marked as reserved in Section 9.1.
The reserved public-key algorithm X9.42 (21) does not have the The reserved public key algorithm X9.42 (21) does not have the
necessary parameters, parameter order, or semantics defined. The necessary parameters, parameter order, or semantics defined. The
same is currently true for reserved public-key algorithms AEDH (23) same is currently true for reserved public key algorithms AEDH (23)
and AEDSA (24). and AEDSA (24).
Previous versions of OpenPGP permitted Elgamal [ELGAMAL] signatures Previous versions of the OpenPGP specification permitted Elgamal
with a public-key algorithm ID of 20. These are no longer permitted. [ELGAMAL] signatures with a public key algorithm ID of 20. These are
An implementation MUST NOT generate such keys. An implementation no longer permitted. An implementation MUST NOT generate such keys.
MUST NOT generate Elgamal signatures. See [BLEICHENBACHER]. An implementation MUST NOT generate Elgamal signatures; see
[BLEICHENBACHER].
12.9. CFB Mode 12.9. CFB Mode
The Cipher Feedback (CFB) mode used in this document is defined in The Cipher Feedback (CFB) mode used in this document is defined in
Section 6.3 of [SP800-38A]. Section 6.3 of [SP800-38A].
The CFB segment size s is equal to the block size of the cipher The CFB segment size s is equal to the block size of the cipher
(i.e., n-bit CFB mode where n is the block size is used). (i.e., n-bit CFB mode, where n is the block size used).
12.10. Private or Experimental Parameters 12.10. Private or Experimental Parameters
S2K specifiers, Signature subpacket type IDs, User Attribute S2K Specifiers, Signature Subpacket Type IDs, User Attribute
subpacket type IDs, image format IDs, and the various algorithm IDs Subpacket Type IDs, image format IDs, and the various algorithm IDs
described in Section 9 all reserve the range 100 to 110 for private described in Section 9 all reserve the range 100 to 110 for Private
and experimental use. Packet type IDs reserve the range 60 to 63 for and Experimental Use. Packet Type IDs reserve the range 60 to 63 for
private and experimental use. These are intentionally managed with Private and Experimental Use. These are intentionally managed by the
the PRIVATE USE method, as described in [RFC8126]. Private Use and Experimental Use policies, as described in [RFC8126].
However, implementations need to be careful with these and promote However, implementations need to be careful with these and promote
them to full IANA-managed parameters when they grow beyond the them to full IANA-managed parameters when they grow beyond the
original, limited system. original, limited system.
12.11. Meta-Considerations for Expansion 12.11. Meta Considerations for Expansion
If OpenPGP is extended in a way that is not backwards-compatible, If OpenPGP is extended in a way that is not backward compatible,
meaning that old implementations will not gracefully handle their meaning that old implementations will not gracefully handle their
absence of a new feature, the extension proposal can be declared in absence of a new feature, the extension proposal can be declared in
the keyholder's self-signature as part of the Features signature the keyholder's self-signature as part of the Features signature
subpacket. subpacket.
We cannot state definitively what extensions will not be upwards- We cannot state definitively what extensions will not be forward
compatible, but typically new algorithms are upwards-compatible, compatible, but typically new algorithms are forward compatible,
whereas new packets are not. whereas new packets are not.
If an extension proposal does not update the Features system, it If an extension proposal does not update the Features system, it
SHOULD include an explanation of why this is unnecessary. If the SHOULD include an explanation of why this is unnecessary. If the
proposal contains neither an extension to the Features system nor an proposal contains neither an extension to the Features system nor an
explanation of why such an extension is unnecessary, the proposal explanation of why such an extension is unnecessary, the proposal
SHOULD be rejected. SHOULD be rejected.
13. Security Considerations 13. Security Considerations
* As with any technology involving cryptography, implementers should * As with any technology involving cryptography, implementers should
check the current literature to determine if any algorithms used check the current literature to determine if any algorithms used
here have been found to be vulnerable to an attack. If so, here have been found to be vulnerable to an attack. If so,
implementers should consider disallowing such algorithms for new implementers should consider disallowing such algorithms for new
data and warn or prevent the enduser when they are trying to data and warning the end user, or preventing use, when they are
consume data protected by such now vulnerable algorithms. trying to consume data protected by such algorithms that are now
vulnerable.
* This specification uses Public-Key Cryptography technologies. It * This specification uses Public Key Cryptography technologies. It
is assumed that the private key portion of a public-private key is assumed that the private key portion of a public-private key
pair is controlled and secured by the proper party or parties. pair is controlled and secured by the proper party or parties.
* The MD5 and SHA-1 hash algorithms have been found to have * The MD5 and SHA-1 hash algorithms have been found to have
weaknesses, with collisions found in a number of cases. MD5 and weaknesses, with collisions found in a number of cases. MD5 and
SHA-1 are deprecated for use in OpenPGP (See Section 9.5). SHA-1 are deprecated for use in OpenPGP (see Section 9.5).
* Many security protocol designers think that it is a bad idea to * Many security protocol designers think that it is a bad idea to
use a single key for both privacy (encryption) and integrity use a single key for both privacy (encryption) and integrity
(signatures). In fact, this was one of the motivating forces (signatures). In fact, this was one of the motivating forces
behind the v4 key format with separate signature and encryption behind the version 4 key format with separate signature and
keys. Using a single key for encrypting and signing is encryption keys. Using a single key for encrypting and signing is
discouraged. discouraged.
* The DSA algorithm will work with any hash, but is sensitive to the * The DSA algorithm will work with any hash, but it is sensitive to
quality of the hash algorithm. Verifiers should be aware that the quality of the hash algorithm. Verifiers should be aware that
even if the signer used a strong hash, an attacker could have even if the signer used a strong hash, an attacker could have
modified the signature to use a weak one. Only signatures using modified the signature to use a weak one. Only signatures using
acceptably strong hash algorithms should be accepted as valid. acceptably strong hash algorithms should be accepted as valid.
* As OpenPGP combines many different asymmetric, symmetric, and hash * As OpenPGP combines many different asymmetric, symmetric, and hash
algorithms, each with different measures of strength, care should algorithms, each with different measures of strength, care should
be taken that the weakest element of an OpenPGP message is still be taken to ensure that the weakest element of an OpenPGP Message
sufficiently strong for the purpose at hand. While consensus is still sufficiently strong for the purpose at hand. While
about the strength of a given algorithm may evolve, NIST Special consensus about the strength of a given algorithm may evolve, NIST
Publication 800-57 [SP800-57] contains recommendations current at Special Publication 800-57 [SP800-57] contains recommendations
the time of this publication about equivalent security levels of (current at the time of this publication) about equivalent
different algorithms. security levels of different algorithms.
* There is a somewhat-related potential security problem in * There is a somewhat-related potential security problem in
signatures. If an attacker can find a message that hashes to the signatures. If an attacker can find a message that hashes to the
same hash with a different algorithm, a bogus signature structure same hash with a different algorithm, a bogus signature structure
can be constructed that evaluates correctly. can be constructed that evaluates correctly.
For example, suppose Alice DSA signs message M using hash For example, suppose Alice DSA-signs message M using hash
algorithm H. Suppose that Mallet finds a message M' that has the algorithm H. Suppose that Mallet finds a message M' that has the
same hash value as M with H'. Mallet can then construct a same hash value as M with H'. Mallet can then construct a
signature block that verifies as Alice's signature of M' with H'. signature block that verifies as Alice's signature of M' with H'.
However, this would also constitute a weakness in either H or H' However, this would also constitute a weakness in either H or H',
or both. Should this ever occur, a revision will have to be made or both. Should this ever occur, a revision will have to be made
to this document to revise the allowed hash algorithms. to this document to revise the allowed hash algorithms.
* If you are building an authentication system, the recipient may * If you are building an authentication system, the recipient may
specify a preferred signing algorithm. However, the signer would specify a preferred signing algorithm. However, the signer would
be foolish to use a weak algorithm simply because the recipient be foolish to use a weak algorithm simply because the recipient
requests it. requests it.
* Some of the encryption algorithms mentioned in this document have * Some of the encryption algorithms mentioned in this document have
been analyzed less than others. For example, although TWOFISH is been analyzed less than others. For example, although TWOFISH is
presently considered reasonably strong, it has been analyzed much presently considered reasonably strong, it has been analyzed much
less than AES. Other algorithms may have other concerns less than AES. Other algorithms may have other concerns
surrounding them. surrounding them.
* In late summer 2002, Jallad, Katz, and Schneier published an * In late summer 2002, Jallad, Katz, and Schneier published an
interesting attack on older versions of the OpenPGP protocol and interesting attack on previous versions of the OpenPGP
some of its implementations [JKS02]. In this attack, the attacker specification and some of its implementations [JKS02]. In this
modifies a message and sends it to a user who then returns the attack, the attacker modifies a message and sends it to a user who
erroneously decrypted message to the attacker. The attacker is then returns the erroneously decrypted message to the attacker.
thus using the user as a decryption oracle, and can often decrypt The attacker is thus using the user as a decryption oracle and can
the message. This attack is a particular form of ciphertext often decrypt the message. This attack is a particular form of
malleability. See Section 13.7 for information on how to defend ciphertext malleability. See Section 13.7 for information on how
against such an attack using more recent versions of OpenPGP. to defend against such an attack using more recent versions of
OpenPGP.
13.1. SHA-1 Collision Detection 13.1. SHA-1 Collision Detection
As described in [SHAMBLES], the SHA-1 digest algorithm is not As described in [SHAMBLES], the SHA-1 digest algorithm is not
collision-resistant. However, an OpenPGP implementation cannot collision resistant. However, an OpenPGP implementation cannot
completely discard the SHA-1 algorithm, because it is required for completely discard the SHA-1 algorithm, because it is required for
implementing v4 public keys. In particular, the v4 fingerprint implementing version 4 public keys. In particular, the version 4
derivation uses SHA-1. So as long as an OpenPGP implementation fingerprint derivation uses SHA-1. So as long as an OpenPGP
supports v4 public keys, it will need to implement SHA-1 in at least implementation supports version 4 public keys, it will need to
some scenarios. implement SHA-1 in at least some scenarios.
To avoid the risk of uncertain breakage from a maliciously introduced To avoid the risk of uncertain breakage from a maliciously introduced
SHA-1 collision, an OpenPGP implementation MAY attempt to detect when SHA-1 collision, an OpenPGP implementation MAY attempt to detect when
a hash input is likely from a known collision attack, and then either a hash input is likely from a known collision attack and then either
deliberately reject the hash input or modify the hash output. This reject the hash input deliberately or modify the hash output. This
should convert an uncertain breakage (where it is unclear what the should convert an uncertain breakage (where it is unclear what the
effect of a collision will be) to an explicit breakage, which is more effect of a collision will be) to an explicit breakage, which is more
desirable for a robust implementation. desirable for a robust implementation.
[STEVENS2013] describes a method for detecting indicators of well- [STEVENS2013] describes a method for detecting indicators of well-
known SHA-1 collision attacks. Some example C code implementing this known SHA-1 collision attacks. Some example C code implementing this
technique can be found at [SHA1CD]. technique can be found at [SHA1CD].
13.2. Advantages of Salted Signatures 13.2. Advantages of Salted Signatures
V6 signatures include a salt that is hashed first, which size depends Version 6 signatures include a salt that is hashed first, and it's
on the hashing algorithm. This makes v6 OpenPGP signatures non- size depends on the hashing algorithm. This makes version 6 OpenPGP
deterministic and protects against a broad class of attacks that signatures non-deterministic and protects against a broad class of
depend on creating a signature over a predictable message. By attacks that depend on creating a signature over a predictable
selecting a new random salt for each signature made, the signed message. By selecting a new random salt for each signature made, the
hashes and the signatures are not predictable. signed hashes and the signatures are not predictable.
While the material to be signed could be attacker-controlled, hashing While the material to be signed could be attacker controlled, hashing
the salt first means that there is no attacker controlled hashed the salt first means that there is no attacker-controlled hashed
prefix. An example of this kind of attack is described in the paper prefix. An example of this kind of attack is described in the paper
"SHA-1 Is A Shambles" [SHAMBLES], which leverages a chosen prefix "SHA-1 is a Shambles" [SHAMBLES], which leverages a chosen prefix
collision attack against SHA-1. This means that an adversary collision attack against SHA-1. This means that an adversary
carrying out a chosen-message attack will not be able to control the carrying out a chosen-message attack will not be able to control the
hash that is being signed, and will need to break second-preimage hash that is being signed and will need to break second-preimage
resistance instead of the simpler collision resistance to create two resistance instead of the simpler collision resistance to create two
messages having the same signature. The size of the salt is bound to messages having the same signature. The size of the salt is bound to
the hash function to match the expected collision resistance level, the hash function to match the expected collision-resistance level
and at least 16 octets. and is at least 16 octets.
In some cases, an attacker may be able to induce a signature to be In some cases, an attacker may be able to induce a signature to be
made, even if they do not control the content of the message. In made, even if they do not control the content of the message. In
some scenarios, a repeated signature over the exact same message may some scenarios, a repeated signature over the exact same message may
risk leakage of part or all of the signing key, for example see risk leakage of part or all of the signing key; for example, see
discussion of hardware faults over EdDSA and deterministic ECDSA in discussion of hardware faults over EdDSA and deterministic ECDSA in
[PSSLR17]. Choosing a new random salt for each signature ensures [PSSLR17]. Choosing a new random salt for each signature ensures
that no repeated signatures are produced, and mitigates this risk. that no repeated signatures are produced, which mitigates this risk.
13.3. Elliptic Curve Side Channels 13.3. Elliptic Curve Side Channels
Side channel attacks are a concern when a compliant application's use Side-channel attacks are a concern when a compliant application's use
of the OpenPGP format can be modeled by a decryption or signing of the OpenPGP format can be modeled by a decryption or signing
oracle, for example, when an application is a network service oracle, for example, when an application is a network service
performing decryption to unauthenticated remote users. ECC scalar performing decryption to unauthenticated remote users. ECC scalar
multiplication operations used in ECDSA and ECDH are vulnerable to multiplication operations used in ECDSA and ECDH are vulnerable to
side channel attacks. Countermeasures can often be taken at the side-channel attacks. Countermeasures can often be taken at the
higher protocol level, such as limiting the number of allowed higher protocol level, such as limiting the number of allowed
failures or time-blinding of the operations associated with each failures or time-blinding the operations associated with each network
network interface. Mitigations at the scalar multiplication level interface. Mitigations at the scalar multiplication level seek to
seek to eliminate any measurable distinction between the ECC point eliminate any measurable distinction between the ECC point addition
addition and doubling operations. and doubling operations.
13.4. Risks of a Quick Check Oracle 13.4. Risks of a Quick Check Oracle
In winter 2005, Serge Mister and Robert Zuccherato from Entrust In winter 2005, Serge Mister and Robert Zuccherato from Entrust
released a paper describing a way that the "quick check" in v1 SEIPD released a paper describing a way that the "quick check" in v1 SEIPD
and SED packets can be used as an oracle to decrypt two octets of and SED packets can be used as an oracle to decrypt two octets of
every cipher block [MZ05]. This check was intended for early every cipher block [MZ05]. This check was intended for early
detection of session key decryption errors, particularly to detect a detection of session key decryption errors, particularly to detect a
wrong passphrase, since v4 SKESK packets do not include an integrity wrong passphrase, since v4 SKESK packets do not include an integrity
check. check.
There is a danger to using the quick check if timing or error There is a danger when using the quick check if timing or error
information about the check can be exposed to an attacker, information about the check can be exposed to an attacker,
particularly via an automated service that allows rapidly repeated particularly via an automated service that allows rapidly repeated
queries. queries.
Disabling the quick check prevents the attack. Disabling the quick check prevents the attack.
For very large encrypted data whose session key is protected by a For very large encrypted data whose session key is protected by a
passphrase using a version 4 SKESK, the quick check may be convenient passphrase using a v4 SKESK, the quick check may be convenient to the
to the user, by informing them early that they typed the wrong user by informing them early that they typed the wrong passphrase.
passphrase. But the implementation should use the quick check with But the implementation should use the quick check with care. The
care. The recommended approach for secure and early detection of recommended approach for secure and early detection of decryption
decryption failure is to encrypt data using v2 SEIPD. If the session failure is to encrypt data using v2 SEIPD. If the session key is
key is public-key encrypted, the quick check is not useful as the public key encrypted, the quick check is not useful as the public key
public-key encryption of the session key should guarantee that it is encryption of the session key should guarantee that it is the right
the right session key. session key.
The quick check oracle attack is a particular type of attack that The quick check oracle attack is a particular type of attack that
exploits ciphertext malleability. For information about other exploits ciphertext malleability. For information about other
similar attacks, see Section 13.7. similar attacks, see Section 13.7.
13.5. Avoiding Leaks From PKCS#1 Errors 13.5. Avoiding Leaks from PKCS#1 Errors
The PKCS#1 padding (used in RSA-encrypted and ElGamal-encrypted The PKCS#1 padding (used in RSA-encrypted and ElGamal-encrypted
PKESK) has been found to be vulnerable to attacks in which a system PKESK) has been found to be vulnerable to attacks in which a system
that allows distinguishing padding errors from other decryption that allows distinguishing padding errors from other decryption
errors can act as a decryption and/or signing oracle that can leak errors can act as a decryption and/or signing oracle that can leak
the session key or allow signing arbitrary data, respectively the session key or allow signing arbitrary data, respectively
[BLEICHENBACHER-PKCS1]. The number of queries required to carry out [BLEICHENBACHER-PKCS1]. The number of queries required to carry out
an attack can range from thousands to millions, depending on how an attack can range from thousands to millions, depending on how
strict and careful an implementation is in processing the padding. strict and careful an implementation is in processing the padding.
To make the attack more difficult, an implementation SHOULD implement To make the attack more difficult, an implementation SHOULD implement
strict, robust, constant time padding checks. strict, robust, and constant time padding checks.
To prevent the attack, in settings where the attacker does not have To prevent the attack, in settings where the attacker does not have
access to timing information concerning message decryption, the access to timing information concerning message decryption, the
simplest solution is to report a single error code for all variants simplest solution is to report a single error code for all variants
of PKESK processing errors as well as SEIPD integrity errors (this of PKESK processing errors as well as SEIPD integrity errors (this
includes also session key parsing errors, such as on invalid cipher also includes session key parsing errors, such as on an invalid
algorithm for v3 PKESK, or session key size mismatch for v6 PKESK). cipher algorithm for v3 PKESK, or a session key size mismatch for v6
If the attacker may have access to timing information, then a PKESK). If the attacker may have access to timing information, then
constant time solution is also needed. This requires careful design, a constant time solution is also needed. This requires careful
especially for v3 PKESK, where session key size and cipher design, especially for v3 PKESK, where session key size and cipher
information is typically not known in advance, as it is part of the information is typically not known in advance, as it is part of the
PKESK encrypted payload. PKESK encrypted payload.
13.6. Fingerprint Usability 13.6. Fingerprint Usability
This specification uses fingerprints in several places on the wire This specification uses fingerprints in several places on the wire
(e.g., Section 5.2.3.23, Section 5.2.3.35, and Section 5.2.3.36), and (e.g., Sections 5.2.3.23, 5.2.3.35, and 5.2.3.36) and in processing
in processing (e.g., in ECDH KDF Section 11.5). An implementation (e.g., in ECDH KDF Section 11.5). An implementation may also use the
may also use the fingerprint internally, for example as an index to a fingerprint internally, for example, as an index to a keystore.
keystore.
Additionally, some OpenPGP users have historically used manual Additionally, some OpenPGP users have historically used manual
fingerprint comparison to verify the public key of a peer. For a fingerprint comparison to verify the public key of a peer. For a
version 4 fingerprint, this has typically been done with the version 4 fingerprint, this has typically been done with the
fingerprint represented as 40 hexadecimal digits, often broken into fingerprint represented as 40 hexadecimal digits, often broken into
groups of four digits with whitespace between each group. groups of four digits with whitespace between each group.
When a human is actively involved, the result of such a verification When a human is actively involved, the result of such a verification
is dubious. There is little evidence that most humans are good at is dubious. There is little evidence that most humans are good at
precise comparison of high-entropy data, particularly when that data precise comparison of high-entropy data, particularly when that data
is represented in compact textual form like a hexadecimal is represented in compact textual form like a hexadecimal
([USENIX-STUDY]). [USENIX-STUDY].
The version 6 fingerprint makes the challenge for a human verifier The version 6 fingerprint makes the challenge for a human verifier
even worse. At 256 bits (compared to v4's 160 bit fingerprint), a v6 even worse. At 256 bits (compared to version 4's 160-bit
fingerprint is even harder for a human to successfully compare. fingerprint), a version 6 fingerprint is even harder for a human to
successfully compare.
An OpenPGP implementation should prioritize mechanical fingerprint An OpenPGP implementation should prioritize mechanical fingerprint
transfer and comparison where possible, and SHOULD NOT promote manual transfer and comparison where possible and SHOULD NOT promote manual
transfer or comparison of full fingerprints by a human unless there transfer or comparison of full fingerprints by a human unless there
is no other way to achieve the desired result. is no other way to achieve the desired result.
While this subsection acknowledges existing practice for human- While this subsection acknowledges existing practice for human-
representable v4 fingerprints, this document does not attempt to representable version 4 fingerprints, this document does not attempt
standardize any specific human-readable form of v6 fingerprint for to standardize any specific human-readable form of version 6
this discouraged use case. fingerprint for this discouraged use case.
NOTE: the topic of interoperable human-in-the-loop key verification NOTE: the topic of interoperable human-in-the-loop key verification
needs more work, to be done in a separate document. needs more work, which will be done in a separate document.
13.7. Avoiding Ciphertext Malleability 13.7. Avoiding Ciphertext Malleability
If ciphertext can be modified by an attacker but still subsequently If ciphertext can be modified by an attacker but still subsequently
decrypted to some new plaintext, it is considered "malleable". A decrypted to some new plaintext, it is considered "malleable". A
number of attacks can arise in any cryptosystem that uses malleable number of attacks can arise in any cryptosystem that uses malleable
encryption, so [RFC4880] and later versions of OpenPGP offer encryption, so [RFC4880] and later versions of OpenPGP offer
mechanisms to defend against it. However, OpenPGP data may have been mechanisms to defend against it. However, OpenPGP data may have been
created before these defense mechanisms were available. Because created before these defense mechanisms were available. Because
OpenPGP implementations deal with historic stored data, they may OpenPGP implementations deal with historic stored data, they may
encounter malleable ciphertexts. encounter malleable ciphertexts.
When an OpenPGP implementation discovers that it is decrypting data When an OpenPGP implementation discovers that it is decrypting data
that appears to be malleable, it MUST indicate a clear error message that appears to be malleable, it MUST generate a clear error message
that the integrity of the message is suspect, SHOULD NOT attempt to that indicates the integrity of the message is suspect, it SHOULD NOT
parse nor release decrypted data to the user, and SHOULD halt with an attempt to parse nor release decrypted data to the user, and it
error. Parsing or releasing decrypted data before having confirmed SHOULD halt with an error. Parsing or releasing decrypted data
its integrity can leak the decrypted data [EFAIL], [MRLG15]. before having confirmed its integrity can leak the decrypted data
[EFAIL] [MRLG15].
In the case of AEAD encrypted data, if the authentication tag fails In the case of AEAD encrypted data, if the authentication tag fails
to verify, the implementation MUST NOT attempt to parse nor release to verify, the implementation MUST NOT attempt to parse nor release
decrypted data to the user, and MUST halt with an error. decrypted data to the user, and it MUST halt with an error.
An implementation that encounters malleable ciphertext MAY choose to An implementation that encounters malleable ciphertext MAY choose to
release cleartext to the user if it is not encrypted using AEAD, and release cleartext to the user if it is not encrypted using AEAD, it
it is known to be dealing with historic archived legacy data, and the is known to be dealing with historic archived legacy data, and the
user is aware of the risks. user is aware of the risks.
In the case of AEAD encrypted messages, if the message is truncated, In the case of AEAD encrypted messages, if the message is truncated,
i.e. the final zero-octet chunk and possibly (part of) some chunks i.e., the final zero-octet chunk and possibly (part of) some chunks
before it are missing, the implementation MAY choose to release before it are missing, the implementation MAY choose to release
cleartext from fully authenticated chunks before it to the user if it cleartext from the fully authenticated chunks before it to the user
is operating in a streaming fashion, but it MUST indicate a clear if it is operating in a streaming fashion, but it MUST indicate a
error message as soon as the truncation is detected. clear error message as soon as the truncation is detected.
Any of the following OpenPGP data elements indicate that malleable Any of the following OpenPGP data elements indicate that malleable
ciphertext is present: ciphertext is present:
* All Symmetrically Encrypted Data packets (Section 5.7). * All Symmetrically Encrypted Data packets (Section 5.7).
* Within any encrypted container, any Compressed Data packet * Within any encrypted container, any Compressed Data packet
(Section 5.6) where there is a decompression failure. (Section 5.6) where there is a decompression failure.
* Any version 1 Symmetrically Encrypted Integrity Protected Data * Any version 1 Symmetrically Encrypted and Integrity Protected Data
packet (Section 5.13.1) where the internal Modification Detection packet (Section 5.13.1) where the internal Modification Detection
Code does not validate. Code does not validate.
* Any version 2 Symmetrically Encrypted Integrity Protected Data * Any version 2 Symmetrically Encrypted and Integrity Protected Data
packet (Section 5.13.2) where the authentication tag of any chunk packet (Section 5.13.2) where the authentication tag of any chunk
fails, or where there is no final zero-octet chunk. fails or where there is no final zero-octet chunk.
* Any Secret-Key packet with encrypted secret key material * Any Secret-Key packet with encrypted secret key material
(Section 3.7.2.1) where there is an integrity failure, based on (Section 3.7.2.1) where there is an integrity failure, based on
the value of the secret key protection octet: the value of the secret key protection octet:
- Value 255 (MalleableCFB) or raw cipher algorithm: where the - Value 253 (AEAD): where the AEAD authentication tag is invalid.
trailing 2-octet checksum does not match.
- Value 254 (CFB): where the SHA1 checksum is mismatched. - Value 254 (CFB): where the SHA1 checksum is mismatched.
- Value 253 (AEAD): where the AEAD authentication tag is invalid. - Value 255 (MalleableCFB) or raw cipher algorithm: where the
trailing 2-octet checksum does not match.
To avoid these circumstances, an implementation that generates To avoid these circumstances, an implementation that generates
OpenPGP encrypted data SHOULD select the encrypted container format OpenPGP encrypted data SHOULD select the encrypted container format
with the most robust protections that can be handled by the intended with the most robust protections that can be handled by the intended
recipients. In particular: recipients. In particular:
* The SED packet is deprecated, and MUST NOT be generated. * The SED packet is deprecated and MUST NOT be generated.
* When encrypting to one or more public keys: * When encrypting to one or more public keys:
- If all recipient keys indicate support for version 2 of the - If all recipient keys indicate support for a version 2
Symmetrically Encrypted Integrity Protected Data packet in Symmetrically Encrypted and Integrity Protected Data packet in
their Features subpacket (Section 5.2.3.32), or are v6 keys their Features signature subpacket (Section 5.2.3.32), if all
without a Features subpacket, or the implementation can recipient keys are version 6 keys without a Features signature
otherwise infer that all recipients support v2 SEIPD packets, subpacket, or the implementation can otherwise infer that all
the implementation SHOULD encrypt using a v2 SEIPD packet. recipients support v2 SEIPD packets, the implementation SHOULD
encrypt using a v2 SEIPD packet.
- If one of the recipients does not support v2 SEIPD packets, - If one of the recipients does not support v2 SEIPD packets,
then the message generator MAY use a v1 SEIPD packet instead. then the message generator MAY use a v1 SEIPD packet instead.
* Passphrase-protected secret key material in a v6 Secret Key or v6 * Passphrase-protected secret key material in a version 6 Secret Key
Secret Subkey packet SHOULD be protected with AEAD encryption (S2K or version 6 Secret Subkey packet SHOULD be protected with AEAD
usage octet 253) unless it will be transferred to an encryption (S2K usage octet 253) unless it will be transferred to
implementation that is known to not support AEAD. An an implementation that is known to not support AEAD. An
implementation should be aware that, in scenarios where an implementation should be aware that, in scenarios where an
attacker has write access to encrypted private keys, CFB-encrypted attacker has write access to encrypted private keys, CFB-encrypted
keys (S2K usage octet 254 or 255) are vulnerable to corruption keys (S2K usage octet 254 or 255) are vulnerable to corruption
attacks that can cause leakage of secret data when the secret key attacks that can cause leakage of secret data when the secret key
is used [KOPENPGP], [KR02]. is used [KOPENPGP] [KR02].
Implementers should implement AEAD (v2 SEIPD and S2K usage octet 253) Implementers should implement AEAD (v2 SEIPD and S2K usage octet 253)
promptly and encourage its spread. promptly and encourage its spread.
Users are RECOMMENDED to migrate to AEAD. Users are RECOMMENDED to migrate to AEAD.
13.8. Secure Use of the v2 SEIPD Session-Key-Reuse Feature 13.8. Secure Use of the v2 SEIPD Session-Key-Reuse Feature
The salted key derivation of v2 SEIPD packets (Section 5.13.2) allows The salted key derivation of v2 SEIPD packets (Section 5.13.2) allows
the recipient of an encrypted message to reply to the sender and all the recipient of an encrypted message to reply to the sender and all
other recipients without needing their public keys but by using the other recipients without needing their public keys but by using the
same v6 PKESK packets he received and a different random salt value. same v6 PKESK packets it received and a different random salt value.
This ensures a secure mechanism on the cryptographic level that This ensures a secure mechanism on the cryptographic level that
enables the use of message encryption in cases where a sender does enables the use of message encryption in cases where a sender does
not have a copy of an encryption-capable certificate for one or more not have a copy of an encryption-capable certificate for one or more
participants in the conversation and thus can enhance the overall participants in the conversation and thus can enhance the overall
security of an application. However, care must be taken when using security of an application. However, care must be taken when using
this mechanism not to create security vulnerabilities, such as the this mechanism not to create security vulnerabilities, such as the
following. following:
* Replying to only a subset of the original recipients and the * Replying to only a subset of the original recipients and the
original sender by use of the session-key-reuse feature would mean original sender by use of the session-key-reuse feature would mean
that the remaining recipients (including the sender) of the that the remaining recipients (including the sender) of the
original message could read the encrypted reply message, too. original message could read the encrypted reply message, too.
* Adding a further recipient to the reply that is encrypted using * Adding a further recipient to the reply that is encrypted using
the session-key-reuse feature gives that further recipient also the session-key-reuse feature gives that further recipient also
cryptographic access to the original message that is being replied cryptographic access to the original message that is being replied
to (and potentially to a longer history of previous messages). to (and potentially to a longer history of previous messages).
* A modification of the list of recipients addressed in the above * A modification of the list of recipients addressed in the above
points needs also to be safeguarded when a message is initially points also needs to be safeguarded when a message is initially
composed as a reply with session-key reuse but then first stored composed as a reply with session-key reuse but then is stored
(e.g. as a draft) and later reopened for further editing and (e.g., as a draft) and later reopened for further editing and to
finally sent. be finally sent.
* There is the potential threat that an attacker with network or * There is the potential threat that an attacker with network or
mailbox access, who is at the same time a recipient of the mailbox access, who is at the same time a recipient of the
original message, silently removes themselves from the message original message, silently removes themselves from the message
before the victim's client receives it. The victim's client that before the victim's client receives it. The victim's client that
then uses the mechanism for replying with session-key reuse would then uses the mechanism for replying with session-key reuse would
unknowingly compose an encrypted message that could be read by the unknowingly compose an encrypted message that could be read by the
attacker. Implementations are encouraged to use the Intended attacker. Implementations are encouraged to use the Intended
Recipient Fingerprint (Section 5.2.3.36) subpacket when composing Recipient Fingerprint subpacket (Section 5.2.3.36) when composing
messages and to use it to check the consistency of the set of messages and checking the consistency of the set of recipients of
recipients of a message before replying to it with session-key a message before replying to it with session-key reuse.
reuse.
* When using the session-key-reuse feature in any higher-layer * When using the session-key-reuse feature in any higher-layer
protocol, care should be taken that there is no other potentially protocol, care should be taken to ensure that there is no other
interfering practice of session-key reuse established in that potentially interfering practice of session-key reuse established
protocol. Such interfering session-key reuse could for instance in that protocol. Such interfering session-key reuse could, for
be given if an initial message is already composed by reusing the instance, be given -- if an initial message is already composed --
session key of an existing encrypted file the access to which may by reusing the session key of an existing encrypted file that may
be shared among a group of users already. Using the session-key- have been shared among a group of users already. Using the
reuse feature to compose an encrypted reply to such a message session-key-reuse feature to compose an encrypted reply to such a
would unknowingly give this whole group of users cryptographic message would unknowingly give this whole group of users
access to the encrypted message. cryptographic access to the encrypted message.
* Generally, the use of the session-key-reuse feature should be * Generally, the use of the session-key-reuse feature should be
under the control of the user. Specifically, care should be taken under the control of the user. Specifically, care should be taken
that this feature is not silently used when the user assumes that so that this feature is not silently used when the user assumes
proper public-key encryption is used. This can be the case for that proper public key encryption is used. This can be the case,
instance when the public key of one of the recipients of the reply for instance, when the public key of one of the recipients of the
is known but has expired. Special care should be taken to ensure reply is known but has expired. Special care should be taken to
that users do not get caught in continued use of the session-key ensure that users do not get caught in continued use of the
reuse unknowingly but instead receive the chance to switch to session-key reuse unknowingly but instead receive the chance to
proper fresh public-key encryption as soon as possible. switch to proper fresh public key encryption as soon as possible.
* Whenever possible, a client should prefer a fresh public key * Whenever possible, a client should prefer a fresh public key
encryption over the session-key reuse. encryption over the session-key reuse.
Even though this not necessarily being a security aspect, note that Even though this is not necessarily a security aspect, note that
initially composing an encrypted reply using the session-key-reuse initially composing an encrypted reply using the session-key-reuse
feature on one client and storing it (e.g. as a draft) and later feature on one client and then storing it (e.g., as a draft) and
reopening the stored unfinished reply with another client that does later reopening the stored unfinished reply with another client that
not support the session-key-reuse feature may lead to does not support the session-key-reuse feature may lead to
interoperability problems. interoperability problems.
Avoiding the pitfalls described above requires context-specific Avoiding the pitfalls described above requires context-specific
expertise. An implementation should only make use of the session- expertise. An implementation should only make use of the session-
key-reuse feature in any particular application layer when it can key-reuse feature in any particular application layer when it can
follow reasonable documentation about how to deploy the feature follow reasonable documentation about how to deploy the feature
safely in the specific application. At the time of this writing, safely in the specific application. At the time of this writing,
there is no known documentation about safe reuse of OpenPGP session there is no known documentation about safe reuse of OpenPGP session
keys for any specific context. An implementer that intends to make keys for any specific context. An implementer that intends to make
use of this feature should publish their own proposed guidance for use of this feature should publish their own proposed guidance for
others to review. others to review.
13.9. Escrowed Revocation Signatures 13.9. Escrowed Revocation Signatures
A keyholder, Alice, may wish to designate a third party to be able to A keyholder, Alice, may wish to designate a third party to be able to
revoke Alice's own key. revoke her own key.
The preferred way for her to do this is to produce a specific The preferred way for Alice to do this is to produce a specific
Revocation Signature (signature type IDs 0x20, 0x28, or 0x30) and Revocation Signature (Signature Type ID 0x20, 0x28, or 0x30) and
distribute it securely to her preferred revoker who can hold it in distribute it securely to a preferred revoker who can hold it in
escrow. The preferred revoker can then publish the escrowed escrow. The preferred revoker can then publish the escrowed
Revocation Signature at whatever time is deemed appropriate, rather Revocation Signature at whatever time is deemed appropriate rather
than generating a revocation signature themselves. than generating the Revocation Signature themselves.
There are multiple advantages of using an escrowed Revocation There are multiple advantages of using an escrowed Revocation
Signature over the deprecated Revocation Key subpacket Signature over the deprecated Revocation Key subpacket
(Section 5.2.3.23): (Section 5.2.3.23):
* The keyholder can constrain what types of revocation the preferred * The keyholder can constrain what types of revocation the preferred
revoker can issue, by only escrowing those specific signatures. revoker can issue, by only escrowing those specific signatures.
* There is no public/visible linkage between the keyholder and the * There is no public/visible linkage between the keyholder and the
preferred revoker. preferred revoker.
* Third parties can verify the revocation without needing to find * Third parties can verify the revocation without needing to find
the key of the preferred revoker. the key of the preferred revoker.
* The preferred revoker doesn't even need to have a public OpenPGP * The preferred revoker doesn't even need to have a public OpenPGP
key if some other secure transport is possible between them and Key if some other secure transport is possible between them and
the keyholder. the keyholder.
* Implementation support for enforcing a revocation from an * Implementation support for enforcing a revocation from an
authorized Revocation Key subpacket is uneven and unreliable. authorized Revocation Key subpacket is uneven and unreliable.
* If the fingerprint mechanism suffers a cryptanalytic flaw, the * If the fingerprint mechanism suffers a cryptanalytic flaw, the
escrowed Revocation Signature is not affected. escrowed Revocation Signature is not affected.
A Revocation Signature may also be split up into shares and A Revocation Signature may also be split up into shares and
distributed among multiple parties, requiring some subset of those distributed among multiple parties, requiring some subset of those
parties to collaborate before the escrowed Revocation Signature is parties to collaborate before the escrowed Revocation Signature is
recreated. recreated.
13.10. Random Number Generation and Seeding 13.10. Random Number Generation and Seeding
OpenPGP requires a cryptographically secure pseudorandom number OpenPGP requires a cryptographically secure pseudorandom number
generator (CSPRNG). In most cases, the operating system provides an generator (CSPRNG). In most cases, the operating system provides an
appropriate facility such as a getrandom() syscall on Linux or BSD, appropriate facility such as a getrandom() syscall on Linux or BSD,
which should be used absent other (for example, performance) which should be used absent other (for example, performance)
concerns. It is RECOMMENDED to use an existing CSPRNG implementation concerns. It is RECOMMENDED to use an existing CSPRNG implementation
in preference to crafting a new one. Many adequate cryptographic as opposed to crafting a new one. Many adequate cryptographic
libraries are already available under favorable license terms. libraries are already available under favorable license terms.
Should those prove unsatisfactory, [RFC4086] provides guidance on the Should those prove unsatisfactory, [RFC4086] provides guidance on the
generation of random values. generation of random values.
OpenPGP uses random data with three different levels of visibility: OpenPGP uses random data with three different levels of visibility:
* In publicly-visible fields such as nonces, IVs, public padding * In publicly visible fields such as nonces, IVs, public padding
material, or salts, material, or salts.
* In shared-secret values, such as session keys for encrypted data * In shared-secret values, such as session keys for encrypted data
or padding material within an encrypted packet, and or padding material within an encrypted packet.
* In entirely private data, such as asymmetric key generation. * In entirely private data, such as asymmetric key generation.
With a properly functioning CSPRNG, this range of visibility does not With a properly functioning CSPRNG, this range of visibility does not
present a security problem, as it is not feasible to determine the present a security problem, as it is not feasible to determine the
CSPRNG state from its output. However, with a broken CSPRNG, it may CSPRNG state from its output. However, with a broken CSPRNG, it may
be possible for an attacker to use visible output to determine the be possible for an attacker to use visible output to determine the
CSPRNG internal state and thereby predict less-visible data like CSPRNG internal state and thereby predict less-visible data like
keying material, as documented in [CHECKOWAY]. keying material, as documented in [CHECKOWAY].
skipping to change at page 147, line 6 skipping to change at line 6755
attack by using separate CSPRNGs to generate random data with attack by using separate CSPRNGs to generate random data with
different levels of visibility. different levels of visibility.
13.11. Traffic Analysis 13.11. Traffic Analysis
When sending OpenPGP data through the network, the size of the data When sending OpenPGP data through the network, the size of the data
may leak information to an attacker. There are circumstances where may leak information to an attacker. There are circumstances where
such a leak could be unacceptable from a security perspective. such a leak could be unacceptable from a security perspective.
For example, if possible cleartext messages for a given protocol are For example, if possible cleartext messages for a given protocol are
known to be either yes (three octets) and no (two octets) and the known to be either yes (3 octets) or no (2 octets) and the messages
messages are sent within a Symmetrically-Encrypted Integrity are sent within a Symmetrically Encrypted and Integrity Protected
Protected Data packet, the length of the encrypted message will Data packet, the length of the encrypted message will reveal the
reveal the contents of the cleartext. contents of the cleartext.
In another example, sending an OpenPGP Transferable Public Key over In another example, sending an OpenPGP Transferable Public Key over
an encrypted network connection might reveal the length of the an encrypted network connection might reveal the length of the
certificate. Since the length of an OpenPGP certificate varies based certificate. Since the length of an OpenPGP certificate varies based
on the content, an external observer interested in metadata (who is on the content, an external observer interested in metadata (e.g.,
trying to contact whom) may be able to guess the identity of the which individual is trying to contact another individual) may be able
certificate sent, if its length is unique. to guess the identity of the certificate sent, if its length is
unique.
In both cases, an implementation can adjust the size of the compound In both cases, an implementation can adjust the size of the compound
structure by including a Padding packet (see Section 5.14). structure by including a Padding packet (see Section 5.14).
13.12. Surreptitious Forwarding 13.12. Surreptitious Forwarding
When an attacker obtains a signature for some text, e.g. by receiving When an attacker obtains a signature for some text, e.g., by
a signed message, they may be able to use that signature maliciously receiving a signed message, they may be able to use that signature
by sending a message purporting to come from the original sender, maliciously by sending a message purporting to come from the original
with the same body and signature, to a different recipient. To sender, with the same body and signature, to a different recipient.
prevent this, an implementation SHOULD implement the Intended To prevent this, an implementation SHOULD implement the Intended
Recipient Fingerprint signature subpacket (Section 5.2.3.36). Recipient Fingerprint subpacket (Section 5.2.3.36).
13.13. Hashed vs. Unhashed Subpackets 13.13. Hashed vs. Unhashed Subpackets
Each OpenPGP signature can have subpackets in two different sections. Each OpenPGP signature can have subpackets in two different sections.
The first set of subpackets (the "hashed section") is covered by the The first set of subpackets (the "hashed section") is covered by the
signature itself. The second set has no cryptographic protections, signature itself. The second set has no cryptographic protections
and is used for advisory material only, including locally-stored and is used for advisory material only, including locally stored
annotations about the signature. annotations about the signature.
For example, consider an implementation working with a specific For example, consider an implementation working with a specific
signature that happens to know that the signature was made by a signature that happens to know that the signature was made by a
certain key, even though the signature contains no Issuer Fingerprint certain key, even though the signature contains no Issuer Fingerprint
subpacket (Section 5.2.3.35) in the hashed section. That subpacket (Section 5.2.3.35) in the hashed section. That
implementation MAY synthesize an Issuer Fingerprint subpacket and implementation MAY synthesize an Issuer Fingerprint subpacket and
store it in the unhashed section so that in the future it will be store it in the unhashed section so that it will be able to recall
able to recall which key issued the signature. which key issued the signature in the future.
Some subpackets are only useful when they are in the hashed section, Some subpackets are only useful when they are in the hashed section,
and an implementation SHOULD ignore them when they are found with and an implementation SHOULD ignore them when they are found with
unknown provenance in the unhashed section. For example, a Preferred unknown provenance in the unhashed section. For example, a Preferred
AEAD Ciphersuites subpacket (Section 5.2.3.15) in a direct key self- AEAD Ciphersuites subpacket (Section 5.2.3.15) in a Direct Key self-
signature indicates the preferences of the keyholder when encrypting signature indicates the preferences of the keyholder when encrypting
SEIPD v2 data to the key. An implementation that observes such a v2 SEIPD data to the key. An implementation that observes such a
subpacket found in the unhashed section would open itself to an subpacket found in the unhashed section would open itself to an
attack where the recipient's certificate is tampered with to attack where the recipient's certificate is tampered with to
encourage the use of a specific cipher or mode of operation. encourage the use of a specific cipher or mode of operation.
13.14. Malicious Compressed Data 13.14. Malicious Compressed Data
It is possible to form a compression quine that produces itself upon It is possible to form a compression quine that produces itself upon
decompression, leading to infinite regress in any implementation decompression, leading to infinite regress in any implementation
willing to parse arbitrary numbers of layers of compression. This willing to parse arbitrary numbers of layers of compression. This
could cause resource exhaustion which itself could lead to it being could cause resource exhaustion, which itself could lead to
terminated by the operating system. If the operating system would termination by the operating system. If the operating system creates
create a "crash report", that report could contain confidential a "crash report", that report could contain confidential information.
information.
An OpenPGP implementation SHOULD limit the number of layers of An OpenPGP implementation SHOULD limit the number of layers of
compression it is willing to decompress in a single message. compression it is willing to decompress in a single message.
14. Implementation Considerations 14. Implementation Considerations
This section is a collection of comments to help an implementer, This section is a collection of comments to help an implementer who
particularly with an eye to backward compatibility. Often the has a particular interest in backward compatibility. Often the
differences are small, but small differences are frequently more differences are small, but small differences are frequently more
vexing than large differences. Thus, this is a non-comprehensive vexing than large differences. Thus, this is a non-comprehensive
list of potential problems and gotchas for a developer who is trying list of potential problems and gotchas for a developer who is trying
to be backward-compatible. to achieve backward compatibility.
* There are many ways possible for two keys to have the same key * There are many possible ways for two keys to have the same key
material, but different fingerprints (and thus Key IDs). For material but different fingerprints (and thus different Key IDs).
example, since a v4 fingerprint is constructed by hashing the key For example, since a version 4 fingerprint is constructed by
creation time along with other things, two v4 keys created at hashing the key creation time along with other things, two version
different times, yet with the same key material will have 4 keys created at different times yet with the same key material
different fingerprints. will have different fingerprints.
* OpenPGP does not put limits on the size of public keys. However, * OpenPGP does not put limits on the size of public keys. However,
larger keys are not necessarily better keys. Larger keys take larger keys are not necessarily better keys. Larger keys take
more computation time to use, and this can quickly become more computation time to use, and this can quickly become
impractical. Different OpenPGP implementations may also use impractical. Different OpenPGP implementations may also use
different upper bounds for public key sizes, and so care should be different upper bounds for public key sizes, so care should be
taken when choosing sizes to maintain interoperability. taken when choosing sizes to maintain interoperability.
* ASCII armor is an optional feature of OpenPGP. The OpenPGP * ASCII Armor is an optional feature of OpenPGP. The OpenPGP
working group strives for a minimal set of mandatory-to-implement Working Group strives for a minimal set of mandatory-to-implement
features, and since there could be useful implementations that features, and since there could be useful implementations that
only use binary object formats, this is not a "MUST" feature for only use binary object formats, this is not a "MUST" feature for
an implementation. For example, an implementation that is using an implementation. For example, an implementation that is using
OpenPGP as a mechanism for file signatures may find ASCII armor OpenPGP as a mechanism for file signatures may find ASCII Armor
unnecessary. OpenPGP permits an implementation to declare what unnecessary. OpenPGP permits an implementation to declare what
features it does and does not support, but ASCII armor is not one features it does and does not support, but ASCII Armor is not one
of these. Since most implementations allow binary and armored of these. Since most implementations allow binary and armored
objects to be used indiscriminately, an implementation that does objects to be used indiscriminately, an implementation that does
not implement ASCII armor may find itself with compatibility not implement ASCII Armor may find itself with compatibility
issues with general-purpose implementations. Moreover, issues with general-purpose implementations. Moreover,
implementations of OpenPGP-MIME [RFC3156] already have a implementations of OpenPGP-MIME [RFC3156] already have a
requirement for ASCII armor so those implementations will requirement for ASCII Armor, so those implementations will
necessarily have support. necessarily have support.
* What this document calls Legacy packet format Section 4.2.2 is * What this document calls the "Legacy packet format"
what older documents called the "old packet format". It is the (Section 4.2.2) is what older documents called the "old packet
packet format used by implementations predating [RFC2440]. Older format". It is the packet format used by implementations
RFCs called the current OpenPGP packet format Section 4.2.1 the predating [RFC2440]. The current "OpenPGP packet format"
"new packet format". This is the format introduced in [RFC2440] (Section 4.2.1) was called the "new packet format" by older RFCs.
and maintained through [RFC4880] to this document. This is the format introduced in [RFC2440] and maintained through
[RFC4880] to this document.
14.1. Constrained Legacy Fingerprint Storage for v6 Keys 14.1. Constrained Legacy Fingerprint Storage for Version 6 Keys
Some OpenPGP implementations have fixed length constraints for key Some OpenPGP implementations have fixed length constraints for key
fingerprint storage that will not fit all 32 octets of a v6 fingerprint storage that will not fit all 32 octets of a version 6
fingerprint. For example, [OPENPGPCARD] reserves 20 octets for each fingerprint. For example, [OPENPGPCARD] reserves 20 octets for each
stored fingerprint. stored fingerprint.
An OpenPGP implementation MUST NOT attempt to map any part of a v6 An OpenPGP implementation MUST NOT attempt to map any part of a
fingerprint to such a constrained field unless the relevant spec for version 6 fingerprint to such a constrained field unless the relevant
the constrained environment has explicit guidance for storing a v6 specification for the constrained environment has explicit guidance
fingerprint that distinguishes it from a v4 fingerprint. An for storing a version 6 fingerprint that distinguishes it from a
implementation interacting with such a constrained field SHOULD version 4 fingerprint. An implementation interacting with such a
directly calculate the v6 fingerprint from public key material and constrained field SHOULD directly calculate the version 6 fingerprint
associated metadata instead of relying on the constrained field. from public key material and associated metadata instead of relying
on the constrained field.
15. IANA Considerations 15. IANA Considerations
This document obsoletes [RFC4880]. IANA is requested to update all This document obsoletes [RFC4880]. IANA has updated all registration
registration information that references [RFC4880] to instead information that references [RFC4880] to reference this RFC instead.
reference this RFC.
15.1. Rename "Pretty Good Privacy (PGP)" Protocol Group to "OpenPGP" 15.1. Renamed Protocol Group
IANA bundles a set of registries associated with a particular IANA bundles a set of registries associated with a particular
protocol into a "protocol group". This document requests IANA to protocol into a "protocol group". IANA has updated the name of the
update the name of the "Pretty Good Privacy (PGP)" protocol group "Pretty Good Privacy (PGP)" protocol group (i.e., the group of
(i.e., the group of registries described at registries described at <https://www.iana.org/assignments/pgp-
https://www.iana.org/assignments/pgp-parameters/) to "OpenPGP". If parameters>) to "OpenPGP". IANA has arranged a permanent redirect
renaming the protocol group results in new URLs for the registries in from the existing URL to the new URL for the registries in this
this protocol group, please arrange for a permanent redirection protocol group. All further updates specified below are for
(e.g., HTTP 301) from the existing URLs to the new URLs. All further registries within this same OpenPGP protocol group.
updates specified below are for registries within this same "OpenPGP"
protocol group.
15.2. Registries to be Renamed and Updated 15.2. Renamed and Updated Registries
IANA is requested to rename the "PGP String-to-Key (S2K)" registry to IANA has renamed the "PGP String-to-Key (S2K)" registry to "OpenPGP
"OpenPGP String-to-Key (S2K) Types" and update its content to String-to-Key (S2K) Types" and updated its contents as shown in
Table 1. Table 1.
IANA is requested to rename the "PGP Packet Types/Tags" registry to IANA has renamed the "PGP Packet Types/Tags" registry to "OpenPGP
"OpenPGP Packet Types" and update its content to Table 3. Packet Types" and updated its contents as shown in Table 3.
IANA is requested to rename the "PGP User Attribute Types" registry IANA has renamed the "Signature Subpacket Types" registry to "OpenPGP
to "OpenPGP User Attribute Subpacket Types" and update its content to Signature Subpacket Types" and updated its contents as shown in
Table 13. Table 5.
IANA is requested to rename the "Image Format Subpacket Types" IANA has renamed the "Key Server Preference Extensions" registry to
registry to "OpenPGP Image Attribute Encoding Format" and update its "OpenPGP Key Server Preference Flags" and updated its contents as
content to Table 15. shown in Table 8.
IANA is requested to rename the "Key Server Preference Extensions" IANA has renamed the "Key Flags Extensions" registry to "OpenPGP Key
registry to "OpenPGP Key Server Preference Flags" and update its Flags" and updated its contents as shown in Table 9.
contents to Table 8.
IANA is requested to rename the "Reason for Revocation Extensions" IANA has renamed the "Reason for Revocation Extensions" registry to
registry to "OpenPGP Reason for Revocation Code" and update its "OpenPGP Reason for Revocation (Revocation Octet)" and updated its
contents to Table 10. contents as shown in Table 10.
IANA is requested to rename the "Key Flags Extensions" registry to IANA has renamed the "Implementation Features" registry to "OpenPGP
"OpenPGP Key Flags" and update its contents to Table 9. Features Flags" and updated its contents as shown in Table 11.
IANA is requested to rename the "Implementation Features" registry to IANA has renamed the "PGP User Attribute Types" registry to "OpenPGP
"OpenPGP Features Flags" and update its contents to Table 11. User Attribute Subpacket Types" and updated its contents as shown in
Table 13.
IANA is requested to rename the "Public Key Algorithms" registry to IANA has renamed the "Image Format Subpacket Types" registry to
"OpenPGP Public Key Algorithms" and update its contents to Table 18. "OpenPGP Image Attribute Encoding Format" and updated its contents as
shown in Table 15.
IANA is requested to rename the "Symmetric Key Algorithms" registry IANA has renamed the "Public Key Algorithms" registry to "OpenPGP
to "OpenPGP Symmetric Key Algorithms" and update its contents to Public Key Algorithms" and updated its contents as shown in Table 18.
IANA has renamed the "Symmetric Key Algorithms" registry to "OpenPGP
Symmetric Key Algorithms" and updated its contents as shown in
Table 21. Table 21.
IANA is requested to rename the "Compression Algorithms" registry to IANA has renamed the "Compression Algorithms" registry to "OpenPGP
"OpenPGP Compression Algorithms" and update its contents to Table 22. Compression Algorithms" and updated its contents as shown in
Table 22.
IANA is requested to rename the "Hash Algorithms" registry to IANA has renamed the "Hash Algorithms" registry to "OpenPGP Hash
"OpenPGP Hash Algorithms" and update its contents to Table 23. Algorithms" and updated its contents as shown in Table 23.
IANA is requested to rename the "Signature Subpacket Types" registry 15.3. Removed Registry
to "OpenPGP Signature Subpacket Types" and update its contents to
Table 5.
15.3. Registries to be Removed IANA has marked the empty "New Packet Versions" registry as OBSOLETE.
IANA is requested to remove the empty "New Packet Versions" registry. A tombstone note has been added to the OpenPGP protocol group with
the following content:
A tombstone note should be added to the OpenPGP protocol group with | Those wishing to use the removed "New Packet Versions" registry
the following content: Those wishing to use the removed "New Packet | should instead register new versions of the relevant packets in
Versions" registry should instead register new versions of the | the "OpenPGP Key and Signature Versions", "OpenPGP Key IDs and
relevant packets in the "OpenPGP Key and Signature Versions", | Fingerprints", and "OpenPGP Encrypted Message Packet Versions"
"OpenPGP Key ID and Fingerprint" and "OpenPGP Encrypted Message | registries.
Packet Versions" registries.
15.4. Registries to be Added 15.4. Added Registries
IANA is requested to add the following registries in the OpenPGP IANA has added the following registries in the OpenPGP protocol
protocol group: group. Note that the initial contents of each registry is shown in
the corresponding table.
* OpenPGP Secret Key Encryption (S2K Usage Octet) containing * "OpenPGP Secret Key Encryption (S2K Usage Octet)" (Table 2).
Table 2.
* OpenPGP Signature Types containing Table 4. * "OpenPGP Signature Types" (Table 4).
* OpenPGP Signature Notation Data Subpacket Notation Flags * "OpenPGP Signature Notation Data Subpacket Notation Flags"
containing Table 6. (Table 6).
* OpenPGP Signature Notation Data Subpacket Types containing * "OpenPGP Signature Notation Data Subpacket Types" (Table 7).
Table 7.
* OpenPGP Key ID and Fingerprint containing Table 12. * "OpenPGP Key IDs and Fingerprints" (Table 12).
* OpenPGP Image Attribute Version containing Table 14. * "OpenPGP Image Attribute Versions" (Table 14).
* OpenPGP Armor Header Line containing Table 16. * "OpenPGP Armor Header Lines" (Table 16).
* OpenPGP Armor Header Key containing Table 17. * "OpenPGP Armor Header Keys" (Table 17).
* OpenPGP ECC Curve OID and Usage containing Table 19. * "OpenPGP ECC Curve OIDs and Usage" (Table 19).
* OpenPGP ECC Curve-specific Wire Formats containing Table 20. * "OpenPGP ECC Curve-Specific Wire Formats" (Table 20).
* OpenPGP Hash Algorithm Identifiers for RSA Signatures use of EMSA- * "OpenPGP Hash Algorithm Identifiers for RSA Signatures' Use of
PKCS1-v1_5 Padding containing Table 24. EMSA-PKCS1-v1_5 Padding" (Table 24).
* OpenPGP AEAD Algorithms containing Table 25. * "OpenPGP AEAD Algorithms" (Table 25).
* OpenPGP Encrypted Message Packet Versions containing Table 26. * "OpenPGP Encrypted Message Packet Versions" (Table 26).
* OpenPGP Key and Signature Versions containing Table 27. * "OpenPGP Key and Signature Versions" (Table 27).
* OpenPGP Elliptic Curve Point Wire Formats containing Table 28. * "OpenPGP Elliptic Curve Point Wire Formats" (Table 28).
* OpenPGP Elliptic Curve Scalar Encodings containing Table 29. * "OpenPGP Elliptic Curve Scalar Encodings" (Table 29).
* OpenPGP ECDH KDF and KEK Parameters containing Table 30. * "OpenPGP ECDH KDF and KEK Parameters" (Table 30).
15.5. Registration Policies 15.5. Registration Policies
IANA is requested to set all registries within the OpenPGP protocol All registries within the OpenPGP protocol group, with the exception
group to use the SPECIFICATION REQUIRED registration policy, see of the registries listed in Section 15.5.1, use the Specification
Section 4.6 of [RFC8126] with the exception of the registries listed Required registration policy; see Section 4.6 of [RFC8126]. This
in Section 15.5.1, below. This policy means that review and approval policy means that review and approval by a designated expert is
by a designated expert is required, and that the IDs and their required and that the IDs and their meanings must be documented in a
meanings must be documented in a permanent and readily available permanent and readily available public specification, in sufficient
public specification, in sufficient detail so that interoperability detail, so that interoperability between independent implementations
between independent implementations is possible. is possible.
15.5.1. Registries that are RFC REQUIRED 15.5.1. Registries That Use RFC Required
The following registries use the RFC REQUIRED registration policy, as The following registries use the RFC Required registration policy, as
described in Section 4.7 of [RFC8126]: described in Section 4.7 of [RFC8126]:
* OpenPGP Packet Types registry (Table 3) * "OpenPGP Packet Types" (Table 3).
* OpenPGP Key and Signature Versions registry (Table 27) * "OpenPGP Key IDs and Fingerprints" (Table 12).
* OpenPGP Key ID and Fingerprint registry (Table 12) * "OpenPGP Encrypted Message Packet Versions" (Table 26).
* OpenPGP Encrypted Message Packet Versions registry (Table 26) * "OpenPGP Key and Signature Versions" (Table 27).
15.6. Designated Experts 15.6. Designated Experts
The designated experts will determine whether the new registrations The designated experts will determine whether the new registrations
retain the security properties that are expected by the base retain the security properties that are expected by the base
implementation and that these new registrations do not cause implementation and whether these new registrations do not cause
interoperability issues with existing implementations other than not interoperability issues with existing implementations, other than not
producing or consuming the IDs associated with these new producing or consuming the IDs associated with these new
registrations. Registration proposals that fail to meet these registrations. Registration proposals that fail to meet these
criteria could instead be proposed as new work items for the OpenPGP criteria could instead be proposed as new work items for the OpenPGP
working group or its successor. Working Group or its successor.
The subsections below describe specific guidance for classes of The subsections below describe specific guidance for classes of
registry updates that a designated expert will consider. registry updates that a designated expert will consider.
The designated experts should also consider Section 12.11 when The designated experts should also consider Section 12.11 when
reviewing proposed additions to the OpenPGP registries. reviewing proposed additions to the OpenPGP protocol group.
15.6.1. Key and Signature Versions 15.6.1. Key and Signature Versions
When defining a new version of OpenPGP keys or signatures, Table 27 When defining a new version of OpenPGP Keys or Signatures, the
should be updated, When a new version of OpenPGP key is defined, "OpenPGP Key and Signature Versions" registry (Table 27) should be
Table 12 should also be updated. updated. When a new version of OpenPGP Key is defined, the "OpenPGP
Key IDs and Fingerprints" registry (Table 12) should also be updated.
15.6.2. Encryption Versions 15.6.2. Encryption Versions
When defining a new version of the Symmetrically Encrypted Integrity When defining a new version of the Symmetrically Encrypted and
Protected Data Packet (Section 5.13), Public Key Encrypted Session Integrity Protected Data packet (Section 5.13), Public Key Encrypted
Key Packet (Section 5.1), and/or Symmetric Key Encrypted Session Key Session Key packet (Section 5.1), and/or Symmetric Key Encrypted
Packet (Section 5.3), the registry from Table 26 needs to be updated. Session Key packet (Section 5.3), the "OpenPGP Encrypted Message
When the SEIPD is updated, consider also adding a corresponding flag Packet Versions" registry (Table 26) should be updated. When the
to Table 11. SEIPD is updated, consider also adding a corresponding flag to the
"OpenPGP Features Flags" registry (Table 11).
15.6.3. Algorithms 15.6.3. Algorithms
Section 9 lists the cryptographic and compression algorithms that Section 9 lists the cryptographic and compression algorithms that
OpenPGP uses. Adding new algorithms is usually simple, in some cases OpenPGP uses. Adding new algorithms is usually simple; in some
as little as allocating an ID and pointing to a reference. But some cases, allocating an ID and pointing to a reference is only needed.
algorithm registries require some subtle additional details when a But some algorithm registries require some subtle additional details
new algorithm is introduced. when a new algorithm is introduced.
15.6.3.1. Elliptic Curve Algorithms 15.6.3.1. Elliptic Curve Algorithms
To register a new elliptic curve for use with OpenPGP, its OID needs To register a new elliptic curve for use with OpenPGP, its OID needs
to be registered in Table 19, its wire format needs to be documented to be registered in the "OpenPGP ECC Curve OIDs and Usage" registry
in Table 20, and if used for ECDH, its KDF and KEK parameters must be (Table 19), its wire format needs to be documented in the "OpenPGP
populated in Table 30. If the wire format(s) used are not already ECC Curve-Specific Wire Formats" registry (Table 20), and if used for
defined in Table 28 or Table 29, they should be defined there as ECDH, its KDF and KEK parameters must be populated in the "OpenPGP
ECDH KDF and KEK Parameters" registry (Table 30). If the wire
format(s) used is not already defined in the "OpenPGP Elliptic Curve
Point Wire Formats" (Table 28) or "OpenPGP Elliptic Curve Scalar
Encodings" (Table 29) registries, they should be defined there as
well. well.
15.6.3.2. Symmetric-Key Algorithms 15.6.3.2. Symmetric Key Algorithms
When registering a new symmetric cipher with a block size of 64 or When registering a new symmetric cipher with a block size of 64 or
128 bits and a key size that is a multiple of 64 bits, no new 128 bits and a key size that is a multiple of 64 bits, no new
considerations are needed. considerations are needed.
If the new cipher has a different block size, there needs to be If the new cipher has a different block size, there needs to be
additional documentation describing how to use the cipher in CFB additional documentation describing how to use the cipher in CFB
mode. mode.
If the new cipher has an unusual key size, then padding needs to be If the new cipher has an unusual key size, then padding needs to be
considered for X25519 and X448 keywrap, which currently needs no considered for X25519 and X448 key wrapping, which currently needs no
padding. padding.
15.6.3.3. Hash Algorithms 15.6.3.3. Hash Algorithms
When registering a new hash algorithm (in Table 23), if the algorithm When registering a new hash algorithm in the "OpenPGP Hash
is also to be used with RSA signing schemes, it must also have an Algorithms" registry (Table 23), if the algorithm is also to be used
entry in Table 24. with RSA signing schemes, it must also have an entry in the "OpenPGP
Hash Algorithm Identifiers for RSA Signatures' Use of EMSA-PKCS1-v1_5
Padding" registry (Table 24).
16. References 16. References
16.1. Normative References 16.1. Normative References
[AES] "Advanced encryption standard (AES)", National Institute [AES] NIST, "Advanced Encryption Standard (AES)", Updated May
of Standards and Technology report, 2023, FIPS PUB 197, DOI 10.6028/NIST.FIPS.197-upd1,
DOI 10.6028/nist.fips.197, November 2001, November 2001, <https://nvlpubs.nist.gov/nistpubs/FIPS/
<https://doi.org/10.6028/nist.fips.197>. NIST.FIPS.197-upd1.pdf>.
[BLOWFISH] Schneier, B., "Description of a New Variable-Length Key, [BLOWFISH] Schneier, B., "Description of a New Variable-Length Key,
64-Bit Block Cipher (Blowfish)", Fast Software Encryption, 64-Bit Block Cipher (Blowfish)", Fast Software Encryption,
Cambridge Security Workshop Proceedings Springer-Verlag, Cambridge Security Workshop Proceedings, pp. 191-204,
1994, pp191-204, December 1993, December 1993,
<http://www.counterpane.com/bfsverlag.html>. <https://www.schneier.com/academic/archives/1994/09/
description_of_a_new.html>.
[BZ2] Seward, J., "The Bzip2 and libbzip2 home page", 2010, [BZ2] bzip2, "bzip2 and libbzip2", 2010,
<http://www.bzip.org/>. <https://sourceware.org/bzip2/>.
[EAX] Bellare, M., Rogaway, P., and D. Wagner, "A Conventional [EAX] Bellare, M., Rogaway, P., and D. Wagner, "A Conventional
Authenticated-Encryption Mode", April 2003, Authenticated-Encryption Mode", April 2003,
<https://seclab.cs.ucdavis.edu/papers/eax.pdf>. <https://seclab.cs.ucdavis.edu/papers/eax.pdf>.
[ELGAMAL] Elgamal, T., "A Public-Key Cryptosystem and a Signature [ELGAMAL] Elgamal, T., "A Public Key Cryptosystem and a Signature
Scheme Based on Discrete Logarithms", IEEE Transactions on Scheme Based on Discrete Logarithms", IEEE Transactions on
Information Theory v. IT-31, n. 4, 1985, pp. 469-472, Information Theory, Vol. 31, Issue 4, pp. 469-472,
1985. DOI 10.1109/TIT.1985.1057074, July 1985,
<https://doi.org/10.1109/TIT.1985.1057074>.
[FIPS180] Dang, Q., "Secure Hash Standard", National Institute of [FIPS180] NIST, "Secure Hash Standard (SHS)", FIPS PUB 180-4,
Standards and Technology report, DOI 10.6028/NIST.FIPS.180-4, August 2015,
DOI 10.6028/nist.fips.180-4, July 2015, <https://nvlpubs.nist.gov/nistpubs/fips/
<https://doi.org/10.6028/nist.fips.180-4>. nist.fips.180-4.pdf>.
[FIPS186] Chen, L., Moody, D., Regenscheid, A., and A. Robinson, [FIPS186] NIST, "Digital Signature Standard (DSS)", FIPS PUB 186-5,
"Digital Signature Standard (DSS)", National Institute of DOI 10.6028/NIST.FIPS.186-5, February 2023,
Standards and Technology (U.S.) report, <https://nvlpubs.nist.gov/nistpubs/FIPS/
DOI 10.6028/nist.fips.186-5, February 2023, NIST.FIPS.186-5.pdf>.
<https://doi.org/10.6028/nist.fips.186-5>.
[FIPS202] Dworkin, M., "SHA-3 Standard: Permutation-Based Hash and [FIPS202] NIST, "SHA-3 Standard: Permutation-Based Hash and
Extendable-Output Functions", National Institute of Extendable-Output Functions", FIPS PUB 202,
Standards and Technology report, DOI 10.6028/NIST.FIPS.202, August 2015,
DOI 10.6028/nist.fips.202, July 2015, <https://nvlpubs.nist.gov/nistpubs/fips/
<https://doi.org/10.6028/nist.fips.202>. nist.fips.202.pdf>.
[IDEA] Lai, X., "On the design and security of block ciphers", [IDEA] Lai, X. and J. L. Massey, "A Proposal for a New Block
ETH Series in Information Processing, J.L. Massey Encryption Standard", Advances in Cryptology - EUROCRYPT
(editor) Vol. 1, Hartung-Gorre Verlag Konstanz, Technische '90, Vol. 473, pp. 389-404, DOI 10.1007/3-540-46877-3_35,
Hochschule (Zurich), 1992. January 1991, <https://link.springer.com/
chapter/10.1007/3-540-46877-3_35>.
[ISO10646] International Organization for Standardization, [ISO10646] ISO, "Information technology - Universal coded character
"Information Technology - Universal Multiple-octet coded set (UCS)", ISO/IEC 10646:2020, December 2020,
Character Set (UCS) - Part 1: Architecture and Basic
Multilingual Plane", ISO Standard 10646-1, 2020,
<https://www.iso.org/standard/76835.html>. <https://www.iso.org/standard/76835.html>.
[JFIF] International Telecommunication Union, "Information [JFIF] ITU-T, "Information technology - Digital compression and
technology Digital compression and coding of continuous- coding of continuous-tone still images: JPEG File
tone still images: JPEG File Interchange Format (JFIF)", Interchange Format (JFIF)", Recommendation ITU-T T.871,
ISO ISO/IEC 10918-5, 14 May 2011, May 2011, <https://www.itu.int/rec/T-REC-T.871-201105-I>.
<https://www.itu.int/rec/T-REC-T.871-201105-I>.
[RFC1321] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, [RFC1321] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321,
DOI 10.17487/RFC1321, April 1992, DOI 10.17487/RFC1321, April 1992,
<https://www.rfc-editor.org/rfc/rfc1321>. <https://www.rfc-editor.org/info/rfc1321>.
[RFC1950] Deutsch, P. and J. Gailly, "ZLIB Compressed Data Format [RFC1950] Deutsch, P. and J. Gailly, "ZLIB Compressed Data Format
Specification version 3.3", RFC 1950, Specification version 3.3", RFC 1950,
DOI 10.17487/RFC1950, May 1996, DOI 10.17487/RFC1950, May 1996,
<https://www.rfc-editor.org/rfc/rfc1950>. <https://www.rfc-editor.org/info/rfc1950>.
[RFC1951] Deutsch, P., "DEFLATE Compressed Data Format Specification [RFC1951] Deutsch, P., "DEFLATE Compressed Data Format Specification
version 1.3", RFC 1951, DOI 10.17487/RFC1951, May 1996, version 1.3", RFC 1951, DOI 10.17487/RFC1951, May 1996,
<https://www.rfc-editor.org/rfc/rfc1951>. <https://www.rfc-editor.org/info/rfc1951>.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997, DOI 10.17487/RFC2119, March 1997,
<https://www.rfc-editor.org/rfc/rfc2119>. <https://www.rfc-editor.org/info/rfc2119>.
[RFC2144] Adams, C., "The CAST-128 Encryption Algorithm", RFC 2144, [RFC2144] Adams, C., "The CAST-128 Encryption Algorithm", RFC 2144,
DOI 10.17487/RFC2144, May 1997, DOI 10.17487/RFC2144, May 1997,
<https://www.rfc-editor.org/rfc/rfc2144>. <https://www.rfc-editor.org/info/rfc2144>.
[RFC2822] Resnick, P., Ed., "Internet Message Format", RFC 2822, [RFC2822] Resnick, P., Ed., "Internet Message Format", RFC 2822,
DOI 10.17487/RFC2822, April 2001, DOI 10.17487/RFC2822, April 2001,
<https://www.rfc-editor.org/rfc/rfc2822>. <https://www.rfc-editor.org/info/rfc2822>.
[RFC2898] Kaliski, B., "PKCS #5: Password-Based Cryptography
Specification Version 2.0", RFC 2898,
DOI 10.17487/RFC2898, September 2000,
<https://www.rfc-editor.org/rfc/rfc2898>.
[RFC3156] Elkins, M., Del Torto, D., Levien, R., and T. Roessler, [RFC3156] Elkins, M., Del Torto, D., Levien, R., and T. Roessler,
"MIME Security with OpenPGP", RFC 3156, "MIME Security with OpenPGP", RFC 3156,
DOI 10.17487/RFC3156, August 2001, DOI 10.17487/RFC3156, August 2001,
<https://www.rfc-editor.org/rfc/rfc3156>. <https://www.rfc-editor.org/info/rfc3156>.
[RFC3394] Schaad, J. and R. Housley, "Advanced Encryption Standard [RFC3394] Schaad, J. and R. Housley, "Advanced Encryption Standard
(AES) Key Wrap Algorithm", RFC 3394, DOI 10.17487/RFC3394, (AES) Key Wrap Algorithm", RFC 3394, DOI 10.17487/RFC3394,
September 2002, <https://www.rfc-editor.org/rfc/rfc3394>. September 2002, <https://www.rfc-editor.org/info/rfc3394>.
[RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO
10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November
2003, <https://www.rfc-editor.org/rfc/rfc3629>. 2003, <https://www.rfc-editor.org/info/rfc3629>.
[RFC3713] Matsui, M., Nakajima, J., and S. Moriai, "A Description of [RFC3713] Matsui, M., Nakajima, J., and S. Moriai, "A Description of
the Camellia Encryption Algorithm", RFC 3713, the Camellia Encryption Algorithm", RFC 3713,
DOI 10.17487/RFC3713, April 2004, DOI 10.17487/RFC3713, April 2004,
<https://www.rfc-editor.org/rfc/rfc3713>. <https://www.rfc-editor.org/info/rfc3713>.
[RFC4086] Eastlake 3rd, D., Schiller, J., and S. Crocker, [RFC4086] Eastlake 3rd, D., Schiller, J., and S. Crocker,
"Randomness Requirements for Security", BCP 106, RFC 4086, "Randomness Requirements for Security", BCP 106, RFC 4086,
DOI 10.17487/RFC4086, June 2005, DOI 10.17487/RFC4086, June 2005,
<https://www.rfc-editor.org/rfc/rfc4086>. <https://www.rfc-editor.org/info/rfc4086>.
[RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data
Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006,
<https://www.rfc-editor.org/rfc/rfc4648>. <https://www.rfc-editor.org/info/rfc4648>.
[RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322, [RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322,
DOI 10.17487/RFC5322, October 2008, DOI 10.17487/RFC5322, October 2008,
<https://www.rfc-editor.org/rfc/rfc5322>. <https://www.rfc-editor.org/info/rfc5322>.
[RFC6234] Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms [RFC6234] Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms
(SHA and SHA-based HMAC and HKDF)", RFC 6234, (SHA and SHA-based HMAC and HKDF)", RFC 6234,
DOI 10.17487/RFC6234, May 2011, DOI 10.17487/RFC6234, May 2011,
<https://www.rfc-editor.org/rfc/rfc6234>. <https://www.rfc-editor.org/info/rfc6234>.
[RFC7253] Krovetz, T. and P. Rogaway, "The OCB Authenticated- [RFC7253] Krovetz, T. and P. Rogaway, "The OCB Authenticated-
Encryption Algorithm", RFC 7253, DOI 10.17487/RFC7253, May Encryption Algorithm", RFC 7253, DOI 10.17487/RFC7253, May
2014, <https://www.rfc-editor.org/rfc/rfc7253>. 2014, <https://www.rfc-editor.org/info/rfc7253>.
[RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves [RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves
for Security", RFC 7748, DOI 10.17487/RFC7748, January for Security", RFC 7748, DOI 10.17487/RFC7748, January
2016, <https://www.rfc-editor.org/rfc/rfc7748>. 2016, <https://www.rfc-editor.org/info/rfc7748>.
[RFC8017] Moriarty, K., Ed., Kaliski, B., Jonsson, J., and A. Rusch, [RFC8017] Moriarty, K., Ed., Kaliski, B., Jonsson, J., and A. Rusch,
"PKCS #1: RSA Cryptography Specifications Version 2.2", "PKCS #1: RSA Cryptography Specifications Version 2.2",
RFC 8017, DOI 10.17487/RFC8017, November 2016, RFC 8017, DOI 10.17487/RFC8017, November 2016,
<https://www.rfc-editor.org/rfc/rfc8017>. <https://www.rfc-editor.org/info/rfc8017>.
[RFC8018] Moriarty, K., Ed., Kaliski, B., and A. Rusch, "PKCS #5:
Password-Based Cryptography Specification Version 2.1",
RFC 8018, DOI 10.17487/RFC8018, January 2017,
<https://www.rfc-editor.org/info/rfc8018>.
[RFC8032] Josefsson, S. and I. Liusvaara, "Edwards-Curve Digital [RFC8032] Josefsson, S. and I. Liusvaara, "Edwards-Curve Digital
Signature Algorithm (EdDSA)", RFC 8032, Signature Algorithm (EdDSA)", RFC 8032,
DOI 10.17487/RFC8032, January 2017, DOI 10.17487/RFC8032, January 2017,
<https://www.rfc-editor.org/rfc/rfc8032>. <https://www.rfc-editor.org/info/rfc8032>.
[RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for
Writing an IANA Considerations Section in RFCs", BCP 26, Writing an IANA Considerations Section in RFCs", BCP 26,
RFC 8126, DOI 10.17487/RFC8126, June 2017, RFC 8126, DOI 10.17487/RFC8126, June 2017,
<https://www.rfc-editor.org/rfc/rfc8126>. <https://www.rfc-editor.org/info/rfc8126>.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/rfc/rfc8174>. May 2017, <https://www.rfc-editor.org/info/rfc8174>.
[RFC9106] Biryukov, A., Dinu, D., Khovratovich, D., and S. [RFC9106] Biryukov, A., Dinu, D., Khovratovich, D., and S.
Josefsson, "Argon2 Memory-Hard Function for Password Josefsson, "Argon2 Memory-Hard Function for Password
Hashing and Proof-of-Work Applications", RFC 9106, Hashing and Proof-of-Work Applications", RFC 9106,
DOI 10.17487/RFC9106, September 2021, DOI 10.17487/RFC9106, September 2021,
<https://www.rfc-editor.org/rfc/rfc9106>. <https://www.rfc-editor.org/info/rfc9106>.
[RIPEMD-160] [RIPEMD-160]
International Organization for Standardization, Geneva, ISO, "Information technology - Security techniques - Hash-
Switzerland, "Information technology - Security techniques functions - Part 3: Dedicated hash-functions", ISO/
- Hash-functions - Part 3: Dedicated hash-functions,", IEC 10118-3:1998, May 1998.
ISO ISO/IEC 10118-3, 1998.
[SP800-38A] [SP800-38A]
Dworkin, M., "Recommendation for Block Cipher Modes of NIST, "Recommendation for Block Cipher Modes of Operation:
Operation: Methods and Techniques", NIST Special Methods and Techniques", NIST Special Publication 800-38A,
Publication 800-38A, December 2001. DOI 10.6028/NIST.SP.800-38A, December 2001,
<https://nvlpubs.nist.gov/nistpubs/legacy/sp/
nistspecialpublication800-38a.pdf>.
[SP800-38D] [SP800-38D]
Dworkin, M., "Recommendation for Block Cipher Modes of NIST, "Recommendation for Block Cipher Modes of Operation:
Operation: Galois/Counter Mode (GCM) and GMAC", NIST Galois/Counter Mode (GCM) and GMAC", NIST Special
Special Publication 800-38D, November 2007. Publication 800-38D, DOI 10.6028/NIST.SP.800-38D, November
2007, <https://nvlpubs.nist.gov/nistpubs/legacy/sp/
nistspecialpublication800-38d.pdf>.
[SP800-56A] [SP800-56A]
Barker, E., Johnson, D., and M. Smid, "Recommendation for NIST, "Recommendation for Pair-Wise Key Establishment
Pair-Wise Key Establishment Schemes Using Discrete Schemes Using Discrete Logarithm Cryptography", NIST
Logarithm Cryptography", NIST Special Publication 800-56A Special Publication 800-56A Revision 3,
Revision 1, March 2007. DOI 10.6028/NIST.SP.800-56Ar, April 2018,
<https://nvlpubs.nist.gov/nistpubs/SpecialPublications/
nist.sp.800-56Ar3.pdf>.
[SP800-67] NIST, "Recommendation for the Triple Data Encryption [SP800-67] NIST, "Recommendation for the Triple Data Encryption
Algorithm (TDEA) Block Cipher", NIST Special Algorithm (TDEA) Block Cipher", NIST Special
Publication 800-67 Rev. 2, DOI 10.6028/NIST.SP.800-67r2, Publication 800-67 Revision 2,
November 2017, <https://doi.org/10.6028/NIST.SP.800-67r2>. DOI 10.6028/NIST.SP.800-67r2, November 2017,
<https://nvlpubs.nist.gov/nistpubs/SpecialPublications/
NIST.SP.800-67r2.pdf>.
[TWOFISH] Schneier, B., Kelsey, J., Whiting, D., Wagner, D., Hall, [TWOFISH] Schneier, B., Kelsey, J., Whiting, D., Wagner, D., Hall,
C., and N. Ferguson, "The Twofish Encryption Algorithm", C., and N. Ferguson, "Twofish: A 128-Bit Block Cipher",
1999, <https://www.schneier.com/wp- June 1998, <https://www.schneier.com/wp-
content/uploads/2016/02/paper-twofish-paper.pdf>. content/uploads/2016/02/paper-twofish-paper.pdf>.
16.2. Informative References 16.2. Informative References
[BLEICHENBACHER] [BLEICHENBACHER]
Bleichenbacher, D., "Generating ElGamal Signatures Without Bleichenbacher, D., "Generating ElGamal Signatures Without
Knowing the Secret Key", Lecture Notes in Computer Knowing the Secret Key", EUROCRYPT'96: International
Science Volume 1070, pp. 10-18, 1996. Conference on the Theory and Applications of Cryptographic
Techniques Proceedings, Vol. 1070, pp. 10-18, May 1996.
[BLEICHENBACHER-PKCS1] [BLEICHENBACHER-PKCS1]
Bleichenbacher, D., "Chosen Ciphertext Attacks Against Bleichenbacher, D., "Chosen Ciphertext Attacks Against
Protocols Based on the RSA Encryption Standard PKCS \#1", Protocols Based on the RSA Encryption Standard PKCS #1",
1998, <http://archiv.infsec.ethz.ch/education/fs08/secsem/ CRYPTO '98: International Cryptology Conference
Proceedings, Vol. 1462, pp. 1-12, August 1998,
<http://archiv.infsec.ethz.ch/education/fs08/secsem/
Bleichenbacher98.pdf>. Bleichenbacher98.pdf>.
[C99] Standardization, I. O. for., "Programming languages - C: [C99] ISO, "Information technology - Programming languages: C",
C99, correction 3:2007, ISO/IEC 9899:1999/Cor 3:2007", ISO/IEC 9899:2018, June 2018,
November 2007, <https://www.iso.org/standard/50510.html>. <https://www.iso.org/standard/74528.html>.
[CHECKOWAY] [CHECKOWAY]
Checkoway, S., Maskiewicz, J., Garman, C., Fried, J., Checkoway, S., Maskiewicz, J., Garman, C., Fried, J.,
Cohney, S., Green, M., Heninger, N., Weinmann, R., Cohney, S., Green, M., Heninger, N., Weinmann, RP.,
Rescorla, E., and H. Shacham, "A Systematic Analysis of Rescorla, E., and H. Shacham, "A Systematic Analysis of
the Juniper Dual EC Incident", Proceedings of the 2016 ACM the Juniper Dual EC Incident", Proceedings of the 2016 ACM
SIGSAC Conference on Computer and Communications Security, SIGSAC Conference on Computer and Communications Security,
DOI 10.1145/2976749.2978395, October 2016, DOI 10.1145/2976749.2978395, October 2016,
<https://doi.org/10.1145/2976749.2978395>. <https://doi.org/10.1145/2976749.2978395>.
[EFAIL] Poddebniak, D., Dresen, C., Müller, J., Ising, F., [EFAIL] Poddebniak, D., Dresen, C., Müller, J., Ising, F.,
Schinzel, S., Friedberger, S., Somorovsky, J., and J. Schinzel, S., Friedberger, S., Somorovsky, J., and J.
Schwenk, "Efail: Breaking S/MIME and OpenPGP Email Schwenk, "Efail: Breaking S/MIME and OpenPGP Email
Encryption using Exfiltration Channels", Proceedings of Encryption using Exfiltration Channels", Proceedings of
the 27th USENIX Conference on Security Symposium, August the 27th USENIX Security Symposium, August 2018,
2018, Pages 549–566 , 2018,
<https://www.usenix.org/system/files/conference/ <https://www.usenix.org/system/files/conference/
usenixsecurity18/sec18-poddebniak.pdf>. usenixsecurity18/sec18-poddebniak.pdf>.
[Errata-2199] [Errata-2199]
"Errata Report 2199 - S2K hash/cipher octet correction", RFC Errata, Erratum ID 2199, RFC 4880,
RFC 4880, <https://www.rfc-editor.org/errata/eid2199>. <https://www.rfc-editor.org/errata/eid2199>.
[Errata-2200] [Errata-2200]
"Errata Report 2200 - No implicit use of IDEA correction", RFC Errata, Erratum ID 2200, RFC 4880,
RFC 4880, <https://www.rfc-editor.org/errata/eid2200>. <https://www.rfc-editor.org/errata/eid2200>.
[Errata-2206] [Errata-2206]
"Errata Report 2206 - PKESK acronym expansion", RFC 4880, RFC Errata, Erratum ID 2206, RFC 4880,
<https://www.rfc-editor.org/errata/eid2206>. <https://www.rfc-editor.org/errata/eid2206>.
[Errata-2208] [Errata-2208]
"Errata Report 2208 - Signature key owner clarification", RFC Errata, Erratum ID 2208, RFC 4880,
RFC 4880, <https://www.rfc-editor.org/errata/eid2208>. <https://www.rfc-editor.org/errata/eid2208>.
[Errata-2214] [Errata-2214]
"Errata Report 2214 - Signature hashing clarification", RFC Errata, Erratum ID 2214, RFC 4880,
RFC 4880, <https://www.rfc-editor.org/errata/eid2214>. <https://www.rfc-editor.org/errata/eid2214>.
[Errata-2216] [Errata-2216]
"Errata Report 2216 - Self signature applies to user ID RFC Errata, Erratum ID 2216, RFC 4880,
correction", RFC 4880,
<https://www.rfc-editor.org/errata/eid2216>. <https://www.rfc-editor.org/errata/eid2216>.
[Errata-2219] [Errata-2219]
"Errata Report 2219 - Session key encryption storage RFC Errata, Erratum ID 2219, RFC 4880,
clarification", RFC 4880,
<https://www.rfc-editor.org/errata/eid2219>. <https://www.rfc-editor.org/errata/eid2219>.
[Errata-2222] [Errata-2222]
"Errata Report 2222 - Simple hash MUST/MAY clarification", RFC Errata, Erratum ID 2222, RFC 4880,
RFC 4880, <https://www.rfc-editor.org/errata/eid2222>. <https://www.rfc-editor.org/errata/eid2222>.
[Errata-2226] [Errata-2226]
"Errata Report 2226 - Native line endings SHOULD RFC Errata, Erratum ID 2226, RFC 4880,
clarification", RFC 4880,
<https://www.rfc-editor.org/errata/eid2226>. <https://www.rfc-editor.org/errata/eid2226>.
[Errata-2234] [Errata-2234]
"Errata Report 2234 - Radix-64 / base64 clarification", RFC Errata, Erratum ID 2234, RFC 4880,
RFC 4880, <https://www.rfc-editor.org/errata/eid2234>. <https://www.rfc-editor.org/errata/eid2234>.
[Errata-2235] [Errata-2235]
"Errata Report 2235 - ASCII / UTF-8 collation sequence RFC Errata, Erratum ID 2235, RFC 4880,
clarification", RFC 4880,
<https://www.rfc-editor.org/errata/eid2235>. <https://www.rfc-editor.org/errata/eid2235>.
[Errata-2236] [Errata-2236]
"Errata Report 2236 - Packet Composition is a sequence RFC Errata, Erratum ID 2236, RFC 4880,
clarification", RFC 4880,
<https://www.rfc-editor.org/errata/eid2236>. <https://www.rfc-editor.org/errata/eid2236>.
[Errata-2238] [Errata-2238]
"Errata Report 2238 - Subkey packets come after all User RFC Errata, Erratum ID 2238, RFC 4880,
ID packets clarification", RFC 4880,
<https://www.rfc-editor.org/errata/eid2238>. <https://www.rfc-editor.org/errata/eid2238>.
[Errata-2240] [Errata-2240]
"Errata Report 2240 - Subkey removal clarification", RFC Errata, Erratum ID 2240, RFC 4880,
RFC 4880, <https://www.rfc-editor.org/errata/eid2240>. <https://www.rfc-editor.org/errata/eid2240>.
[Errata-2242] [Errata-2242]
"Errata Report 2242 - mL / emLen variable correction", RFC Errata, Erratum ID 2242, RFC 4880,
RFC 4880, <https://www.rfc-editor.org/errata/eid2242>. <https://www.rfc-editor.org/errata/eid2242>.
[Errata-2243] [Errata-2243]
"Errata Report 2243 - CFB mode initialization vector (IV) RFC Errata, Erratum ID 2243, RFC 4880,
clarification", RFC 4880,
<https://www.rfc-editor.org/errata/eid2243>. <https://www.rfc-editor.org/errata/eid2243>.
[Errata-2270] [Errata-2270]
"Errata Report 2270 - SHA-224 octet sequence correction", RFC Errata, Erratum ID 2270, RFC 4880,
RFC 4880, <https://www.rfc-editor.org/errata/eid2270>. <https://www.rfc-editor.org/errata/eid2270>.
[Errata-2271] [Errata-2271]
"Errata Report 2271 - Radix-64 correction", RFC 4880, RFC Errata, Erratum ID 2271, RFC 4880,
<https://www.rfc-editor.org/errata/eid2271>. <https://www.rfc-editor.org/errata/eid2271>.
[Errata-3298] [Errata-3298]
"Errata Report 3298 - Key revocation signatures RFC Errata, Erratum ID 3298, RFC 4880,
correction", RFC 4880,
<https://www.rfc-editor.org/errata/eid3298>. <https://www.rfc-editor.org/errata/eid3298>.
[Errata-5491] [Errata-5491]
"Errata Report 5491 - C code fix for CRC24_POLY define", RFC Errata, Erratum ID 5491, RFC 4880,
RFC 4880, <https://www.rfc-editor.org/errata/eid5491>. <https://www.rfc-editor.org/errata/eid5491>.
[Errata-7545] [Errata-7545]
"Errata Report 7545 - Armor Header colon hex fix", RFC Errata, Erratum ID 7545, RFC 4880,
RFC 4880, <https://www.rfc-editor.org/errata/eid7545>. <https://www.rfc-editor.org/errata/eid7545>.
[Errata-7889]
RFC Errata, Erratum ID 7889, RFC 4880,
<https://www.rfc-editor.org/errata/eid7889>.
[HASTAD] Hastad, J., "Solving Simultaneous Modular Equations of Low [HASTAD] Hastad, J., "Solving Simultaneous Modular Equations of Low
Degree", DOI 10.1137/0217019, 1988, Degree", DOI 10.1137/0217019, April 1988,
<https://doi.org/10.1137/0217019>. <https://doi.org/10.1137/0217019>.
[JKS02] Jallad, K., Katz, J., and B. Schneier, "Implementation of [JKS02] Jallad, K., Katz, J., and B. Schneier, "Implementation of
Chosen-Ciphertext Attacks against PGP and GnuPG", 2002, Chosen-Ciphertext Attacks against PGP and GnuPG",
<http://www.counterpane.com/pgp-attack.html>. DOI 0.1007/3-540-45811-5_7, September 2002,
<https://www.schneier.com/academic/archives/2002/01/
implementation_of_ch.html>.
[KOBLITZ] Koblitz, N., "A course in number theory and cryptography, [KOBLITZ] Koblitz, N., "A course in number theory and cryptography",
Chapter VI. Elliptic Curves", ISBN 0-387-96576-9, 1997. Chaper VI: Elliptic Curves, DOI 10.2307/3618498, 1997,
<https://doi.org/10.2307/3618498>.
[KOPENPGP] Bruseghini, L., Paterson, K. G., and D. Huigens, "Victory [KOPENPGP] Bruseghini, L., Paterson, K. G., and D. Huigens, "Victory
by KO: Attacking OpenPGP Using Key Overwriting", by KO: Attacking OpenPGP Using Key Overwriting",
Proceedings of the 29th ACM Conference on Computer and Proceedings of the ACM SIGSAC Conference on Computer and
Communications Security, November 2022 (to appear) , 2022, Communications Security, pp. 411-423,
<https://www.kopenpgp.com/>. DOI 10.1145/3548606.3559363, November 2022,
<https://dl.acm.org/doi/10.1145/3548606.3559363>.
[KR02] Klíma, V. and T. Rosa, "Attack on Private Signature Keys [KR02] Klíma, V. and T. Rosa, "Attack on Private Signature Keys
of the OpenPGP Format, PGP(TM) Programs and Other of the OpenPGP Format, PGP(TM) Programs and Other
Applications Compatible with OpenPGP", Cryptology ePrint Applications Compatible with OpenPGP", Cryptology ePrint
Archive, Report 2002/076 , 2002, Archive, Paper 2002/076, March 2001,
<https://eprint.iacr.org/2002/076>. <https://eprint.iacr.org/2002/076>.
[MRLG15] Maury, F., Reinhard, J.-R., Levillain, O., and H. Gilbert, [MRLG15] Maury, F., Reinhard, JR., Levillain, O., and H. Gilbert,
"Format Oracles on OpenPGP", CT-RSA 2015 Topics in "Format Oracles on OpenPGP", Topics in Cryptology -- CT-
Cryptology –- CT-RSA 2015 pp 220–236, RSA 2015, Vol. 9048, pp. 220-236,
DOI 10.1007/978-3-319-16715-2_12, 2015, DOI 10.1007/978-3-319-16715-2_12, January 2015,
<https://doi.org/10.1007/978-3-319-16715-2_12>. <https://doi.org/10.1007/978-3-319-16715-2_12>.
[MZ05] Mister, S. and R. Zuccherato, "An Attack on CFB Mode [MZ05] Mister, S. and R. Zuccherato, "An Attack on CFB Mode
Encryption As Used By OpenPGP", IACR ePrint Archive Report Encryption As Used By OpenPGP", Cryptology ePrint Archive,
2005/033, 8 February 2005, Paper 2005/033, February 2005,
<http://eprint.iacr.org/2005/033>. <http://eprint.iacr.org/2005/033>.
[OPENPGPCARD] [OPENPGPCARD]
Pietig, A., "Functional Specification of the OpenPGP Pietig, A., "Functional Specification of the OpenPGP
application on ISO Smart Card Operating Systems (version application on ISO Smart Card Operating Systems", Version
3.4.1)", 2020, <https://gnupg.org/ftp/specs/OpenPGP-smart- 3.4.1, March 2020, <https://gnupg.org/ftp/specs/OpenPGP-
card-application-3.4.1.pdf>. smart-card-application-3.4.1.pdf>.
[PAX] The Open Group, "IEEE Standard for Information [PAX] The Open Group, "The Open Group Base Specifications", 'pax
Technology--Portable Operating System Interface (POSIX(R)) - portable archive interchange', Issue 7, 2018 Edition,
Base Specifications, Issue 7: pax - portable archive IEEE Std 1003.1-2017, 2018,
interchange", IEEE Standard 1003.1-2017,
DOI 10.1109/IEEESTD.2018.8277153, 2018,
<https://pubs.opengroup.org/onlinepubs/9699919799/ <https://pubs.opengroup.org/onlinepubs/9699919799/
utilities/pax.html>. utilities/pax.html>.
[PSSLR17] Poddebniak, D., Somorovsky, J., Schinzel, S., Lochter, M., [PSSLR17] Poddebniak, D., Somorovsky, J., Schinzel, S., Lochter, M.,
and P. Rösler, "Attacking Deterministic Signature Schemes and P. Rösler, "Attacking Deterministic Signature Schemes
using Fault Attacks", October 2017, using Fault Attacks", Cryptology ePrint Archive, Paper
2017/1014, October 2017,
<https://eprint.iacr.org/2017/1014>. <https://eprint.iacr.org/2017/1014>.
[REGEX] Friedl, J., "Mastering Regular Expressions", [REGEX] regex, "Henry Spencer's regular expression libraries",
ISBN 0-596-00289-0, August 2002. <https://garyhouston.github.io/regex/>.
[RFC1991] Atkins, D., Stallings, W., and P. Zimmermann, "PGP Message [RFC1991] Atkins, D., Stallings, W., and P. Zimmermann, "PGP Message
Exchange Formats", RFC 1991, DOI 10.17487/RFC1991, August Exchange Formats", RFC 1991, DOI 10.17487/RFC1991, August
1996, <https://www.rfc-editor.org/rfc/rfc1991>. 1996, <https://www.rfc-editor.org/info/rfc1991>.
[RFC2440] Callas, J., Donnerhacke, L., Finney, H., and R. Thayer, [RFC2440] Callas, J., Donnerhacke, L., Finney, H., and R. Thayer,
"OpenPGP Message Format", RFC 2440, DOI 10.17487/RFC2440, "OpenPGP Message Format", RFC 2440, DOI 10.17487/RFC2440,
November 1998, <https://www.rfc-editor.org/rfc/rfc2440>. November 1998, <https://www.rfc-editor.org/info/rfc2440>.
[RFC2978] Freed, N. and J. Postel, "IANA Charset Registration [RFC2978] Freed, N. and J. Postel, "IANA Charset Registration
Procedures", BCP 19, RFC 2978, DOI 10.17487/RFC2978, Procedures", BCP 19, RFC 2978, DOI 10.17487/RFC2978,
October 2000, <https://www.rfc-editor.org/rfc/rfc2978>. October 2000, <https://www.rfc-editor.org/info/rfc2978>.
[RFC4880] Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R. [RFC4880] Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R.
Thayer, "OpenPGP Message Format", RFC 4880, Thayer, "OpenPGP Message Format", RFC 4880,
DOI 10.17487/RFC4880, November 2007, DOI 10.17487/RFC4880, November 2007,
<https://www.rfc-editor.org/rfc/rfc4880>. <https://www.rfc-editor.org/info/rfc4880>.
[RFC5581] Shaw, D., "The Camellia Cipher in OpenPGP", RFC 5581, [RFC5581] Shaw, D., "The Camellia Cipher in OpenPGP", RFC 5581,
DOI 10.17487/RFC5581, June 2009, DOI 10.17487/RFC5581, June 2009,
<https://www.rfc-editor.org/rfc/rfc5581>. <https://www.rfc-editor.org/info/rfc5581>.
[RFC5639] Lochter, M. and J. Merkle, "Elliptic Curve Cryptography [RFC5639] Lochter, M. and J. Merkle, "Elliptic Curve Cryptography
(ECC) Brainpool Standard Curves and Curve Generation", (ECC) Brainpool Standard Curves and Curve Generation",
RFC 5639, DOI 10.17487/RFC5639, March 2010, RFC 5639, DOI 10.17487/RFC5639, March 2010,
<https://www.rfc-editor.org/rfc/rfc5639>. <https://www.rfc-editor.org/info/rfc5639>.
[RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand [RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand
Key Derivation Function (HKDF)", RFC 5869, Key Derivation Function (HKDF)", RFC 5869,
DOI 10.17487/RFC5869, May 2010, DOI 10.17487/RFC5869, May 2010,
<https://www.rfc-editor.org/rfc/rfc5869>. <https://www.rfc-editor.org/info/rfc5869>.
[RFC6090] McGrew, D., Igoe, K., and M. Salter, "Fundamental Elliptic [RFC6090] McGrew, D., Igoe, K., and M. Salter, "Fundamental Elliptic
Curve Cryptography Algorithms", RFC 6090, Curve Cryptography Algorithms", RFC 6090,
DOI 10.17487/RFC6090, February 2011, DOI 10.17487/RFC6090, February 2011,
<https://www.rfc-editor.org/rfc/rfc6090>. <https://www.rfc-editor.org/info/rfc6090>.
[RFC6637] Jivsov, A., "Elliptic Curve Cryptography (ECC) in [RFC6637] Jivsov, A., "Elliptic Curve Cryptography (ECC) in
OpenPGP", RFC 6637, DOI 10.17487/RFC6637, June 2012, OpenPGP", RFC 6637, DOI 10.17487/RFC6637, June 2012,
<https://www.rfc-editor.org/rfc/rfc6637>. <https://www.rfc-editor.org/info/rfc6637>.
[SEC1] Standards for Efficient Cryptography Group, "Standards for [SEC1] Standards for Efficient Cryptography Group, "SEC 1:
Efficient Cryptography 1 (SEC 1)", May 2009, Elliptic Curve Cryptography", May 2009,
<https://www.secg.org/sec1-v2.pdf>. <https://www.secg.org/sec1-v2.pdf>.
[SHA1CD] Stevens, M. and D. Shumow, "sha1collisiondetection", 2017, [SHA1CD] "sha1collisiondetection", commit b4a7b0b, December 2020,
<https://github.com/cr-marcstevens/ <https://github.com/cr-marcstevens/
sha1collisiondetection>. sha1collisiondetection>.
[SHAMBLES] Leurent, G. and T. Peyrin, "Sha-1 is a shambles: First [SHAMBLES] Leurent, G. and T. Peyrin, "Sha-1 is a shambles: first
chosen-prefix collision on sha-1 and application to the chosen-prefix collision on sha-1 and application to the
PGP web of trust", 2020, <https://sha-mbles.github.io/>. PGP web of trust", August 2020,
<https://dl.acm.org/doi/abs/10.5555/3489212.3489316/>.
[SP800-131A] [SP800-131A]
Barker, E. and A. Roginsky, "Transitioning the Use of NIST, "Transitioning the Use of Cryptographic Algorithms
Cryptographic Algorithms and Key Lengths", NIST Special and Key Lengths", NIST Special Publication 800-131A,
Publication 800-131A Revision 2, March 2019, Revision 2, DOI 10.6028/NIST.SP.800-131Ar2, March 2019,
<https://nvlpubs.nist.gov/nistpubs/SpecialPublications/ <https://nvlpubs.nist.gov/nistpubs/SpecialPublications/
NIST.SP.800-131Ar2.pdf>. NIST.SP.800-131Ar2.pdf>.
[SP800-57] NIST, "Recommendation on Key Management: Part 1 - [SP800-57] NIST, "Recommendation for Key Management: Part 1 -
General", NIST Special Publication 800-57 Part 1 Rev. 5, General", NIST Special Publication 800-57 Part 1, Revision
DOI 10.6028/NIST.SP.800-57pt1r5, May 2020, 5, DOI 10.6028/NIST.SP.800-57pt1r5, May 2020,
<https://nvlpubs.nist.gov/nistpubs/SpecialPublications/ <https://nvlpubs.nist.gov/nistpubs/SpecialPublications/
NIST.SP.800-57pt1r5.pdf>. NIST.SP.800-57pt1r5.pdf>.
[STEVENS2013] [STEVENS2013]
Stevens, M., "Counter-cryptanalysis", June 2013, Stevens, M., "Counter-cryptanalysis", Cryptology ePrint
Archive, Paper 2013/358, June 2013,
<https://eprint.iacr.org/2013/358>. <https://eprint.iacr.org/2013/358>.
[UNIFIED-DIFF] [UNIFIED-DIFF]
Free Software Foundation, "Detailed Description of Unified Free Software Foundation, "Comparing and Merging Files",
Format", 2 January 2021, 'Detailed Description of Unified Format', Section 2.2.2.2,
January 2021,
<https://www.gnu.org/software/diffutils/manual/html_node/ <https://www.gnu.org/software/diffutils/manual/html_node/
Detailed-Unified.html>. Detailed-Unified.html>.
[USENIX-STUDY] [USENIX-STUDY]
Usenix, "An Empirical Study of Textual Key-Fingerprint Dechand, S., Schürmann, D., Busse, K., Acar, Y., Fahl, S.,
Representations", ISBN 978-1-931971-32-4, 10 August 2016, and M. Smith, "An Empirical Study of Textual Key-
Fingerprint Representations", ISBN 978-1-931971-32-4,
August 2016,
<https://www.usenix.org/system/files/conference/ <https://www.usenix.org/system/files/conference/
usenixsecurity16/sec16_paper_dechand.pdf>. usenixsecurity16/sec16_paper_dechand.pdf>.
Appendix A. Test vectors Appendix A. Test Vectors
To help implementing this specification a set of non-normative To help with the implementation of this specification, a set of non-
examples follow here. normative examples follow.
A.1. Sample v4 Ed25519Legacy key A.1. Sample Version 4 Ed25519Legacy Key
The secret key used for this example is: The secret key used for this example is:
D: 1a8b1ff05ded48e18bf50166c664ab023ea70003d78d9e41f5758a91d850f8d2 D: 1a8b1ff05ded48e18bf50166c664ab023ea70003d78d9e41f5758a91d850f8d2
Note that this is the raw secret key used as input to the EdDSA Note that this is the raw secret key used as input to the EdDSA
signing operation. The key was created on 2014-08-19 14:28:27 and signing operation. The key was created on 2014-08-19 14:28:27 and
thus the fingerprint of the OpenPGP key is: thus the fingerprint of the OpenPGP Key is:
C959 BDBA FA32 A2F8 9A15 3B67 8CFD E121 9796 5A9A C959 BDBA FA32 A2F8 9A15 3B67 8CFD E121 9796 5A9A
The algorithm-specific input parameters without the MPI length The algorithm-specific input parameters without the MPI length
headers are: headers are:
oid: 2b06010401da470f01 oid: 2b06010401da470f01
q: 403f098994bdd916ed4053197934e4a87c80733a1280d62f8010992e43ee3b2406 q: 403f098994bdd916ed4053197934e4a87c80733a1280d62f8010992e43ee3b2406
The entire public key packet is thus: The entire Public Key packet is thus:
98 33 04 53 f3 5f 0b 16 09 2b 06 01 04 01 da 47 98 33 04 53 f3 5f 0b 16 09 2b 06 01 04 01 da 47
0f 01 01 07 40 3f 09 89 94 bd d9 16 ed 40 53 19 0f 01 01 07 40 3f 09 89 94 bd d9 16 ed 40 53 19
79 34 e4 a8 7c 80 73 3a 12 80 d6 2f 80 10 99 2e 79 34 e4 a8 7c 80 73 3a 12 80 d6 2f 80 10 99 2e
43 ee 3b 24 06 43 ee 3b 24 06
The same packet, represented in ASCII-armored form is: The same packet represented in ASCII-armored form is:
-----BEGIN PGP PUBLIC KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK-----
xjMEU/NfCxYJKwYBBAHaRw8BAQdAPwmJlL3ZFu1AUxl5NOSofIBzOhKA1i+AEJku xjMEU/NfCxYJKwYBBAHaRw8BAQdAPwmJlL3ZFu1AUxl5NOSofIBzOhKA1i+AEJku
Q+47JAY= Q+47JAY=
-----END PGP PUBLIC KEY BLOCK----- -----END PGP PUBLIC KEY BLOCK-----
A.2. Sample v4 Ed25519Legacy signature A.2. Sample Version 4 Ed25519Legacy Signature
The signature is created using the sample key over the input data The signature is created using the sample key over the input data
"OpenPGP" on 2015-09-16 12:24:53 UTC and thus the input to the hash "OpenPGP" on 2015-09-16 12:24:53 UTC and thus the input to the hash
function is: function is:
m: 4f70656e504750040016080006050255f95f9504ff0000000c m: 4f70656e504750040016080006050255f95f9504ff0000000c
Using the SHA2-256 hash algorithm yields the digest: Using the SHA2-256 hash algorithm yields the digest:
d: f6220a3f757814f4c2176ffbb68b00249cd4ccdc059c4b34ad871f30b1740280 d: f6220a3f757814f4c2176ffbb68b00249cd4ccdc059c4b34ad871f30b1740280
Which is fed into the EdDSA signature function and yields this which is fed into the EdDSA signature function and yields the
signature: following signature:
r: 56f90cca98e2102637bd983fdb16c131dfd27ed82bf4dde5606e0d756aed3366 r: 56f90cca98e2102637bd983fdb16c131dfd27ed82bf4dde5606e0d756aed3366
s: d09c4fa11527f038e0f57f2201d82f2ea2c9033265fa6ceb489e854bae61b404 s: d09c4fa11527f038e0f57f2201d82f2ea2c9033265fa6ceb489e854bae61b404
The entire signature packet is thus: The entire Signature packet is thus:
88 5e 04 00 16 08 00 06 05 02 55 f9 5f 95 00 0a 88 5e 04 00 16 08 00 06 05 02 55 f9 5f 95 00 0a
09 10 8c fd e1 21 97 96 5a 9a f6 22 00 ff 56 f9 09 10 8c fd e1 21 97 96 5a 9a f6 22 00 ff 56 f9
0c ca 98 e2 10 26 37 bd 98 3f db 16 c1 31 df d2 0c ca 98 e2 10 26 37 bd 98 3f db 16 c1 31 df d2
7e d8 2b f4 dd e5 60 6e 0d 75 6a ed 33 66 01 00 7e d8 2b f4 dd e5 60 6e 0d 75 6a ed 33 66 01 00
d0 9c 4f a1 15 27 f0 38 e0 f5 7f 22 01 d8 2f 2e d0 9c 4f a1 15 27 f0 38 e0 f5 7f 22 01 d8 2f 2e
a2 c9 03 32 65 fa 6c eb 48 9e 85 4b ae 61 b4 04 a2 c9 03 32 65 fa 6c eb 48 9e 85 4b ae 61 b4 04
The same packet represented in ASCII-armored form is: The same packet represented in ASCII-armored form is:
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
iF4EABYIAAYFAlX5X5UACgkQjP3hIZeWWpr2IgD/VvkMypjiECY3vZg/2xbBMd/S iF4EABYIAAYFAlX5X5UACgkQjP3hIZeWWpr2IgD/VvkMypjiECY3vZg/2xbBMd/S
ftgr9N3lYG4NdWrtM2YBANCcT6EVJ/A44PV/IgHYLy6iyQMyZfps60iehUuuYbQE ftgr9N3lYG4NdWrtM2YBANCcT6EVJ/A44PV/IgHYLy6iyQMyZfps60iehUuuYbQE
-----END PGP SIGNATURE----- -----END PGP SIGNATURE-----
A.3. Sample v6 Certificate (Transferable Public Key) A.3. Sample Version 6 Certificate (Transferable Public Key)
Here is a Transferable Public Key consisting of: Here is a Transferable Public Key consisting of:
* A v6 Ed25519 Public-Key packet * A version 6 Ed25519 Public Key packet
* A v6 direct key self-signature * A version 6 Direct Key self-signature
* A v6 X25519 Public-Subkey packet * A version 6 X25519 Public Subkey packet
* A v6 subkey binding signature * A version 6 Subkey Binding signature
The primary key has the fingerprint The primary key has the following fingerprint:
CB186C4F0609A697E4D52DFA6C722B0C1F1E27C18A56708F6525EC27BAD9ACC9.
The subkey has the fingerprint CB186C4F0609A697E4D52DFA6C722B0C1F1E27C18A56708F6525EC27BAD9ACC9
12C83F1E706F6308FE151A417743A1F033790E93E9978488D1DB378DA9930885.
The subkey has the following fingerprint:
12C83F1E706F6308FE151A417743A1F033790E93E9978488D1DB378DA9930885
-----BEGIN PGP PUBLIC KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK-----
xioGY4d/4xsAAAAg+U2nu0jWCmHlZ3BqZYfQMxmZu52JGggkLq2EVD34laPCsQYf xioGY4d/4xsAAAAg+U2nu0jWCmHlZ3BqZYfQMxmZu52JGggkLq2EVD34laPCsQYf
GwoAAABCBYJjh3/jAwsJBwUVCg4IDAIWAAKbAwIeCSIhBssYbE8GCaaX5NUt+mxy GwoAAABCBYJjh3/jAwsJBwUVCg4IDAIWAAKbAwIeCSIhBssYbE8GCaaX5NUt+mxy
KwwfHifBilZwj2Ul7Ce62azJBScJAgcCAAAAAK0oIBA+LX0ifsDm185Ecds2v8lw KwwfHifBilZwj2Ul7Ce62azJBScJAgcCAAAAAK0oIBA+LX0ifsDm185Ecds2v8lw
gyU2kCcUmKfvBXbAf6rhRYWzuQOwEn7E/aLwIwRaLsdry0+VcallHhSu4RN6HWaE gyU2kCcUmKfvBXbAf6rhRYWzuQOwEn7E/aLwIwRaLsdry0+VcallHhSu4RN6HWaE
QsiPlR4zxP/TP7mhfVEe7XWPxtnMUMtf15OyA51YBM4qBmOHf+MZAAAAIIaTJINn QsiPlR4zxP/TP7mhfVEe7XWPxtnMUMtf15OyA51YBM4qBmOHf+MZAAAAIIaTJINn
+eUBXbki+PSAld2nhJh/LVmFsS+60WyvXkQ1wpsGGBsKAAAALAWCY4d/4wKbDCIh +eUBXbki+PSAld2nhJh/LVmFsS+60WyvXkQ1wpsGGBsKAAAALAWCY4d/4wKbDCIh
BssYbE8GCaaX5NUt+mxyKwwfHifBilZwj2Ul7Ce62azJAAAAAAQBIKbpGG2dWTX8 BssYbE8GCaaX5NUt+mxyKwwfHifBilZwj2Ul7Ce62azJAAAAAAQBIKbpGG2dWTX8
j+VjFM21J0hqWlEg+bdiojWnKfA5AQpWUWtnNwDEM0g12vYxoWM8Y81W+bHBw805 j+VjFM21J0hqWlEg+bdiojWnKfA5AQpWUWtnNwDEM0g12vYxoWM8Y81W+bHBw805
I8kWVkXU6vFOi+HWvv/ira7ofJu16NnoUkhclkUrk0mXubZvyl4GBg== I8kWVkXU6vFOi+HWvv/ira7ofJu16NnoUkhclkUrk0mXubZvyl4GBg==
-----END PGP PUBLIC KEY BLOCK----- -----END PGP PUBLIC KEY BLOCK-----
The corresponding Transferable Secret Key can be found in The corresponding Transferable Secret Key can be found in
Appendix A.4. Appendix A.4.
A.3.1. Hashed Data Stream for Signature Verification A.3.1. Hashed Data Stream for Signature Verification
The direct key self-signature in the certificate in Appendix A.3 is The Direct Key self-signature in the certificate in Appendix A.3 is
made over the following sequence of data: made over the following sequence of data:
0x0000 10 3e 2d 7d 22 7e c0 e6 0x0000 10 3e 2d 7d 22 7e c0 e6
0x0008 d7 ce 44 71 db 36 bf c9 0x0008 d7 ce 44 71 db 36 bf c9
0x0010 70 83 25 36 90 27 14 98 0x0010 70 83 25 36 90 27 14 98
0x0018 a7 ef 05 76 c0 7f aa e1 0x0018 a7 ef 05 76 c0 7f aa e1
0x0020 9b 00 00 00 2a 06 63 87 0x0020 9b 00 00 00 2a 06 63 87
0x0028 7f e3 1b 00 00 00 20 f9 0x0028 7f e3 1b 00 00 00 20 f9
0x0030 4d a7 bb 48 d6 0a 61 e5 0x0030 4d a7 bb 48 d6 0a 61 e5
0x0038 67 70 6a 65 87 d0 33 19 0x0038 67 70 6a 65 87 d0 33 19
skipping to change at page 167, line 10 skipping to change at line 7715
0x0090 d9 ac c9 05 27 09 02 07 0x0090 d9 ac c9 05 27 09 02 07
0x0098 02 06 ff 00 00 00 4a 0x0098 02 06 ff 00 00 00 4a
The same data, broken out by octet and semantics, is: The same data, broken out by octet and semantics, is:
0x0000 10 3e 2d 7d 22 7e c0 e6 salt 0x0000 10 3e 2d 7d 22 7e c0 e6 salt
0x0008 d7 ce 44 71 db 36 bf c9 0x0008 d7 ce 44 71 db 36 bf c9
0x0010 70 83 25 36 90 27 14 98 0x0010 70 83 25 36 90 27 14 98
0x0018 a7 ef 05 76 c0 7f aa e1 0x0018 a7 ef 05 76 c0 7f aa e1
[ pubkey begins ] [ pubkey begins ]
0x0020 9b v6 pubkey 0x0020 9b key packet
0x0021 00 00 00 2a pubkey length 0x0021 00 00 00 2a pubkey length
0x0025 06 pubkey version 0x0025 06 pubkey version
0x0026 63 87 creation time 0x0026 63 87 creation time
0x0028 7f e3 (2022-11-30T16:08:03Z) 0x0028 7f e3 (2022-11-30T16:08:03Z)
0x002a 1b key algo: Ed25519 0x002a 1b key algo: Ed25519
0x002b 00 00 00 20 key length 0x002b 00 00 00 20 key length
0x002f f9 Ed25519 public key 0x002f f9 Ed25519 public key
0x0030 4d a7 bb 48 d6 0a 61 e5 0x0030 4d a7 bb 48 d6 0a 61 e5
0x0038 67 70 6a 65 87 d0 33 19 0x0038 67 70 6a 65 87 d0 33 19
0x0040 99 bb 9d 89 1a 08 24 2e 0x0040 99 bb 9d 89 1a 08 24 2e
0x0048 ad 84 54 3d f8 95 a3 0x0048 ad 84 54 3d f8 95 a3
[ trailer begins ] [ trailer begins ]
0x004f 06 sig version 0x004f 06 sig version 6
0x0050 1f sig type: direct key signature 0x0050 1f sig type: Direct Key signature
0x0051 1b sig algo: Ed25519 0x0051 1b sig algo: Ed25519
0x0052 0a hash ago: SHA2-512 0x0052 0a hash ago: SHA2-512
0x0053 00 00 00 42 hashed subpackets length 0x0053 00 00 00 42 hashed subpackets length
0x0057 05 subpkt length 0x0057 05 subpkt length
0x0058 82 critical subpkt: Sig Creation Time 0x0058 82 critical subpkt: Sig Creation Time
0x0059 63 87 7f e3 Signature Creation Time 0x0059 63 87 7f e3 Signature Creation Time
0x005d 03 subpkt length 0x005d 03 subpkt length
0x005e 0b subpkt type: Pref. v1 SEIPD Ciphers 0x005e 0b subpkt type: Pref. v1 SEIPD Ciphers
0x005f 09 Ciphers: [AES256 AES128] 0x005f 09 Ciphers: [AES256 AES128]
0x0060 07 0x0060 07
skipping to change at page 167, line 47 skipping to change at line 7752
0x0063 0a 0e Hashes: [SHA2-512 SHA3-512 0x0063 0a 0e Hashes: [SHA2-512 SHA3-512
0x0065 08 0c SHA2-256 SHA3-256] 0x0065 08 0c SHA2-256 SHA3-256]
0x0067 02 subpkt length 0x0067 02 subpkt length
0x0068 16 subpkt type: Pref. Compression 0x0068 16 subpkt type: Pref. Compression
0x0069 00 Compression: [none] 0x0069 00 Compression: [none]
0x006a 02 subpkt length 0x006a 02 subpkt length
0x006b 9b critical subpkt: Key Flags 0x006b 9b critical subpkt: Key Flags
0x006c 03 Key Flags: {certify, sign} 0x006c 03 Key Flags: {certify, sign}
0x006d 02 subpkt length 0x006d 02 subpkt length
0x006e 1e subpkt type: Features 0x006e 1e subpkt type: Features
0x006f 09 Features: {SEIPDv1, SEIPDv2} 0x006f 09 Features: {v1SEIPD, v2SEIPD}
0x0070 22 subpkt length 0x0070 22 subpkt length
0x0071 21 subpkt type: Issuer Fingerprint 0x0071 21 subpkt type: Issuer Fingerprint
0x0072 06 Fingerprint version 6 0x0072 06 Fingerprint version 6
0x0073 cb 18 6c 4f 06 Issuer Fingerprint 0x0073 cb 18 6c 4f 06 Fingerprint
0x0078 09 a6 97 e4 d5 2d fa 6c 0x0078 09 a6 97 e4 d5 2d fa 6c
0x0080 72 2b 0c 1f 1e 27 c1 8a 0x0080 72 2b 0c 1f 1e 27 c1 8a
0x0088 56 70 8f 65 25 ec 27 ba 0x0088 56 70 8f 65 25 ec 27 ba
0x0090 d9 ac c9 0x0090 d9 ac c9
0x0093 05 subpkt length 0x0093 05 subpkt length
0x0094 27 subpkt type: Pref. AEAD Ciphersuites 0x0094 27 subpkt type: Pref. AEAD Ciphersuites
0x0095 09 02 07 Ciphersuites: 0x0095 09 02 07 Ciphersuites:
0x0098 02 [ AES256-OCB, AES128-OCB ] 0x0098 02 [ AES256-OCB, AES128-OCB ]
0x0099 06 sig version 0x0099 06 sig version 6
0x009a ff sentinel octet 0x009a ff sentinel octet
0x009b 00 00 00 4a trailer length 0x009b 00 00 00 4a trailer length
The subkey binding signature in Appendix A.3 is made over the The Subkey Binding signature in Appendix A.3 is made over the
following sequence of data: following sequence of data:
0x0000 a6 e9 18 6d 9d 59 35 fc 0x0000 a6 e9 18 6d 9d 59 35 fc
0x0008 8f e5 63 14 cd b5 27 48 0x0008 8f e5 63 14 cd b5 27 48
0x0010 6a 5a 51 20 f9 b7 62 a2 0x0010 6a 5a 51 20 f9 b7 62 a2
0x0018 35 a7 29 f0 39 01 0a 56 0x0018 35 a7 29 f0 39 01 0a 56
0x0020 9b 00 00 00 2a 06 63 87 0x0020 9b 00 00 00 2a 06 63 87
0x0028 7f e3 1b 00 00 00 20 f9 0x0028 7f e3 1b 00 00 00 20 f9
0x0030 4d a7 bb 48 d6 0a 61 e5 0x0030 4d a7 bb 48 d6 0a 61 e5
0x0038 67 70 6a 65 87 d0 33 19 0x0038 67 70 6a 65 87 d0 33 19
skipping to change at page 168, line 49 skipping to change at line 7803
0x00a8 70 8f 65 25 ec 27 ba d9 0x00a8 70 8f 65 25 ec 27 ba d9
0x00b0 ac c9 06 ff 00 00 00 34 0x00b0 ac c9 06 ff 00 00 00 34
The same data, broken out by octet and semantics, is: The same data, broken out by octet and semantics, is:
0x0000 a6 e9 18 6d 9d 59 35 fc salt 0x0000 a6 e9 18 6d 9d 59 35 fc salt
0x0008 8f e5 63 14 cd b5 27 48 0x0008 8f e5 63 14 cd b5 27 48
0x0010 6a 5a 51 20 f9 b7 62 a2 0x0010 6a 5a 51 20 f9 b7 62 a2
0x0018 35 a7 29 f0 39 01 0a 56 0x0018 35 a7 29 f0 39 01 0a 56
[ primary pubkey begins ] [ primary pubkey begins ]
0x0020 9b v6 pubkey 0x0020 9b key packet
0x0021 00 00 00 2a pubkey length 0x0021 00 00 00 2a pubkey length
0x0025 06 pubkey version 0x0025 06 pubkey version
0x0026 63 87 creation time 0x0026 63 87 creation time
0x0028 7f e3 (2022-11-30T16:08:03Z) 0x0028 7f e3 (2022-11-30T16:08:03Z)
0x002a 1b key algo: Ed25519 0x002a 1b key algo: Ed25519
0x002b 00 00 00 20 key length 0x002b 00 00 00 20 key length
0x002f f9 Ed25519 public key 0x002f f9 Ed25519 public key
0x0030 4d a7 bb 48 d6 0a 61 e5 0x0030 4d a7 bb 48 d6 0a 61 e5
0x0038 67 70 6a 65 87 d0 33 19 0x0038 67 70 6a 65 87 d0 33 19
0x0040 99 bb 9d 89 1a 08 24 2e 0x0040 99 bb 9d 89 1a 08 24 2e
0x0048 ad 84 54 3d f8 95 a3 0x0048 ad 84 54 3d f8 95 a3
[ subkey pubkey begins ] [ subkey pubkey begins ]
0x004f 9b v6 key 0x004f 9b key packet
0x0050 00 00 00 2a pubkey length 0x0050 00 00 00 2a pubkey length
0x0054 06 pubkey version 0x0054 06 pubkey version
0x0055 63 87 7f creation time (2022-11-30T16:08:03Z) 0x0055 63 87 7f creation time (2022-11-30T16:08:03Z)
0x0058 e3 0x0058 e3
0x0059 19 key algo: X25519 0x0059 19 key algo: X25519
0x005a 00 00 00 20 key length 0x005a 00 00 00 20 key length
0x005e 86 93 X25519 public key 0x005e 86 93 X25519 public key
0x0060 24 83 67 f9 e5 01 5d b9 0x0060 24 83 67 f9 e5 01 5d b9
0x0068 22 f8 f4 80 95 dd a7 84 0x0068 22 f8 f4 80 95 dd a7 84
0x0070 98 7f 2d 59 85 b1 2f ba 0x0070 98 7f 2d 59 85 b1 2f ba
0x0078 d1 6c af 5e 44 35 0x0078 d1 6c af 5e 44 35
[ trailer begins ] [ trailer begins ]
0x007e 06 sig version 0x007e 06 sig version 6
0x007f 18 sig type: Subkey Binding sig 0x007f 18 sig type: Subkey Binding sig
0x0080 1b sig algo Ed25519 0x0080 1b sig algo Ed25519
0x0081 0a hash algo: SHA2-512 0x0081 0a hash algo: SHA2-512
0x0082 00 00 00 2c hashed subpackets length 0x0082 00 00 00 2c hashed subpackets length
0x0086 05 subpkt length 0x0086 05 subpkt length
0x0087 82 critical subpkt: Sig Creation Time 0x0087 82 critical subpkt: Sig Creation Time
0x0088 63 87 7f e3 Signature Creation Time 0x0088 63 87 7f e3 Signature Creation Time
0x008c 02 subpkt length 0x008c 02 subpkt length
0x008d 9b critical subpkt: Key Flags 0x008d 9b critical subpkt: Key Flags
0x008e 0c Key Flags: {EncComms, EncStorage} 0x008e 0c Key Flags: {EncComms, EncStorage}
0x008f 22 subpkt length 0x008f 22 subpkt length
0x0090 21 subpkt type: Issuer Fingerprint 0x0090 21 subpkt type: Issuer Fingerprint
0x0091 06 Fingerprint version 6 0x0091 06 Fingerprint version 6
0x0092 cb 18 6c 4f 06 09 Fingerprint 0x0092 cb 18 6c 4f 06 09 Fingerprint
0x0098 a6 97 e4 d5 2d fa 6c 72 0x0098 a6 97 e4 d5 2d fa 6c 72
0x00a0 2b 0c 1f 1e 27 c1 8a 56 0x00a0 2b 0c 1f 1e 27 c1 8a 56
0x00a8 70 8f 65 25 ec 27 ba d9 0x00a8 70 8f 65 25 ec 27 ba d9
0x00b0 ac c9 0x00b0 ac c9
0x00b2 06 sig version 0x00b2 06 sig version 6
0x00b3 ff sentinel octet 0x00b3 ff sentinel octet
0x00b4 00 00 00 34 trailer length 0x00b4 00 00 00 34 trailer length
A.4. Sample v6 Secret Key (Transferable Secret Key) A.4. Sample Version 6 Secret Key (Transferable Secret Key)
Here is a Transferable Secret Key consisting of: Here is a Transferable Secret Key consisting of:
* A v6 Ed25519 Secret-Key packet * A version 6 Ed25519 Secret Key packet
* A v6 direct key self-signature * A version 6 Direct Key self-signature
* A v6 X25519 Secret-Subkey packet * A version 6 X25519 Secret Subkey packet
* A v6 subkey binding signature * A version 6 Subkey Binding signature
-----BEGIN PGP PRIVATE KEY BLOCK----- -----BEGIN PGP PRIVATE KEY BLOCK-----
xUsGY4d/4xsAAAAg+U2nu0jWCmHlZ3BqZYfQMxmZu52JGggkLq2EVD34laMAGXKB xUsGY4d/4xsAAAAg+U2nu0jWCmHlZ3BqZYfQMxmZu52JGggkLq2EVD34laMAGXKB
exK+cH6NX1hs5hNhIB00TrJmosgv3mg1ditlsLfCsQYfGwoAAABCBYJjh3/jAwsJ exK+cH6NX1hs5hNhIB00TrJmosgv3mg1ditlsLfCsQYfGwoAAABCBYJjh3/jAwsJ
BwUVCg4IDAIWAAKbAwIeCSIhBssYbE8GCaaX5NUt+mxyKwwfHifBilZwj2Ul7Ce6 BwUVCg4IDAIWAAKbAwIeCSIhBssYbE8GCaaX5NUt+mxyKwwfHifBilZwj2Ul7Ce6
2azJBScJAgcCAAAAAK0oIBA+LX0ifsDm185Ecds2v8lwgyU2kCcUmKfvBXbAf6rh 2azJBScJAgcCAAAAAK0oIBA+LX0ifsDm185Ecds2v8lwgyU2kCcUmKfvBXbAf6rh
RYWzuQOwEn7E/aLwIwRaLsdry0+VcallHhSu4RN6HWaEQsiPlR4zxP/TP7mhfVEe RYWzuQOwEn7E/aLwIwRaLsdry0+VcallHhSu4RN6HWaEQsiPlR4zxP/TP7mhfVEe
7XWPxtnMUMtf15OyA51YBMdLBmOHf+MZAAAAIIaTJINn+eUBXbki+PSAld2nhJh/ 7XWPxtnMUMtf15OyA51YBMdLBmOHf+MZAAAAIIaTJINn+eUBXbki+PSAld2nhJh/
LVmFsS+60WyvXkQ1AE1gCk95TUR3XFeibg/u/tVY6a//1q0NWC1X+yui3O24wpsG LVmFsS+60WyvXkQ1AE1gCk95TUR3XFeibg/u/tVY6a//1q0NWC1X+yui3O24wpsG
GBsKAAAALAWCY4d/4wKbDCIhBssYbE8GCaaX5NUt+mxyKwwfHifBilZwj2Ul7Ce6 GBsKAAAALAWCY4d/4wKbDCIhBssYbE8GCaaX5NUt+mxyKwwfHifBilZwj2Ul7Ce6
2azJAAAAAAQBIKbpGG2dWTX8j+VjFM21J0hqWlEg+bdiojWnKfA5AQpWUWtnNwDE 2azJAAAAAAQBIKbpGG2dWTX8j+VjFM21J0hqWlEg+bdiojWnKfA5AQpWUWtnNwDE
M0g12vYxoWM8Y81W+bHBw805I8kWVkXU6vFOi+HWvv/ira7ofJu16NnoUkhclkUr M0g12vYxoWM8Y81W+bHBw805I8kWVkXU6vFOi+HWvv/ira7ofJu16NnoUkhclkUr
k0mXubZvyl4GBg== k0mXubZvyl4GBg==
-----END PGP PRIVATE KEY BLOCK----- -----END PGP PRIVATE KEY BLOCK-----
The corresponding Transferable Public Key can be found in The corresponding Transferable Public Key can be found in
Appendix A.3. Appendix A.3.
A.5. Sample locked v6 Secret Key (Transferable Secret Key) A.5. Sample Locked Version 6 Secret Key (Transferable Secret Key)
Here is the same secret key as in Appendix A.4, but the secret key Here is the same secret key as in Appendix A.4, but the secret key
material is locked with a passphrase using AEAD and Argon2. material is locked with a passphrase using AEAD and Argon2.
The passphrase is the ASCII string: The passphrase is the ASCII string:
correct horse battery staple correct horse battery staple
-----BEGIN PGP PRIVATE KEY BLOCK----- -----BEGIN PGP PRIVATE KEY BLOCK-----
xYIGY4d/4xsAAAAg+U2nu0jWCmHlZ3BqZYfQMxmZu52JGggkLq2EVD34laP9JgkC xYIGY4d/4xsAAAAg+U2nu0jWCmHlZ3BqZYfQMxmZu52JGggkLq2EVD34laP9JgkC
FARdb9ccngltHraRe25uHuyuAQQVtKipJ0+r5jL4dacGWSAheCWPpITYiyfyIOPS FARdb9ccngltHraRe25uHuyuAQQVtKipJ0+r5jL4dacGWSAheCWPpITYiyfyIOPS
3gIDyg8f7strd1OB4+LZsUhcIjOMpVHgmiY/IutJkulneoBYwrEGHxsKAAAAQgWC 3gIDyg8f7strd1OB4+LZsUhcIjOMpVHgmiY/IutJkulneoBYwrEGHxsKAAAAQgWC
Y4d/4wMLCQcFFQoOCAwCFgACmwMCHgkiIQbLGGxPBgmml+TVLfpscisMHx4nwYpW Y4d/4wMLCQcFFQoOCAwCFgACmwMCHgkiIQbLGGxPBgmml+TVLfpscisMHx4nwYpW
cI9lJewnutmsyQUnCQIHAgAAAACtKCAQPi19In7A5tfORHHbNr/JcIMlNpAnFJin cI9lJewnutmsyQUnCQIHAgAAAACtKCAQPi19In7A5tfORHHbNr/JcIMlNpAnFJin
7wV2wH+q4UWFs7kDsBJ+xP2i8CMEWi7Ha8tPlXGpZR4UruETeh1mhELIj5UeM8T/ 7wV2wH+q4UWFs7kDsBJ+xP2i8CMEWi7Ha8tPlXGpZR4UruETeh1mhELIj5UeM8T/
0z+5oX1RHu11j8bZzFDLX9eTsgOdWATHggZjh3/jGQAAACCGkySDZ/nlAV25Ivj0 0z+5oX1RHu11j8bZzFDLX9eTsgOdWATHggZjh3/jGQAAACCGkySDZ/nlAV25Ivj0
gJXdp4SYfy1ZhbEvutFsr15ENf0mCQIUBA5hhGgp2oaavg6mFUXcFMwBBBUuE8qf gJXdp4SYfy1ZhbEvutFsr15ENf0mCQIUBA5hhGgp2oaavg6mFUXcFMwBBBUuE8qf
skipping to change at page 172, line 7 skipping to change at line 7942
3c60cb63285f62f4c3de49835786f011cf6f4c069f61232cd7013ff5fd31e603 3c60cb63285f62f4c3de49835786f011cf6f4c069f61232cd7013ff5fd31e603
The additional data for AEAD for the subkey is: The additional data for AEAD for the subkey is:
c70663877fe319000000208693248367f9e5015db922f8f48095dda784987f2d c70663877fe319000000208693248367f9e5015db922f8f48095dda784987f2d
5985b12fbad16caf5e4435 5985b12fbad16caf5e4435
A.6. Sample Cleartext Signed Message A.6. Sample Cleartext Signed Message
Here is a signed message that uses the cleartext signature framework Here is a signed message that uses the Cleartext Signature Framework
(Section 7). It can be verified with the certificate from (Section 7). It can be verified with the certificate from
(Appendix A.3). Appendix A.3.
Note that this message makes use of dash-escaping (Section 7.2) due Note that this message makes use of dash-escaping (Section 7.2) due
to its contents. to its contents.
-----BEGIN PGP SIGNED MESSAGE----- -----BEGIN PGP SIGNED MESSAGE-----
What we need from the grocery store: What we need from the grocery store:
- - tofu - - tofu
- - vegetables - - vegetables
- - noodles - - noodles
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
wpgGARsKAAAAKQWCY5ijYyIhBssYbE8GCaaX5NUt+mxyKwwfHifBilZwj2Ul7Ce6 wpgGARsKAAAAKQWCY5ijYyIhBssYbE8GCaaX5NUt+mxyKwwfHifBilZwj2Ul7Ce6
2azJAAAAAGk2IHZJX1AhiJD39eLuPBgiUU9wUA9VHYblySHkBONKU/usJ9BvuAqo 2azJAAAAAGk2IHZJX1AhiJD39eLuPBgiUU9wUA9VHYblySHkBONKU/usJ9BvuAqo
/FvLFuGWMbKAdA+epq7V4HOtAPlBWmU8QOd6aud+aSunHQaaEJ+iTFjP2OMW0KBr /FvLFuGWMbKAdA+epq7V4HOtAPlBWmU8QOd6aud+aSunHQaaEJ+iTFjP2OMW0KBr
NK2ay45cX1IVAQ== NK2ay45cX1IVAQ==
-----END PGP SIGNATURE----- -----END PGP SIGNATURE-----
The signature packet here is: The Signature packet here is:
0x0000 c2 packet type: Signature 0x0000 c2 packet type: Signature
0x0001 98 packet length 0x0001 98 packet length
0x0002 06 signature version 6 0x0002 06 sig version 6
0x0003 01 signature type: canonical text 0x0003 01 sig type: Canonical Text
0x0004 1b pubkey algorithm: Ed25519 0x0004 1b pubkey algorithm: Ed25519
0x0005 0a hash algorithm used: SHA2-512 0x0005 0a hash algorithm used: SHA2-512
0x0006 00 00 hashed subpackets length: 41 0x0006 00 00 hashed subpackets length: 41
0x0008 00 29 0x0008 00 29
0x000a 05 subpkt length 0x000a 05 subpkt length
0x000b 82 critical subpkt: Sig Creation Time 0x000b 82 critical subpkt: Sig Creation Time
0x000c 63 98 a3 63 (2022-12-13T16:08:03Z) 0x000c 63 98 a3 63 (2022-12-13T16:08:03Z)
0x0010 22 subpkt length 0x0010 22 subpkt length
0x0011 21 subpkt type: issuer fingerprint 0x0011 21 subpkt type: Issuer Fingerprint
0x0012 06 key version 0x0012 06 Fingerprint version 6
0x0013 cb 18 6c 4f 06 v6 fingerprint 0x0013 cb 18 6c 4f 06 Fingerprint
0x001a 09 a6 97 e4 d5 2d fa 6c 0x001a 09 a6 97 e4 d5 2d fa 6c
0x0020 72 2b 0c 1f 1e 27 c1 8a 0x0020 72 2b 0c 1f 1e 27 c1 8a
0x0028 56 70 8f 65 25 ec 27 ba 0x0028 56 70 8f 65 25 ec 27 ba
0x0030 d9 ac c9 0x0030 d9 ac c9
0x0033 00 00 00 00 unhashed subpackets length: 0 0x0033 00 00 00 00 unhashed subpackets length: 0
0x0037 69 left 16 bits of signed hash 0x0037 69 left 16 bits of signed hash
0x0038 36 0x0038 36
0x0039 20 salt length 0x0039 20 salt length
0x003a 76 49 5f 50 21 88 salt 0x003a 76 49 5f 50 21 88 salt
0x0040 90 f7 f5 e2 ee 3c 18 22 0x0040 90 f7 f5 e2 ee 3c 18 22
skipping to change at page 175, line 21 skipping to change at line 8046
0x0028 6e 65 65 64 20 66 72 6f 0x0028 6e 65 65 64 20 66 72 6f
0x0030 6d 20 74 68 65 20 67 72 0x0030 6d 20 74 68 65 20 67 72
0x0038 6f 63 65 72 79 20 73 74 0x0038 6f 63 65 72 79 20 73 74
0x0040 6f 72 65 3a 0d 0a 0d 0a 0x0040 6f 72 65 3a 0d 0a 0d 0a
0x0048 2d 20 74 6f 66 75 0d 0a 0x0048 2d 20 74 6f 66 75 0d 0a
0x0050 2d 20 76 65 67 65 74 61 0x0050 2d 20 76 65 67 65 74 61
0x0058 62 6c 65 73 0d 0a 2d 20 0x0058 62 6c 65 73 0d 0a 2d 20
0x0060 6e 6f 6f 64 6c 65 73 0d 0x0060 6e 6f 6f 64 6c 65 73 0d
0x0068 0a 0x0068 0a
[ trailer begins ] [ trailer begins ]
0x0069 06 sig version 0x0069 06 sig version 6
0x006a 01 sigtype: canonical text 0x006a 01 sig type: Canonical Text
0x006b 1b pubkey algorithm: Ed25519 0x006b 1b pubkey algorithm: Ed25519
0x006c 0a hash algorithm: SHA2-512 0x006c 0a hash algorithm: SHA2-512
0x006d 00 00 00 hashed subpackets length 0x006d 00 00 00 hashed subpackets length
0x0070 29 0x0070 29
0x0071 05 subpacket length 0x0071 05 subpacket length
0x0072 82 critical subpkt: Sig Creation Time 0x0072 82 critical subpkt: Sig Creation Time
0x0073 63 98 a3 63 (2022-12-13T16:08:03Z) 0x0073 63 98 a3 63 (2022-12-13T16:08:03Z)
0x0077 22 subpkt length 0x0077 22 subpkt length
0x0078 21 subpkt type: issuer fingerprint 0x0078 21 subpkt type: Issuer Fingerprint
0x0079 06 key version 0x0079 06 Fingerprint version 6
0x007a cb 18 6c 4f 06 09 v6 fingerprint 0x007a cb 18 6c 4f 06 09 Fingerprint
0x0080 a6 97 e4 d5 2d fa 6c 72 0x0080 a6 97 e4 d5 2d fa 6c 72
0x0088 2b 0c 1f 1e 27 c1 8a 56 0x0088 2b 0c 1f 1e 27 c1 8a 56
0x0090 70 8f 65 25 ec 27 ba d9 0x0090 70 8f 65 25 ec 27 ba d9
0x0098 ac c9 0x0098 ac c9
0x009a 06 sig version 0x009a 06 sig version 6
0x009b ff sentinel octet 0x009b ff sentinel octet
0x009c 00 00 00 31 trailer length 0x009c 00 00 00 31 trailer length
The calculated SHA2-512 hash digest over this data is: The calculated SHA2-512 hash digest over this data is:
69365bf44a97af1f0844f1f6ab83fdf6b36f26692efaa621a8aac91c4e29ea07 69365bf44a97af1f0844f1f6ab83fdf6b36f26692efaa621a8aac91c4e29ea07
e894cabc6e2f20eedfce6c03b89141a2cc7cbe245e6e7a5654addbec5000b89b e894cabc6e2f20eedfce6c03b89141a2cc7cbe245e6e7a5654addbec5000b89b
A.7. Sample inline-signed message A.7. Sample Inline-Signed Message
This is the same message and signature as in Appendix A.6, but as This is the same message and signature as in Appendix A.6 but as an
inline-signed message. The hashed data is exactly the same, and all inline-signed message. The hashed data is exactly the same, and all
intermediate values and annotated hex dumps are also applicable. intermediate values and annotated hex dumps are also applicable.
-----BEGIN PGP MESSAGE----- -----BEGIN PGP MESSAGE-----
xEYGAQobIHZJX1AhiJD39eLuPBgiUU9wUA9VHYblySHkBONKU/usyxhsTwYJppfk xEYGAQobIHZJX1AhiJD39eLuPBgiUU9wUA9VHYblySHkBONKU/usyxhsTwYJppfk
1S36bHIrDB8eJ8GKVnCPZSXsJ7rZrMkBy0p1AAAAAABXaGF0IHdlIG5lZWQgZnJv 1S36bHIrDB8eJ8GKVnCPZSXsJ7rZrMkBy0p1AAAAAABXaGF0IHdlIG5lZWQgZnJv
bSB0aGUgZ3JvY2VyeSBzdG9yZToKCi0gdG9mdQotIHZlZ2V0YWJsZXMKLSBub29k bSB0aGUgZ3JvY2VyeSBzdG9yZToKCi0gdG9mdQotIHZlZ2V0YWJsZXMKLSBub29k
bGVzCsKYBgEbCgAAACkFgmOYo2MiIQbLGGxPBgmml+TVLfpscisMHx4nwYpWcI9l bGVzCsKYBgEbCgAAACkFgmOYo2MiIQbLGGxPBgmml+TVLfpscisMHx4nwYpWcI9l
JewnutmsyQAAAABpNiB2SV9QIYiQ9/Xi7jwYIlFPcFAPVR2G5ckh5ATjSlP7rCfQ JewnutmsyQAAAABpNiB2SV9QIYiQ9/Xi7jwYIlFPcFAPVR2G5ckh5ATjSlP7rCfQ
b7gKqPxbyxbhljGygHQPnqau1eBzrQD5QVplPEDnemrnfmkrpx0GmhCfokxYz9jj b7gKqPxbyxbhljGygHQPnqau1eBzrQD5QVplPEDnemrnfmkrpx0GmhCfokxYz9jj
FtCgazStmsuOXF9SFQE= FtCgazStmsuOXF9SFQE=
-----END PGP MESSAGE----- -----END PGP MESSAGE-----
A.8. Sample X25519-AEAD-OCB encryption and decryption A.8. Sample X25519-AEAD-OCB Encryption and Decryption
This example encrypts the cleartext string Hello, world! for the This example encrypts the cleartext string Hello, world! for the
sample cert (see Appendix A.3), using AES-128 with AEAD-OCB sample cert (see Appendix A.3), using AES-128 with AEAD-OCB
encryption. encryption.
A.8.1. Sample public-key encrypted session key packet (v6) A.8.1. Sample Version 6 Public Key Encrypted Session Key Packet
This packet contains the following series of octets: This packet contains the following series of octets:
0x0000 c1 5d 06 21 06 12 c8 3f 0x0000 c1 5d 06 21 06 12 c8 3f
0x0008 1e 70 6f 63 08 fe 15 1a 0x0008 1e 70 6f 63 08 fe 15 1a
0x0010 41 77 43 a1 f0 33 79 0e 0x0010 41 77 43 a1 f0 33 79 0e
0x0018 93 e9 97 84 88 d1 db 37 0x0018 93 e9 97 84 88 d1 db 37
0x0020 8d a9 93 08 85 19 87 cf 0x0020 8d a9 93 08 85 19 87 cf
0x0028 18 d5 f1 b5 3f 81 7c ce 0x0028 18 d5 f1 b5 3f 81 7c ce
0x0030 5a 00 4c f3 93 cc 89 58 0x0030 5a 00 4c f3 93 cc 89 58
0x0038 bd dc 06 5f 25 f8 4a f5 0x0038 bd dc 06 5f 25 f8 4a f5
0x0040 09 b1 7d d3 67 64 18 de 0x0040 09 b1 7d d3 67 64 18 de
0x0048 a3 55 43 79 56 61 79 01 0x0048 a3 55 43 79 56 61 79 01
0x0050 e0 69 57 fb ca 8a 6a 47 0x0050 e0 69 57 fb ca 8a 6a 47
0x0058 a5 b5 15 3e 8d 3a b7 0x0058 a5 b5 15 3e 8d 3a b7
The same data, broken out by octet and semantics: The same data, broken out by octet and semantics, is:
0x0000 c1 packet type: PKESK 0x0000 c1 packet type: PKESK
0x0001 5d packet length 0x0001 5d packet length
0x0002 06 PKESK version 6 0x0002 06 v6 PKESK
0x0003 21 length of fingerprint 0x0003 21 length of fingerprint
0x0004 06 Key version 6 0x0004 06 Key version 6
0x0005 12 c8 3f Key fingerprint 0x0005 12 c8 3f Key fingerprint
0x0008 1e 70 6f 63 08 fe 15 1a 0x0008 1e 70 6f 63 08 fe 15 1a
0x0010 41 77 43 a1 f0 33 79 0e 0x0010 41 77 43 a1 f0 33 79 0e
0x0018 93 e9 97 84 88 d1 db 37 0x0018 93 e9 97 84 88 d1 db 37
0x0020 8d a9 93 08 85 0x0020 8d a9 93 08 85
0x0025 19 algorithm: X25519 0x0025 19 algorithm: X25519
0x0026 87 cf Ephemeral key 0x0026 87 cf Ephemeral key
0x0028 18 d5 f1 b5 3f 81 7c ce 0x0028 18 d5 f1 b5 3f 81 7c ce
0x0030 5a 00 4c f3 93 cc 89 58 0x0030 5a 00 4c f3 93 cc 89 58
0x0038 bd dc 06 5f 25 f8 4a f5 0x0038 bd dc 06 5f 25 f8 4a f5
0x0040 09 b1 7d d3 67 64 0x0040 09 b1 7d d3 67 64
0x0046 18 ESK length 0x0046 18 ESK length
0x0047 de ESK 0x0047 de ESK
0x0048 a3 55 43 79 56 61 79 01 0x0048 a3 55 43 79 56 61 79 01
0x0050 e0 69 57 fb ca 8a 6a 47 0x0050 e0 69 57 fb ca 8a 6a 47
0x0058 a5 b5 15 3e 8d 3a b7 0x0058 a5 b5 15 3e 8d 3a b7
A.8.2. X25519 encryption/decryption of the session key A.8.2. X25519 Encryption/Decryption of the Session Key
Ephemeral key: Ephemeral key:
87 cf 18 d5 f1 b5 3f 81 7c ce 5a 00 4c f3 93 cc 87 cf 18 d5 f1 b5 3f 81 7c ce 5a 00 4c f3 93 cc
89 58 bd dc 06 5f 25 f8 4a f5 09 b1 7d d3 67 64 89 58 bd dc 06 5f 25 f8 4a f5 09 b1 7d d3 67 64
This ephemeral key is derived from the following ephemeral secret key This ephemeral key is derived from the following ephemeral secret key
material, which is never placed on the wire: material, which is never placed on the wire:
af 1e 43 c0 d1 23 ef e8 93 a7 d4 d3 90 f3 a7 61 af 1e 43 c0 d1 23 ef e8 93 a7 d4 d3 90 f3 a7 61
e3 fa c3 3d fc 7f 3e da a8 30 c9 01 13 52 c7 79 e3 fa c3 3d fc 7f 3e da a8 30 c9 01 13 52 c7 79
Public key from target certificate (see Appendix A.3): Public key from the target certificate (see Appendix A.3):
86 93 24 83 67 f9 e5 01 5d b9 22 f8 f4 80 95 dd 86 93 24 83 67 f9 e5 01 5d b9 22 f8 f4 80 95 dd
a7 84 98 7f 2d 59 85 b1 2f ba d1 6c af 5e 44 35 a7 84 98 7f 2d 59 85 b1 2f ba d1 6c af 5e 44 35
The corresponding long-lived X25519 private key material (see The corresponding long-lived X25519 private key material (see
Appendix A.4): Appendix A.4):
4d 60 0a 4f 79 4d 44 77 5c 57 a2 6e 0f ee fe d5 4d 60 0a 4f 79 4d 44 77 5c 57 a2 6e 0f ee fe d5
58 e9 af ff d6 ad 0d 58 2d 57 fb 2b a2 dc ed b8 58 e9 af ff d6 ad 0d 58 2d 57 fb 2b a2 dc ed b8
skipping to change at page 178, line 16 skipping to change at line 8173
8b 6e 2a e4 4d 39 8b dc 6f 92 c5 ad 4a 49 25 14 8b 6e 2a e4 4d 39 8b dc 6f 92 c5 ad 4a 49 25 14
HKDF output: HKDF output:
f6 6d ad cf f6 45 92 23 9b 25 45 39 b6 4f f6 07 f6 6d ad cf f6 45 92 23 9b 25 45 39 b6 4f f6 07
Decrypted session key: Decrypted session key:
dd 70 8f 6f a1 ed 65 11 4d 68 d2 34 3e 7c 2f 1d dd 70 8f 6f a1 ed 65 11 4d 68 d2 34 3e 7c 2f 1d
A.8.3. Sample v2 SEIPD packet A.8.3. Sample v2 SEIPD Packet
This packet contains the following series of octets: This packet contains the following series of octets:
0x0000 d2 69 02 07 02 06 61 64 0x0000 d2 69 02 07 02 06 61 64
0x0008 16 53 5b e0 b0 71 6d 60 0x0008 16 53 5b e0 b0 71 6d 60
0x0010 e0 52 a5 6c 4c 40 7f 9e 0x0010 e0 52 a5 6c 4c 40 7f 9e
0x0018 b3 6b 0e fa fe 9a d0 a0 0x0018 b3 6b 0e fa fe 9a d0 a0
0x0020 df 9b 03 3c 69 a2 1b a9 0x0020 df 9b 03 3c 69 a2 1b a9
0x0028 eb d2 c0 ec 95 bf 56 9d 0x0028 eb d2 c0 ec 95 bf 56 9d
0x0030 25 c9 99 ee 4a 3d e1 70 0x0030 25 c9 99 ee 4a 3d e1 70
0x0038 58 f4 0d fa 8b 4c 68 2b 0x0038 58 f4 0d fa 8b 4c 68 2b
0x0040 e3 fb bb d7 b2 7e b0 f5 0x0040 e3 fb bb d7 b2 7e b0 f5
0x0048 9b b5 00 5f 80 c7 c6 f4 0x0048 9b b5 00 5f 80 c7 c6 f4
0x0050 03 88 c3 0a d4 06 ab 05 0x0050 03 88 c3 0a d4 06 ab 05
0x0058 13 dc d6 f9 fd 73 76 56 0x0058 13 dc d6 f9 fd 73 76 56
0x0060 28 6e 11 77 d0 0f 88 8a 0x0060 28 6e 11 77 d0 0f 88 8a
0x0068 db 31 c4 0x0068 db 31 c4
The same data, broken out by octet and semantics: The same data, broken out by octet and semantics, is:
0x0000 d2 packet type: SEIPD 0x0000 d2 packet type: SEIPD
0x0001 69 packet length 0x0001 69 packet length
0x0002 02 SEIPD version 2 0x0002 02 v2 SEIPD
0x0003 07 cipher: AES128 0x0003 07 cipher: AES128
0x0004 02 AEAD mode: OCB 0x0004 02 AEAD mode: OCB
0x0005 06 chunk size (2**12 octets) 0x0005 06 chunk size (2^12 octets)
0x0006 61 64 salt 0x0006 61 64 salt
0x0008 16 53 5b e0 b0 71 6d 60 0x0008 16 53 5b e0 b0 71 6d 60
0x0010 e0 52 a5 6c 4c 40 7f 9e 0x0010 e0 52 a5 6c 4c 40 7f 9e
0x0018 b3 6b 0e fa fe 9a d0 a0 0x0018 b3 6b 0e fa fe 9a d0 a0
0x0020 df 9b 03 3c 69 a2 0x0020 df 9b 03 3c 69 a2
0x0026 1b a9 chunk #0 encrypted data 0x0026 1b a9 chunk #0 encrypted data
0x0028 eb d2 c0 ec 95 bf 56 9d 0x0028 eb d2 c0 ec 95 bf 56 9d
0x0030 25 c9 99 ee 4a 3d e1 70 0x0030 25 c9 99 ee 4a 3d e1 70
0x0038 58 f4 0d fa 8b 4c 68 2b 0x0038 58 f4 0d fa 8b 4c 68 2b
0x0040 e3 fb bb d7 b2 7e b0 f5 0x0040 e3 fb bb d7 b2 7e b0 f5
0x0048 9b b5 00 0x0048 9b b5 00
0x004b 5f 80 c7 c6 f4 chunk #0 AEAD tag 0x004b 5f 80 c7 c6 f4 chunk #0 AEAD tag
0x0050 03 88 c3 0a d4 06 ab 05 0x0050 03 88 c3 0a d4 06 ab 05
0x0058 13 dc d6 0x0058 13 dc d6
0x005b f9 fd 73 76 56 final AEAD tag (#1) 0x005b f9 fd 73 76 56 final AEAD tag (#1)
0x0060 28 6e 11 77 d0 0f 88 8a S0x0060 28 6e 11 77 d0 0f 88 8a
0x0068 db 31 c4 0x0068 db 31 c4
A.8.4. Decryption of data A.8.4. Decryption of Data
Starting AEAD-OCB decryption of data, using the session key. Starting AEAD-OCB decryption of data, using the session key.
HKDF info: HKDF info:
d2 02 07 02 06 d2 02 07 02 06
HKDF output: HKDF output:
45 12 f7 14 9d 86 33 41 52 7c 65 67 d5 bf fc 42 45 12 f7 14 9d 86 33 41 52 7c 65 67 d5 bf fc 42
skipping to change at page 180, line 20 skipping to change at line 8258
Encrypted data chunk: Encrypted data chunk:
1b a9 eb d2 c0 ec 95 bf 56 9d 25 c9 99 ee 4a 3d 1b a9 eb d2 c0 ec 95 bf 56 9d 25 c9 99 ee 4a 3d
e1 70 58 f4 0d fa 8b 4c 68 2b e3 fb bb d7 b2 7e e1 70 58 f4 0d fa 8b 4c 68 2b e3 fb bb d7 b2 7e
b0 f5 9b b5 00 5f 80 c7 c6 f4 03 88 c3 0a d4 06 b0 f5 9b b5 00 5f 80 c7 c6 f4 03 88 c3 0a d4 06
ab 05 13 dc d6 ab 05 13 dc d6
Decrypted chunk #0. Decrypted chunk #0.
Literal data packet with the string contents Hello, world!: Literal Data packet with the string contents Hello, world!:
cb 13 62 00 00 00 00 00 48 65 6c 6c 6f 2c 20 77 cb 13 62 00 00 00 00 00 48 65 6c 6c 6f 2c 20 77
6f 72 6c 64 21 6f 72 6c 64 21
Padding packet: Padding packet:
d5 0e c5 a2 93 07 29 91 62 81 47 d7 2c 8f 86 b7 d5 0e c5 a2 93 07 29 91 62 81 47 d7 2c 8f 86 b7
Authenticating final tag: Authenticating final tag:
Final nonce: Final nonce:
5f af 32 50 21 2f f9 00 00 00 00 00 00 00 01 5f af 32 50 21 2f f9 00 00 00 00 00 00 00 01
Final additional authenticated data: Final additional authenticated data:
d2 02 07 02 06 00 00 00 00 00 00 00 25 d2 02 07 02 06 00 00 00 00 00 00 00 25
A.8.5. Complete X25519-AEAD-OCB encrypted packet sequence A.8.5. Complete X25519-AEAD-OCB Encrypted Packet Sequence
-----BEGIN PGP MESSAGE----- -----BEGIN PGP MESSAGE-----
wV0GIQYSyD8ecG9jCP4VGkF3Q6HwM3kOk+mXhIjR2zeNqZMIhRmHzxjV8bU/gXzO wV0GIQYSyD8ecG9jCP4VGkF3Q6HwM3kOk+mXhIjR2zeNqZMIhRmHzxjV8bU/gXzO
WgBM85PMiVi93AZfJfhK9QmxfdNnZBjeo1VDeVZheQHgaVf7yopqR6W1FT6NOrfS WgBM85PMiVi93AZfJfhK9QmxfdNnZBjeo1VDeVZheQHgaVf7yopqR6W1FT6NOrfS
aQIHAgZhZBZTW+CwcW1g4FKlbExAf56zaw76/prQoN+bAzxpohup69LA7JW/Vp0l aQIHAgZhZBZTW+CwcW1g4FKlbExAf56zaw76/prQoN+bAzxpohup69LA7JW/Vp0l
yZnuSj3hcFj0DfqLTGgr4/u717J+sPWbtQBfgMfG9AOIwwrUBqsFE9zW+f1zdlYo yZnuSj3hcFj0DfqLTGgr4/u717J+sPWbtQBfgMfG9AOIwwrUBqsFE9zW+f1zdlYo
bhF30A+IitsxxA== bhF30A+IitsxxA==
-----END PGP MESSAGE----- -----END PGP MESSAGE-----
A.9. Sample AEAD-EAX encryption and decryption A.9. Sample AEAD-EAX Encryption and Decryption
This example encrypts the cleartext string Hello, world! with the This example encrypts the cleartext string Hello, world! with the
passphrase password, using AES-128 with AEAD-EAX encryption. passphrase password, using AES-128 with AEAD-EAX encryption.
A.9.1. Sample symmetric-key encrypted session key packet (v6) A.9.1. Sample Version 6 Symmetric Key Encrypted Session Key Packet
This packet contains the following series of octets: This packet contains the following series of octets:
0x0000 c3 40 06 1e 07 01 0b 03 0x0000 c3 40 06 1e 07 01 0b 03
0x0008 08 a5 ae 57 9d 1f c5 d8 0x0008 08 a5 ae 57 9d 1f c5 d8
0x0010 2b ff 69 22 4f 91 99 93 0x0010 2b ff 69 22 4f 91 99 93
0x0018 b3 50 6f a3 b5 9a 6a 73 0x0018 b3 50 6f a3 b5 9a 6a 73
0x0020 cf f8 c5 ef c5 f4 1c 57 0x0020 cf f8 c5 ef c5 f4 1c 57
0x0028 fb 54 e1 c2 26 81 5d 78 0x0028 fb 54 e1 c2 26 81 5d 78
0x0030 28 f5 f9 2c 45 4e b6 5e 0x0030 28 f5 f9 2c 45 4e b6 5e
0x0038 be 00 ab 59 86 c6 8e 6e 0x0038 be 00 ab 59 86 c6 8e 6e
0x0040 7c 55 0x0040 7c 55
The same data, broken out by octet and semantics: The same data, broken out by octet and semantics, is:
0x0000 c3 packet type: SKESK 0x0000 c3 packet type: SKESK
0x0001 40 packet length 0x0001 40 packet length
0x0002 06 SKESK version 6 0x0002 06 v6 SKESK
0x0003 1e length through end of AEAD nonce 0x0003 1e length through end of AEAD nonce
0x0004 07 cipher: AES128 0x0004 07 cipher: AES128
0x0005 01 AEAD mode: EAX 0x0005 01 AEAD mode: EAX
0x0006 0b length of S2K 0x0006 0b length of S2K
0x0007 03 S2K type: iterated+salted 0x0007 03 S2K type: iterated+salted
0x0008 08 S2K hash: SHA2-256 0x0008 08 S2K hash: SHA2-256
0x0009 a5 ae 57 9d 1f c5 d8 S2K salt 0x0009 a5 ae 57 9d 1f c5 d8 S2K salt
0x0010 2b 0x0010 2b
0x0011 ff S2K iterations (65011712 octets) 0x0011 ff S2K iterations (65011712 octets)
0x0012 69 22 4f 91 99 93 AEAD nonce 0x0012 69 22 4f 91 99 93 AEAD nonce
0x0018 b3 50 6f a3 b5 9a 6a 73 0x0018 b3 50 6f a3 b5 9a 6a 73
0x0020 cf f8 0x0020 cf f8
0x0022 c5 ef c5 f4 1c 57 encrypted session key 0x0022 c5 ef c5 f4 1c 57 encrypted session key
0x0028 fb 54 e1 c2 26 81 5d 78 0x0028 fb 54 e1 c2 26 81 5d 78
0x0030 28 f5 0x0030 28 f5
0x0032 f9 2c 45 4e b6 5e AEAD tag 0x0032 f9 2c 45 4e b6 5e AEAD tag
0x0038 be 00 ab 59 86 c6 8e 6e 0x0038 be 00 ab 59 86 c6 8e 6e
0x0040 7c 55 0x0040 7c 55
A.9.2. Starting AEAD-EAX decryption of the session key A.9.2. Starting AEAD-EAX Decryption of the Session Key
The derived key is: The derived key is:
15 49 67 e5 90 aa 1f 92 3e 1c 0a c6 4c 88 f2 3d 15 49 67 e5 90 aa 1f 92 3e 1c 0a c6 4c 88 f2 3d
HKDF info: HKDF info:
c3 06 07 01 c3 06 07 01
HKDF output: HKDF output:
skipping to change at page 182, line 25 skipping to change at line 8357
c3 06 07 01 c3 06 07 01
Nonce: Nonce:
69 22 4f 91 99 93 b3 50 6f a3 b5 9a 6a 73 cf f8 69 22 4f 91 99 93 b3 50 6f a3 b5 9a 6a 73 cf f8
Decrypted session key: Decrypted session key:
38 81 ba fe 98 54 12 45 9b 86 c3 6f 98 cb 9a 5e 38 81 ba fe 98 54 12 45 9b 86 c3 6f 98 cb 9a 5e
A.9.3. Sample v2 SEIPD packet A.9.3. Sample v2 SEIPD Packet
This packet contains the following series of octets: This packet contains the following series of octets:
0x0000 d2 69 02 07 01 06 9f f9 0x0000 d2 69 02 07 01 06 9f f9
0x0008 0e 3b 32 19 64 f3 a4 29 0x0008 0e 3b 32 19 64 f3 a4 29
0x0010 13 c8 dc c6 61 93 25 01 0x0010 13 c8 dc c6 61 93 25 01
0x0018 52 27 ef b7 ea ea a4 9f 0x0018 52 27 ef b7 ea ea a4 9f
0x0020 04 c2 e6 74 17 5d 4a 3d 0x0020 04 c2 e6 74 17 5d 4a 3d
0x0028 22 6e d6 af cb 9c a9 ac 0x0028 22 6e d6 af cb 9c a9 ac
0x0030 12 2c 14 70 e1 1c 63 d4 0x0030 12 2c 14 70 e1 1c 63 d4
0x0038 c0 ab 24 1c 6a 93 8a d4 0x0038 c0 ab 24 1c 6a 93 8a d4
0x0040 8b f9 9a 5a 99 b9 0b ba 0x0040 8b f9 9a 5a 99 b9 0b ba
0x0048 83 25 de 61 04 75 40 25 0x0048 83 25 de 61 04 75 40 25
0x0050 8a b7 95 9a 95 ad 05 1d 0x0050 8a b7 95 9a 95 ad 05 1d
0x0058 da 96 eb 15 43 1d fe f5 0x0058 da 96 eb 15 43 1d fe f5
0x0060 f5 e2 25 5c a7 82 61 54 0x0060 f5 e2 25 5c a7 82 61 54
0x0068 6e 33 9a 0x0068 6e 33 9a
The same data, broken out by octet and semantics: The same data, broken out by octet and semantics, is:
0x0000 d2 packet type: SEIPD 0x0000 d2 packet type: SEIPD
0x0001 69 packet length 0x0001 69 packet length
0x0002 02 SEIPD version 2 0x0002 02 v2 SEIPD
0x0003 07 cipher: AES128 0x0003 07 cipher: AES128
0x0004 01 AEAD mode: EAX 0x0004 01 AEAD mode: EAX
0x0005 06 chunk size (2**12 octets) 0x0005 06 chunk size (2^12 octets)
0x0005 9f f9 salt 0x0005 9f f9 salt
0x0008 0e 3b 32 19 64 f3 a4 29 0x0008 0e 3b 32 19 64 f3 a4 29
0x0010 13 c8 dc c6 61 93 25 01 0x0010 13 c8 dc c6 61 93 25 01
0x0018 52 27 ef b7 ea ea a4 9f 0x0018 52 27 ef b7 ea ea a4 9f
0x0020 04 c2 e6 74 17 5d 0x0020 04 c2 e6 74 17 5d
0x0026 4a 3d chunk #0 encrypted data 0x0026 4a 3d chunk #0 encrypted data
0x0028 22 6e d6 af cb 9c a9 ac 0x0028 22 6e d6 af cb 9c a9 ac
0x0030 12 2c 14 70 e1 1c 63 d4 0x0030 12 2c 14 70 e1 1c 63 d4
0x0038 c0 ab 24 1c 6a 93 8a d4 0x0038 c0 ab 24 1c 6a 93 8a d4
0x0040 8b f9 9a 5a 99 b9 0b ba 0x0040 8b f9 9a 5a 99 b9 0b ba
0x0048 83 25 de 0x0048 83 25 de
0x004b 61 04 75 40 25 chunk #0 AEAD tag 0x004b 61 04 75 40 25 chunk #0 AEAD tag
0x0050 8a b7 95 9a 95 ad 05 1d 0x0050 8a b7 95 9a 95 ad 05 1d
0x0058 da 96 eb 0x0058 da 96 eb
0x005b 15 43 1d fe f5 final AEAD tag (#1) 0x005b 15 43 1d fe f5 final AEAD tag (#1)
0x0060 f5 e2 25 5c a7 82 61 54 0x0060 f5 e2 25 5c a7 82 61 54
0x0068 6e 33 9a 0x0068 6e 33 9a
A.9.4. Decryption of data A.9.4. Decryption of Data
Starting AEAD-EAX decryption of data, using the session key. Starting AEAD-EAX decryption of data, using the session key.
HKDF info: HKDF info:
d2 02 07 01 06 d2 02 07 01 06
HKDF output: HKDF output:
b5 04 22 ac 1c 26 be 9d dd 83 1d 5b bb 36 b6 4f b5 04 22 ac 1c 26 be 9d dd 83 1d 5b bb 36 b6 4f
skipping to change at page 184, line 13 skipping to change at line 8435
Nonce: Nonce:
78 b8 33 f2 e9 4a 60 c0 00 00 00 00 00 00 00 00 78 b8 33 f2 e9 4a 60 c0 00 00 00 00 00 00 00 00
Additional authenticated data: Additional authenticated data:
d2 02 07 01 06 d2 02 07 01 06
Decrypted chunk #0. Decrypted chunk #0.
Literal data packet with the string contents Hello, world!: Literal Data packet with the string contents Hello, world!:
cb 13 62 00 00 00 00 00 48 65 6c 6c 6f 2c 20 77 cb 13 62 00 00 00 00 00 48 65 6c 6c 6f 2c 20 77
6f 72 6c 64 21 6f 72 6c 64 21
Padding packet: Padding packet:
d5 0e ae 5b f0 cd 67 05 50 03 55 81 6c b0 c8 ff d5 0e ae 5b f0 cd 67 05 50 03 55 81 6c b0 c8 ff
Authenticating final tag: Authenticating final tag:
Final nonce: Final nonce:
78 b8 33 f2 e9 4a 60 c0 00 00 00 00 00 00 00 01 78 b8 33 f2 e9 4a 60 c0 00 00 00 00 00 00 00 01
Final additional authenticated data: Final additional authenticated data:
d2 02 07 01 06 00 00 00 00 00 00 00 25 d2 02 07 01 06 00 00 00 00 00 00 00 25
A.9.5. Complete AEAD-EAX encrypted packet sequence A.9.5. Complete AEAD-EAX Encrypted Packet Sequence
-----BEGIN PGP MESSAGE----- -----BEGIN PGP MESSAGE-----
w0AGHgcBCwMIpa5XnR/F2Cv/aSJPkZmTs1Bvo7WaanPP+MXvxfQcV/tU4cImgV14 w0AGHgcBCwMIpa5XnR/F2Cv/aSJPkZmTs1Bvo7WaanPP+MXvxfQcV/tU4cImgV14
KPX5LEVOtl6+AKtZhsaObnxV0mkCBwEGn/kOOzIZZPOkKRPI3MZhkyUBUifvt+rq KPX5LEVOtl6+AKtZhsaObnxV0mkCBwEGn/kOOzIZZPOkKRPI3MZhkyUBUifvt+rq
pJ8EwuZ0F11KPSJu1q/LnKmsEiwUcOEcY9TAqyQcapOK1Iv5mlqZuQu6gyXeYQR1 pJ8EwuZ0F11KPSJu1q/LnKmsEiwUcOEcY9TAqyQcapOK1Iv5mlqZuQu6gyXeYQR1
QCWKt5Wala0FHdqW6xVDHf719eIlXKeCYVRuM5o= QCWKt5Wala0FHdqW6xVDHf719eIlXKeCYVRuM5o=
-----END PGP MESSAGE----- -----END PGP MESSAGE-----
A.10. Sample AEAD-OCB encryption and decryption A.10. Sample AEAD-OCB Encryption and Decryption
This example encrypts the cleartext string Hello, world! with the This example encrypts the cleartext string Hello, world! with the
passphrase password, using AES-128 with AEAD-OCB encryption. passphrase password, using AES-128 with AEAD-OCB encryption.
A.10.1. Sample symmetric-key encrypted session key packet (v6) A.10.1. Sample Version 6 Symmetric Key Encrypted Session Key Packet
This packet contains the following series of octets: This packet contains the following series of octets:
0x0000 c3 3f 06 1d 07 02 0b 03 0x0000 c3 3f 06 1d 07 02 0b 03
0x0008 08 56 a2 98 d2 f5 e3 64 0x0008 08 56 a2 98 d2 f5 e3 64
0x0010 53 ff cf cc 5c 11 66 4e 0x0010 53 ff cf cc 5c 11 66 4e
0x0018 db 9d b4 25 90 d7 dc 46 0x0018 db 9d b4 25 90 d7 dc 46
0x0020 b0 72 41 b6 12 c3 81 2c 0x0020 b0 72 41 b6 12 c3 81 2c
0x0028 ff fb ea 00 f2 34 7b 25 0x0028 ff fb ea 00 f2 34 7b 25
0x0030 64 11 23 f8 87 ae 60 d4 0x0030 64 11 23 f8 87 ae 60 d4
0x0038 fd 61 4e 08 37 d8 19 d3 0x0038 fd 61 4e 08 37 d8 19 d3
0x0040 6c 0x0040 6c
The same data, broken out by octet and semantics: The same data, broken out by octet and semantics, is:
0x0000 c3 packet type: SKESK 0x0000 c3 packet type: SKESK
0x0001 3f packet length 0x0001 3f packet length
0x0002 06 SKESK version 6 0x0002 06 v6 SKESK
0x0003 1d length through end of AEAD nonce 0x0003 1d length through end of AEAD nonce
0x0004 07 cipher: AES128 0x0004 07 cipher: AES128
0x0005 02 AEAD mode: OCB 0x0005 02 AEAD mode: OCB
0x0006 0b length of S2K 0x0006 0b length of S2K
0x0007 03 S2K type: iterated+salted 0x0007 03 S2K type: iterated+salted
0x0008 08 S2K hash: SHA2-256 0x0008 08 S2K hash: SHA2-256
0x0009 56 a2 98 d2 f5 e3 64 S2K salt 0x0009 56 a2 98 d2 f5 e3 64 S2K salt
0x0010 53 0x0010 53
0x0011 ff S2K iterations (65011712 octets) 0x0011 ff S2K iterations (65011712 octets)
0x0012 cf cc 5c 11 66 4e AEAD nonce 0x0012 cf cc 5c 11 66 4e AEAD nonce
0x0018 db 9d b4 25 90 d7 dc 46 0x0018 db 9d b4 25 90 d7 dc 46
0x0020 b0 0x0020 b0
0x0021 72 41 b6 12 c3 81 2c encrypted session key 0x0021 72 41 b6 12 c3 81 2c encrypted session key
0x0028 ff fb ea 00 f2 34 7b 25 0x0028 ff fb ea 00 f2 34 7b 25
0x0030 64 0x0030 64
0x0031 11 23 f8 87 ae 60 d4 AEAD tag 0x0031 11 23 f8 87 ae 60 d4 AEAD tag
0x0038 fd 61 4e 08 37 d8 19 d3 0x0038 fd 61 4e 08 37 d8 19 d3
0x0040 6c 0x0040 6c
A.10.2. Starting AEAD-OCB decryption of the session key A.10.2. Starting AEAD-OCB Decryption of the Session Key
The derived key is: The derived key is:
e8 0d e2 43 a3 62 d9 3b 9d c6 07 ed e9 6a 73 56 e8 0d e2 43 a3 62 d9 3b 9d c6 07 ed e9 6a 73 56
HKDF info: HKDF info:
c3 06 07 02 c3 06 07 02
HKDF output: HKDF output:
skipping to change at page 186, line 17 skipping to change at line 8533
c3 06 07 02 c3 06 07 02
Nonce: Nonce:
cf cc 5c 11 66 4e db 9d b4 25 90 d7 dc 46 b0 cf cc 5c 11 66 4e db 9d b4 25 90 d7 dc 46 b0
Decrypted session key: Decrypted session key:
28 e7 9a b8 23 97 d3 c6 3d e2 4a c2 17 d7 b7 91 28 e7 9a b8 23 97 d3 c6 3d e2 4a c2 17 d7 b7 91
A.10.3. Sample v2 SEIPD packet A.10.3. Sample v2 SEIPD Packet
This packet contains the following series of octets: This packet contains the following series of octets:
0x0000 d2 69 02 07 02 06 20 a6 0x0000 d2 69 02 07 02 06 20 a6
0x0008 61 f7 31 fc 9a 30 32 b5 0x0008 61 f7 31 fc 9a 30 32 b5
0x0010 62 33 26 02 7e 3a 5d 8d 0x0010 62 33 26 02 7e 3a 5d 8d
0x0018 b5 74 8e be ff 0b 0c 59 0x0018 b5 74 8e be ff 0b 0c 59
0x0020 10 d0 9e cd d6 41 ff 9f 0x0020 10 d0 9e cd d6 41 ff 9f
0x0028 d3 85 62 75 80 35 bc 49 0x0028 d3 85 62 75 80 35 bc 49
0x0030 75 4c e1 bf 3f ff a7 da 0x0030 75 4c e1 bf 3f ff a7 da
0x0038 d0 a3 b8 10 4f 51 33 cf 0x0038 d0 a3 b8 10 4f 51 33 cf
0x0040 42 a4 10 0a 83 ee f4 ca 0x0040 42 a4 10 0a 83 ee f4 ca
0x0048 1b 48 01 a8 84 6b f4 2b 0x0048 1b 48 01 a8 84 6b f4 2b
0x0050 cd a7 c8 ce 9d 65 e2 12 0x0050 cd a7 c8 ce 9d 65 e2 12
0x0058 f3 01 cb cd 98 fd ca de 0x0058 f3 01 cb cd 98 fd ca de
0x0060 69 4a 87 7a d4 24 73 23 0x0060 69 4a 87 7a d4 24 73 23
0x0068 f6 e8 57 0x0068 f6 e8 57
The same data, broken out by octet and semantics: The same data, broken out by octet and semantics, is:
0x0000 d2 packet type: SEIPD 0x0000 d2 packet type: SEIPD
0x0001 69 packet length 0x0001 69 packet length
0x0002 02 SEIPD version 2 0x0002 02 v2 SEIPD
0x0003 07 cipher: AES128 0x0003 07 cipher: AES128
0x0004 02 AEAD mode: OCB 0x0004 02 AEAD mode: OCB
0x0005 06 chunk size (2**21 octets) 0x0005 06 chunk size (2^12 octets)
0x0006 20 a6 salt 0x0006 20 a6 salt
0x0008 61 f7 31 fc 9a 30 32 b5 0x0008 61 f7 31 fc 9a 30 32 b5
0x0010 62 33 26 02 7e 3a 5d 8d 0x0010 62 33 26 02 7e 3a 5d 8d
0x0018 b5 74 8e be ff 0b 0c 59 0x0018 b5 74 8e be ff 0b 0c 59
0x0020 10 d0 9e cd d6 41 0x0020 10 d0 9e cd d6 41
0x0026 ff 9f chunk #0 encrypted data 0x0026 ff 9f chunk #0 encrypted data
0x0028 d3 85 62 75 80 35 bc 49 0x0028 d3 85 62 75 80 35 bc 49
0x0030 75 4c e1 bf 3f ff a7 da 0x0030 75 4c e1 bf 3f ff a7 da
0x0038 d0 a3 b8 10 4f 51 33 cf 0x0038 d0 a3 b8 10 4f 51 33 cf
0x0040 42 a4 10 0a 83 ee f4 ca 0x0040 42 a4 10 0a 83 ee f4 ca
0x0048 1b 48 01 0x0048 1b 48 01
0x004b a8 84 6b f4 2b chunk #0 authentication tag 0x004b a8 84 6b f4 2b chunk #0 authentication tag
0x0050 cd a7 c8 ce 9d 65 e2 12 0x0050 cd a7 c8 ce 9d 65 e2 12
0x0058 f3 01 cb 0x0058 f3 01 cb
0x005b cd 98 fd ca de final AEAD tag (#1) 0x005b cd 98 fd ca de final AEAD tag (#1)
0x0060 69 4a 87 7a d4 24 73 23 0x0060 69 4a 87 7a d4 24 73 23
0x0068 f6 e8 57 0x0068 f6 e8 57
A.10.4. Decryption of data A.10.4. Decryption of Data
Starting AEAD-OCB decryption of data, using the session key. Starting AEAD-OCB decryption of data, using the session key.
HKDF info: HKDF info:
d2 02 07 02 06 d2 02 07 02 06
HKDF output: HKDF output:
71 66 2a 11 ee 5b 4e 08 14 4e 6d e8 83 a0 09 99 71 66 2a 11 ee 5b 4e 08 14 4e 6d e8 83 a0 09 99
skipping to change at page 188, line 13 skipping to change at line 8611
Nonce: Nonce:
eb de 12 bb 57 0d cf 00 00 00 00 00 00 00 00 eb de 12 bb 57 0d cf 00 00 00 00 00 00 00 00
Additional authenticated data: Additional authenticated data:
d2 02 07 02 06 d2 02 07 02 06
Decrypted chunk #0. Decrypted chunk #0.
Literal data packet with the string contents Hello, world!: Literal Data packet with the string contents Hello, world!:
cb 13 62 00 00 00 00 00 48 65 6c 6c 6f 2c 20 77 cb 13 62 00 00 00 00 00 48 65 6c 6c 6f 2c 20 77
6f 72 6c 64 21 6f 72 6c 64 21
Padding packet: Padding packet:
d5 0e ae 6a a1 64 9b 56 aa 83 5b 26 13 90 2b d2 d5 0e ae 6a a1 64 9b 56 aa 83 5b 26 13 90 2b d2
Authenticating final tag: Authenticating final tag:
Final nonce: Final nonce:
eb de 12 bb 57 0d cf 00 00 00 00 00 00 00 01 eb de 12 bb 57 0d cf 00 00 00 00 00 00 00 01
Final additional authenticated data: Final additional authenticated data:
d2 02 07 02 06 00 00 00 00 00 00 00 25 d2 02 07 02 06 00 00 00 00 00 00 00 25
A.10.5. Complete AEAD-OCB encrypted packet sequence A.10.5. Complete AEAD-OCB Encrypted Packet Sequence
-----BEGIN PGP MESSAGE----- -----BEGIN PGP MESSAGE-----
wz8GHQcCCwMIVqKY0vXjZFP/z8xcEWZO2520JZDX3EawckG2EsOBLP/76gDyNHsl wz8GHQcCCwMIVqKY0vXjZFP/z8xcEWZO2520JZDX3EawckG2EsOBLP/76gDyNHsl
ZBEj+IeuYNT9YU4IN9gZ02zSaQIHAgYgpmH3MfyaMDK1YjMmAn46XY21dI6+/wsM ZBEj+IeuYNT9YU4IN9gZ02zSaQIHAgYgpmH3MfyaMDK1YjMmAn46XY21dI6+/wsM
WRDQns3WQf+f04VidYA1vEl1TOG/P/+n2tCjuBBPUTPPQqQQCoPu9MobSAGohGv0 WRDQns3WQf+f04VidYA1vEl1TOG/P/+n2tCjuBBPUTPPQqQQCoPu9MobSAGohGv0
K82nyM6dZeIS8wHLzZj9yt5pSod61CRzI/boVw== K82nyM6dZeIS8wHLzZj9yt5pSod61CRzI/boVw==
-----END PGP MESSAGE----- -----END PGP MESSAGE-----
A.11. Sample AEAD-GCM encryption and decryption A.11. Sample AEAD-GCM Encryption and Decryption
This example encrypts the cleartext string Hello, world! with the This example encrypts the cleartext string Hello, world! with the
passphrase password, using AES-128 with AEAD-GCM encryption. passphrase password, using AES-128 with AEAD-GCM encryption.
A.11.1. Sample symmetric-key encrypted session key packet (v6) A.11.1. Sample Version 6 Symmetric Key Encrypted Session Key Packet
This packet contains the following series of octets: This packet contains the following series of octets:
0x0000 c3 3c 06 1a 07 03 0b 03 0x0000 c3 3c 06 1a 07 03 0b 03
0x0008 08 e9 d3 97 85 b2 07 00 0x0008 08 e9 d3 97 85 b2 07 00
0x0010 08 ff b4 2e 7c 48 3e f4 0x0010 08 ff b4 2e 7c 48 3e f4
0x0018 88 44 57 cb 37 26 b9 b3 0x0018 88 44 57 cb 37 26 b9 b3
0x0020 db 9f f7 76 e5 f4 d9 a4 0x0020 db 9f f7 76 e5 f4 d9 a4
0x0028 09 52 e2 44 72 98 85 1a 0x0028 09 52 e2 44 72 98 85 1a
0x0030 bf ff 75 26 df 2d d5 54 0x0030 bf ff 75 26 df 2d d5 54
0x0038 41 75 79 a7 79 9f 0x0038 41 75 79 a7 79 9f
The same data, broken out by octet and semantics: The same data, broken out by octet and semantics, is:
0x0000 c3 packet type: SKESK 0x0000 c3 packet type: SKESK
0x0001 3c packet length 0x0001 3c packet length
0x0002 06 SKESK version 6 0x0002 06 v6 SKESK
0x0003 1a length through end of AEAD nonce 0x0003 1a length through end of AEAD nonce
0x0004 07 cipher: AES128 0x0004 07 cipher: AES128
0x0005 03 AEAD mode: GCM 0x0005 03 AEAD mode: GCM
0x0006 0b length of S2K 0x0006 0b length of S2K
0x0007 03 S2K type: iterated+salted 0x0007 03 S2K type: iterated+salted
0x0008 08 S2K hash: SHA2-256 0x0008 08 S2K hash: SHA2-256
0x0009 e9 d3 97 85 b2 07 00 S2K salt 0x0009 e9 d3 97 85 b2 07 00 S2K salt
0x0010 08 0x0010 08
0x0011 ff S2K iterations (65011712 octets) 0x0011 ff S2K iterations (65011712 octets)
0x0012 b4 2e 7c 48 3e f4 AEAD nonce 0x0012 b4 2e 7c 48 3e f4 AEAD nonce
0x0018 88 44 57 cb 37 26 0x0018 88 44 57 cb 37 26
0x001e b9 b3 encrypted session key 0x001e b9 b3 encrypted session key
0x0020 db 9f f7 76 e5 f4 d9 a4 0x0020 db 9f f7 76 e5 f4 d9 a4
0x0028 09 52 e2 44 72 98 0x0028 09 52 e2 44 72 98
0x002e 85 1a AEAD tag 0x002e 85 1a AEAD tag
0x0030 bf ff 75 26 df 2d d5 54 0x0030 bf ff 75 26 df 2d d5 54
0x0038 41 75 79 a7 79 9f 0x0038 41 75 79 a7 79 9f
A.11.2. Starting AEAD-GCM decryption of the session key A.11.2. Starting AEAD-GCM Decryption of the Session Key
The derived key is: The derived key is:
25 02 81 71 5b ba 78 28 ef 71 ef 64 c4 78 47 53 25 02 81 71 5b ba 78 28 ef 71 ef 64 c4 78 47 53
HKDF info: HKDF info:
c3 06 07 03 c3 06 07 03
HKDF output: HKDF output:
skipping to change at page 190, line 15 skipping to change at line 8707
c3 06 07 03 c3 06 07 03
Nonce: Nonce:
b4 2e 7c 48 3e f4 88 44 57 cb 37 26 b4 2e 7c 48 3e f4 88 44 57 cb 37 26
Decrypted session key: Decrypted session key:
19 36 fc 85 68 98 02 74 bb 90 0d 83 19 36 0c 77 19 36 fc 85 68 98 02 74 bb 90 0d 83 19 36 0c 77
A.11.3. Sample v2 SEIPD packet A.11.3. Sample v2 SEIPD Packet
This packet contains the following series of octets: This packet contains the following series of octets, is:
0x0000 d2 69 02 07 03 06 fc b9 0x0000 d2 69 02 07 03 06 fc b9
0x0008 44 90 bc b9 8b bd c9 d1 0x0008 44 90 bc b9 8b bd c9 d1
0x0010 06 c6 09 02 66 94 0f 72 0x0010 06 c6 09 02 66 94 0f 72
0x0018 e8 9e dc 21 b5 59 6b 15 0x0018 e8 9e dc 21 b5 59 6b 15
0x0020 76 b1 01 ed 0f 9f fc 6f 0x0020 76 b1 01 ed 0f 9f fc 6f
0x0028 c6 d6 5b bf d2 4d cd 07 0x0028 c6 d6 5b bf d2 4d cd 07
0x0030 90 96 6e 6d 1e 85 a3 00 0x0030 90 96 6e 6d 1e 85 a3 00
0x0038 53 78 4c b1 d8 b6 a0 69 0x0038 53 78 4c b1 d8 b6 a0 69
0x0040 9e f1 21 55 a7 b2 ad 62 0x0040 9e f1 21 55 a7 b2 ad 62
0x0048 58 53 1b 57 65 1f d7 77 0x0048 58 53 1b 57 65 1f d7 77
0x0050 79 12 fa 95 e3 5d 9b 40 0x0050 79 12 fa 95 e3 5d 9b 40
0x0058 21 6f 69 a4 c2 48 db 28 0x0058 21 6f 69 a4 c2 48 db 28
0x0060 ff 43 31 f1 63 29 07 39 0x0060 ff 43 31 f1 63 29 07 39
0x0068 9e 6f f9 0x0068 9e 6f f9
The same data, broken out by octet and semantics: The same data, broken out by octet and semantics, is:
0x0000 d2 packet type: SEIPD 0x0000 d2 packet type: SEIPD
0x0001 69 packet length 0x0001 69 packet length
0x0002 02 SEIPD version 2 0x0002 02 v2 SEIPD
0x0003 07 cipher: AES128 0x0003 07 cipher: AES128
0x0004 03 AEAD mode: GCM 0x0004 03 AEAD mode: GCM
0x0005 06 chunk size (2**21 octets) 0x0005 06 chunk size (2^12 octets)
0x0006 fc b9 salt 0x0006 fc b9 salt
0x0008 44 90 bc b9 8b bd c9 d1 0x0008 44 90 bc b9 8b bd c9 d1
0x0010 06 c6 09 02 66 94 0f 72 0x0010 06 c6 09 02 66 94 0f 72
0x0018 e8 9e dc 21 b5 59 6b 15 0x0018 e8 9e dc 21 b5 59 6b 15
0x0020 76 b1 01 ed 0f 9f 0x0020 76 b1 01 ed 0f 9f
0x0026 fc 6f chunk #0 encrypted data 0x0026 fc 6f chunk #0 encrypted data
0x0028 c6 d6 5b bf d2 4d cd 07 0x0028 c6 d6 5b bf d2 4d cd 07
0x0030 90 96 6e 6d 1e 85 a3 00 0x0030 90 96 6e 6d 1e 85 a3 00
0x0038 53 78 4c b1 d8 b6 a0 69 0x0038 53 78 4c b1 d8 b6 a0 69
0x0040 9e f1 21 55 a7 b2 ad 62 0x0040 9e f1 21 55 a7 b2 ad 62
0x0048 58 53 1b 0x0048 58 53 1b
0x004b 57 65 1f d7 77 chunk #0 authentication tag 0x004b 57 65 1f d7 77 chunk #0 authentication tag
0x0050 79 12 fa 95 e3 5d 9b 40 0x0050 79 12 fa 95 e3 5d 9b 40
0x0058 21 6f 69 0x0058 21 6f 69
0x005b a4 c2 48 db 28 final AEAD tag (#1) 0x005b a4 c2 48 db 28 final AEAD tag (#1)
0x0060 ff 43 31 f1 63 29 07 39 0x0060 ff 43 31 f1 63 29 07 39
0x0068 9e 6f f9 0x0068 9e 6f f9
A.11.4. Decryption of data A.11.4. Decryption of Data
Starting AEAD-GCM decryption of data, using the session key. Starting AEAD-GCM decryption of data, using the session key.
HKDF info: HKDF info:
d2 02 07 03 06 d2 02 07 03 06
HKDF output: HKDF output:
ea 14 38 80 3c b8 a4 77 40 ce 9b 54 c3 38 77 8d ea 14 38 80 3c b8 a4 77 40 ce 9b 54 c3 38 77 8d
skipping to change at page 192, line 13 skipping to change at line 8785
Nonce: Nonce:
4d 2b dc 2b 00 00 00 00 00 00 00 00 4d 2b dc 2b 00 00 00 00 00 00 00 00
Additional authenticated data: Additional authenticated data:
d2 02 07 03 06 d2 02 07 03 06
Decrypted chunk #0. Decrypted chunk #0.
Literal data packet with the string contents Hello, world!: Literal Data packet with the string contents Hello, world!:
cb 13 62 00 00 00 00 00 48 65 6c 6c 6f 2c 20 77 cb 13 62 00 00 00 00 00 48 65 6c 6c 6f 2c 20 77
6f 72 6c 64 21 6f 72 6c 64 21
Padding packet: Padding packet:
d5 0e 1c e2 26 9a 9e dd ef 81 03 21 72 b7 ed 7c d5 0e 1c e2 26 9a 9e dd ef 81 03 21 72 b7 ed 7c
Authenticating final tag: Authenticating final tag:
Final nonce: Final nonce:
4d 2b dc 2b 00 00 00 00 00 00 00 01 4d 2b dc 2b 00 00 00 00 00 00 00 01
Final additional authenticated data: Final additional authenticated data:
d2 02 07 03 06 00 00 00 00 00 00 00 25 d2 02 07 03 06 00 00 00 00 00 00 00 25
A.11.5. Complete AEAD-GCM encrypted packet sequence A.11.5. Complete AEAD-GCM Encrypted Packet Sequence
-----BEGIN PGP MESSAGE----- -----BEGIN PGP MESSAGE-----
wzwGGgcDCwMI6dOXhbIHAAj/tC58SD70iERXyzcmubPbn/d25fTZpAlS4kRymIUa wzwGGgcDCwMI6dOXhbIHAAj/tC58SD70iERXyzcmubPbn/d25fTZpAlS4kRymIUa
v/91Jt8t1VRBdXmneZ/SaQIHAwb8uUSQvLmLvcnRBsYJAmaUD3LontwhtVlrFXax v/91Jt8t1VRBdXmneZ/SaQIHAwb8uUSQvLmLvcnRBsYJAmaUD3LontwhtVlrFXax
Ae0Pn/xvxtZbv9JNzQeQlm5tHoWjAFN4TLHYtqBpnvEhVaeyrWJYUxtXZR/Xd3kS Ae0Pn/xvxtZbv9JNzQeQlm5tHoWjAFN4TLHYtqBpnvEhVaeyrWJYUxtXZR/Xd3kS
+pXjXZtAIW9ppMJI2yj/QzHxYykHOZ5v+Q== +pXjXZtAIW9ppMJI2yj/QzHxYykHOZ5v+Q==
-----END PGP MESSAGE----- -----END PGP MESSAGE-----
A.12. Sample messages encrypted using Argon2 A.12. Sample Messages Encrypted Using Argon2
These messages are the literal data "Hello, world!" encrypted using These messages are the literal data Hello, world! encrypted using v1
v1 SEIPD, with Argon2 and the passphrase "password", using different SEIPD, with Argon2 and the passphrase "password", using different
session key sizes. In each example, the choice of symmetric cipher session key sizes. In each example, the choice of symmetric cipher
is the same in both the v4 SKESK packet and v1 SEIPD packet. In all is the same in both the v4 SKESK packet and v1 SEIPD packet. In all
cases, the Argon2 parameters are t = 1, p = 4, and m = 21. cases, the Argon2 parameters are t = 1, p = 4, and m = 21.
A.12.1. Version 4 SKESK using Argon2 with AES-128 A.12.1. V4 SKESK Using Argon2 with AES-128
-----BEGIN PGP MESSAGE----- -----BEGIN PGP MESSAGE-----
Comment: Encrypted using AES with 128-bit key Comment: Encrypted using AES with 128-bit key
Comment: Session key: 01FE16BBACFD1E7B78EF3B865187374F Comment: Session key: 01FE16BBACFD1E7B78EF3B865187374F
wycEBwScUvg8J/leUNU1RA7N/zE2AQQVnlL8rSLPP5VlQsunlO+ECxHSPgGYGKY+ wycEBwScUvg8J/leUNU1RA7N/zE2AQQVnlL8rSLPP5VlQsunlO+ECxHSPgGYGKY+
YJz4u6F+DDlDBOr5NRQXt/KJIf4m4mOlKyC/uqLbpnLJZMnTq3o79GxBTdIdOzhH YJz4u6F+DDlDBOr5NRQXt/KJIf4m4mOlKyC/uqLbpnLJZMnTq3o79GxBTdIdOzhH
XfA3pqV4mTzF XfA3pqV4mTzF
-----END PGP MESSAGE----- -----END PGP MESSAGE-----
A.12.2. Version 4 SKESK using Argon2 with AES-192 A.12.2. V4 SKESK Using Argon2 with AES-192
-----BEGIN PGP MESSAGE----- -----BEGIN PGP MESSAGE-----
Comment: Encrypted using AES with 192-bit key Comment: Encrypted using AES with 192-bit key
Comment: Session key: 27006DAE68E509022CE45A14E569E91001C2955... Comment: Session key: 27006DAE68E509022CE45A14E569E91001C2955...
Comment: Session key: ...AF8DFE194 Comment: Session key: ...AF8DFE194
wy8ECAThTKxHFTRZGKli3KNH4UP4AQQVhzLJ2va3FG8/pmpIPd/H/mdoVS5VBLLw wy8ECAThTKxHFTRZGKli3KNH4UP4AQQVhzLJ2va3FG8/pmpIPd/H/mdoVS5VBLLw
F9I+AdJ1Sw56PRYiKZjCvHg+2bnq02s33AJJoyBexBI4QKATFRkyez2gldJldRys F9I+AdJ1Sw56PRYiKZjCvHg+2bnq02s33AJJoyBexBI4QKATFRkyez2gldJldRys
LVg77Mwwfgl2n/d572WciAM= LVg77Mwwfgl2n/d572WciAM=
-----END PGP MESSAGE----- -----END PGP MESSAGE-----
A.12.3. Version 4 SKESK using Argon2 with AES-256 A.12.3. V4 SKESK Using Argon2 with AES-256
-----BEGIN PGP MESSAGE----- -----BEGIN PGP MESSAGE-----
Comment: Encrypted using AES with 256-bit key Comment: Encrypted using AES with 256-bit key
Comment: Session key: BBEDA55B9AAE63DAC45D4F49D89DACF4AF37FEF... Comment: Session key: BBEDA55B9AAE63DAC45D4F49D89DACF4AF37FEF...
Comment: Session key: ...C13BAB2F1F8E18FB74580D8B0 Comment: Session key: ...C13BAB2F1F8E18FB74580D8B0
wzcECQS4eJUgIG/3mcaILEJFpmJ8AQQVnZ9l7KtagdClm9UaQ/Z6M/5roklSGpGu wzcECQS4eJUgIG/3mcaILEJFpmJ8AQQVnZ9l7KtagdClm9UaQ/Z6M/5roklSGpGu
623YmaXezGj80j4B+Ku1sgTdJo87X1Wrup7l0wJypZls21Uwd67m9koF60eefH/K 623YmaXezGj80j4B+Ku1sgTdJo87X1Wrup7l0wJypZls21Uwd67m9koF60eefH/K
95D1usliXOEm8ayQJQmZrjf6K6v9PWwqMQ== 95D1usliXOEm8ayQJQmZrjf6K6v9PWwqMQ==
-----END PGP MESSAGE----- -----END PGP MESSAGE-----
Appendix B. Upgrade Guidance (Adapting Implementations from RFC 4880 Appendix B. Upgrade Guidance (Adapting Implementations from RFCs 4880
and RFC 6637) and 6637)
This subsection offers a concise, non-normative summary of the This subsection offers a concise, non-normative summary of the
substantial additions to and departures from [RFC4880] and [RFC6637]. substantial additions to and departures from [RFC4880] and [RFC6637].
It is intended to help implementers who are augmenting an existing It is intended to help implementers who are augmenting an existing
implementation from those standards to this standard. Cryptographic implementation from those specifications to comply with this
algorithms marked with "MTI" are mandatory to implement. specification. Cryptographic algorithms marked with "MTI" are
mandatory to implement.
* Public Key signing algorithms: * Public Key Signing Algorithms:
- Ed25519 (Section 5.5.5.9 and Section 5.2.3.4), MTI - Ed25519 (Sections 5.5.5.9 and 5.2.3.4) -- MTI
- Ed448 (Section 5.5.5.10 and Section 5.2.3.5) - Ed448 (Sections 5.5.5.10 and 5.2.3.5)
- EdDSALegacy with Ed25519Legacy (Section 5.5.5.5 and
Section 5.2.3.3) - EdDSALegacy with Ed25519Legacy (Sections 5.5.5.5 and 5.2.3.3)
- ECDSA with Brainpool curves (Section 9.2) - ECDSA with Brainpool curves (Section 9.2)
* Public Key encryption algorithms: * Public Key Encryption Algorithms:
- X25519 (Section 5.5.5.7 and Section 5.1.6), MTI - X25519 (Sections 5.5.5.7 and 5.1.6) -- MTI
- X448 (Section 5.5.5.8 and Section 5.1.7) - X448 (Sections 5.5.5.8 and 5.1.7)
- ECDH with Curve25519Legacy (Section 9.2) - ECDH with Curve25519Legacy (Section 9.2)
- ECDH with Brainpool curves (Section 9.2) - ECDH with Brainpool curves (Section 9.2)
* AEAD Encryption: * AEAD Encryption:
- Version 2 SEIPD (Section 5.13.2) - V2 SEIPD (Section 5.13.2)
- AEAD modes: - AEAD modes:
o OCB mode (Section 5.13.4), MTI o OCB mode (Section 5.13.4) -- MTI
o EAX mode (Section 5.13.3) o EAX mode (Section 5.13.3)
o GCM mode (Section 5.13.5) o GCM mode (Section 5.13.5)
- Version 6 PKESK (Section 5.1.2) - V6 PKESK (Section 5.1.2)
- Version 6 SKESK (Section 5.3.2) - V6 SKESK (Section 5.3.2)
- Features subpacket: add flag for SEIPDv2 (Section 5.2.3.32) - Features signature subpacket: add flag for v2 SEIPD
(Section 5.2.3.32)
- Subpacket: Preferred AEAD Ciphersuites (Section 5.2.3.15) - Signature Subpacket: Preferred AEAD Ciphersuites
(Section 5.2.3.15)
- Secret key encryption: AEAD "S2K usage octet" (Section 3.7.2 - Secret key encryption: AEAD "S2K usage octet" (Sections 3.7.2
and Section 5.5.3) and 5.5.3)
* Version 6 Keys and Signatures: * Version 6 Keys and Signatures:
- Version 6 Public keys (Section 5.5.2.3) - Version 6 Public Keys (Section 5.5.2.3)
- Version 6 Fingerprint and Key ID (Section 5.5.4.3) - Version 6 Fingerprint and Key ID (Section 5.5.4.3)
- Version 6 Secret keys (Section 5.5.3) - Version 6 Secret Keys (Section 5.5.3)
- Version 6 Signatures (Section 5.2.3) - Version 6 Signatures (Section 5.2.3)
- Version 6 One-Pass Signatures (Section 5.4) - Version 6 One-Pass Signatures (Section 5.4)
* Certificate (Transferable Public Key) Structure: * Certificate (Transferable Public Key) Structure:
- Preferences subpackets in Direct Key Signatures - Preferences subpackets in Direct Key signatures
(Section 5.2.3.10) (Section 5.2.3.10)
- Self-verifying revocation certificate (Section 10.1.2) - Self-verifying revocation certificate (Section 10.1.2)
- User ID is explicitly optional (Section 10.1.1) - User ID is explicitly optional (Section 10.1.1)
* S2K: Argon2 (Section 3.7.1.4) * S2K: Argon2 (Section 3.7.1.4)
* Subpacket: Intended Recipient Fingerprint (Section 5.2.3.36) * Subpacket: Intended Recipient Fingerprint (Section 5.2.3.36)
* Digest algorithms: SHA3-256 and SHA3-512 (Section 9.5) * Digest Algorithms: SHA3-256 and SHA3-512 (Section 9.5)
* Packet: Padding (Section 5.14) * Packet: Padding (Section 5.14)
* Message structure: Packet Criticality (Section 4.3) * Message Structure: Packet Criticality (Section 4.3)
* Deprecations: * Deprecations:
- Public Key Algorithms: - Public Key Algorithms:
o Avoid RSA weak keys (Section 12.4) o Avoid RSA weak keys (Section 12.4)
o Avoid DSA (Section 12.5) o Avoid DSA (Section 12.5)
o Avoid ElGamal (Section 12.6, Section 5.1.4) o Avoid ElGamal (Sections 12.6 and 5.1.4)
o For Version 6 Keys: Avoid EdDSA25519Legacy, Curve25519Legacy o For Version 6 Keys: Avoid EdDSA25519Legacy and
(Section 9.2) Curve25519Legacy (Section 9.2)
- Digest Algorithms: - Digest Algorithms:
o Avoid MD5, SHA1, RIPEMD160 (Section 9.5) o Avoid MD5, SHA1, and RIPEMD160 (Section 9.5)
- Symmetric Key Algorithms: - Symmetric Key Algorithms:
o Avoid IDEA, TripleDES, CAST5 (Section 9.3) o Avoid IDEA, TripleDES, and CAST5 (Section 9.3)
- S2K Specifier: - S2K Specifier:
o Avoid Simple S2K (Section 3.7.1.1) o Avoid Simple S2K (Section 3.7.1.1)
- Secret Key protections (a.k.a. S2K Usage): - Secret Key Protections (a.k.a. S2K Usage):
o Avoid MalleableCFB (Section 3.7.2.1) o Avoid MalleableCFB (Section 3.7.2.1)
- Packet Types: - Packet Types:
o Avoid Symmetrically-Encrypted Data (Section 5.7, o Avoid Symmetrically Encrypted Data (Sections 5.7 and 13.7)
Section 13.7)
- Literal Data packet metadata: - Literal Data Packet Metadata:
o Avoid Filename and Date fields (Section 5.9) o Avoid Filename and Date fields (Section 5.9)
o Avoid Special _CONSOLE "filename" (Section 5.9.1) o Avoid Special _CONSOLE "filename" (Section 5.9.1)
- Packet Versions: - Packet Versions:
o Avoid Version 3 Public Keys (Section 5.5.2.1) o Avoid Version 3 Public Keys (Section 5.5.2.1)
o Avoid Version 3 Signatures (Section 5.2) o Avoid Version 3 Signatures (Section 5.2)
- Signature Types: - Signature Types:
o Avoid Reserved Signature Type ID 0xFF (Section 5.2.1.16, o Avoid Reserved Signature Type ID 0xFF (Sections 5.2.1.16 and
Section 5.2.4.1) 5.2.4.1)
- Signature Subpackets: - Signature Subpackets:
o For Version 6 Signatures: Avoid Issuer Key ID o For Version 6 Signatures: Avoid Issuer Key ID
(Section 5.2.3.12) (Section 5.2.3.12)
o Avoid Revocation Key (Section 5.2.3.23) o Avoid Revocation Key (Section 5.2.3.23)
- ASCII Armor: - ASCII Armor:
o Ignore, do not emit CRC (Section 6.1) o Ignore; do not emit CRC (Section 6.1)
o Do not emit "Version" armor header (Section 6.2.2.1) o Do not emit "Version" Armor Header (Section 6.2.2.1)
- Cleartext Signature Framework: - Cleartext Signature Framework:
o Ignore, avoid emitting unnecessary Hash: headers o Ignore; avoid emitting unnecessary Hash: headers
(Section 6.2.2.3) (Section 6.2.2.3)
o Reject CSF signatures with invalid Hash: headers o Reject Cleartext Signature Framework signatures with invalid
(Section 6.2.2.3) or any other Armor Header (Section 7.1) Hash: headers (Section 6.2.2.3) or any other Armor Header
(Section 7.1)
B.1. Terminology Changes B.1. Terminology Changes
Note that some of the words used in previous revisions of the OpenPGP Note that some of the words used in previous versions of the OpenPGP
standard have been improved in this document. specification have been improved in this document.
In previous revisions, the following terms were used: In previous versions, the following terms were used:
* "Radix-64" was used to refer to OpenPGP's ASCII Armor base64 * "Radix-64" was used to refer to OpenPGP's ASCII Armor base64
encoding (Section 6). encoding (Section 6).
* "Old packet format" was used to refer to the Legacy packet format * "Old packet format" was used to refer to the Legacy packet format
(Section 4.2.2) predating [RFC2440]. (Section 4.2.2) predating [RFC2440].
* "New packet format" was used to refer to the OpenPGP packet format * "New packet format" was used to refer to the OpenPGP packet format
(Section 4.2.1) introduced in [RFC2440]. (Section 4.2.1) introduced in [RFC2440].
* "Certificate" was used ambiguously to mean multiple things. In * "Certificate" was used ambiguously to mean multiple things. In
this document, it is used to mean "Transferable Public Key" this document, it means "Transferable Public Key" exclusively.
exclusively.
* "Preferred Symmetric Algorithms" was the old name for the * "Preferred Symmetric Algorithms" was the old name for the
"Preferred Symmetric Ciphers for v1 SEIPD" subpacket "Preferred Symmetric Ciphers for v1 SEIPD" subpacket
(Section 5.2.3.14) (Section 5.2.3.14).
* "Modification Detection Code" or "MDC" was originally described as * "Modification Detection Code" or "MDC" was originally described as
a distinct packet (packet type ID 19), and its corresponding flag a distinct packet (Packet Type ID 19), and its corresponding flag
in the Features subpacket (Section 5.2.3.32) was known as in the Features signature subpacket (Section 5.2.3.32) was known
"Modification Detection". It is now described as an intrinsic as "Modification Detection". It is now described as an intrinsic
part of v1 SEIPD (Section 5.13.1), and the same corresponding flag part of v1 SEIPD (Section 5.13.1), and the same corresponding flag
is known as "Symmetrically Encrypted Integrity Protected Data is known as "Version 1 Symmetrically Encrypted and Integrity
packet version 1". Protected Data packet".
* "Packet Tag" was used to refer to the Packet Type ID (Section 5), * "Packet Tag" was used to refer to the Packet Type ID (Section 5)
or sometimes to the encoded Packet Type ID (Section 4.2). or sometimes to the encoded Packet Type ID (Section 4.2).
Appendix C. Acknowledgements Appendix C. Errata Addressed by This Document
Thanks to the openpgp design team for working on this document to
prepare it for working group consumption: Stephen Farrell, Daniel
Kahn Gillmor, Daniel Huigens, Jeffrey Lau, Yutaka Niibe, Justus
Winter and Paul Wouters.
Thanks to Werner Koch for the early work on rfc4880bis and Andrey
Jivsov for [RFC6637].
This document also draws on much previous work from a number of other
authors, including: Derek Atkins, Charles Breed, Dave Del Torto, Marc
Dyksterhouse, Gail Haspert, Gene Hoffman, Paul Hoffman, Ben Laurie,
Raph Levien, Colin Plumb, Will Price, David Shaw, William Stallings,
Mark Weaver, and Philip R. Zimmermann.
Appendix D. Errata addressed by this document
The following verified errata have been incorporated or are otherwise The following verified errata have been incorporated or are otherwise
resolved by this document: resolved by this document:
* [Errata-2199] - S2K hash/cipher octet correction * [Errata-2199] - S2K hash/cipher octet correction
* [Errata-2200] - No implicit use of IDEA correction * [Errata-2200] - No implicit use of IDEA correction
* [Errata-2206] - PKESK acronym expansion * [Errata-2206] - PKESK acronym expansion
* [Errata-2208] - Signature key owner clarification * [Errata-2208] - Signature key owner clarification
* [Errata-2214] - Signature hashing clarification * [Errata-2214] - Signature hashing clarification
* [Errata-2216] - Self signature applies to user ID correction * [Errata-2216] - Self-signature applies to user ID correction
* [Errata-2219] - Session key encryption storage clarification * [Errata-2219] - Session key encryption storage clarification
* [Errata-2222] - Simple hash MUST/MAY clarification * [Errata-2222] - Simple hash MUST/MAY clarification
* [Errata-2226] - Native line endings SHOULD clarification * [Errata-2226] - Native line endings SHOULD clarification
* [Errata-2234] - Radix-64 / base64 clarification * [Errata-2234] - Radix-64/base64 clarification
* [Errata-2235] - ASCII / UTF-8 collation sequence clarification * [Errata-2235] - ASCII/UTF-8 collation sequence clarification
* [Errata-2236] - Packet Composition is a sequence clarification * [Errata-2236] - Packet Composition is a sequence clarification
* [Errata-2238] - Subkey packets come after all User ID packets * [Errata-2238] - Subkey packets come after all User ID packets
clarification clarification
* [Errata-2240] - Subkey removal clarification * [Errata-2240] - Subkey removal clarification
* [Errata-2242] - mL / emLen variable correction * [Errata-2242] - mL/emLen variable correction
* [Errata-2243] - CFB mode initialization vector (IV) clarification * [Errata-2243] - CFB mode initialization vector (IV) clarification
* [Errata-2270] - SHA-224 octet sequence correction * [Errata-2270] - SHA-224 octet sequence correction
* [Errata-2271] - Radix-64 correction * [Errata-2271] - Radix-64 correction
* [Errata-3298] - Key revocation signatures correction
* [Errata-3298] - Key Revocation signatures correction
* [Errata-5491] - C code fix for CRC24_POLY define * [Errata-5491] - C code fix for CRC24_POLY define
* [Errata-7545] - Armor Header colon hex fix * [Errata-7545] - Armor Header colon hex fix
* [Errata-7889] - Signature/certification correction
Acknowledgements
Thanks to the OpenPGP Design Team for working on this document and
preparing it for working group consumption: Stephen Farrell, Daniel
Kahn Gillmor, Daniel Huigens, Jeffrey Lau, Yutaka Niibe, Justus
Winter, and Paul Wouters.
Thanks to Werner Koch for the early work on rfc4880bis and Andrey
Jivsov for the work on [RFC6637].
This document also draws on much previous work from a number of other
authors including Derek Atkins, Charles Breed, Dave Del Torto, Marc
Dyksterhouse, Gail Haspert, Gene Hoffman, Paul Hoffman, Ben Laurie,
Raph Levien, Colin Plumb, Will Price, Daphne Shaw, William Stallings,
Mark Weaver, and Philip R. Zimmermann.
Authors' Addresses Authors' Addresses
Paul Wouters (editor) Paul Wouters (editor)
Aiven Aiven
Email: paul.wouters@aiven.io Email: paul.wouters@aiven.io
Daniel Huigens Daniel Huigens
Proton AG Proton AG
Email: d.huigens@protonmail.com Email: d.huigens@protonmail.com
Justus Winter Justus Winter
Sequoia-PGP Sequoia PGP
Email: justus@sequoia-pgp.org Email: justus@sequoia-pgp.org
Yutaka Niibe Yutaka Niibe
FSIJ FSIJ
Email: gniibe@fsij.org Email: gniibe@fsij.org
 End of changes. 1302 change blocks. 
3449 lines changed or deleted 3489 lines changed or added

This html diff was produced by rfcdiff 1.48.