draft-ietf-openpgp-crypto-refresh-04.txt   draft-ietf-openpgp-crypto-refresh-05.txt 
Network Working Group W. Koch, Ed. Network Working Group W. Koch, Ed.
Internet-Draft GnuPG e.V. Internet-Draft GnuPG e.V.
Obsoletes: 4880, 5581, 6637 (if approved) P. Wouters, Ed. Obsoletes: 4880, 5581, 6637 (if approved) P. Wouters, Ed.
Intended status: Standards Track Aiven Intended status: Standards Track Aiven
Expires: 21 April 2022 18 October 2021 Expires: 8 September 2022 7 March 2022
OpenPGP Message Format OpenPGP Message Format
draft-ietf-openpgp-crypto-refresh-04 draft-ietf-openpgp-crypto-refresh-05
Abstract Abstract
{ Work in progress to update the OpenPGP specification from RFC4880 }
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
OpenPGP) and RFC 6637 (Elliptic Curves in OpenPGP).
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on 21 April 2022. This Internet-Draft will expire on 8 September 2022.
Copyright Notice Copyright Notice
Copyright (c) 2021 IETF Trust and the persons identified as the Copyright (c) 2022 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 (https://trustee.ietf.org/
license-info) in effect on the date of publication of this document. license-info) in effect on the date of publication of this document.
Please review these documents carefully, as they describe your rights Please review these documents carefully, as they describe your rights
and restrictions with respect to this document. Code Components and restrictions with respect to this document. Code Components
extracted from this document must include Simplified BSD License text extracted from this document must include Revised BSD License text as
as described in Section 4.e of the Trust Legal Provisions and are described in Section 4.e of the Trust Legal Provisions and are
provided without warranty as described in the Simplified BSD License. provided without warranty as described in the Revised BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 6 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 7
1.1. Terms . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.1. Terms . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2. General functions . . . . . . . . . . . . . . . . . . . . . . 7 2. General functions . . . . . . . . . . . . . . . . . . . . . . 8
2.1. Confidentiality via Encryption . . . . . . . . . . . . . 8 2.1. Confidentiality via Encryption . . . . . . . . . . . . . 8
2.2. Authentication via Digital Signature . . . . . . . . . . 9 2.2. Authentication via Digital Signature . . . . . . . . . . 9
2.3. Compression . . . . . . . . . . . . . . . . . . . . . . . 9 2.3. Compression . . . . . . . . . . . . . . . . . . . . . . . 10
2.4. Conversion to Radix-64 . . . . . . . . . . . . . . . . . 10 2.4. Conversion to Radix-64 . . . . . . . . . . . . . . . . . 10
2.5. Signature-Only Applications . . . . . . . . . . . . . . . 10 2.5. Signature-Only Applications . . . . . . . . . . . . . . . 10
3. Data Element Formats . . . . . . . . . . . . . . . . . . . . 10 3. Data Element Formats . . . . . . . . . . . . . . . . . . . . 10
3.1. Scalar Numbers . . . . . . . . . . . . . . . . . . . . . 10 3.1. Scalar Numbers . . . . . . . . . . . . . . . . . . . . . 10
3.2. Multiprecision Integers . . . . . . . . . . . . . . . . . 10 3.2. Multiprecision Integers . . . . . . . . . . . . . . . . . 11
3.2.1. Using MPIs to encode other data . . . . . . . . . . . 11 3.2.1. Using MPIs to encode other data . . . . . . . . . . . 11
3.3. Key IDs . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.3. Key IDs . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.4. Text . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.4. Text . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.5. Time Fields . . . . . . . . . . . . . . . . . . . . . . . 11 3.5. Time Fields . . . . . . . . . . . . . . . . . . . . . . . 12
3.6. Keyrings . . . . . . . . . . . . . . . . . . . . . . . . 12 3.6. Keyrings . . . . . . . . . . . . . . . . . . . . . . . . 12
3.7. String-to-Key (S2K) Specifiers . . . . . . . . . . . . . 12 3.7. String-to-Key (S2K) Specifiers . . . . . . . . . . . . . 12
3.7.1. String-to-Key (S2K) Specifier Types . . . . . . . . . 12 3.7.1. String-to-Key (S2K) Specifier Types . . . . . . . . . 12
3.7.1.1. Simple S2K . . . . . . . . . . . . . . . . . . . 12 3.7.1.1. Simple S2K . . . . . . . . . . . . . . . . . . . 13
3.7.1.2. Salted S2K . . . . . . . . . . . . . . . . . . . 13 3.7.1.2. Salted S2K . . . . . . . . . . . . . . . . . . . 14
3.7.1.3. Iterated and Salted S2K . . . . . . . . . . . . . 13 3.7.1.3. Iterated and Salted S2K . . . . . . . . . . . . . 14
3.7.1.4. Argon2 . . . . . . . . . . . . . . . . . . . . . 14 3.7.1.4. Argon2 . . . . . . . . . . . . . . . . . . . . . 15
3.7.2. String-to-Key Usage . . . . . . . . . . . . . . . . . 15 3.7.2. String-to-Key Usage . . . . . . . . . . . . . . . . . 16
3.7.2.1. Secret-Key Encryption . . . . . . . . . . . . . . 15 3.7.2.1. Secret-Key Encryption . . . . . . . . . . . . . . 16
3.7.2.2. Symmetric-Key Message Encryption . . . . . . . . 16 3.7.2.2. Symmetric-Key Message Encryption . . . . . . . . 17
4. Packet Syntax . . . . . . . . . . . . . . . . . . . . . . . . 16 4. Packet Syntax . . . . . . . . . . . . . . . . . . . . . . . . 18
4.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 16 4.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 18
4.2. Packet Headers . . . . . . . . . . . . . . . . . . . . . 16 4.2. Packet Headers . . . . . . . . . . . . . . . . . . . . . 18
4.2.1. Old Format Packet Lengths . . . . . . . . . . . . . . 17 4.2.1. OpenPGP Format Packet Lengths . . . . . . . . . . . . 19
4.2.2. New Format Packet Lengths . . . . . . . . . . . . . . 18 4.2.1.1. One-Octet Lengths . . . . . . . . . . . . . . . . 20
4.2.2.1. One-Octet Lengths . . . . . . . . . . . . . . . . 18 4.2.1.2. Two-Octet Lengths . . . . . . . . . . . . . . . . 20
4.2.2.2. Two-Octet Lengths . . . . . . . . . . . . . . . . 18 4.2.1.3. Five-Octet Lengths . . . . . . . . . . . . . . . 20
4.2.2.3. Five-Octet Lengths . . . . . . . . . . . . . . . 18 4.2.1.4. Partial Body Lengths . . . . . . . . . . . . . . 20
4.2.2.4. Partial Body Lengths . . . . . . . . . . . . . . 19 4.2.2. Legacy Format Packet Lengths . . . . . . . . . . . . 21
4.2.3. Packet Length Examples . . . . . . . . . . . . . . . 19 4.2.3. Packet Length Examples . . . . . . . . . . . . . . . 21
4.3. Packet Tags . . . . . . . . . . . . . . . . . . . . . . . 20 4.3. Packet Tags . . . . . . . . . . . . . . . . . . . . . . . 22
5. Packet Types . . . . . . . . . . . . . . . . . . . . . . . . 21 5. Packet Types . . . . . . . . . . . . . . . . . . . . . . . . 23
5.1. Public-Key Encrypted Session Key Packets (Tag 1) . . . . 22 5.1. Public-Key Encrypted Session Key Packets (Tag 1) . . . . 23
5.1.1. Algorithm Specific Fields for RSA encryption . . . . 22 5.1.1. v3 PKESK . . . . . . . . . . . . . . . . . . . . . . 23
5.1.2. Algorithm Specific Fields for Elgamal encryption . . 22 5.1.2. v5 PKESK . . . . . . . . . . . . . . . . . . . . . . 24
5.1.3. Algorithm-Specific Fields for ECDH encryption . . . . 22 5.1.3. Algorithm Specific Fields for RSA encryption . . . . 25
5.1.4. Notes on PKESK . . . . . . . . . . . . . . . . . . . 23 5.1.4. Algorithm Specific Fields for Elgamal encryption . . 25
5.2. Signature Packet (Tag 2) . . . . . . . . . . . . . . . . 23 5.1.5. Algorithm-Specific Fields for ECDH encryption . . . . 25
5.2.1. Signature Types . . . . . . . . . . . . . . . . . . . 24 5.1.6. Notes on PKESK . . . . . . . . . . . . . . . . . . . 25
5.2.2. Version 3 Signature Packet Format . . . . . . . . . . 26 5.2. Signature Packet (Tag 2) . . . . . . . . . . . . . . . . 26
5.2.3. Version 4 and 5 Signature Packet Formats . . . . . . 29 5.2.1. Signature Types . . . . . . . . . . . . . . . . . . . 26
5.2.3.1. Algorithm-Specific Fields for RSA signatures . . 30 5.2.2. Version 3 Signature Packet Format . . . . . . . . . . 28
5.2.3. Version 4 and 5 Signature Packet Formats . . . . . . 31
5.2.3.1. Algorithm-Specific Fields for RSA signatures . . 32
5.2.3.2. Algorithm-Specific Fields for DSA or ECDSA 5.2.3.2. Algorithm-Specific Fields for DSA or ECDSA
signatures . . . . . . . . . . . . . . . . . . . . 30 signatures . . . . . . . . . . . . . . . . . . . . 32
5.2.3.3. Algorithm-Specific Fields for EdDSA signatures . 30 5.2.3.3. Algorithm-Specific Fields for EdDSA signatures . 32
5.2.3.4. Notes on Signatures . . . . . . . . . . . . . . . 31 5.2.3.4. Notes on Signatures . . . . . . . . . . . . . . . 33
5.2.3.5. Signature Subpacket Specification . . . . . . . . 32 5.2.3.5. Signature Subpacket Specification . . . . . . . . 34
5.2.3.6. Signature Subpacket Types . . . . . . . . . . . . 34 5.2.3.6. Signature Subpacket Types . . . . . . . . . . . . 37
5.2.3.7. Notes on Self-Signatures . . . . . . . . . . . . 35 5.2.3.7. Notes on Self-Signatures . . . . . . . . . . . . 37
5.2.3.8. Signature Creation Time . . . . . . . . . . . . . 36 5.2.3.8. Signature Creation Time . . . . . . . . . . . . . 38
5.2.3.9. Issuer . . . . . . . . . . . . . . . . . . . . . 36 5.2.3.9. Issuer . . . . . . . . . . . . . . . . . . . . . 38
5.2.3.10. Key Expiration Time . . . . . . . . . . . . . . . 36 5.2.3.10. Key Expiration Time . . . . . . . . . . . . . . . 38
5.2.3.11. Preferred Symmetric Algorithms . . . . . . . . . 36 5.2.3.11. Preferred Symmetric Ciphers for v1 SEIPD . . . . 39
5.2.3.12. Preferred Hash Algorithms . . . . . . . . . . . . 37 5.2.3.12. Preferred AEAD Ciphersuites . . . . . . . . . . . 39
5.2.3.13. Preferred Compression Algorithms . . . . . . . . 37 5.2.3.13. Preferred Hash Algorithms . . . . . . . . . . . . 40
5.2.3.14. Signature Expiration Time . . . . . . . . . . . . 37 5.2.3.14. Preferred Compression Algorithms . . . . . . . . 40
5.2.3.15. Exportable Certification . . . . . . . . . . . . 37 5.2.3.15. Signature Expiration Time . . . . . . . . . . . . 40
5.2.3.16. Revocable . . . . . . . . . . . . . . . . . . . . 38 5.2.3.16. Exportable Certification . . . . . . . . . . . . 40
5.2.3.17. Trust Signature . . . . . . . . . . . . . . . . . 38 5.2.3.17. Revocable . . . . . . . . . . . . . . . . . . . . 41
5.2.3.18. Regular Expression . . . . . . . . . . . . . . . 38 5.2.3.18. Trust Signature . . . . . . . . . . . . . . . . . 41
5.2.3.19. Revocation Key . . . . . . . . . . . . . . . . . 39 5.2.3.19. Regular Expression . . . . . . . . . . . . . . . 42
5.2.3.20. Notation Data . . . . . . . . . . . . . . . . . . 39 5.2.3.20. Revocation Key . . . . . . . . . . . . . . . . . 42
5.2.3.21. Key Server Preferences . . . . . . . . . . . . . 40 5.2.3.21. Notation Data . . . . . . . . . . . . . . . . . . 43
5.2.3.22. Preferred Key Server . . . . . . . . . . . . . . 41 5.2.3.22. Key Server Preferences . . . . . . . . . . . . . 44
5.2.3.23. Primary User ID . . . . . . . . . . . . . . . . . 41 5.2.3.23. Preferred Key Server . . . . . . . . . . . . . . 44
5.2.3.24. Policy URI . . . . . . . . . . . . . . . . . . . 41 5.2.3.24. Primary User ID . . . . . . . . . . . . . . . . . 45
5.2.3.25. Key Flags . . . . . . . . . . . . . . . . . . . . 42 5.2.3.25. Policy URI . . . . . . . . . . . . . . . . . . . 45
5.2.3.26. Signer's User ID . . . . . . . . . . . . . . . . 43 5.2.3.26. Key Flags . . . . . . . . . . . . . . . . . . . . 45
5.2.3.27. Reason for Revocation . . . . . . . . . . . . . . 43 5.2.3.27. Signer's User ID . . . . . . . . . . . . . . . . 47
5.2.3.28. Features . . . . . . . . . . . . . . . . . . . . 45 5.2.3.28. Reason for Revocation . . . . . . . . . . . . . . 47
5.2.3.29. Signature Target . . . . . . . . . . . . . . . . 45 5.2.3.29. Features . . . . . . . . . . . . . . . . . . . . 49
5.2.3.30. Embedded Signature . . . . . . . . . . . . . . . 46 5.2.3.30. Signature Target . . . . . . . . . . . . . . . . 50
5.2.3.31. Issuer Fingerprint . . . . . . . . . . . . . . . 46 5.2.3.31. Embedded Signature . . . . . . . . . . . . . . . 50
5.2.3.32. Intended Recipient Fingerprint . . . . . . . . . 46 5.2.3.32. Issuer Fingerprint . . . . . . . . . . . . . . . 50
5.2.4. Computing Signatures . . . . . . . . . . . . . . . . 46 5.2.3.33. Intended Recipient Fingerprint . . . . . . . . . 50
5.2.4.1. Subpacket Hints . . . . . . . . . . . . . . . . . 49 5.2.4. Computing Signatures . . . . . . . . . . . . . . . . 51
5.3. Symmetric-Key Encrypted Session Key Packets (Tag 3) . . . 49 5.2.4.1. Subpacket Hints . . . . . . . . . . . . . . . . . 52
5.3.1. No v5 SKESK with SEIPD . . . . . . . . . . . . . . . 51 5.3. Symmetric-Key Encrypted Session Key Packets (Tag 3) . . . 53
5.4. One-Pass Signature Packets (Tag 4) . . . . . . . . . . . 51 5.3.1. v4 SKESK . . . . . . . . . . . . . . . . . . . . . . 53
5.5. Key Material Packet . . . . . . . . . . . . . . . . . . . 52 5.3.2. v5 SKESK . . . . . . . . . . . . . . . . . . . . . . 54
5.5.1. Key Packet Variants . . . . . . . . . . . . . . . . . 52 5.4. One-Pass Signature Packets (Tag 4) . . . . . . . . . . . 55
5.5.1.1. Public-Key Packet (Tag 6) . . . . . . . . . . . . 52 5.5. Key Material Packet . . . . . . . . . . . . . . . . . . . 56
5.5.1.2. Public-Subkey Packet (Tag 14) . . . . . . . . . . 52 5.5.1. Key Packet Variants . . . . . . . . . . . . . . . . . 56
5.5.1.3. Secret-Key Packet (Tag 5) . . . . . . . . . . . . 52 5.5.1.1. Public-Key Packet (Tag 6) . . . . . . . . . . . . 56
5.5.1.4. Secret-Subkey Packet (Tag 7) . . . . . . . . . . 52 5.5.1.2. Public-Subkey Packet (Tag 14) . . . . . . . . . . 57
5.5.2. Public-Key Packet Formats . . . . . . . . . . . . . . 53 5.5.1.3. Secret-Key Packet (Tag 5) . . . . . . . . . . . . 57
5.5.3. Secret-Key Packet Formats . . . . . . . . . . . . . . 54 5.5.1.4. Secret-Subkey Packet (Tag 7) . . . . . . . . . . 57
5.6. Algorithm-specific Parts of Keys . . . . . . . . . . . . 57 5.5.2. Public-Key Packet Formats . . . . . . . . . . . . . . 57
5.6.1. Algorithm-Specific Part for RSA Keys . . . . . . . . 57 5.5.3. Secret-Key Packet Formats . . . . . . . . . . . . . . 59
5.6.2. Algorithm-Specific Part for DSA Keys . . . . . . . . 57 5.6. Algorithm-specific Parts of Keys . . . . . . . . . . . . 61
5.6.3. Algorithm-Specific Part for Elgamal Keys . . . . . . 57 5.6.1. Algorithm-Specific Part for RSA Keys . . . . . . . . 62
5.6.4. Algorithm-Specific Part for ECDSA Keys . . . . . . . 58 5.6.2. Algorithm-Specific Part for DSA Keys . . . . . . . . 62
5.6.5. Algorithm-Specific Part for EdDSA Keys . . . . . . . 58 5.6.3. Algorithm-Specific Part for Elgamal Keys . . . . . . 62
5.6.6. Algorithm-Specific Part for ECDH Keys . . . . . . . . 59 5.6.4. Algorithm-Specific Part for ECDSA Keys . . . . . . . 63
5.7. Compressed Data Packet (Tag 8) . . . . . . . . . . . . . 59 5.6.5. Algorithm-Specific Part for EdDSA Keys . . . . . . . 63
5.8. Symmetrically Encrypted Data Packet (Tag 9) . . . . . . . 60 5.6.6. Algorithm-Specific Part for ECDH Keys . . . . . . . . 63
5.9. Marker Packet (Obsolete Literal Packet) (Tag 10) . . . . 61 5.6.6.1. ECDH Secret Key Material . . . . . . . . . . . . 64
5.10. Literal Data Packet (Tag 11) . . . . . . . . . . . . . . 61 5.7. Compressed Data Packet (Tag 8) . . . . . . . . . . . . . 65
5.11. Trust Packet (Tag 12) . . . . . . . . . . . . . . . . . . 62 5.8. Symmetrically Encrypted Data Packet (Tag 9) . . . . . . . 66
5.12. User ID Packet (Tag 13) . . . . . . . . . . . . . . . . . 63 5.9. Marker Packet (Tag 10) . . . . . . . . . . . . . . . . . 67
5.13. User Attribute Packet (Tag 17) . . . . . . . . . . . . . 63 5.10. Literal Data Packet (Tag 11) . . . . . . . . . . . . . . 67
5.13.1. The Image Attribute Subpacket . . . . . . . . . . . 64 5.10.1. Special Filename _CONSOLE (Deprecated) . . . . . . . 69
5.11. Trust Packet (Tag 12) . . . . . . . . . . . . . . . . . . 69
5.12. User ID Packet (Tag 13) . . . . . . . . . . . . . . . . . 70
5.13. User Attribute Packet (Tag 17) . . . . . . . . . . . . . 70
5.13.1. The Image Attribute Subpacket . . . . . . . . . . . 71
5.14. Sym. Encrypted Integrity Protected Data Packet (Tag 5.14. Sym. Encrypted Integrity Protected Data Packet (Tag
18) . . . . . . . . . . . . . . . . . . . . . . . . . . 64 18) . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.15. Modification Detection Code Packet (Tag 19) . . . . . . . 67 5.14.1. Version 1 Sym. Encrypted Integrity Protected Data
5.16. AEAD Encrypted Data Packet (Tag 20) . . . . . . . . . . . 68 Packet Format . . . . . . . . . . . . . . . . . . . . 72
5.16.1. EAX Mode . . . . . . . . . . . . . . . . . . . . . . 69 5.14.2. Version 2 Sym. Encrypted Integrity Protected Data
5.16.2. OCB Mode . . . . . . . . . . . . . . . . . . . . . . 70 Packet Format . . . . . . . . . . . . . . . . . . . . 74
6. Radix-64 Conversions . . . . . . . . . . . . . . . . . . . . 70 5.14.3. EAX Mode . . . . . . . . . . . . . . . . . . . . . . 76
6.1. An Implementation of the CRC-24 in "C" . . . . . . . . . 71 5.14.4. OCB Mode . . . . . . . . . . . . . . . . . . . . . . 76
6.2. Forming ASCII Armor . . . . . . . . . . . . . . . . . . . 71 5.14.5. GCM Mode . . . . . . . . . . . . . . . . . . . . . . 76
6.3. Encoding Binary in Radix-64 . . . . . . . . . . . . . . . 74 5.15. Padding Packet (Tag 21) . . . . . . . . . . . . . . . . . 76
6.4. Decoding Radix-64 . . . . . . . . . . . . . . . . . . . . 76 6. Radix-64 Conversions . . . . . . . . . . . . . . . . . . . . 77
6.5. Examples of Radix-64 . . . . . . . . . . . . . . . . . . 76 6.1. An Implementation of the CRC-24 in "C" . . . . . . . . . 78
6.6. Example of an ASCII Armored Message . . . . . . . . . . . 77 6.2. Forming ASCII Armor . . . . . . . . . . . . . . . . . . . 78
7. Cleartext Signature Framework . . . . . . . . . . . . . . . . 77 6.3. Encoding Binary in Radix-64 . . . . . . . . . . . . . . . 81
7.1. Dash-Escaped Text . . . . . . . . . . . . . . . . . . . . 78 6.4. Decoding Radix-64 . . . . . . . . . . . . . . . . . . . . 83
8. Regular Expressions . . . . . . . . . . . . . . . . . . . . . 79 6.5. Examples of Radix-64 . . . . . . . . . . . . . . . . . . 83
9. Constants . . . . . . . . . . . . . . . . . . . . . . . . . . 79 6.6. Example of an ASCII Armored Message . . . . . . . . . . . 84
9.1. Public-Key Algorithms . . . . . . . . . . . . . . . . . . 80 7. Cleartext Signature Framework . . . . . . . . . . . . . . . . 84
9.2. ECC Curves for OpenPGP . . . . . . . . . . . . . . . . . 82 7.1. Dash-Escaped Text . . . . . . . . . . . . . . . . . . . . 85
9.2.1. Curve-Specific Wire Formats . . . . . . . . . . . . . 83 8. Regular Expressions . . . . . . . . . . . . . . . . . . . . . 86
9.3. Symmetric-Key Algorithms . . . . . . . . . . . . . . . . 84 9. Constants . . . . . . . . . . . . . . . . . . . . . . . . . . 87
9.4. Compression Algorithms . . . . . . . . . . . . . . . . . 85 9.1. Public-Key Algorithms . . . . . . . . . . . . . . . . . . 87
9.5. Hash Algorithms . . . . . . . . . . . . . . . . . . . . . 86 9.2. ECC Curves for OpenPGP . . . . . . . . . . . . . . . . . 89
9.6. AEAD Algorithms . . . . . . . . . . . . . . . . . . . . . 87 9.2.1. Curve-Specific Wire Formats . . . . . . . . . . . . . 91
10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 87 9.3. Symmetric-Key Algorithms . . . . . . . . . . . . . . . . 92
10.1. New String-to-Key Specifier Types . . . . . . . . . . . 87 9.4. Compression Algorithms . . . . . . . . . . . . . . . . . 93
10.2. New Packets . . . . . . . . . . . . . . . . . . . . . . 88 9.5. Hash Algorithms . . . . . . . . . . . . . . . . . . . . . 93
10.2.1. User Attribute Types . . . . . . . . . . . . . . . . 88 9.6. AEAD Algorithms . . . . . . . . . . . . . . . . . . . . . 94
10.2.1.1. Image Format Subpacket Types . . . . . . . . . . 88 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 95
10.2.2. New Signature Subpackets . . . . . . . . . . . . . . 88 10.1. New String-to-Key Specifier Types . . . . . . . . . . . 95
10.2.2.1. Signature Notation Data Subpackets . . . . . . . 89 10.2. New Packets . . . . . . . . . . . . . . . . . . . . . . 95
10.2.1. User Attribute Types . . . . . . . . . . . . . . . . 96
10.2.1.1. Image Format Subpacket Types . . . . . . . . . . 96
10.2.2. New Signature Subpackets . . . . . . . . . . . . . . 96
10.2.2.1. Signature Notation Data Subpackets . . . . . . . 96
10.2.2.2. Signature Notation Data Subpacket Notation 10.2.2.2. Signature Notation Data Subpacket Notation
Flags . . . . . . . . . . . . . . . . . . . . . . . 89 Flags . . . . . . . . . . . . . . . . . . . . . . . 97
10.2.2.3. Key Server Preference Extensions . . . . . . . . 89 10.2.2.3. Key Server Preference Extensions . . . . . . . . 97
10.2.2.4. Key Flags Extensions . . . . . . . . . . . . . . 89 10.2.2.4. Key Flags Extensions . . . . . . . . . . . . . . 97
10.2.2.5. Reason for Revocation Extensions . . . . . . . . 90 10.2.2.5. Reason for Revocation Extensions . . . . . . . . 97
10.2.2.6. Implementation Features . . . . . . . . . . . . 90 10.2.2.6. Implementation Features . . . . . . . . . . . . 97
10.2.3. New Packet Versions . . . . . . . . . . . . . . . . 90 10.2.3. New Packet Versions . . . . . . . . . . . . . . . . 98
10.3. New Algorithms . . . . . . . . . . . . . . . . . . . . . 90 10.3. New Algorithms . . . . . . . . . . . . . . . . . . . . . 98
10.3.1. Public-Key Algorithms . . . . . . . . . . . . . . . 91 10.3.1. Public-Key Algorithms . . . . . . . . . . . . . . . 98
10.3.2. Symmetric-Key Algorithms . . . . . . . . . . . . . . 91 10.3.2. Symmetric-Key Algorithms . . . . . . . . . . . . . . 99
10.3.3. Hash Algorithms . . . . . . . . . . . . . . . . . . 91 10.3.3. Hash Algorithms . . . . . . . . . . . . . . . . . . 99
10.3.4. Compression Algorithms . . . . . . . . . . . . . . . 92 10.3.4. Compression Algorithms . . . . . . . . . . . . . . . 100
10.3.5. Elliptic Curve Algorithms . . . . . . . . . . . . . 92 10.3.5. Elliptic Curve Algorithms . . . . . . . . . . . . . 100
10.4. Elliptic Curve Point and Scalar Wire Formats . . . . . . 93 10.4. Elliptic Curve Point and Scalar Wire Formats . . . . . . 100
10.5. Changes to existing registries . . . . . . . . . . . . . 93 10.5. Changes to existing registries . . . . . . . . . . . . . 101
11. Packet Composition . . . . . . . . . . . . . . . . . . . . . 93 11. Packet Composition . . . . . . . . . . . . . . . . . . . . . 101
11.1. Transferable Public Keys . . . . . . . . . . . . . . . . 93 11.1. Transferable Public Keys . . . . . . . . . . . . . . . . 101
11.2. Transferable Secret Keys . . . . . . . . . . . . . . . . 95 11.2. Transferable Secret Keys . . . . . . . . . . . . . . . . 103
11.3. OpenPGP Messages . . . . . . . . . . . . . . . . . . . . 95 11.3. OpenPGP Messages . . . . . . . . . . . . . . . . . . . . 103
11.4. Detached Signatures . . . . . . . . . . . . . . . . . . 96 11.3.1. Unwrapping Encrypted and Compressed Messages . . . . 104
12. Enhanced Key Formats . . . . . . . . . . . . . . . . . . . . 96 11.3.2. Additional Constraints on Packet Sequences . . . . . 104
12.1. Key Structures . . . . . . . . . . . . . . . . . . . . . 96 11.3.2.1. Packet Versions in Encrypted Messages . . . . . 105
12.2. Key IDs and Fingerprints . . . . . . . . . . . . . . . . 97 11.4. Detached Signatures . . . . . . . . . . . . . . . . . . 106
13. Elliptic Curve Cryptography . . . . . . . . . . . . . . . . . 99 12. Enhanced Key Formats . . . . . . . . . . . . . . . . . . . . 106
13.1. Supported ECC Curves . . . . . . . . . . . . . . . . . . 99 12.1. Key Structures . . . . . . . . . . . . . . . . . . . . . 106
13.2. EC Point Wire Formats . . . . . . . . . . . . . . . . . 100 12.2. Key IDs and Fingerprints . . . . . . . . . . . . . . . . 107
13.2.1. SEC1 EC Point Wire Format . . . . . . . . . . . . . 100 13. Elliptic Curve Cryptography . . . . . . . . . . . . . . . . . 108
13.2.2. Prefixed Native EC Point Wire Format . . . . . . . . 100 13.1. Supported ECC Curves . . . . . . . . . . . . . . . . . . 109
13.2.3. Notes on EC Point Wire Formats . . . . . . . . . . . 101 13.2. EC Point Wire Formats . . . . . . . . . . . . . . . . . 109
13.3. EC Scalar Wire Formats . . . . . . . . . . . . . . . . . 101 13.2.1. SEC1 EC Point Wire Format . . . . . . . . . . . . . 109
13.3.1. EC Octet String Wire Format . . . . . . . . . . . . 102 13.2.2. Prefixed Native EC Point Wire Format . . . . . . . . 110
13.3.2. Elliptic Curve Prefixed Octet String Wire Format . . 103 13.2.3. Notes on EC Point Wire Formats . . . . . . . . . . . 110
13.4. Key Derivation Function . . . . . . . . . . . . . . . . 103 13.3. EC Scalar Wire Formats . . . . . . . . . . . . . . . . . 110
13.5. EC DH Algorithm (ECDH) . . . . . . . . . . . . . . . . . 104 13.3.1. EC Octet String Wire Format . . . . . . . . . . . . 111
14. Notes on Algorithms . . . . . . . . . . . . . . . . . . . . . 107 13.3.2. Elliptic Curve Prefixed Octet String Wire Format . . 112
14.1. PKCS#1 Encoding in OpenPGP . . . . . . . . . . . . . . . 107 13.4. Key Derivation Function . . . . . . . . . . . . . . . . 112
14.1.1. EME-PKCS1-v1_5-ENCODE . . . . . . . . . . . . . . . 107 13.5. EC DH Algorithm (ECDH) . . . . . . . . . . . . . . . . . 113
14.1.2. EME-PKCS1-v1_5-DECODE . . . . . . . . . . . . . . . 108 14. Notes on Algorithms . . . . . . . . . . . . . . . . . . . . . 116
14.1.3. EMSA-PKCS1-v1_5 . . . . . . . . . . . . . . . . . . 108 14.1. PKCS#1 Encoding in OpenPGP . . . . . . . . . . . . . . . 116
14.2. Symmetric Algorithm Preferences . . . . . . . . . . . . 109 14.1.1. EME-PKCS1-v1_5-ENCODE . . . . . . . . . . . . . . . 116
14.3. Other Algorithm Preferences . . . . . . . . . . . . . . 110 14.1.2. EME-PKCS1-v1_5-DECODE . . . . . . . . . . . . . . . 117
14.3.1. Compression Preferences . . . . . . . . . . . . . . 110 14.1.3. EMSA-PKCS1-v1_5 . . . . . . . . . . . . . . . . . . 118
14.3.2. Hash Algorithm Preferences . . . . . . . . . . . . . 111 14.2. Symmetric Algorithm Preferences . . . . . . . . . . . . 119
14.2.1. Plaintext . . . . . . . . . . . . . . . . . . . . . 119
14.4. Plaintext . . . . . . . . . . . . . . . . . . . . . . . 111 14.3. Other Algorithm Preferences . . . . . . . . . . . . . . 120
14.5. RSA . . . . . . . . . . . . . . . . . . . . . . . . . . 111 14.3.1. Compression Preferences . . . . . . . . . . . . . . 120
14.6. DSA . . . . . . . . . . . . . . . . . . . . . . . . . . 112 14.3.1.1. Uncompressed . . . . . . . . . . . . . . . . . . 120
14.7. Elgamal . . . . . . . . . . . . . . . . . . . . . . . . 112 14.3.2. Hash Algorithm Preferences . . . . . . . . . . . . . 120
14.8. EdDSA . . . . . . . . . . . . . . . . . . . . . . . . . 112 14.4. RSA . . . . . . . . . . . . . . . . . . . . . . . . . . 121
14.9. Reserved Algorithm Numbers . . . . . . . . . . . . . . . 113 14.5. DSA . . . . . . . . . . . . . . . . . . . . . . . . . . 121
14.10. OpenPGP CFB Mode . . . . . . . . . . . . . . . . . . . . 113 14.6. Elgamal . . . . . . . . . . . . . . . . . . . . . . . . 121
14.11. Private or Experimental Parameters . . . . . . . . . . . 115 14.7. EdDSA . . . . . . . . . . . . . . . . . . . . . . . . . 122
14.12. Extension of the MDC System . . . . . . . . . . . . . . 115 14.8. Reserved Algorithm Numbers . . . . . . . . . . . . . . . 122
14.13. Meta-Considerations for Expansion . . . . . . . . . . . 116 14.9. OpenPGP CFB Mode . . . . . . . . . . . . . . . . . . . . 122
15. Security Considerations . . . . . . . . . . . . . . . . . . . 116 14.10. Private or Experimental Parameters . . . . . . . . . . . 124
16. Implementation Nits . . . . . . . . . . . . . . . . . . . . . 122 14.11. Meta-Considerations for Expansion . . . . . . . . . . . 124
17. References . . . . . . . . . . . . . . . . . . . . . . . . . 124 15. Security Considerations . . . . . . . . . . . . . . . . . . . 124
17.1. Normative References . . . . . . . . . . . . . . . . . . 124 15.1. Avoiding Ciphertext Malleability . . . . . . . . . . . . 128
17.2. Informative References . . . . . . . . . . . . . . . . . 127 15.2. Escrowed Revocation Signatures . . . . . . . . . . . . . 130
Appendix A. Test vectors . . . . . . . . . . . . . . . . . . . . 128 15.3. Random Number Generation and Seeding . . . . . . . . . . 131
A.1. Sample EdDSA key . . . . . . . . . . . . . . . . . . . . 128 15.4. Traffic Analysis . . . . . . . . . . . . . . . . . . . . 131
A.2. Sample EdDSA signature . . . . . . . . . . . . . . . . . 129 16. Implementation Nits . . . . . . . . . . . . . . . . . . . . . 132
A.3. Sample AEAD-EAX encryption and decryption . . . . . . . . 129 17. References . . . . . . . . . . . . . . . . . . . . . . . . . 133
A.3.1. Sample Parameters . . . . . . . . . . . . . . . . . . 129 17.1. Normative References . . . . . . . . . . . . . . . . . . 133
17.2. Informative References . . . . . . . . . . . . . . . . . 136
Appendix A. Test vectors . . . . . . . . . . . . . . . . . . . . 138
A.1. Sample EdDSA key . . . . . . . . . . . . . . . . . . . . 138
A.2. Sample EdDSA signature . . . . . . . . . . . . . . . . . 138
A.3. Sample AEAD-EAX encryption and decryption . . . . . . . . 139
A.3.1. Sample Parameters . . . . . . . . . . . . . . . . . . 139
A.3.2. Sample symmetric-key encrypted session key packet A.3.2. Sample symmetric-key encrypted session key packet
(v5) . . . . . . . . . . . . . . . . . . . . . . . . 130 (v5) . . . . . . . . . . . . . . . . . . . . . . . . 139
A.3.3. Starting AEAD-EAX decryption of CEK . . . . . . . . . 130 A.3.3. Starting AEAD-EAX decryption of the session key . . . 140
A.3.4. Initial Content Encryption Key . . . . . . . . . . . 131 A.3.4. Sample v2 SEIPD packet . . . . . . . . . . . . . . . 140
A.3.5. Sample AEAD encrypted data packet . . . . . . . . . . 131 A.3.5. Decryption of data . . . . . . . . . . . . . . . . . 141
A.3.6. Decryption of data . . . . . . . . . . . . . . . . . 131 A.3.6. Complete AEAD-EAX encrypted packet sequence . . . . . 142
A.3.7. Complete AEAD-EAX encrypted packet sequence . . . . . 132
A.4. Sample AEAD-OCB encryption and decryption . . . . . . . . 132 A.4. Sample AEAD-OCB encryption and decryption . . . . . . . . 142
A.4.1. Sample Parameters . . . . . . . . . . . . . . . . . . 132 A.4.1. Sample Parameters . . . . . . . . . . . . . . . . . . 142
A.4.2. Sample symmetric-key encrypted session key packet A.4.2. Sample symmetric-key encrypted session key packet
(v5) . . . . . . . . . . . . . . . . . . . . . . . . 133 (v5) . . . . . . . . . . . . . . . . . . . . . . . . 143
A.4.3. Starting AEAD-OCB decryption of CEK . . . . . . . . . 133 A.4.3. Starting AEAD-EAX decryption of the session key . . . 143
A.4.4. Initial Content Encryption Key . . . . . . . . . . . 134 A.4.4. Sample v2 SEIPD packet . . . . . . . . . . . . . . . 144
A.4.5. Sample AEAD encrypted data packet . . . . . . . . . . 134 A.4.5. Decryption of data . . . . . . . . . . . . . . . . . 144
A.4.6. Decryption of data . . . . . . . . . . . . . . . . . 134 A.4.6. Complete AEAD-EAX encrypted packet sequence . . . . . 145
A.4.7. Complete AEAD-OCB encrypted packet sequence . . . . . 135 A.5. Sample AEAD-GCM encryption and decryption . . . . . . . . 146
Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 135 A.5.1. Sample Parameters . . . . . . . . . . . . . . . . . . 146
Appendix C. Document Workflow . . . . . . . . . . . . . . . . . 136 A.5.2. Sample symmetric-key encrypted session key packet
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 136 (v5) . . . . . . . . . . . . . . . . . . . . . . . . 146
A.5.3. Starting AEAD-EAX decryption of the session key . . . 146
A.5.4. Sample v2 SEIPD packet . . . . . . . . . . . . . . . 147
A.5.5. Decryption of data . . . . . . . . . . . . . . . . . 148
A.5.6. Complete AEAD-EAX encrypted packet sequence . . . . . 149
A.6. Sample message encrypted using Argon2 . . . . . . . . . . 149
Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 150
Appendix C. Document Workflow . . . . . . . . . . . . . . . . . 150
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 150
1. Introduction 1. Introduction
{ This is work in progress to update OpenPGP. Editorial notes are
enclosed in curly braces. }
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 RFC 4880, "OpenPGP
Message Format", which is a revision of RFC 2440, which itself Message Format", which is a revision of RFC 2440, which itself
replaces RFC 1991, "PGP Message Exchange Formats" [RFC1991] [RFC2440] replaces RFC 1991, "PGP Message Exchange Formats" [RFC1991] [RFC2440]
[RFC4880]. [RFC4880].
This document obsoletes: RFC 4880 (OpenPGP), RFC 5581 (Camellia in This document obsoletes: RFC 4880 (OpenPGP), RFC 5581 (Camellia in
OpenPGP) and RFC 6637 (Elliptic Curves in OpenPGP). OpenPGP) and RFC 6637 (Elliptic Curves in OpenPGP).
skipping to change at page 7, line 39 skipping to change at page 8, line 20
* GnuPG - GNU Privacy Guard, also called GPG. GnuPG is an OpenPGP * GnuPG - GNU Privacy Guard, also called GPG. GnuPG is an OpenPGP
implementation that avoids all encumbered algorithms. implementation that avoids all encumbered algorithms.
Consequently, early versions of GnuPG did not include RSA public Consequently, early versions of GnuPG did not include RSA public
keys. keys.
"PGP", "Pretty Good", and "Pretty Good Privacy" are trademarks of PGP "PGP", "Pretty Good", and "Pretty Good Privacy" are trademarks of PGP
Corporation and are used with permission. The term "OpenPGP" refers Corporation and are used with permission. The term "OpenPGP" refers
to the protocol described in this and related documents. to the protocol described in this and related documents.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
document are to be interpreted as described in [RFC2119]. "OPTIONAL" in this document are to be interpreted as described in BCP
14 [RFC2119] [RFC8174] when, and only when, they appear in all
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].
2. General functions 2. General functions
OpenPGP provides data integrity services for messages and data files OpenPGP provides data integrity services for messages and data files
by using these core technologies: by using these core technologies:
skipping to change at page 8, line 34 skipping to change at page 9, line 17
1. The sender creates a message. 1. The sender creates a message.
2. The sending OpenPGP generates a random number to be used as a 2. The sending OpenPGP generates a random number to be used as a
session key for this message only. session key for this message only.
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 encrypts the message using the session key, 4. The sending OpenPGP encrypts the message using the session key,
which forms the remainder of the message. Note that the message which forms the remainder of the message.
is also usually compressed.
5. The receiving OpenPGP decrypts the session key using the 5. The receiving OpenPGP decrypts the session key using the
recipient's private key. recipient's private key.
6. The receiving OpenPGP decrypts the message using the session key. 6. The receiving OpenPGP decrypts the message using the session key.
If the message was compressed, it will be decompressed. If the message was compressed, it will be decompressed.
With symmetric-key encryption, an object may be encrypted with a With symmetric-key encryption, an object may be encrypted with a
symmetric key derived from a passphrase (or other shared secret), or symmetric key derived from a passphrase (or other shared secret), or
a two-stage mechanism similar to the public-key method described a two-stage mechanism similar to the public-key method described
skipping to change at page 9, line 30 skipping to change at page 10, line 13
4. The binary signature is attached to the message. 4. The binary signature is attached to the message.
5. The receiving software keeps a copy of the message signature. 5. The receiving software keeps a copy of the message signature.
6. The receiving software generates a new hash code for the received 6. The receiving software generates a new hash code for the received
message and verifies it using the message's signature. If the message and verifies it using the message's signature. If the
verification is successful, the message is accepted as authentic. verification is successful, the message is accepted as authentic.
2.3. Compression 2.3. Compression
OpenPGP implementations SHOULD compress the message after applying
the signature but before encryption.
If an implementation does not implement compression, its authors If an implementation does not implement compression, its authors
should be aware that most OpenPGP messages in the world are should be aware that most OpenPGP messages in the world are
compressed. Thus, it may even be wise for a space-constrained compressed. Thus, it may even be wise for a space-constrained
implementation to implement decompression, but not compression. implementation to implement decompression, but not compression.
Furthermore, compression has the added side effect that some types of
attacks can be thwarted by the fact that slightly altered, compressed
data rarely uncompresses without severe errors. This is hardly
rigorous, but it is operationally useful. These attacks can be
rigorously prevented by implementing and using Modification Detection
Codes as described in sections following.
2.4. Conversion to Radix-64 2.4. Conversion to Radix-64
OpenPGP's underlying native representation for encrypted messages, OpenPGP's underlying native representation for encrypted messages,
signature certificates, and keys is a stream of arbitrary octets. signature certificates, and keys 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 seven-bit,
printable text. For transporting OpenPGP's native raw binary octets printable text. For transporting OpenPGP's native raw binary octets
through channels that are not safe to raw binary data, a printable through channels that are not safe to raw binary data, a printable
encoding of these binary octets is needed. OpenPGP provides the encoding of these binary octets is needed. OpenPGP provides the
service of converting the raw 8-bit binary octet stream to a stream service of converting the raw 8-bit binary octet stream to a stream
of printable ASCII characters, called Radix-64 encoding or ASCII of printable ASCII characters, called Radix-64 encoding or ASCII
skipping to change at page 11, line 39 skipping to change at page 11, line 52
string of known, fixed length (see Section 13.3). The wire string of known, fixed length (see Section 13.3). The wire
representation is the same: two octets of length in bits counted from representation is the same: two 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 3.3. Key IDs
A Key ID is an eight-octet scalar that identifies a key. A Key ID is an eight-octet scalar that identifies a key.
Implementations SHOULD NOT assume that Key IDs are unique. Implementations SHOULD NOT assume that Key IDs are unique.
Section 12 describes how Key IDs are formed. Section 12.2 describes how Key IDs 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 four-octet number containing the number
of seconds elapsed since midnight, 1 January 1970 UTC. of 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 Traditionally, a keyring is simply a sequential list of keys, but 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 standard to
discuss the details of keyrings or other databases. discuss the details of keyrings or other databases.
3.7. String-to-Key (S2K) Specifiers 3.7. String-to-Key (S2K) Specifiers
String-to-key (S2K) specifiers are used to convert passphrase strings A string-to-key (S2K) specifier is used to convert a passphrase
into symmetric-key encryption/decryption keys. They are used in two string into a symmetric-key encryption/decryption key. They are used
places, currently: to encrypt the secret part of private keys in the in two places, currently: to encrypt the secret part of private keys
private keyring, and to convert passphrases to encryption keys for in the private keyring, and to convert passphrases to encryption keys
symmetrically encrypted messages. for symmetrically encrypted messages.
3.7.1. String-to-Key (S2K) Specifier Types 3.7.1. String-to-Key (S2K) Specifier Types
There are three types of S2K specifiers currently supported, and some There are four types of S2K specifiers currently supported, and some
reserved values: reserved values:
+========+==================+==================+=================+ +=====+==============+==================+===============+===========+
| ID | S2K Type | Generate? | Reference | | ID | S2K Type | Generate? | S2K field | Reference |
+========+==================+==================+=================+ | | | | size (octets) | |
| 0 | Simple S2K | N | Section 3.7.1.1 | +=====+==============+==================+===============+===========+
+--------+------------------+------------------+-----------------+ | 0 | Simple S2K | N | 2 | Section |
| 1 | Salted S2K | Only when string | Section 3.7.1.2 | | | | | | 3.7.1.1 |
| | | is high entropy | | +-----+--------------+------------------+---------------+-----------+
+--------+------------------+------------------+-----------------+ | 1 | Salted S2K | Only when | 10 | Section |
| 2 | Reserved value | N | | | | | string is | | 3.7.1.2 |
+--------+------------------+------------------+-----------------+ | | | high entropy | | |
| 3 | Iterated and | Y | Section 3.7.1.3 | +-----+--------------+------------------+---------------+-----------+
| | Salted S2K | | | | 2 | Reserved | N | | |
+--------+------------------+------------------+-----------------+ | | value | | | |
| 4 | Argon2 | Y | Section 3.7.1.4 | +-----+--------------+------------------+---------------+-----------+
+--------+------------------+------------------+-----------------+ | 3 | Iterated and | Y | 11 | Section |
| 100 to | Private/ | As appropriate | | | | Salted S2K | | | 3.7.1.3 |
| 110 | Experimental S2K | | | +-----+--------------+------------------+---------------+-----------+
+--------+------------------+------------------+-----------------+ | 4 | Argon2 | Y | 20 | Section |
| | | | | 3.7.1.4 |
+-----+--------------+------------------+---------------+-----------+
| 100 | Private/ | As | | |
| to | Experimental | appropriate | | |
| 110 | S2K | | | |
+-----+--------------+------------------+---------------+-----------+
Table 1: S2K type registry Table 1: S2K type registry
These are described in the subsections below. These are described in the subsections below.
3.7.1.1. Simple S2K 3.7.1.1. Simple S2K
This directly hashes the string to produce the key data. See below This directly hashes the string to produce the key data. See below
for how this hashing is done. for how this hashing is done.
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 will depend on the cipher used) and the size of the hash (which will depend on the cipher used) and the size of the hash
algorithm's output. If the hash size is greater than the session key algorithm's output. If the hash size is greater than the session key
size, the high-order (leftmost) octets of the hash are used as the size, the high-order (leftmost) octets of the hash are used as the
key. 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 to say, the first instance has no preloading, the second gets
preloaded with 1 octet of zero, the third is preloaded with two preloaded with 1 octet of zero, the third is preloaded with two
octets of zeros, and so forth). octets of zeros, 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 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, with any excess octets
on the right discarded. on the right discarded.
3.7.1.2. Salted S2K 3.7.1.2. Salted S2K
This includes a "salt" value in the S2K specifier -- some arbitrary This includes a "salt" value in the S2K specifier --- some arbitrary
data -- that gets hashed along with the passphrase string, to help data --- that gets hashed along with the passphrase string, to help
prevent dictionary attacks. 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.
skipping to change at page 15, line 5 skipping to change at page 15, line 38
Octets 1-16: 16-octet salt value Octets 1-16: 16-octet salt value
Octet 17: one-octet number of passes t Octet 17: one-octet number of passes t
Octet 18: one-octet degree of parallelism p Octet 18: one-octet degree of parallelism p
Octet 19: one-octet exponent indicating the memory size m Octet 19: one-octet exponent indicating the memory size m
The salt SHOULD be unique for each password. The salt SHOULD be unique for each password.
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, where "encoded_m" is the encoded The memory size m is 2**encoded_m kibibytes of RAM, where "encoded_m"
memory size in Octet 19. The encoded memory size MUST be a value is the encoded memory size in Octet 19. The encoded memory size MUST
from 3+ceil(log_2(p)) to 31, such that the decoded memory size m is a be a value from 3+ceil(log_2(p)) to 31, such that the decoded memory
value from 8*p to 2**31. size m is a value from 8*p to 2**31. Note that memory-hardness size
is indicated in kibibytes (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 [RFC9106].
If the recommended value of m for a given application is not a power If the recommended value of m for a given application is not a power
of 2, it is RECOMMENDED to round up to the next power of 2 if the of 2, it is RECOMMENDED to round up to the next power of 2 if the
resulting performance would be acceptable, and round down otherwise resulting performance would be acceptable, and round down otherwise
(keeping in mind that m must be at least 8*p). (keeping in mind that m must be at least 8*p).
skipping to change at page 15, line 36 skipping to change at page 16, line 21
(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. String-to-Key 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 IV reuse
(see Section 5.3). Therefore, when generating S2K specifiers, (see Section 5.3). Therefore, when generating S2K specifiers,
implementations MUST NOT use Simple S2K, and SHOULD NOT use Salted implementations MUST NOT use Simple S2K, and SHOULD NOT use Salted
S2K unless the implementation knows that the string is high-entropy S2K unless the implementation knows that the string is high-entropy
(e.g., it generated the string itself using a known-good source of (for example, it generated the string itself using a known-good
randomness). It is RECOMMENDED that implementations use Argon2. source of randomness). It is RECOMMENDED that implementations use
Argon2.
3.7.2.1. Secret-Key Encryption 3.7.2.1. Secret-Key Encryption
An S2K specifier can be stored in the secret keyring to specify how An S2K specifier can be stored in the secret keyring to specify how
to convert the passphrase to a key that unlocks the secret data. to convert the passphrase to a key that unlocks the secret data.
Older versions of PGP just stored a symmetric cipher algorithm octet Older versions of PGP just stored a symmetric cipher algorithm octet
preceding the secret data or a zero to indicate that the secret data preceding the secret data or a zero to indicate that the secret data
was unencrypted. The MD5 hash function was always used to convert was unencrypted. The MD5 hash function was always used to convert
the passphrase to a key for the specified cipher algorithm. the passphrase to a key for the specified cipher algorithm.
For compatibility, when an S2K specifier is used, the special value For compatibility, when an S2K specifier is used, the special value
253, 254, or 255 is stored in the position where the cipher algorithm 253, 254, or 255 is stored in the position where the cipher algorithm
octet would have been in the old data structure. This is then octet would have been in the old data structure. This is then
followed immediately by a one-octet algorithm identifier, and then by followed immediately by a one-octet algorithm identifier, and other
the S2K specifier as encoded above. fields relevant to the type of encryption used.
Therefore, preceding the secret data there will be one of these Therefore, the first octet of the secret key material describes how
possibilities: the secret key data is presented.
0: secret data is unencrypted (no passphrase) In the table below, check(x) means the "2-octet checksum" meaning the
255, 254, or 253: followed by algorithm octet and S2K specifier sum of all octets in x mod 65536.
Cipher alg: use Simple S2K algorithm using MD5 hash
This last possibility, the cipher algorithm number with an implicit +==============+================+=====================+===========+
use of MD5 and IDEA, is provided for backward compatibility; it MAY | First octet | Next fields | Encryption | Generate? |
be understood, but SHOULD NOT be generated, and is deprecated. +==============+================+=====================+===========+
| 0 | - | cleartext | Yes |
| | | secrets || | |
| | | check(secrets) | |
+--------------+----------------+---------------------+-----------+
| Known | IV | CFB(MD5(password), | No |
| symmetric | | secrets || | |
| cipher algo | | check(secrets)) | |
| ID (see | | | |
| Section 9.3) | | | |
+--------------+----------------+---------------------+-----------+
| 253 | cipher-algo, | AEAD(S2K(password), | Yes |
| | AEAD-mode, | secrets, pubkey) | |
| | S2K-specifier, | | |
| | nonce | | |
+--------------+----------------+---------------------+-----------+
| 254 | cipher-algo, | CFB(S2K(password), | Yes |
| | S2K-specifier, | secrets || | |
| | IV | SHA1(secrets)) | |
+--------------+----------------+---------------------+-----------+
| 255 | cipher-algo, | CFB(S2K(password), | No |
| | S2K-specifier, | secrets || | |
| | IV | check(secrets)) | |
+--------------+----------------+---------------------+-----------+
These are followed by an Initial Vector of the same length as the Table 2: Secret Key protection details
block size of the cipher for the decryption of the secret values, if
they are encrypted, and then the secret-key values themselves. Each row with "Generate?" marked as "No" is described for backward
compatibility, and MUST NOT be generated.
An implementation MUST NOT create and MUST reject as malformed a
secret key packet where the S2K usage octet is anything but 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 (ESK) packet
at the front of a message. This is used to allow S2K specifiers to at the front of a message. This is used to allow S2K specifiers to
be used for the passphrase conversion or to create messages with a be used for the passphrase conversion or to create messages with a
mix of symmetric-key ESKs and public-key ESKs. This allows a message mix of symmetric-key ESKs and public-key ESKs. This allows a message
to be decrypted either with a passphrase or a public-key pair. to be decrypted either with a passphrase or a public-key pair.
PGP 2 always used IDEA with Simple string-to-key conversion when PGP 2 always used IDEA with Simple string-to-key conversion when
encrypting a message with a symmetric algorithm. This is deprecated, encrypting a message with a symmetric algorithm. See Section 5.8.
but MAY be used for backward-compatibility. This 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 traditionally called packets. A packet is a chunk of data that has a
tag specifying its meaning. An OpenPGP message, keyring, tag specifying its meaning. An OpenPGP message, keyring,
certificate, and so forth consists of a number of packets. Some of certificate, and so forth consists of a number of packets. Some of
those packets may contain other OpenPGP packets (for example, a those packets may contain other OpenPGP packets (for example, a
compressed data packet, when uncompressed, contains OpenPGP packets). compressed data packet, when uncompressed, contains 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
packet header is the canonical source of packet boundaries. An
implementation handling a packet stream that wants to find the next
packet MUST look for it at the precise offset indicated in the
previous packet header.
Additionally, some packets contain internal length indicators (for
example, a subfield within the packet). In the event that a subfield
length indicator within a packet implies inclusion of octets outside
the range indicated in the packet header, a parser MUST truncate the
subfield at the octet boundary indicated in the packet header. Such
a truncation renders the packet malformed and unusable. An
implementation MUST NOT interpret octets outside the range 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 header is called the "Packet Tag". It The first octet of the packet header is called the "Packet Tag". It
determines the format of the header and denotes the packet contents. determines the format of the header and denotes the packet contents.
The remainder of the packet header is the length of the packet. The remainder of the packet header is the length of the packet.
There are two packet formats, the (current) OpenPGP packet format
specified by this document and its predecessors and the Legacy packet
format as used by PGP 2.x implementations.
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 7.
A mask for this bit is 0x80 in hexadecimal. A mask for this bit is 0x80 in hexadecimal.
┌───────────────┐ ┌───────────────┐
PTag │7 6 5 4 3 2 1 0│ PTag │7 6 5 4 3 2 1 0│
└───────────────┘ └───────────────┘
Bit 7 -- Always one Bit 7 -- Always one
Bit 6 -- New packet format if set Bit 6 -- Always one (except for Legacy packet format)
PGP 2.6.x only uses old format packets. Thus, software that
interoperates with those versions of PGP must only use old format
packets. If interoperability is not an issue, the new packet format
is RECOMMENDED. Note that old format packets have four bits of
packet tags, and new format packets have six; some features cannot be
used and still be backward-compatible.
Also note that packets with a tag greater than or equal to 16 MUST
use new format packets. The old format packets can only express tags
less than or equal to 15.
Old format packets contain:
Bits 5-2 -- packet tag
Bits 1-0 -- length-type
New format packets contain:
Bits 5-0 -- packet tag
4.2.1. Old Format Packet Lengths The Legacy packet format MAY be used when consuming packets to
facilitate interoperability with legacy implementations and accessing
archived data. The Legacy packet format SHOULD NOT be used to
generate new data, unless the recipient is known to only support the
Legacy packet format.
The meaning of the length-type in old format packets is: An implementation that consumes and re-distributes pre-existing
OpenPGP data (such as Transferable Public Keys) may encounter packets
framed with the Legacy packet format. Such an implementation MAY
either re-distribute these packets in their Legacy format, or
transform them to the current OpenPGP packet format before re-
distribution.
0 The packet has a one-octet length. The header is 2 octets long. The current OpenPGP packet format packets contain:
1 The packet has a two-octet length. The header is 3 octets long. Bits 5 to 0 -- packet tag
2 The packet has a four-octet length. The header is 5 octets long. Legacy packet format packets contain:
3 The packet is of indeterminate length. The header is 1 octet Bits 5 to 2 -- packet tag
long, and the implementation must determine how long the packet Bits 1 to 0 -- length-type
is. If the packet is in a file, this means that the packet
extends until the end of the file. In general, an implementation
SHOULD NOT use indeterminate-length packets except where the end
of the data will be clear from the context, and even then it is
better to use a definite length, or a new format header. The new
format headers described below have a mechanism for precisely
encoding data of indeterminate length.
4.2.2. New Format Packet Lengths 4.2.1. OpenPGP Format Packet Lengths
New 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 one-octet Body Length header encodes packet lengths of up to
191 octets. 191 octets.
2. A two-octet Body Length header encodes packet lengths of 192 to 2. A two-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 five-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 four-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.2.1. One-Octet Lengths 4.2.1.1. One-Octet Lengths
A one-octet Body Length header encodes a length of 0 to 191 octets. A one-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 one octet value
is less than 192. The body length is equal to: is less than 192. The body length is equal to:
bodyLen = 1st_octet; bodyLen = 1st_octet;
4.2.2.2. Two-Octet Lengths 4.2.1.2. Two-Octet Lengths
A two-octet Body Length header encodes a length of 192 to 8383 A two-octet Body Length header encodes a length of 192 to 8383
octets. It is recognized because its first octet is in the range 192 octets. It is recognized because its first octet is in the range 192
to 223. The body length is equal to: to 223. The body length is equal to:
bodyLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192 bodyLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192
4.2.2.3. Five-Octet Lengths 4.2.1.3. Five-Octet Lengths
A five-octet Body Length header consists of a single octet holding A five-octet Body Length header consists of a single octet holding
the value 255, followed by a four-octet scalar. The body length is the value 255, followed by a four-octet scalar. The body length is
equal to: equal 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 one, two, and five-octet lengths is also used
internally to some packets. internally to some packets.
4.2.2.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 one 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 one
octet value that is greater than or equal to 224, and less than 255. octet value that is greater than or equal to 224, and less than 255.
The Partial Body Length is equal to: 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
skipping to change at page 19, line 31 skipping to change at page 21, line 10
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, be
they literal, compressed, or encrypted. The first partial length they literal, compressed, or encrypted. The first partial length
MUST be at least 512 octets long. Partial Body Lengths MUST NOT be MUST be at least 512 octets long. Partial Body Lengths MUST NOT be
used for any other packet types. used for any other packet types.
4.2.2. Legacy Format Packet Lengths
The meaning of the length-type in Legacy format packets is:
0 The packet has a one-octet length. The header is 2 octets long.
1 The packet has a two-octet length. The header is 3 octets long.
2 The packet has a four-octet length. The header is 5 octets long.
3 The packet is of indeterminate length. The header is 1 octet
long, and the implementation must determine how long the packet
is. If the packet is in a file, this means that the packet
extends until the end of the file. The OpenPGP format headers
have a mechanism for precisely encoding data of indeterminate
length. An implementation MUST NOT generate a Legacy format
packet with indeterminate length. An implementation MAY interpret
an indeterminate length Legacy format packet in order to deal with
historic data, or data generated by a legacy system.
4.2.3. Packet Length Examples 4.2.3. Packet Length Examples
These examples show ways that new format packets might encode the These examples show ways that OpenPGP format packets might encode the
packet lengths. packet lengths.
A packet with length 100 may have its length encoded in one octet: A packet with length 100 may have its length encoded in one octet:
0x64. This is followed by 100 octets of data. 0x64. This is followed by 100 octets of data.
A packet with length 1723 may have its length encoded in two octets: A packet with length 1723 may have its length encoded in two octets:
0xC5, 0xFB. This header is followed by the 1723 octets of data. 0xC5, 0xFB. This header is followed by the 1723 octets of data.
A packet with length 100000 may have its length encoded in five A packet with length 100000 may have its length encoded in five
octets: 0xFF, 0x00, 0x01, 0x86, 0xA0. octets: 0xFF, 0x00, 0x01, 0x86, 0xA0.
skipping to change at page 20, line 12 skipping to change at page 22, line 12
headers, as long as a regular Body Length header encodes the last headers, as long as a regular Body Length header encodes the last
portion of the data. 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 Tags 4.3. Packet Tags
The packet tag denotes what type of packet the body holds. Note that The packet tag denotes what type of packet the body holds. Note that
old format headers can only have tags less than 16, whereas new Legacy format headers can only have tags less than 16, whereas
format headers can have tags as great as 63. The defined tags (in OpenPGP format headers can have tags as great as 63. The defined
decimal) are as follows: tags (in decimal) are as follows:
+==========+====================================================+ +==========+========================================================+
| Tag | Packet Type | | Tag | Packet Type |
+==========+====================================================+ +==========+========================================================+
| 0 | Reserved - a packet tag MUST NOT have this value | | 0 | Reserved - a packet tag MUST NOT have this value |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 1 | Public-Key Encrypted Session Key Packet | | 1 | Public-Key Encrypted Session Key Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 2 | Signature Packet | | 2 | Signature Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 3 | Symmetric-Key Encrypted Session Key Packet | | 3 | Symmetric-Key Encrypted Session Key Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 4 | One-Pass Signature Packet | | 4 | One-Pass Signature Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 5 | Secret-Key Packet | | 5 | Secret-Key Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 6 | Public-Key Packet | | 6 | Public-Key Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 7 | Secret-Subkey Packet | | 7 | Secret-Subkey Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 8 | Compressed Data Packet | | 8 | Compressed Data Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 9 | Symmetrically Encrypted Data Packet | | 9 | Symmetrically Encrypted Data Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 10 | Marker Packet | | 10 | Marker Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 11 | Literal Data Packet | | 11 | Literal Data Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 12 | Trust Packet | | 12 | Trust Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 13 | User ID Packet | | 13 | User ID Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 14 | Public-Subkey Packet | | 14 | Public-Subkey Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 17 | User Attribute Packet | | 17 | User Attribute Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 18 | Sym. Encrypted and Integrity Protected Data Packet | | 18 | Sym. Encrypted and Integrity Protected Data Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 19 | Modification Detection Code Packet | | 19 | Reserved (formerly Modification Detection Code Packet) |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 20 | AEAD Encrypted Data Packet | | 20 | Reserved (formerly AEAD Encrypted Data Packet) |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 60 to 63 | Private or Experimental Values | | 21 | Padding Packet |
+----------+----------------------------------------------------+ +----------+--------------------------------------------------------+
| 60 to | Private or Experimental Values |
| 63 | |
+----------+--------------------------------------------------------+
Table 2: Packet type registry Table 3: Packet type registry
5. Packet Types 5. Packet Types
5.1. Public-Key Encrypted Session Key Packets (Tag 1) 5.1. Public-Key Encrypted Session Key Packets (Tag 1)
Zero or more Public-Key Encrypted Session Key packets and/or Zero or more Public-Key Encrypted Session Key (PKESK) packets and/or
Symmetric-Key Encrypted Session Key packets may precede an encryption Symmetric-Key Encrypted Session Key packets (Section 5.3) may precede
container (i.e. a Symmetrically Encrypted Integrity Protected Data an encryption container (that is, a Symmetrically Encrypted Integrity
packet, an AEAD Encrypted Data packet, or -- for historic data -- a Protected Data packet or --- for historic data --- a Symmetrically
Symmetrically Encrypted Data 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 consists of: The body of this packet starts with a one-octet number giving the
version number of the packet type. The currently defined versions
are 3 and 5. The remainder of the packet depends on the version.
* A one-octet number giving the version number of the packet type. The versions differ in how they identify the recipient key, and in
The currently defined value for packet version is 3. what they encode. The version of the PKESK packet must align with
the version of the SEIPD packet (see Section 11.3.2.1).
5.1.1. v3 PKESK
A version 3 Public-Key Encrypted Session Key (PKESK) packet precedes
a version 1 Symmetrically Encrypted Integrity Protected Data (v1
SEIPD, see Section 5.14.1) packet. In historic data, it is sometimes
found preceding a deprecated Symmetrically Encrypted Data packet
(SED, see Section 5.8). A v3 PKESK packet MUST NOT precede a v2
SEIPD packet (see Section 11.3.2.1).
The v3 PKESK packet consists of:
* A one-octet version number with value 3.
* An eight-octet number that gives the Key ID of the public key to * An eight-octet number that gives the Key ID of the public key to
which the session key is encrypted. If the session key is which the session key is encrypted. If the session key is
encrypted to a subkey, then the Key ID of this subkey is used here encrypted to a subkey, then the Key ID of this subkey is used here
instead of the Key ID of the primary key. instead of the Key ID of the primary key. The Key ID may also be
all zeros, for an "anonymous recipient" (see Section 5.1.6).
* A one-octet number giving the public-key algorithm used. * A one-octet number giving the public-key algorithm used.
* A string of octets that is the encrypted session key. This string * A series of values comprising the encrypted session key. This is
takes up the remainder of the packet, and its contents are algorithm-specific and described below.
dependent on the public-key algorithm used.
5.1.1. Algorithm Specific Fields for RSA encryption When creating a v3 PKESK packet, the session key is first prefixed
with a one-octet algorithm identifier that specifies the symmetric
encryption algorithm used to encrypt the following encryption
container. Then a two-octet checksum is appended, which is equal to
the sum of the preceding session key octets, not including the
algorithm identifier, modulo 65536.
The resulting octet string (algorithm identifier, session key, and
checksum) is encrypted according to the public-key algorithm used, as
described below.
5.1.2. v5 PKESK
A version 5 Public-Key Encrypted Session Key (PKESK) packet precedes
a version 2 Symmetrically Encrypted Integrity Protected Data (v2
SEIPD, see Section 5.14.2) packet. A v5 PKESK packet MUST NOT
precede a v1 SEIPD packet or a deprecated Symmetrically Encrypted
Data packet (see Section 11.3.2.1).
The v5 PKESK packet consists of:
* A one-octet version number with value 5.
* A one octet key version number and N octets of 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 version 4 key is
20 octets; for a version 5 key N is 32. The key version number
may also be zero, and the fingerprint omitted (that is, the length
N is zero in this case), for an "anonymous recipient" (see
Section 5.1.6).
* A one-octet number giving the public-key algorithm used.
* A series of values comprising the encrypted session key. This is
algorithm-specific and described below.
When creating a V5 PKESK packet, the symmetric encryption algorithm
identifier is not included. Before encrypting, a two-octet checksum
is appended, which is equal to the sum of the preceding session key
octets, modulo 65536.
The resulting octet string (session key and checksum) is encrypted
according to the public-key algorithm used, as described below.
5.1.3. Algorithm Specific Fields for RSA encryption
* Multiprecision integer (MPI) of RSA-encrypted value m**e mod n. * Multiprecision integer (MPI) of RSA-encrypted value m**e mod n.
5.1.2. Algorithm Specific Fields for Elgamal encryption The value "m" in the above formula is the plaintext value described
above, encoded in the PKCS#1 block encoding EME-PKCS1-v1_5 described
in Section 7.2.1 of [RFC8017] (see also Section 14.1). Note that
when an implementation forms several PKESKs with one session key,
forming a message that can be decrypted by several keys, the
implementation MUST make a new PKCS#1 encoding for each key.
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.
5.1.3. Algorithm-Specific Fields for ECDH encryption The value "m" in the above formula is the plaintext value described
above, encoded in the PKCS#1 block encoding EME-PKCS1-v1_5 described
in Section 7.2.1 of [RFC8017] (see also Section 14.1). Note that
when an implementation forms several PKESKs with one session key,
forming a message that can be decrypted by several keys, the
implementation MUST make a new PKCS#1 encoding for each key.
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 one-octet size, followed by a symmetric key encoded using the
method described in Section 13.5. method described in Section 13.5.
5.1.4. Notes on PKESK 5.1.6. Notes on PKESK
The value "m" in the above formulas is derived from the session key
as follows. First, the session key is prefixed with a one-octet
algorithm identifier that specifies the symmetric encryption
algorithm used to encrypt the following encryption container. Then a
two-octet checksum is appended, which is equal to the sum of the
preceding session key octets, not including the algorithm identifier,
modulo 65536. This value is then encoded as described in PKCS#1
block encoding EME-PKCS1-v1_5 in Section 7.2.1 of [RFC3447] to form
the "m" value used in the formulas above. See Section 14.1 in this
document for notes on OpenPGP's use of PKCS#1.
Note that when an implementation forms several PKESKs with one
session key, forming a message that can be decrypted by several keys,
the implementation MUST make a new PKCS#1 encoding for each key.
An implementation MAY accept or use a Key ID of zero as a "wild card" An implementation MAY accept or use a Key ID of all zeros, or a key
or "speculative" Key ID. In this case, the receiving implementation version of zero and no key fingerprint, to hide the intended
would try all available private keys, checking for a valid decrypted decryption key. In this case, the receiving implementation would try
session key. This format helps reduce traffic analysis of messages. all available private keys, checking for a valid decrypted session
key. This format helps reduce traffic analysis of messages.
5.2. Signature Packet (Tag 2) 5.2. Signature Packet (Tag 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 5 provide an basic signature information, while versions 4 and 5 provide an
expandable format with subpackets that can specify more information expandable format with subpackets that can specify more information
about the signature. PGP 2.6.x only accepts version 3 signatures. about the signature.
Implementations MUST generate version 5 signatures when using a An implementation MUST generate a version 5 signature when signing
version 5 key. Implementations SHOULD generate V4 signatures with with a version 5 key. An implementation MUST generate a version 4
version 4 keys. Implementations MUST NOT create version 3 signature when signing with a version 4 key. Implementations MUST
signatures; they MAY accept version 3 signatures. NOT create version 3 signatures; they MAY accept version 3
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 in a signature type octet in any given signature. Please indicated in a signature type octet 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 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
skipping to change at page 24, line 30 skipping to change at page 26, line 47
has not been modified. has not been modified.
0x01: Signature of a canonical text document. 0x01: Signature of a canonical text document.
This means the signer owns it, created it, or certifies that it This means the signer owns it, created it, or certifies that it
has not been modified. The signature is calculated over the text has not been modified. The signature is calculated over the text
data with its line endings converted to <CR><LF>. data with its line endings converted to <CR><LF>.
0x02: Standalone signature. 0x02: Standalone signature.
This signature is a signature of only its own subpacket contents. This signature is a signature of only its own subpacket contents.
It is calculated identically to a signature over a zero-length It is calculated identically to a signature over a zero-length
binary document. Note that it doesn't make sense to have a V3 binary document. V3 standalone signatures MUST NOT be generated
standalone signature. and MUST be ignored.
0x10: Generic certification of a User ID and Public-Key packet. 0x10: Generic certification of a User ID 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 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. of the key is in fact the person described by the User ID.
0x11: Persona certification of a User ID and Public-Key packet. 0x11: Persona certification of a User ID and Public-Key packet.
The issuer of this certification has not done any verification of The issuer of this certification has not done any verification of
the claim that the owner of this key is the User ID specified. the claim that the owner of this key is the User ID specified.
0x12: Casual certification of a User ID and Public-Key packet. 0x12: Casual certification of a User ID and Public-Key packet.
The issuer of this certification has done some casual verification The issuer of this certification has done some casual verification
skipping to change at page 24, line 48 skipping to change at page 27, line 19
0x11: Persona certification of a User ID and Public-Key packet. 0x11: Persona certification of a User ID and Public-Key packet.
The issuer of this certification has not done any verification of The issuer of this certification has not done any verification of
the claim that the owner of this key is the User ID specified. the claim that the owner of this key is the User ID specified.
0x12: Casual certification of a User ID and Public-Key packet. 0x12: Casual certification of a User ID and Public-Key packet.
The issuer of this certification has done some casual verification The issuer of this certification has done some casual verification
of the claim of identity. of the claim of identity.
0x13: Positive certification of a User ID and Public-Key packet. 0x13: Positive certification of a User ID and Public-Key packet.
The issuer of this certification has done substantial verification The issuer of this certification has done substantial verification
of the claim of identity. Most OpenPGP implementations make their of the claim of identity.
"key signatures" as 0x10 certifications. Some implementations can
issue 0x11-0x13 certifications, but few differentiate between the Most OpenPGP implementations make their "key signatures" as 0x10
types. certifications. Some implementations can issue 0x11-0x13
certifications, but few differentiate between the types.
0x18: Subkey Binding Signature. 0x18: Subkey Binding Signature.
This signature is a statement by the top-level signing key that This signature is a statement by the top-level signing key that
indicates that it owns the subkey. This signature is calculated indicates 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 other packets. A signature that binds a signing subkey MUST have
an Embedded Signature subpacket in this binding signature that an Embedded Signature subpacket in this binding signature that
contains a 0x19 signature made by the signing subkey on the contains a 0x19 signature made by the signing subkey on the
primary key and subkey. primary key and subkey.
0x19: Primary Key Binding Signature. 0x19: Primary Key Binding Signature.
This signature is a statement by a signing subkey, indicating that This signature is a statement by a signing subkey, indicating that
it is owned by the primary key and subkey. This signature is it is owned by the primary key and subkey. This signature is
calculated the same way as a 0x18 signature: directly on the calculated the same way as a 0x18 signature: directly on the
primary key and subkey, and not on any User ID or other packets. primary key and subkey, and not on any User ID or other packets.
0x1F: Signature directly on a key. 0x1F: Signature directly on a key.
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 to be used for subpackets that provide information appropriate to be used for subpackets that provide information
about the key, such as the Revocation Key subpacket. It is also about the key, such as the Key Flags subpacket or (deprecated)
appropriate for statements that non-self certifiers want to make Revocation Key. It is also appropriate for statements that non-
about the key itself, rather than the binding between a key and a self certifiers want to make about the key itself, rather than the
name. binding between a key and a name.
0x20: Key revocation signature. 0x20: Key revocation signature.
The signature is calculated directly on the key being revoked. A The signature is calculated directly on the key being revoked. A
revoked key is not to be used. Only revocation signatures by the revoked key is not to be used. Only revocation signatures by the
key being revoked, or by an authorized revocation key, should be key being revoked, or by a (deprecated) Revocation Key, should be
considered valid revocation signatures. considered valid revocation signatures.
0x28: Subkey revocation signature. 0x28: Subkey revocation signature.
The signature is calculated directly on the subkey being revoked. The signature is calculated directly on the subkey being revoked.
A revoked subkey is not to be used. Only revocation signatures by A revoked subkey is not to be used. Only revocation signatures by
the top-level signature key that is bound to this subkey, or by an the top-level signature key that is bound to this subkey, or by a
authorized revocation key, should be considered valid revocation (deprecated) Revocation Key, should be considered valid revocation
signatures. signatures.
0x30: Certification revocation signature. 0x30: Certification revocation signature.
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 (signature class 0x10 through 0x13) or direct-key signature
(0x1F). It should be issued by the same key that issued the (0x1F). It should be issued by the same key that issued the
revoked signature or an authorized revocation key. The signature revoked signature or by a (deprecated) Revocation Key. The
is computed over the same data as the certificate that it revokes, signature is computed over the same data as the certificate that
and should have a later creation date than that certificate. it revokes, and should have a later creation date than that
certificate.
0x40: Timestamp signature. 0x40: Timestamp signature.
This signature is only meaningful for the timestamp contained in This signature is only meaningful for the timestamp contained in
it. it.
0x50: Third-Party Confirmation signature. 0x50: Third-Party Confirmation signature.
This signature is a signature over some other OpenPGP Signature This signature is a signature over some other OpenPGP Signature
packet(s). It is analogous to a notary seal on the signed data. packet(s). It is analogous to a notary seal on the signed data.
A third-party signature SHOULD include Signature Target A third-party signature SHOULD include Signature Target
subpacket(s) to give easy identification. Note that we really do subpacket(s) to give easy identification. Note that we really do
skipping to change at page 26, line 48 skipping to change at page 29, line 25
creation time from the Signature packet (5 additional octets) is 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. * Multiprecision integer (MPI) of RSA signature value m**d mod n.
Algorithm-Specific Fields for DSA and ECDSA signatures: Algorithm-Specific Fields for DSA signatures:
* MPI of DSA or ECDSA value r. * MPI of DSA value r.
* MPI of DSA or ECDSA 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. DSA signatures than for RSA signatures.
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 [RFC3447]. This type EMSA-PKCS1-v1_5 as described in Section 9.2 of [RFC8017]. This
requires inserting the hash value as an octet string into an ASN.1 requires inserting the hash value as an octet string into an ASN.1
structure. The object identifier for the type of hash being used is structure. The object identifier for the type of hash being used is
included in the structure. The hexadecimal representations for the included in the structure. The hexadecimal representations for the
currently defined hash algorithms are as follows: currently defined hash algorithms are as follows:
+============+======================================================+ +============+======================================================+
| algorithm | hexadecimal represenatation | | algorithm | hexadecimal representation |
+============+======================================================+ +============+======================================================+
| MD5 | 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05 | | MD5 | 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05 |
+------------+------------------------------------------------------+ +------------+------------------------------------------------------+
| RIPEMD-160 | 0x2B, 0x24, 0x03, 0x02, 0x01 | | RIPEMD-160 | 0x2B, 0x24, 0x03, 0x02, 0x01 |
+------------+------------------------------------------------------+ +------------+------------------------------------------------------+
| SHA-1 | 0x2B, 0x0E, 0x03, 0x02, 0x1A | | SHA-1 | 0x2B, 0x0E, 0x03, 0x02, 0x1A |
+------------+------------------------------------------------------+ +------------+------------------------------------------------------+
| SHA224 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, | | SHA224 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, |
| | 0x02, 0x04 | | | 0x02, 0x04 |
+------------+------------------------------------------------------+ +------------+------------------------------------------------------+
| SHA256 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, | | SHA256 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, |
| | 0x02, 0x01 | | | 0x02, 0x01 |
+------------+------------------------------------------------------+ +------------+------------------------------------------------------+
| SHA384 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, | | SHA384 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, |
| | 0x02, 0x02 | | | 0x02, 0x02 |
+------------+------------------------------------------------------+ +------------+------------------------------------------------------+
| SHA512 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, | | SHA512 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, |
| | 0x02, 0x03 | | | 0x02, 0x03 |
+------------+------------------------------------------------------+ +------------+------------------------------------------------------+
Table 3: Hash hexadecimal representations Table 4: Hash hexadecimal representations
The ASN.1 Object Identifiers (OIDs) are as follows: The ASN.1 Object Identifiers (OIDs) are as follows:
+============+========================+ +============+========================+
| algorithm | OID | | algorithm | OID |
+============+========================+ +============+========================+
| MD5 | 1.2.840.113549.2.5 | | MD5 | 1.2.840.113549.2.5 |
+------------+------------------------+ +------------+------------------------+
| RIPEMD-160 | 1.3.36.3.2.1 | | RIPEMD-160 | 1.3.36.3.2.1 |
+------------+------------------------+ +------------+------------------------+
skipping to change at page 28, line 23 skipping to change at page 30, line 49
+------------+------------------------+ +------------+------------------------+
| SHA224 | 2.16.840.1.101.3.4.2.4 | | SHA224 | 2.16.840.1.101.3.4.2.4 |
+------------+------------------------+ +------------+------------------------+
| SHA256 | 2.16.840.1.101.3.4.2.1 | | SHA256 | 2.16.840.1.101.3.4.2.1 |
+------------+------------------------+ +------------+------------------------+
| SHA384 | 2.16.840.1.101.3.4.2.2 | | SHA384 | 2.16.840.1.101.3.4.2.2 |
+------------+------------------------+ +------------+------------------------+
| SHA512 | 2.16.840.1.101.3.4.2.3 | | SHA512 | 2.16.840.1.101.3.4.2.3 |
+------------+------------------------+ +------------+------------------------+
Table 4: Hash OIDs Table 5: Hash OIDs
The full hash prefixes for these are as follows: The full hash prefixes for these are as follows:
+============+==========================================+ +============+==========================================+
| algorithm | full hash prefix | | algorithm | full hash prefix |
+============+==========================================+ +============+==========================================+
| MD5 | 0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, | | MD5 | 0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, |
| | 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, | | | 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, |
| | 0x02, 0x05, 0x05, 0x00, 0x04, 0x10 | | | 0x02, 0x05, 0x05, 0x00, 0x04, 0x10 |
+------------+------------------------------------------+ +------------+------------------------------------------+
skipping to change at page 29, line 37 skipping to change at page 31, line 37
+------------+------------------------------------------+ +------------+------------------------------------------+
| SHA384 | 0x30, 0x41, 0x30, 0x0D, 0x06, 0x09, | | SHA384 | 0x30, 0x41, 0x30, 0x0D, 0x06, 0x09, |
| | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, | | | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, |
| | 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30 | | | 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30 |
+------------+------------------------------------------+ +------------+------------------------------------------+
| SHA512 | 0x30, 0x51, 0x30, 0x0D, 0x06, 0x09, | | SHA512 | 0x30, 0x51, 0x30, 0x0D, 0x06, 0x09, |
| | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, | | | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, |
| | 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40 | | | 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40 |
+------------+------------------------------------------+ +------------+------------------------------------------+
Table 5: Hash hexadecimal prefixes Table 6: Hash hexadecimal prefixes
DSA signatures MUST use hashes that are equal in size to the number DSA signatures MUST use hashes that are equal in size to the number
of bits of q, the group generated by the DSA key's generator value. of bits of q, the group generated by the DSA key's 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.
skipping to change at page 30, line 14 skipping to change at page 32, line 14
* One-octet version number. This is 4 for V4 signatures and 5 for * One-octet version number. This is 4 for V4 signatures and 5 for
V5 signatures. V5 signatures.
* One-octet signature type. * One-octet signature type.
* One-octet public-key algorithm. * One-octet public-key algorithm.
* One-octet hash algorithm. * One-octet hash algorithm.
* Two-octet scalar octet count for following hashed subpacket data. * A scalar octet count for following hashed subpacket data. For a
Note that this is the length in octets of all of the hashed V4 signature, this is a two-octet field. For a V5 signature, this
subpackets; a pointer incremented by this number will skip over is a four-octet field. Note that this is the length in octets of
the hashed subpackets. all of the hashed subpackets; a pointer incremented by this number
will skip over the hashed subpackets.
* Hashed subpacket data set (zero or more subpackets). * Hashed subpacket data set (zero or more subpackets).
* Two-octet scalar octet count for the following unhashed subpacket * A scalar octet count for the following unhashed subpacket data.
data. Note that this is the length in octets of all of the For a V4 signature, this is a two-octet field. For a V5
unhashed subpackets; a pointer incremented by this number will signature, this is a four-octet field. Note that this is the
skip over the unhashed subpackets. length in octets of all of the unhashed subpackets; a pointer
incremented by this number will skip over the unhashed subpackets.
* Unhashed subpacket data set (zero or more subpackets). * Unhashed subpacket data set (zero or more subpackets).
* Two-octet field holding the left 16 bits of the signed hash value. * Two-octet field holding the left 16 bits of the signed hash value.
* Only for V5 signatures, a 16 octet field containing random values
used as salt.
* One or more multiprecision integers comprising the signature. * One or more multiprecision integers comprising the signature.
This portion is algorithm specific: This portion is 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. * Multiprecision integer (MPI) of RSA signature value m**d mod n.
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.
5.2.3.3. Algorithm-Specific Fields for EdDSA signatures A version 3 signature MUST NOT be created and MUST NOT be used with
ECDSA.
5.2.3.3. Algorithm-Specific Fields for EdDSA signatures
* 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
EdDSA. EdDSA.
5.2.3.3.1. Algorithm-Specific Fields for Ed25519 signatures 5.2.3.3.1. Algorithm-Specific Fields for Ed25519 signatures
The two MPIs for Ed25519 use octet strings R and S as described in The two MPIs for Ed25519 use octet strings R and S as described in
[RFC8032]. [RFC8032].
skipping to change at page 31, line 26 skipping to change at page 33, line 31
5.2.3.3.2. Algorithm-Specific Fields for Ed448 signatures 5.2.3.3.2. Algorithm-Specific Fields for Ed448 signatures
For Ed448 signatures, the native signature format is used as For Ed448 signatures, the native signature format is used as
described in [RFC8032]. The two MPIs are composed as follows: described in [RFC8032]. The two MPIs are composed as follows:
* The first MPI has a body of 58 octets: a prefix 0x40 octet, * The first MPI has a body of 58 octets: a prefix 0x40 octet,
followed by 57 octets of the native signature. followed by 57 octets of the native signature.
* The second MPI is set to 0 (this is a placeholder, and is unused). * The second MPI is set to 0 (this is a placeholder, and is unused).
Note that an MPI with a value of 0 is encoded on the wire as a Note that an MPI with a value of 0 is encoded on the wire as a
pair of zero octets: "00 00". pair of zero octets: 00 00.
5.2.3.4. Notes on Signatures 5.2.3.4. Notes on Signatures
The concatenation of the data being signed and the signature data The concatenation of the data being signed and the signature data
from the version number through the hashed subpacket data (inclusive) from the version number through the hashed subpacket data (inclusive)
is hashed. The resulting hash value is what is signed. The high 16 is hashed. The resulting hash value is what is signed. The high 16
bits (first two octets) of the hash are included in the Signature bits (first two octets) of the hash are included in the Signature
packet to provide a way to reject some invalid signatures without packet to provide a way to reject some invalid signatures without
performing a signature verification. performing a signature verification.
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 unhashed. The second set of subpackets is not cryptographically is unhashed. The second set of subpackets is not cryptographically
protected by the signature and should include only advisory protected by the signature and should include only advisory
information. information.
The difference between a V4 and V5 signature is that the latter The differences between a V4 and V5 signature are two-fold: first, a
includes additional meta data. V5 signature increases the width of the size indicators for the
signed data, making it more capable when signing large keys or
messages. Second, the hash is salted with 128 bit of random data.
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 a section below. are described in Section 5.2.4.
5.2.3.5. Signature Subpacket Specification 5.2.3.5. 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 two-
octet scalar count of the length in octets of all the subpackets. A octet (for V4 signatures) or four-octet (for V5 signatures) scalar
pointer incremented by this number will skip over the subpacket data count of the length in octets of all the subpackets. A pointer
set. 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 subpacket length (1, 2, or 5 octets),
* the subpacket type (1 octet), * the subpacket type (1 octet),
and is followed by the subpacket-specific data. and is followed by the subpacket-specific data.
skipping to change at page 32, line 40 skipping to change at page 34, line 43
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 = [four-octet scalar starting at 2nd_octet]
The value of the subpacket type octet may be: The value of the subpacket type octet may be:
+============+========================================+ +============+==========================================+
| Type | Description | | Type | Description |
+============+========================================+ +============+==========================================+
| 0 | Reserved | | 0 | Reserved |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 1 | Reserved | | 1 | Reserved |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 2 | Signature Creation Time | | 2 | Signature Creation Time |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 3 | Signature Expiration Time | | 3 | Signature Expiration Time |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 4 | Exportable Certification | | 4 | Exportable Certification |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 5 | Trust Signature | | 5 | Trust Signature |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 6 | Regular Expression | | 6 | Regular Expression |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 7 | Revocable | | 7 | Revocable |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 8 | Reserved | | 8 | Reserved |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 9 | Key Expiration Time | | 9 | Key Expiration Time |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 10 | Placeholder for backward compatibility | | 10 | Placeholder for backward compatibility |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 11 | Preferred Symmetric Algorithms | | 11 | Preferred Symmetric Ciphers for v1 SEIPD |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 12 | Revocation Key | | 12 | Revocation Key (deprecated) |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 13 to 15 | Reserved | | 13 to 15 | Reserved |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 16 | Issuer | | 16 | Issuer |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 17 to 19 | Reserved | | 17 to 19 | Reserved |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 20 | Notation Data | | 20 | Notation Data |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 21 | Preferred Hash Algorithms | | 21 | Preferred Hash Algorithms |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 22 | Preferred Compression Algorithms | | 22 | Preferred Compression Algorithms |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 23 | Key Server Preferences | | 23 | Key Server Preferences |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 24 | Preferred Key Server | | 24 | Preferred Key Server |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 25 | Primary User ID | | 25 | Primary User ID |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 26 | Policy URI | | 26 | Policy URI |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 27 | Key Flags | | 27 | Key Flags |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 28 | Signer's User ID | | 28 | Signer's User ID |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 29 | Reason for Revocation | | 29 | Reason for Revocation |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 30 | Features | | 30 | Features |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 31 | Signature Target | | 31 | Signature Target |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 32 | Embedded Signature | | 32 | Embedded Signature |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 33 | Issuer Fingerprint | | 33 | Issuer Fingerprint |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 34 | Reserved (Preferred AEAD Algorithms) | | 34 | Reserved |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 35 | Intended Recipient Fingerprint | | 35 | Intended Recipient Fingerprint |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 37 | Reserved (Attested Certifications) | | 37 | Reserved (Attested Certifications) |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 38 | Reserved (Key Block) | | 38 | Reserved (Key Block) |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 100 to 110 | Private or experimental | | 39 | Preferred AEAD Ciphersuites |
+------------+----------------------------------------+ +------------+------------------------------------------+
| 100 to 110 | Private or experimental |
+------------+------------------------------------------+
Table 6: Subpacket type registry Table 7: Subpacket type 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.
Bit 7 of the subpacket type is the "critical" bit. If set, it Bit 7 of the subpacket type is the "critical" bit. If set, it
denotes that the subpacket is one that is critical for the evaluator denotes that the subpacket is one that is critical for the evaluator
of the signature to recognize. If a subpacket is encountered that is of the signature to recognize. If a subpacket is encountered that is
marked critical but is unknown to the evaluating software, the marked critical but is unknown to the evaluating software, the
evaluator SHOULD consider the signature to be in error. evaluator SHOULD consider the signature to be in error.
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 than be ignored. error than be ignored.
Implementations SHOULD implement the three preferred algorithm Implementations SHOULD implement the four preferred algorithm
subpackets (11, 21, and 22), as well as the "Reason for Revocation" subpackets (11, 21, 22, and 34), as well as the "Reason for
subpacket. Note, however, that if an implementation chooses not to Revocation" subpacket. Note, however, that if an implementation
implement some of the preferences, it is required to behave in a chooses not to implement some of the preferences, it is required to
polite manner to respect the wishes of those users who do implement behave in a polite manner to respect the wishes of those users who do
these preferences. implement these preferences.
5.2.3.6. Signature Subpacket Types 5.2.3.6. Signature Subpacket Types
A number of subpackets are currently defined. Some subpackets apply A number of subpackets are currently defined. Some subpackets apply
to the signature itself and some are attributes of the key. to the signature itself and some are attributes of the key.
Subpackets that are found on a self-signature are placed on a Subpackets that are found on a self-signature are placed on a
certification made by the key itself. Note that a key may have more 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-signature, and than one User ID, and thus may have more than one self-signature, and
differing subpackets. differing subpackets.
A subpacket may be found either in the hashed or unhashed subpacket A subpacket may be found either in the hashed or unhashed subpacket
sections of a signature. If a subpacket is not hashed, then the sections of a signature. If a subpacket is not hashed, then the
information in it cannot be considered definitive because it is not information in it cannot be considered definitive because it is not
part of the signature proper. part of the signature proper.
5.2.3.7. Notes on Self-Signatures 5.2.3.7. 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 (types 0x10-0x13), the direct-key signature certification signatures (types 0x10-0x13), the direct-key signature
(type 0x1F), and the subkey binding signature (type 0x18). For (type 0x1F), and the subkey binding signature (type 0x18). A
certification self-signatures, each User ID may have a self- cryptographically-valid self-signature should be accepted from any
primary key, regardless of what Key Flags (Section 5.2.3.26) 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 valid self-
signature.
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 in fact has a self- For subkey binding signatures, each subkey in fact has a self-
signature. Subpackets that appear in a certification self-signature signature. Subpackets that appear in a certification self-signature
apply to the user name, and subpackets that appear in the subkey apply to the user name, and subpackets that appear in the subkey
self-signature apply to the subkey. Lastly, subpackets on the self-signature apply to the subkey. Lastly, subpackets on the
direct-key signature apply to the entire key. direct-key signature apply to the entire key.
Implementing software should interpret a self-signature's preference Implementing software 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 two user names, Alice and Bob. Suppose that Alice prefers the AEAD
symmetric algorithm AES-256, and Bob prefers Camellia-256 or AES-128. ciphersuite AES-256 with OCB, and Bob prefers Camellia-256 with GCM.
If the software locates this key via Alice's name, then the preferred If the software locates this key via Alice's name, then the preferred
algorithm is AES-256; if software locates the key via Bob's name, AEAD ciphersuite is AES-256 with OCB; if software locates the key via
then the preferred algorithm is Camellia-256. If the key is located Bob's name, then the preferred algorithm is Camellia-256 with GCM.
by Key ID, the algorithm of the primary User ID of the key provides If the key is located by Key ID, the algorithm of the primary User ID
the preferred symmetric algorithm. of the key provides the preferred 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" and
is corroborated by other users' certifications. If another user is corroborated by other users' certifications. If another user
revokes their certification, they are effectively saying that they no revokes their certification, they are effectively saying that they no
longer believe that name and that key are tied together. Similarly, longer believe that name and that key are tied together. Similarly,
if the users themselves revoke their self-signature, then the users if the users themselves revoke their self-signature, then the users
no longer go by that name, no longer have that email address, etc. no longer go by that name, no longer have that email address, etc.
Revoking a binding signature effectively retires that subkey. Revoking a binding signature effectively retires that subkey.
Revoking a direct-key signature cancels that signature. Please see Revoking a direct-key signature cancels that signature. Please see
Section 5.2.3.27 for more relevant detail. Section 5.2.3.28 for more relevant detail.
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.
It is good practice to verify that a self-signature imported into an It is good practice to verify that a self-signature imported into an
implementation doesn't advertise features that the implementation implementation doesn't advertise features that the implementation
doesn't support, rewriting the signature as appropriate. doesn't support, rewriting the signature as appropriate.
skipping to change at page 36, line 33 skipping to change at page 39, line 4
(8-octet Key ID) (8-octet Key ID)
The OpenPGP Key ID of the key issuing the signature. If the version The OpenPGP Key ID of the key issuing the signature. If the version
of that key is greater than 4, this subpacket MUST NOT be included in of that key is greater than 4, this subpacket MUST NOT be included in
the signature. the signature.
5.2.3.10. Key Expiration Time 5.2.3.10. 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. If this is not present the key creation time that the key expires. For a direct or
or has a value of zero, the key never expires. This is found only on certification self-signature, the key creation time is that of the
a self-signature. 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
zero, the key never expires. This is found only on a self-signature.
5.2.3.11. Preferred Symmetric Algorithms 5.2.3.11. Preferred Symmetric Ciphers for v1 SEIPD
(array of one-octet values) (array of one-octet values)
Symmetric algorithm numbers that indicate which algorithms the key A series of symmetric cipher algorithm identifiers indicating how the
holder prefers to use. The subpacket body is an ordered list of keyholder prefers to receive version 1 Symmetrically Encrypted
octets with the most preferred listed first. It is assumed that only Integrity Protected Data (Section 5.14.1). The subpacket body is an
algorithms listed are supported by the recipient's software. ordered list of octets with the most preferred listed first. It is
Algorithm numbers are in Section 9.3. This is only found on a self- assumed that only algorithms listed are supported by the recipient's
signature. software. Algorithm numbers are in Section 9.3. This is only found
on a self-signature.
5.2.3.12. Preferred Hash Algorithms When generating a v2 SEIPD packet, this preference list is not
relevant. See Section 5.2.3.12 instead.
5.2.3.12. Preferred AEAD Ciphersuites
(array of pairs of octets indicating Symmetric Cipher and AEAD
algorithms)
A series of paired algorithm identifiers indicating how the keyholder
prefers to receive version 2 Symmetrically Encrypted Integrity
Protected Data (Section 5.14.2). Each pair of octets indicates a
combination of a symmetric cipher and an AEAD mode that the key
holder prefers to use. The symmetric cipher identifier precedes the
AEAD identifier in each pair. The subpacket body is 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
supported by the recipient's software, with the exception of the
mandatory-to-implement combination of AES-128 and OCB. If AES-128
and OCB are not found in the subpacket, it is implicitly listed at
the end.
AEAD algorithm numbers are listed in Section 9.6. Symmetric cipher
algorithm numbers are listed in Section 9.3.
For example, a subpacket with content of these six octets:
09 02 09 03 13 02
Indicates that the keyholder prefers to receive v2 SEIPD using
AES-256 with OCB, then AES-256 with GCM, then Camellia-256 with OCB,
and finally the implicit AES-128 with OCB.
Note that support for version 2 of the Symmetrically Encrypted
Integrity Protected Data packet (Section 5.14.2) in general is
indicated by a Feature Flag (Section 5.2.3.29).
This subpacket is only found on a self-signature.
When generating a v1 SEIPD packet, this preference list is not
relevant. See Section 5.2.3.11 instead.
5.2.3.13. Preferred Hash Algorithms
(array of one-octet values) (array of one-octet values)
Message digest algorithm numbers that indicate which algorithms the Message digest algorithm numbers that indicate which algorithms the
key holder prefers to receive. Like the preferred symmetric key holder prefers to receive. Like the preferred AEAD ciphersuites,
algorithms, the list is ordered. Algorithm numbers are in the list is ordered. Algorithm numbers are in Section 9.5. This is
Section 9.5. This is only found on a self-signature. only found on a self-signature.
5.2.3.13. Preferred Compression Algorithms 5.2.3.14. Preferred Compression Algorithms
(array of one-octet values) (array of one-octet values)
Compression algorithm numbers that indicate which algorithms the key Compression algorithm numbers that indicate which algorithms the key
holder prefers to use. Like the preferred symmetric algorithms, the holder prefers to use. Like the preferred AEAD ciphersuites, the
list is ordered. Algorithm numbers are in Section 9.4. If this list is ordered. Algorithm numbers are in Section 9.4. A zero, or
subpacket is not included, ZIP is preferred. A zero denotes that the absence of this subpacket, denotes that uncompressed data is
uncompressed data is preferred; the key holder's software might have preferred; the key holder's software might have no compression
no compression software in that implementation. This is only found software in that implementation. This is only found on a self-
on a self-signature. signature.
5.2.3.14. Signature Expiration Time 5.2.3.15. 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.
5.2.3.15. Exportable Certification 5.2.3.16. 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", to be used by other users than the signature's issuer.
The packet body contains a Boolean flag indicating whether the The packet body contains a Boolean flag indicating whether the
signature is exportable. If this packet is not present, the signature is exportable. If this packet is not present, the
certification is exportable; it is equivalent to a flag containing a certification is exportable; it is equivalent to a flag containing a
1. 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.
skipping to change at page 38, line 16 skipping to change at page 41, line 29
any local certifications. In normal operation, there won't be any, any local certifications. In normal operation, there won't be any,
assuming the import is performed on an exported key. However, there assuming the import is performed on an exported key. However, there
are instances where this can reasonably happen. For example, if an are instances where this can reasonably happen. For example, if an
implementation allows keys to be imported from a key database in implementation allows keys to be imported from a key database in
addition to an exported key, then this situation can arise. 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.
5.2.3.16. Revocable 5.2.3.17. 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 Signature's revocability status. The packet body contains a Boolean
flag indicating whether the signature is revocable. Signatures that flag indicating whether the signature is revocable. Signatures that
are not revocable have any later revocation signatures ignored. They are not revocable have any later revocation signatures ignored. They
represent a commitment by the signer that he cannot revoke his represent a commitment by the signer that he cannot revoke his
signature for the life of his key. If this packet is not present, signature for the life of his key. If this packet is not present,
the signature is revocable. the signature is revocable.
5.2.3.17. Trust Signature 5.2.3.18. 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 Signer asserts that the key is not only valid but also trustworthy at
the specified level. Level 0 has the same meaning as an ordinary the specified level. Level 0 has the same meaning as an ordinary
validity signature. Level 1 means that the signed key is asserted to validity signature. Level 1 means that the signed key is asserted to
be a valid trusted introducer, with the 2nd octet of the body be a valid trusted introducer, with the 2nd octet of the body
specifying the degree of trust. Level 2 means that the signed key is specifying the degree of trust. Level 2 means that the signed key is
asserted to be trusted to issue level 1 trust signatures, i.e., that asserted to be trusted to issue level 1 trust signatures; that is,
it is a "meta introducer". Generally, a level n trust signature the signed key is a "meta introducer". Generally, a level n trust
asserts that a key is trusted to issue level n-1 trust signatures. signature asserts that a key is trusted to issue level n-1 trust
The trust amount is in a range from 0-255, interpreted such that signatures. The trust amount is in a range from 0-255, interpreted
values less than 120 indicate partial trust and values of 120 or such that values less than 120 indicate partial trust and values of
greater indicate complete trust. Implementations SHOULD emit values 120 or greater indicate complete trust. Implementations SHOULD emit
of 60 for partial trust and 120 for complete trust. values of 60 for partial trust and 120 for complete trust.
5.2.3.18. Regular Expression 5.2.3.19. Regular Expression
(null-terminated regular expression) (null-terminated 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 the Henry Spencer's The regular expression uses the same syntax as the 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. description of the syntax is found in Section 8.
5.2.3.19. Revocation Key 5.2.3.20. Revocation Key
(1 octet of class, 1 octet of public-key algorithm ID, 20 or 32 (1 octet of class, 1 octet of public-key algorithm ID, 20 octets of
octets of fingerprint) V4 fingerprint)
V4 keys use the full 20 octet fingerprint; V5 keys use the full 32 This mechanism is deprecated. Applications MUST NOT generate such a
octet fingerprint subpacket.
Authorizes the specified key to issue revocation signatures for this An application that wants the functionality of delegating revocation
key. Class octet must have bit 0x80 set. If the bit 0x40 is set, SHOULD instead use an escrowed Revocation Signature. See
then this means that the revocation information is sensitive. Other Section 15.2 for more details.
bits are for future expansion to other kinds of authorizations. This
is only found on a direct-key self-signature (type 0x1f). The use on The remainder of this section describes how some implementations
other types of self-signatures is unspecified. attempt to interpret this deprecated subpacket.
This packet was intended to authorize the specified key to issue
revocation signatures for this key. Class octet must have bit 0x80
set. If the bit 0x40 is set, then this means that the revocation
information is sensitive. Other bits are for future expansion to
other kinds of authorizations. This is only found on a direct-key
self-signature (type 0x1f). The use on other types of self-
signatures is 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: when the signature is being sent to the
designated revoker, or when it is accompanied by a revocation 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.20. Notation Data 5.2.3.21. 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 four octets of
flags. flags.
skipping to change at page 40, line 11 skipping to change at page 43, line 37
All undefined flags MUST be zero. Defined flags are as follows: All undefined flags MUST be zero. Defined flags are as follows:
First octet: First octet:
+======+================+==========================+ +======+================+==========================+
| flag | shorthand | definition | | flag | shorthand | definition |
+======+================+==========================+ +======+================+==========================+
| 0x80 | human-readable | This note value is text. | | 0x80 | human-readable | This note value is text. |
+------+----------------+--------------------------+ +------+----------------+--------------------------+
Table 7: Notation flag registry (first octet) Table 8: Notation flag registry (first octet)
Other octets: none. Other octets: none.
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.
skipping to change at page 40, line 40 skipping to change at page 44, line 18
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.21. Key Server Preferences 5.2.3.22. 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 one-bit flags that indicate preferences that the
key holder has about how the key is handled on a key server. All key holder has about how the key is handled on a key server. All
undefined flags MUST be zero. undefined flags MUST be zero.
First octet: First octet:
+======+===========+============================================+ +======+===========+============================================+
| flag | shorthand | definition | | flag | shorthand | definition |
+======+===========+============================================+ +======+===========+============================================+
| 0x80 | No-modify | The key holder requests that this key only | | 0x80 | No-modify | The key holder requests that this key only |
| | | be modified or updated by the key holder | | | | be modified or updated by the key holder |
| | | or an administrator of the key server. | | | | or an administrator of the key server. |
+------+-----------+--------------------------------------------+ +------+-----------+--------------------------------------------+
Table 8: Key server preferences flag registry (first octet) Table 9: Key server preferences flag registry (first octet)
This is found only on a self-signature. This is found only on a self-signature.
5.2.3.22. Preferred Key Server 5.2.3.23. Preferred Key Server
(String) (String)
This is a URI of a key server that the key holder prefers be used for This is a URI of a key server that the key holder 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 ftp, http, key server can actually be a copy of the key retrieved by ftp, http,
finger, etc. finger, etc.
5.2.3.23. Primary User ID 5.2.3.24. 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, etc. by implementation to resolve ambiguities in preferences, etc. 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 to say, 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.24. Policy URI 5.2.3.25. 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.25. Key Flags 5.2.3.26. 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. This is so it can grow over time. If a
list is shorter than an implementation expects, the unstated flags list is shorter than an implementation expects, the unstated flags
are considered to be zero. The defined flags are as follows: are considered to be zero. The defined flags are as follows:
First octet: First octet:
+======+=================================================+ +======+=====================================================+
| flag | definition | | flag | definition |
+======+=================================================+ +======+=====================================================+
| 0x01 | This key may be used to certify other keys. | | 0x01 | This key may be used to make User ID certifications |
+------+-------------------------------------------------+ | | (signature types 0x10-0x13) or direct key |
| 0x02 | This key may be used to sign data. | | | signatures (signature type 0x1F) over other keys. |
+------+-------------------------------------------------+ +------+-----------------------------------------------------+
| 0x04 | This key may be used to encrypt communications. | | 0x02 | This key may be used to sign data. |
+------+-------------------------------------------------+ +------+-----------------------------------------------------+
| 0x08 | This key may be used to encrypt storage. | | 0x04 | This key may be used to encrypt communications. |
+------+-------------------------------------------------+ +------+-----------------------------------------------------+
| 0x10 | The private component of this key may have been | | 0x08 | This key may be used to encrypt storage. |
| | split by a secret-sharing mechanism. | +------+-----------------------------------------------------+
+------+-------------------------------------------------+ | 0x10 | The private component of this key may have been |
| 0x20 | This key may be used for authentication. | | | split by a secret-sharing mechanism. |
+------+-------------------------------------------------+ +------+-----------------------------------------------------+
| 0x80 | The private component of this key may be in the | | 0x20 | This key may be used for authentication. |
| | possession of more than one person. | +------+-----------------------------------------------------+
+------+-------------------------------------------------+ | 0x80 | The private component of this key may be in the |
| | possession of more than one person. |
+------+-----------------------------------------------------+
Table 9: Key flags registry (first octet) Table 10: Key flags registry (first octet)
Second octet: Second octet:
+======+==========================+ +======+==========================+
| flag | definition | | flag | definition |
+======+==========================+ +======+==========================+
| 0x04 | Reserved (ADSK). | | 0x04 | Reserved (ADSK). |
+------+--------------------------+ +------+--------------------------+
| 0x08 | Reserved (timestamping). | | 0x08 | Reserved (timestamping). |
+------+--------------------------+ +------+--------------------------+
Table 10: Key flags registry Table 11: Key flags registry
(second octet) (second octet)
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 signature who is making the statement --- for example, a certification
that has the "sign data" flag is stating that the certification is signature that has the "sign data" flag is stating that the
for that use. On the other hand, the "communications encryption" certification is for that use. On the other hand, the
flag in a self-signature is stating a preference that a given key be "communications encryption" flag in a self-signature is stating a
used for communications. Note however, that it is a thorny issue to preference that a given key be used for communications. Note
determine what is "communications" and what is "storage". This however, that it is a thorny issue to determine what is
decision is left wholly up to the implementation; the authors of this "communications" and what is "storage". This decision is left wholly
document do not claim any special wisdom on the issue and realize up to the implementation; the authors of this document do not claim
that accepted opinion may change. any special wisdom on the issue and realize that accepted opinion may
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 0x1F) or a subkey signature (type 0x18), one that refers to the (type 0x1F) or a subkey signature (type 0x18), one that refers to the
key the flag applies to. key the flag applies to.
5.2.3.26. Signer's User ID 5.2.3.27. 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
different purposes, such as business communications as well as different purposes, such as business communications as well as
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.27. Reason for Revocation 5.2.3.28. 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
certificate was revoked. certificate 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:
skipping to change at page 44, line 26 skipping to change at page 48, line 26
+---------+----------------------------------+ +---------+----------------------------------+
| 3 | Key is retired and no longer | | 3 | Key is retired and no longer |
| | used (key revocations) | | | used (key revocations) |
+---------+----------------------------------+ +---------+----------------------------------+
| 32 | User ID information is no longer | | 32 | User ID information is no longer |
| | valid (cert revocations) | | | valid (cert revocations) |
+---------+----------------------------------+ +---------+----------------------------------+
| 100-110 | Private Use | | 100-110 | Private Use |
+---------+----------------------------------+ +---------+----------------------------------+
Table 11: Reasons for revocation Table 12: Reasons for revocation
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, that is, of zero length. The (UTF-8). The string may be null (of zero length). The length of the
length of the subpacket is the length of the reason string plus one. subpacket is the length of the reason string plus one. An
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
revocation SHOULD include a 0x20 code. revocation SHOULD include a 0x20 code.
Note that any signature may be revoked, including a certification on Note that any signature may be revoked, including a certification on
some other person's key. There are many good reasons for revoking a some other person's key. There are many good reasons for revoking a
certification signature, such as the case where the keyholder leaves certification signature, such as the case where the keyholder leaves
the employ of a business with an email address. A revoked 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.28. Features 5.2.3.29. 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 backwards-compatible, a user can
state that they can use that feature. The flags are single bits that state 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 in a self-signature. appears 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. user who does not state that they can use it.
Defined features are as follows: Defined features are as follows:
First octet: First octet:
+=========+============================================+ +=========+===================================+===========+
| feature | definition | | Feature | Definition | Reference |
+=========+============================================+ +=========+===================================+===========+
| 0x01 | Modification Detection (packets 18 and 19) | | 0x01 | Symmetrically Encrypted Integrity | Section |
+---------+--------------------------------------------+ | | Protected Data packet version 1 | 5.14.1 |
| 0x02 | AEAD Encrypted Data (packet 20) | +---------+-----------------------------------+-----------+
+---------+--------------------------------------------+ | 0x02 | Reserved | |
| 0x04 | Reserved | +---------+-----------------------------------+-----------+
+---------+--------------------------------------------+ | 0x04 | Reserved | |
+---------+-----------------------------------+-----------+
| 0x08 | Symmetrically Encrypted Integrity | Section |
| | Protected Data packet version 2 | 5.14.2 |
+---------+-----------------------------------+-----------+
Table 12: Features registry Table 13: Features 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.
An implementation may freely infer features from other suitable An implementation may freely infer features from other suitable
implementation-dependent mechanisms. implementation-dependent mechanisms.
5.2.3.29. Signature Target See Section 15.1 for details about how to use the Features subpacket
when generating encryption data.
5.2.3.30. 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 or timestamp signature, this designates what signature is
signed. All arguments are an identifier of that target signature. 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 hash of the
signature. For example, a target signature with a SHA-1 hash MUST signature. For example, a target signature with a SHA-1 hash MUST
have 20 octets of hash data. have 20 octets of hash data.
5.2.3.30. Embedded Signature 5.2.3.31. 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.31. Issuer Fingerprint 5.2.3.32. 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 subpacket is also included in the the issuing key is 4 and an Issuer subpacket is also included in the
signature, the key ID of the Issuer subpacket MUST match the low 64 signature, the key ID of the Issuer subpacket MUST match the low 64
bits of the fingerprint. bits of the 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 5 key N is 32. octets; for a version 5 key N is 32.
5.2.3.32. Intended Recipient Fingerprint 5.2.3.33. 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. outside of its intended, encrypted context.
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 5 key N is 32. octets; for a version 5 key N is 32.
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, and then using the resulting hash in the signature algorithm. data, and then using the resulting hash in the signature algorithm.
When a V5 signature is made, the salt is hashed first.
For binary document signatures (type 0x00), the document data is For binary document signatures (type 0x00), the document data is
hashed directly. For text document signatures (type 0x01), the hashed directly. For text document signatures (type 0x01), the
document is canonicalized by converting line endings to <CR><LF>, and document is canonicalized by converting line endings to <CR><LF>, and
the resulting data is hashed. the resulting data is hashed.
When a V4 signature is made over a key, the hash data starts with the When a V4 signature is made over a key, the hash data starts with the
octet 0x99, followed by a two-octet length of the key, and then body octet 0x99, followed by a two-octet length of the key, and then body
of the key packet; when a V5 signature is made over a key, the hash of the key packet. When a V5 signature is made over a key, the hash
data starts with the octet 0x9a, followed by a four-octet length of data starts with the octet 0x9a, followed by a four-octet length of
the key, and then body of the key packet. A subkey binding signature the key, and then body of the key packet.
(type 0x18) or primary key binding signature (type 0x19) then hashes
the subkey using the same format as the main key (also using 0x99 or A subkey binding signature (type 0x18) or primary key binding
0x9a as the first octet). Primary key revocation signatures (type signature (type 0x19) then hashes the subkey using the same format as
0x20) hash only the key being revoked. Subkey revocation signature the main key (also using 0x99 or 0x9a as the first octet). Primary
(type 0x28) hash first the primary key and then the subkey being key revocation signatures (type 0x20) hash only the key being
revoked. revoked. Subkey revocation signature (type 0x28) hash first the
primary key and then the subkey being revoked.
A certification signature (type 0x10 through 0x13) hashes the User ID A certification signature (type 0x10 through 0x13) hashes the User ID
being bound to the key into the hash context after the above data. A being bound to the key into the hash context after the above data. A
V3 certification hashes the contents of the User ID or attribute V3 certification hashes the contents of the User ID or attribute
packet packet, without any header. A V4 or V5 certification hashes packet packet, without any header. A V4 or V5 certification hashes
the constant 0xB4 for User ID certifications or the constant 0xD1 for the constant 0xB4 for User ID certifications or the constant 0xD1 for
User Attribute certifications, followed by a four-octet number giving User Attribute certifications, followed by a four-octet number giving
the length of the User ID or User Attribute data, and then the User the length of the User ID or User Attribute data, and then the User
ID or User Attribute data. ID or User Attribute data.
When a signature is made over a Signature packet (type 0x50, "Third- When a signature is made over a Signature packet (type 0x50, "Third-
Party Confirmation signature"), the hash data starts with the octet Party Confirmation signature"), the hash data starts with the octet
0x88, followed by the four-octet length of the signature, and then 0x88, followed by the four-octet length of the signature, and then
the body of the Signature packet. (Note that this is an old-style the body of the Signature packet. (Note that this is a Legacy packet
packet header for a Signature packet with the length-of-length field header for a Signature packet with the length-of-length field set to
set to zero.) The unhashed subpacket data of the Signature packet zero.) The unhashed subpacket data of the Signature packet being
being hashed is not included in the hash, and the unhashed subpacket hashed is not included in the hash, and the unhashed subpacket data
data length value is set to zero. length value is 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 V3 signature hashes five octets of the packet body, starting
from the signature type field. This data is the signature type, from the signature type field. This data is the signature type,
followed by the four-octet signature time. followed by the four-octet signature time.
* A V4 signature hashes the packet body starting from its first * A V4 or V5 signature hashes the packet body starting from its
field, the version number, through the end of the hashed subpacket first field, the version number, through the end of the hashed
data and a final extra trailer. Thus, the hashed fields are: subpacket data and a final extra trailer. Thus, the hashed fields
are:
- the signature version (0x04),
- the signature type,
- the public-key algorithm,
- the hash algorithm,
- the hashed subpacket length,
- the hashed subpacket body,
- the two octets 0x04 and 0xFF,
- a four-octet big-endian number that is the length of the hashed
data from the Signature packet stopping right before the 0x04,
0xff octets.
The four-octet big-endian number is considered to be an
unsigned integer modulo 2**32.
* A V5 signature hashes the packet body starting from its first
field, the version number, through the end of the hashed subpacket
data and a final extra trailer. Thus, the hashed fields are:
- the signature version (0x05), - An octet indicating the signature version (0x04 for V4, 0x05
for V5),
- 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,
- Only for document signatures (type 0x00 or 0x01) the following - A second version octet (0x04 for V4, 0x05 for V5)
three data items are hashed here:
o the one-octet content format,
o the file name as a string (one octet length, followed by the
file name),
o a four-octet number that indicates a date,
- the two octets 0x05 and 0xFF,
- a eight-octet big-endian number that is the length of the - A single octet 0xFF,
hashed data from the Signature packet stopping right before the
0x05, 0xff octets.
The three data items hashed for document signatures need to - A number representing the length of the hashed data from the
mirror the values of the Literal Data packet. For detached and Signature packet stopping right before the second version
cleartext signatures 6 zero octets are hashed instead. octet. For a V4 signature, this is a four-octet big-endian
number, considered to be an unsigned integer modulo 2**32. For
a V5 signature, this is an eight-octet big-endian number,
considered to be an unsigned integer modulo 2**64.
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 placed at resulting hash field is used in the signature algorithm and placed at
the end of the Signature packet. the end of the Signature packet.
5.2.4.1. Subpacket Hints 5.2.4.1. Subpacket Hints
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
signature, but MAY use any conflict resolution scheme that makes more signature, but MAY use any conflict resolution scheme that makes more
sense. Please note that we are intentionally leaving conflict sense. Please note that we are intentionally leaving conflict
resolution to the implementer; most conflicts are simply syntax resolution to the implementer; most conflicts are simply syntax
errors, and the wishy-washy language here allows a receiver to be errors, and the wishy-washy language here allows a receiver to be
generous in what they accept, while putting pressure on a creator to generous in what they accept, while putting pressure on a creator to
be stingy in what they generate. 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 V3 key and a V4 key that share the same RSA
key material. Either of these keys can verify a signature created by key material. Either of these keys can verify a signature created by
the other, and it may be reasonable for a signature to contain an the other, and it may be reasonable for a signature to contain an
issuer subpacket for each key, as a way of explicitly tying those issuer subpacket for each key, as a way of explicitly tying those
keys to the signature. keys to the signature.
5.3. Symmetric-Key Encrypted Session Key Packets (Tag 3) 5.3. Symmetric-Key Encrypted Session Key Packets (Tag 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 and/or Zero or more Public-Key Encrypted Session Key packets (Section 5.1)
Symmetric-Key Encrypted Session Key packets may precede a an and/or Symmetric-Key Encrypted Session Key packets may precede a an
encryption container (i.e. a Symmetrically Encrypted Integrity encryption container (that is, a Symmetrically Encrypted Integrity
Protected Data packet, an AEAD Encrypted Data packet, or -- for Protected Data packet or --- for historic data --- a Symmetrically
historic data -- a Symmetrically Encrypted Data packet) that holds an Encrypted Data packet) that holds an encrypted message. The message
encrypted message. The message is encrypted with a session key, and is encrypted with a session key, and the session key is itself
the session key is itself encrypted and stored in the Encrypted encrypted and stored in the Encrypted Session Key packet(s).
Session Key packet or the Symmetric-Key Encrypted Session Key packet.
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. This packet type is new and is not generated by PGP 2 passphrases.
or PGP version 5.0.
The body of this packet starts with a one-octet number giving the
version number of the packet type. The currently defined versions
are 4 and 5. The remainder of the packet depends on the version.
The versions differ in how they encrypt the session key with the
password, and in what they encode. The version of the SKESK packet
must align with the version of the SEIPD packet (see
Section 11.3.2.1).
5.3.1. v4 SKESK
A version 4 Symmetric-Key Encrypted Session Key (SKESK) packet
precedes a version 1 Symmetrically Encrypted Integrity Protected Data
(v1 SEIPD, see Section 5.14.1) packet. In historic data, it is
sometimes found preceding a deprecated Symmetrically Encrypted Data
packet (SED, see Section 5.8). A v4 SKESK packet MUST NOT precede a
v2 SEIPD packet (see Section 11.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 one-octet version number with value 4.
* A one-octet number describing the symmetric algorithm used. * A one-octet number describing the symmetric algorithm used.
* A string-to-key (S2K) specifier, length as defined above. * A string-to-key (S2K) specifier. The length of the string-to-key
specifier depends on its 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 string-to-key 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 from the
Symmetric-Key Encrypted Session Key packet. 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 one-octet algorithm identifier
that specifies the symmetric-key encryption algorithm used to encrypt that specifies the symmetric-key encryption algorithm used to encrypt
the following encryption container, followed by the session key the following encryption container, followed by the session key
octets themselves. octets 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 or an Iterated- specifier MUST use a salt value, either a Salted S2K, an Iterated-
Salted S2K. The salt value will ensure that the decryption key is Salted S2K, or Argon2. The salt value will ensure that the
not repeated even if the passphrase is reused. decryption key is not repeated even if the passphrase is reused.
5.3.2. v5 SKESK
A version 5 Symmetric-Key Encrypted Session Key (SKESK) packet
precedes a version 2 Symmetrically Encrypted Integrity Protected Data
(v2 SEIPD, see Section 5.14.2) packet. A v5 SKESK packet MUST NOT
precede a v1 SEIPD packet or a deprecated Symmetrically Encrypted
Data packet (see Section 11.3.2.1).
A version 5 Symmetric-Key Encrypted Session Key packet consists of: A version 5 Symmetric-Key Encrypted Session Key packet consists of:
* A one-octet version number with value 5. * A one-octet version number with value 5.
* A one-octet cipher algorithm. * A one-octet scalar octet count of the following 5 fields.
* A one-octet AEAD algorithm. * A one-octet symmetric cipher algorithm identifier.
* A string-to-key (S2K) specifier, length as defined above. * A one-octet AEAD algorithm identifier.
* A one-octet scalar octet count of the following field.
* A string-to-key (S2K) specifier. The length of the string-to-key
specifier depends on its type (see Section 3.7.1).
* A starting initialization vector of size specified by the AEAD * A starting initialization vector of size specified by the AEAD
algorithm. algorithm.
* The encrypted session key itself, which is decrypted with the * The encrypted session key itself.
string-to-key object using the given cipher and AEAD mode.
* An authentication tag for the AEAD mode. * An authentication tag for the AEAD mode.
The encrypted session key is encrypted using one of the AEAD HKDF is used with SHA256 as hash algorithm, the key derived from S2K
algorithms specified for the AEAD Encrypted Data Packet. Note that as Initial Keying Material (IKM), no salt, and the Packet Tag in new
no chunks are used and that there is only one authentication tag. format encoding (bits 7 and 6 set, bits 5-0 carry the packet tag),
The Packet Tag in new format encoding (bits 7 and 6 set, bits 5-0 the packet version, and the cipher-algo and AEAD-mode used to encrypt
carry the packet tag), the packet version number, the cipher the key material, are used as info parameter. Then, the session key
algorithm octet, and the AEAD algorithm octet are given as additional is encrypted using the resulting key, with the AEAD algorithm
data. For example, the additional data used with EAX and AES-128 specified for version 2 of the Symmetrically Encrypted Integrity
consists of the octets 0xC3, 0x05, 0x07, and 0x01. Protected Data packet. Note that no chunks are used and that there
is only one authentication tag. The Packet Tag in OpenPGP format
5.3.1. No v5 SKESK with SEIPD encoding (bits 7 and 6 set, bits 5-0 carry the packet tag), the
packet version number, the cipher algorithm octet, and the AEAD
Note that unlike the AEAD Encrypted Data Packet (AED, see algorithm octet are given as additional data. For example, the
Section 5.16), the Symmetrically Encrypted Integrity Protected Data additional data used with AES-128 with OCB consists of the octets
Packet (SEIPD, see Section 5.14) does not internally indicate what 0xC3, 0x05, 0x07, and 0x02.
cipher algorithm to use to decrypt it. Since the v5 SKESK packet's
encrypted payload only indicates the key used, not the choice of
cipher algorithm used for the subsequent encrypted data, a v5 SKESK
packet can only provide a session key for an AED packet, and MUST NOT
be used to provide a session key for a SEIPD Packet.
5.4. One-Pass Signature Packets (Tag 4) 5.4. One-Pass Signature Packets (Tag 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.
A One-Pass Signature does not interoperate with PGP 2.6.x or earlier.
The body of this packet consists of: The body of this packet consists of:
* A one-octet version number. The current version is 3. * A one-octet version number. The currently defined versions are 3
and 5.
* A one-octet signature type. Signature types are described in * A one-octet signature type. Signature types are described in
Section 5.2.1. Section 5.2.1.
* A one-octet number describing the hash algorithm used. * A one-octet number describing the hash algorithm used.
* A one-octet number describing the public-key algorithm used. * A one-octet number describing the public-key algorithm used.
* An eight-octet number holding the Key ID of the signing key. * Only for V5 packets, a 16 octet field containing random values
used as salt. The value must match the salt field of the
corresponding Signature packet.
* Only for V3 packets, an eight-octet number holding the Key ID of
the signing key.
* Only for V5 packets, a one octet key version number and N octets
of the fingerprint of the signing key. Note that the length N of
the fingerprint for a version 5 key is 32.
* A one-octet number holding a flag showing whether the signature is * A one-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
correspond to the version of the associated signature packet, except
for the historical accident that v4 keys use a v3 one-pass signature
packet (there is no v4 OPS):
+=====================+====================+================+
| Signing key version | OPS packet version | Signature |
| | | packet version |
+=====================+====================+================+
| 4 | 3 | 4 |
+---------------------+--------------------+----------------+
| 5 | 5 | 5 |
+---------------------+--------------------+----------------+
Table 14: Versions of packets used in a one-pass signature
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- packet and the final Signature packet corresponds to the first one-
pass packet. pass packet.
5.5. Key Material Packet 5.5. Key Material Packet
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, and two private key. There are four variants of this packet type, and two
skipping to change at page 52, line 32 skipping to change at page 57, line 13
key (sometimes called an OpenPGP certificate). key (sometimes called an OpenPGP certificate).
5.5.1.2. Public-Subkey Packet (Tag 14) 5.5.1.2. Public-Subkey Packet (Tag 14)
A Public-Subkey packet (tag 14) has exactly the same format as a A Public-Subkey packet (tag 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 denotes a subkey. One or more subkeys may be
associated with a top-level key. By convention, the top-level key associated with a top-level key. By convention, the top-level key
provides signature services, and the subkeys provide encryption provides signature services, and the subkeys provide encryption
services. services.
Note: in PGP version 2.6, tag 14 was intended to indicate a comment
packet. This tag was selected for reuse because no previous version
of PGP ever emitted comment packets but they did properly ignore
them. Public-Subkey packets are ignored by PGP version 2.6 and do
not cause it to fail, providing a limited degree of backward
compatibility.
5.5.1.3. Secret-Key Packet (Tag 5) 5.5.1.3. Secret-Key Packet (Tag 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 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 (Tag 7) 5.5.1.4. Secret-Subkey Packet (Tag 7)
A Secret-Subkey packet (tag 7) is the subkey analog of the Secret Key A Secret-Subkey packet (tag 7) is the subkey analog of the Secret Key
packet and has exactly the same format. packet and has exactly the same format.
5.5.2. Public-Key Packet Formats 5.5.2. Public-Key Packet Formats
There are three versions of key-material packets. Version 3 packets There are three versions of key-material packets.
were first generated by PGP version 2.6. Version 4 keys first
appeared in PGP 5 and are the preferred key version for OpenPGP.
OpenPGP implementations MUST create keys with version 4 format. V3 OpenPGP implementations SHOULD create keys with version 5 format. V4
keys are deprecated; an implementation MUST NOT generate a V3 key, keys are deprecated; an implementation SHOULD NOT generate a V4 key,
but MAY accept it. but SHOULD accept it. V3 keys are deprecated; an implementation MUST
NOT generate a V3 key, but MAY accept it. V2 keys are deprecated; an
implementation MUST NOT generate a V2 key, but MAY accept it.
A version 3 public key or public-subkey packet contains: A version 3 public key or public-subkey packet contains:
* A one-octet version number (3). * A one-octet version number (3).
* A four-octet number denoting the time that the key was created. * A four-octet number denoting the time that the key was created.
* A two-octet number denoting the time in days that this key is * A two-octet number denoting the time in days that this key is
valid. If this number is zero, then it does not expire. valid. If this number is zero, then it does not expire.
skipping to change at page 53, line 39 skipping to change at page 58, line 12
- an MPI of RSA public encryption exponent e. - an MPI of RSA public encryption exponent e.
V3 keys are deprecated. They contain three weaknesses. First, it is V3 keys are deprecated. They contain three weaknesses. First, it is
relatively easy to construct a V3 key that has the same Key ID as any relatively easy to construct a V3 key that has the same Key ID as any
other key because the Key ID is simply the low 64 bits of the public other key because the Key ID is simply the low 64 bits of the public
modulus. Secondly, because the fingerprint of a V3 key hashes the modulus. Secondly, because the fingerprint of a V3 key hashes the
key material, but not its length, there is an increased opportunity key material, but not its length, there is an increased opportunity
for fingerprint collisions. Third, there are weaknesses in the MD5 for fingerprint collisions. Third, there are weaknesses in the MD5
hash algorithm that make developers prefer other algorithms. See hash algorithm that make developers prefer other algorithms. See
below for a fuller discussion of Key IDs and fingerprints. Section 12.2 for a fuller discussion of Key IDs and fingerprints.
V2 keys are identical to the deprecated V3 keys except for the V2 keys are identical to the deprecated V3 keys except for the
version number. An implementation MUST NOT generate them and MAY version number.
accept or reject them as it sees fit.
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 12. Section 12.
A version 4 packet contains: A version 4 packet contains:
* A one-octet version number (4). * A one-octet version number (4).
* A four-octet number denoting the time that the key was created. * A four-octet number denoting the time that the key was created.
* A one-octet number denoting the public-key algorithm of this key. * A one-octet number denoting the public-key algorithm of this key.
* A series of multiprecision integers comprising the key material. * A series of values comprising the key material. This is
This is algorithm-specific and described in Section 5.6. algorithm-specific and described in Section 5.6.
The version 5 format is similar to the version 4 format except for The version 5 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 5 keys are calculated differently from fingerprints of version 5 keys are calculated differently from
version 4 keys, as described in the section "Enhanced Key Formats". version 4 keys, as described in Section 12.
A version 5 packet contains: A version 5 packet contains:
* A one-octet version number (5). * A one-octet version number (5).
* A four-octet number denoting the time that the key was created. * A four-octet number denoting the time that the key was created.
* A one-octet number denoting the public-key algorithm of this key. * A one-octet number denoting the public-key algorithm of this key.
* A four-octet scalar octet count for the following public key * A four-octet scalar octet count for the following public key
skipping to change at page 54, line 43 skipping to change at page 59, line 16
algorithm-specific and described in Section 5.6. algorithm-specific and described in Section 5.6.
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:
* A Public-Key or Public-Subkey packet, as described above. * The fields of a Public-Key or Public-Subkey packet, as described
above.
* One octet indicating string-to-key usage conventions. Zero * One octet indicating string-to-key usage conventions. Zero
indicates that the secret-key data is not encrypted. 255 or 254 indicates that the secret-key data is not encrypted. 255, 254, or
indicates that a string-to-key specifier is being given. Any 253 indicates that a string-to-key specifier is being given. Any
other value is a symmetric-key encryption algorithm identifier. A other value is a symmetric-key encryption algorithm identifier. A
version 5 packet MUST NOT use the value 255. version 5 packet MUST NOT use the value 255.
* Only for a version 5 packet, a one-octet scalar octet count of the * Only for a version 5 packet, a one-octet scalar octet count of the
next 4 optional fields. next 5 optional fields.
* [Optional] If string-to-key usage octet was 255, 254, or 253, a * [Optional] If string-to-key usage octet was 255, 254, or 253, a
one-octet symmetric encryption algorithm. one-octet symmetric encryption algorithm.
* [Optional] If string-to-key usage octet was 253, a one-octet AEAD * [Optional] If string-to-key usage octet was 253, a one-octet AEAD
algorithm. algorithm.
* [Optional] Only for a version 5 packet, and if string-to-key usage
octet was 255, 254, or 253, an one-octet count of the following
field.
* [Optional] If string-to-key usage octet was 255, 254, or 253, a * [Optional] If string-to-key usage octet was 255, 254, or 253, a
string-to-key specifier. The length of the string-to-key string-to-key (S2K) specifier. The length of the string-to-key
specifier is implied by its type, as described above. specifier depends on its type (see Section 3.7.1).
* [Optional] If string-to-key usage octet was 253 (i.e. the secret * [Optional] If string-to-key usage octet was 253 (that is, the
data is AEAD-encrypted), an initialization vector (IV) of size secret data is AEAD-encrypted), an initialization vector (IV) of
specified by the AEAD algorithm (see Section 5.16), which is used size specified by the AEAD algorithm (see Section 5.14.2), which
as the nonce for the AEAD algorithm. is used as the nonce for the AEAD algorithm.
* [Optional] If string-to-key usage octet was 255, 254, or a cipher * [Optional] If string-to-key usage octet was 255, 254, or a cipher
algorithm identifier (i.e. the secret data is CFB-encrypted), an algorithm identifier (that is, the secret data is CFB-encrypted),
initialization vector (IV) of the same length as the cipher's an initialization vector (IV) of the same length as the cipher's
block size. block size.
* Only for a version 5 packet, a four-octet scalar octet count for
the following secret key material. This includes the encrypted
SHA-1 hash or AEAD tag if the string-to-key usage octet is 254 or
253.
* 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 section key data. This is algorithm-specific and described in
Section 5.6. If the string-to-key usage octet is 253, then an Section 5.6. If the string-to-key usage octet is 253, then an
AEAD authentication tag is part of that data. If the string-to- AEAD authentication tag is part of that data. If the string-to-
key usage octet is 254, a 20-octet SHA-1 hash of the plaintext of key usage octet is 254, a 20-octet SHA-1 hash of the plaintext of
the algorithm-specific portion is appended to plaintext and the algorithm-specific portion is appended to plaintext and
encrypted with it. If the string-to-key usage octet is 255 or encrypted with it. If the string-to-key usage octet is 255 or
another nonzero value (i.e., a symmetric-key encryption algorithm another nonzero value (that is, a symmetric-key encryption
identifier), a two-octet checksum of the plaintext of the algorithm identifier), a two-octet checksum of the plaintext of
algorithm-specific portion (sum of all octets, mod 65536) is the algorithm-specific portion (sum of all octets, mod 65536) is
appended to plaintext and encrypted with it. (This is deprecated appended to plaintext and encrypted with it. (This is deprecated
and SHOULD NOT be used, see below.) and SHOULD NOT be used, see below.)
* If the string-to-key usage octet is zero, then a two-octet * If the string-to-key usage octet is zero, then a two-octet
checksum of the algorithm-specific portion (sum of all octets, mod checksum of the algorithm-specific portion (sum of all octets, mod
65536). 65536).
The details about storing algorithm-specific secrets above are
summarized in Table 2.
Note that the version 5 packet format adds two count values to help Note that the version 5 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 a string-
to-key specifier is given, that describes the algorithm for to-key specifier is given, that describes the algorithm for
converting the passphrase to a key, else a simple MD5 hash of the converting the passphrase to a key, else a simple MD5 hash of the
passphrase is used. Implementations MUST use a string-to-key passphrase is used. Implementations MUST use a string-to-key
specifier; the simple hash is for backward compatibility and is specifier; the simple hash is for backward compatibility and is
deprecated, though implementations MAY continue to use existing deprecated, though implementations MAY continue to use existing
private keys in the old format. The cipher for encrypting the MPIs private keys in the old format. The cipher for encrypting the MPIs
is specified in the Secret-Key packet. is specified in the 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 initialization vector from the
packet. If the string-to-key usage octet is not 253, CFB mode is packet. If the string-to-key usage octet is not 253, CFB mode is
used. A different mode is used with V3 keys (which are only RSA) used. A different mode is used with V3 keys (which are only RSA)
than with other key formats. With V3 keys, the MPI bit count prefix than with other key formats. With V3 keys, the MPI bit count prefix
(i.e., the first two octets) is not encrypted. Only the MPI non- (that is, the first two octets) is not encrypted. Only the MPI non-
prefix data is encrypted. Furthermore, the CFB state is prefix data is encrypted. Furthermore, the CFB state is
resynchronized at the beginning of each new MPI value, so that the resynchronized at the beginning of each new MPI value, so that the
CFB block boundary is aligned with the start of the MPI data. CFB block boundary is aligned with the start of the MPI data.
With V4 and V5 keys, a simpler method is used. All secret MPI values With V4 and V5 keys, a simpler method is used. All secret MPI values
are encrypted, including the MPI bitcount prefix. are encrypted, including the MPI bitcount prefix.
If the string-to-key usage octet is 253, the encrypted MPI values are If the string-to-key usage octet is 253, the key encryption key is
encrypted as one combined plaintext using one of the AEAD algorithms derived using HKDF (see [RFC5869]) to provide key separation. HKDF
specified for the AEAD Encrypted Data Packet. Note that no chunks is used with SHA256 as hash algorithm, the key derived from S2K as
are used and that there is only one authentication tag. As Initial Keying Material (IKM), no salt, and the Packet Tag in OpenPGP
additional data, the Packet Tag in new format encoding (bits 7 and 6 format encoding (bits 7 and 6 set, bits 5-0 carry the packet tag),
set, bits 5-0 carry the packet tag), followed by the public key the packet version, and the cipher-algo and AEAD-mode used to encrypt
packet fields, starting with the packet version number, are passed to the key material, are used as info parameter. Then, the encrypted
the AEAD algorithm. For example, the additional data used with a MPI values are encrypted as one combined plaintext using one of the
Secret-Key Packet of version 4 consists of the octets 0xC5, 0x04, AEAD algorithms specified for version 2 of the Symmetrically
followed by four octets of creation time, one octet denoting the Encrypted Integrity Protected Data packet. Note that no chunks are
public-key algorithm, and the algorithm-specific public-key used and that there is only one authentication tag. As additional
parameters. For a Secret-Subkey Packet, the first octet would be data, the Packet Tag in OpenPGP format encoding (bits 7 and 6 set,
0xC7. For a version 5 key packet, the second octet would be 0x05, bits 5-0 carry the packet tag), followed by the public key packet
and the four-octet octet count of the public key material would be fields, starting with the packet version number, are passed to the
included as well (see Section 5.5.2). AEAD algorithm. For example, the additional data used with a Secret-
Key Packet of version 4 consists of the octets 0xC5, 0x04, followed
by four octets of creation time, one octet denoting the public-key
algorithm, and the algorithm-specific public-key parameters. For a
Secret-Subkey Packet, the first octet would be 0xC7. For a version 5
key packet, the second octet would be 0x05, and the four-octet octet
count of the 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 two-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 MPI prefix and data). With V3 keys, the
checksum is stored in the clear. With V4 keys, the checksum is checksum is stored in the clear. With V4 keys, the checksum is
encrypted like the algorithm-specific data. This value is used to encrypted like the algorithm-specific data. This value is used to
check that the passphrase was correct. However, this checksum is check that the passphrase was correct. However, this checksum is
deprecated; an implementation SHOULD NOT use it, but should rather deprecated; an implementation SHOULD NOT use it, but should rather
use the SHA-1 hash denoted with a usage octet of 254. The reason for use the SHA-1 hash denoted with a usage octet of 254. The reason for
this is that there are some attacks that involve undetectably this is that there are some attacks that involve undetectably
modifying the secret key. If the string-to-key usage octet is 253 no modifying the secret key. If the string-to-key usage octet is 253 no
checksum or SHA-1 hash is used but the authentication tag of the AEAD checksum or SHA-1 hash is used but the authentication tag of the AEAD
algorithm follows. algorithm follows.
When decrypting the secret key material using any of these schemes
(that is, where the usage octet is non-zero), the resulting cleartext
octet stream MUST be well-formed. In particular, an implementation
MUST NOT interpret octets beyond the unwrapped cleartext octet stream
as part of any of the unwrapped MPI objects. Furthermore, an
implementation MUST reject as unusable any secret key material whose
cleartext length does not align with the lengths of the unwrapped MPI
objects.
5.6. Algorithm-specific Parts of Keys 5.6. Algorithm-specific Parts of Keys
The public and secret key format specifies algorithm-specific parts The public and secret key format specifies algorithm-specific parts
of a key. The following sections describe them in detail. of a key. The following sections describe them in detail.
5.6.1. Algorithm-Specific Part for RSA Keys 5.6.1. Algorithm-Specific Part for RSA Keys
The public key is this series of multiprecision integers: The public key is this series of multiprecision integers:
* MPI of RSA public modulus n; * MPI of RSA public modulus n;
skipping to change at page 59, line 42 skipping to change at page 64, line 35
Section 13.5 for details. Section 13.5 for details.
Observe that an ECDH public key is composed of the same sequence of Observe that an ECDH public key is composed of the same sequence of
fields that define an ECDSA key plus the KDF parameters field. fields that define an ECDSA key plus the KDF parameters field.
The secret key is this single multiprecision integer: The secret key is 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.6.6.1. ECDH Secret Key Material
When curve P-256, P-384, or P-521 are used in ECDH, their secret keys
are represented as a simple integer in standard MPI form. Other
curves are presented on the wire differently (though still as a
single MPI), as described below and in Section 9.2.1.
5.6.6.1.1. Curve25519 ECDH Secret Key Material
A Curve25519 secret key is stored as a standard integer in big-endian
MPI form. Note that this form is in reverse octet order from the
little-endian "native" form found in [RFC7748].
Note also that the integer for a Curve25519 secret key for 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 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 following 32
octets from the wire will produce the "native" form.
When generating a new Curve25519 secret key from 32 fully-random
octets, the following pseudocode produces the MPI wire format (note
the similarity to decodeScalar25519 from [RFC7748]):
def curve25519_MPI_from_random(octet_list):
octet_list[0] &= 248
octet_list[31] &= 127
octet_list[31] |= 64
mpi_header = [ 0x00, 0xff ]
return mpi_header || reversed(octet_list)
5.6.6.1.2. X448 ECDH Secret Key Material
An X448 secret key is contained within its MPI as a prefixed octet
string (see Section 13.3.2), which encapsulates the native secret key
format found in [RFC7748]. The full wire format (as an MPI) will
thus be the three octets 01 c7 40 followed by the full 56 octet
native secret key.
When generating a new X448 secret key from 56 fully-random octets,
the following pseudocode produces the MPI wire format:
def X448_MPI_from_random(octet_list):
prefixed_header = [ 0x01, 0xc7, 0x40 ]
return prefixed_header || octet_list
5.7. Compressed Data Packet (Tag 8) 5.7. Compressed Data Packet (Tag 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 that gives 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 an block that compresses A Compressed Data Packet's body contains an block that compresses
some set of packets. See Section 11 for details on how messages are some set of packets. See Section 11 for details on how messages are
formed. formed.
ZIP-compressed packets are compressed with raw [RFC1951] DEFLATE ZIP-compressed packets are compressed with raw [RFC1951] DEFLATE
blocks. Note that PGP V2.6 uses 13 bits of compression. If an blocks.
implementation uses more bits of compression, PGP V2.6 cannot
decompress it.
ZLIB-compressed packets are compressed with [RFC1950] ZLIB-style ZLIB-compressed packets are compressed with [RFC1950] ZLIB-style
blocks. blocks.
BZip2-compressed packets are compressed using the BZip2 [BZ2] BZip2-compressed packets are compressed using the BZip2 [BZ2]
algorithm. algorithm.
An implementation that generates a Compressed Data packet MUST use
the non-legacy format for packet framing (see Section 4.2.1). It
MUST NOT generate a Compressed Data packet with Legacy format
(Section 4.2.2)
An implementation that deals with either historic data or data
generated by legacy implementations MAY interpret Compressed Data
packets that use the Legacy format for packet framing.
5.8. Symmetrically Encrypted Data Packet (Tag 9) 5.8. Symmetrically Encrypted Data Packet (Tag 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 other Symmetrically Encrypted Data packets or
sequences of packets that form whole OpenPGP messages). sequences of packets that form whole OpenPGP messages).
This packet is obsolete. An implementation MUST NOT create this This packet is obsolete. An implementation MUST NOT create this
packet. An implementation MAY process such a packet but it MUST packet. An implementation MAY process such a packet but it MUST
return a clear diagnostic that a non-integrity protected packet has return a clear diagnostic that a non-integrity protected packet has
been processed. The implementation SHOULD also return an error in been processed. The implementation SHOULD also return an error in
this case and stop processing. this case and stop processing.
This packet format is impossible to handle safely in general because
the ciphertext it provides is malleable. See Section 15.1 about
selecting a better OpenPGP encryption container that does not have
this flaw.
The body of this packet consists of: The body of this packet consists of:
* Encrypted data, the output of the selected symmetric-key cipher * Encrypted data, the output of the selected symmetric-key cipher
operating in OpenPGP's variant of Cipher Feedback (CFB) mode. operating in OpenPGP's variant of Cipher Feedback (CFB) mode.
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 octet is prefixed to the session key before it is algorithm octet is prefixed to the session key before it is
encrypted. If no packets of these types precede the encrypted data, encrypted. If no packets of these types precede the encrypted data,
skipping to change at page 61, line 21 skipping to change at page 67, line 34
After encrypting the first block-size-plus-two octets, the CFB state After encrypting the first block-size-plus-two octets, the CFB state
is resynchronized. The last block-size octets of ciphertext are is resynchronized. The last block-size octets of ciphertext are
passed through the cipher and the block boundary is reset. passed through the cipher and the block boundary is reset.
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 15 for hints on the proper use of this "quick incorrect. See Section 15 for hints on the proper use of this "quick
check". check".
5.9. Marker Packet (Obsolete Literal Packet) (Tag 10) 5.9. Marker Packet (Tag 10)
An experimental version of PGP used this packet as the Literal
packet, but no released version of PGP generated Literal packets with
this tag. With PGP 5, this packet has been reassigned and is
reserved for use as the Marker packet.
The body of this packet consists of: The body of this 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. It may be placed at the Such a packet MUST be ignored when received.
beginning of a message that uses features not available in PGP
version 2.6 in order to cause that version to report that newer
software is necessary to process the message.
5.10. Literal Data Packet (Tag 11) 5.10. Literal Data Packet (Tag 11)
A Literal Data packet contains the body of a message; data that is A Literal Data packet contains the body of a message; data that is
not to be further interpreted. 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 one-octet field that describes how the data is formatted.
If it is a "b" (0x62), then the Literal packet contains binary If it is a b (0x62), then the Literal packet contains binary data.
data. If it is a "t" (0x74), then it contains text data, and thus If it is a u (0x75), then the Literal packet contains UTF-
may need line ends converted to local form, or other text-mode 8-encoded text data, and thus may need line ends converted to
changes. The tag "u" (0x75) means the same as "t", but also local form, or other text mode changes.
indicates that implementation believes that the literal data
contains UTF-8 text.
Early versions of PGP also defined a value of "l" as a 'local' Older versions of OpenPGP used t (0x74) to indicate textual data,
mode for machine-local conversions. [RFC1991] incorrectly stated but did not specify the character encoding. Implementations
this local mode flag as "1" (ASCII numeral one). Both of these SHOULD NOT emit this value. An implementation that receives a
local modes are deprecated. literal data packet with this value in the format field SHOULD
interpret the packet data as UTF-8 encoded text, unless reliable
(not attacker-controlled) context indicates a specific alternate
text encoding. This mode is deprecated due to its ambiguity.
Early versions of PGP also defined a value of l as a 'local' mode
for machine-local conversions. [RFC1991] incorrectly stated this
local mode flag as 1 (ASCII numeral one). Both of these local
modes are deprecated.
* File name as a string (one-octet length, followed by a file name). * File name as a string (one-octet length, followed by a file name).
This may be a zero-length string. Commonly, if the source of the This may be a zero-length string. Commonly, if the source of the
encrypted data is a file, this will be the name of the encrypted encrypted data is a file, this will be the name of the encrypted
file. An implementation MAY consider the file name in the Literal file. An implementation MAY consider the file name in the Literal
packet to be a more authoritative name than the actual file name. packet to be a more authoritative name than the actual file name.
If the special name "_CONSOLE" is used, the message is considered
to be "for your eyes only". This advises that the message data is
unusually sensitive, and the receiving program should process it
more carefully, perhaps avoiding storing the received data to
disk, for example.
* A four-octet number that indicates a date associated with the * A four-octet number that indicates a date associated with the
literal data. Commonly, the date might be the modification date literal data. Commonly, the date might be the modification date
of a file, or the time the packet was created, or a zero that of a file, or the time the packet was created, or a zero that
indicates no specific time. indicates no specific time.
* The remainder of the packet is literal data. * The remainder of the packet is literal data.
Text data is stored with <CR><LF> text endings (i.e., network- Text data is stored with <CR><LF> text endings (that is, network-
normal line endings). These should be converted to native line normal line endings). These should be converted to native line
endings by the receiving software. endings by the receiving software.
Note that V3 and V4 signatures do not include the formatting octet, Note that OpenPGP signatures do not include the formatting octet, the
the file name, and the date field of the literal packet in a file name, and the date field of the literal packet in a signature
signature hash and thus are not protected against tampering in a hash and thus those fields are not protected against tampering in a
signed document. In contrast V5 signatures include them. signed document. A receiving implementation MUST NOT treat those
fields as though they were cryptographically secured by the
surrounding signature either when representing them to the user or
acting on them.
Due to their inherent malleability, an implementation that generates
a literal data packet SHOULD avoid storing any significant data in
these fields. If the implementation is certain that the data is
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
Section 5.2.1), it MAY set the format octet to u. Otherwise, it
SHOULD 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 (encoded as four zero octets).
An application that wishes to include such filesystem metadata within
a signature is advised to sign an encapsulated archive (for example,
[PAX]).
An implementation that generates a Literal Data packet MUST use the
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)
An implementation that deals with either historic data or data
generated by legacy implementations MAY interpret Literal Data
packets that use the Legacy format for packet framing.
5.10.1. Special Filename _CONSOLE (Deprecated)
The Literal Data packet's filename field has a historical special
case for the special name _CONSOLE. When the filename field is
_CONSOLE, the message is considered to be "for your eyes only". This
advises that the message data is unusually sensitive, and the
receiving program should process it more carefully, perhaps avoiding
storing the received data to disk, for example.
An OpenPGP deployment that generates literal data packets MUST NOT
depend on this indicator being honored in any particular way. It
cannot be enforced, and the field itself is not covered by any
cryptographic signature.
It is NOT RECOMMENDED to use this special filename in a newly-
generated literal data packet.
5.11. Trust Packet (Tag 12) 5.11. Trust Packet (Tag 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 key holders are trustworthy introducers, specifications of which key holders are trustworthy introducers,
along with other information that implementing software uses for along with other information that implementing software uses for
trust information. The format of Trust packets is defined by a given trust information. The format of Trust packets is defined by a given
implementation. implementation.
skipping to change at page 63, line 49 skipping to change at page 70, line 49
The following table lists the currently known subpackets: The following table lists the currently known subpackets:
+=========+===========================+ +=========+===========================+
| Type | Attribute Subpacket | | Type | Attribute Subpacket |
+=========+===========================+ +=========+===========================+
| 1 | Image Attribute Subpacket | | 1 | Image Attribute Subpacket |
+---------+---------------------------+ +---------+---------------------------+
| 100-110 | Private/Experimental Use | | 100-110 | Private/Experimental Use |
+---------+---------------------------+ +---------+---------------------------+
Table 13: User Attribute type registry Table 15: User Attribute type 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.13.1. The Image Attribute Subpacket 5.13.1. The 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
skipping to change at page 64, line 39 skipping to change at page 71, line 39
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.14. Sym. Encrypted Integrity Protected Data Packet (Tag 18) 5.14. Sym. Encrypted Integrity Protected Data Packet (Tag 18)
The Symmetrically Encrypted Integrity Protected Data packet is a This packet contains integrity protected and encrypted data. When it
variant of the Symmetrically Encrypted Data packet. It is a new has been decrypted, it will contain other packets forming an OpenPGP
feature created for OpenPGP that addresses the problem of detecting a Message (see Section 11.3).
modification to encrypted data. It is used in combination with a
Modification Detection Code packet.
There is a corresponding feature in the features Signature subpacket The first octet of this packet is always used to indicate the version
that denotes that an implementation can properly use this packet number, but different versions contain differently-structured
type. An implementation MUST support decrypting and generating these ciphertext. Version 1 of this packet contains data encrypted with a
packets. An implementation SHOULD specifically denote support for symmetric-key algorithm and protected against modification by the
this packet, but it MAY infer it from other mechanisms. SHA-1 hash algorithm. This is a legacy OpenPGP mechanism that offers
some protections against ciphertext malleability.
For example, an implementation might infer from the use of a cipher Version 2 of this packet contains data encrypted with an
such as Advanced Encryption Standard (AES) or Twofish that a user authenticated encryption and additional data (AEAD) construction.
supports this feature. It might place in the unhashed portion of This offers a more cryptographically rigorous defense against
another user's key signature a Features subpacket. It might also ciphertext malleability, but may not be as widely supported yet. See
present a user with an opportunity to regenerate their own self- Section 15.1 for more details on choosing between these formats.
signature with a Features subpacket.
This packet contains data encrypted with a symmetric-key algorithm 5.14.1. Version 1 Sym. Encrypted Integrity Protected Data Packet Format
and protected against modification by the SHA-1 hash algorithm. When
it has been decrypted, it will typically contain other packets (often
a Literal Data packet or Compressed Data packet). The last decrypted
packet in this packet's payload MUST be a Modification Detection Code
packet.
The body of this packet consists of: A version 1 Symmetrically Encrypted Integrity Protected Data packet
consists of:
* A one-octet version number. The only currently defined value is * A one-octet version number with value 1.
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 mode with shift amount equal to the operating in Cipher Feedback mode with shift amount equal to the
block size of the cipher (CFB-n where n is the block size). block size of the cipher (CFB-n where n is the block size).
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 Integrity Protected Data packet. In either
case, the cipher algorithm octet is prefixed to the session key case, the cipher algorithm octet is prefixed to the session key
before it is encrypted. before it is encrypted.
skipping to change at page 65, line 46 skipping to change at page 72, line 40
zeros. Instead of using an IV, OpenPGP prefixes an octet string to zeros. Instead of using an IV, OpenPGP prefixes an octet string to
the data before it is encrypted. The length of the octet string the data before it is encrypted. The length of the octet string
equals the block size of the cipher in octets, plus two. The first equals the block size of the cipher in octets, plus two. The first
octets in the group, of length equal to the block size of the cipher, octets in the group, of length equal to the block size of the cipher,
are random; the last two octets are each copies of their 2nd are random; the last two octets are each copies of their 2nd
preceding octet. For example, with a cipher whose block size is 128 preceding octet. For example, with a cipher whose block size is 128
bits or 16 octets, the prefix data will contain 16 random octets, bits or 16 octets, the prefix data will contain 16 random octets,
then two more octets, which are copies of the 15th and 16th octets, then two more octets, which are copies of the 15th and 16th octets,
respectively. Unlike the Symmetrically Encrypted Data Packet, no respectively. Unlike the Symmetrically Encrypted Data Packet, no
special CFB resynchronization is done after encrypting this prefix special CFB resynchronization is done after encrypting this prefix
data. See Section 14.10 for more details. data. See Section 14.9 for more details.
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. incorrect.
The plaintext of the data to be encrypted is passed through the SHA-1 Two constant octets with the values 0xD3 and 0x14 are appended to the
hash function, and the result of the hash is appended to the plaintext. Then, the plaintext of the data to be encrypted is passed
plaintext in a Modification Detection Code packet. The input to the through the SHA-1 hash function. The input to the hash function
hash function includes the prefix data described above; it includes includes the prefix data described above; it includes all of the
all of the plaintext, and then also includes two octets of values plaintext, including the trailing constant octets 0xD3, 0x14. The 20
0xD3, 0x14. These represent the encoding of a Modification Detection octets of the SHA-1 hash are then appended to the plaintext (after
Code packet tag and length field of 20 octets. the constant octets 0xD3, 0x14) and encrypted along with the
plaintext using the same CFB context. This trailing checksum is
The resulting hash value is stored in a Modification Detection Code known as the Modification Detection Code (MDC).
(MDC) packet, which MUST use the two octet encoding just given to
represent its tag and length field. The body of the MDC packet is
the 20-octet output of the SHA-1 hash.
The Modification Detection Code packet is appended to the plaintext
and encrypted along with the plaintext using the same CFB context.
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 packet tag and length field including the prefix data as well as the trailing constant octets
of the Modification Detection Code packet. The body of the MDC 0xD3, 0x14, but excluding the last 20 octets containing the SHA-1
packet, upon decryption, is compared with the result of the SHA-1 hash. The computed SHA-1 hash is then compared with the last 20
hash. octets of plaintext. A mismatch of the hash indicates that the
message has been modified and MUST be treated as a security problem.
Any failure of the MDC indicates that the message has been modified
and MUST be treated as a security problem. Failures include a
difference in the hash values, but also the absence of an MDC packet,
or an MDC packet in any position other than the end of the plaintext.
Any failure SHOULD be reported to the user. Any failure SHOULD be reported to the user.
Note: future designs of new versions of this packet should consider
rollback attacks since it will be possible for an attacker to change
the version back to 1.
NON-NORMATIVE EXPLANATION NON-NORMATIVE EXPLANATION
The MDC system, as packets 18 and 19 are called, were created to The Modification Detection Code (MDC) system, as the integrity
provide an integrity mechanism that is less strong than a protection mechanism of version 1 of the Symmetrically Encrypted
signature, yet stronger than bare CFB encryption. Integrity Protected Data packet is called, was created to provide
an integrity mechanism that is less strong than a signature, yet
stronger than bare CFB encryption.
It is a limitation of CFB encryption that damage to the ciphertext It is a limitation of CFB encryption that damage to the ciphertext
will corrupt the affected cipher blocks and the block following. will 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
skipping to change at page 67, line 39 skipping to change at page 74, line 31
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 would be an attack that
replaced SHA2-256 with SHA-1, for example. A cross-grade attack replaced SHA2-256 with SHA-1, for example. A cross-grade attack
would replace SHA-1 with another 160-bit hash, such as RIPE- would replace SHA-1 with another 160-bit hash, such as RIPE-
MD/160, for example.) MD/160, for example.)
However, given the present state of hash function cryptanalysis However, no update will be needed because the MDC has been
and cryptography, it may be desirable to upgrade the MDC system to replaced by the AEAD encryption described in this document.
a new hash function. See Section 14.12 for guidance.
5.15. Modification Detection Code Packet (Tag 19)
The Modification Detection Code packet contains a SHA-1 hash of
plaintext data, which is used to detect message modification. It is
only used with a Symmetrically Encrypted Integrity Protected Data
packet. The Modification Detection Code packet MUST be the last
packet in the plaintext data that is encrypted in the Symmetrically
Encrypted Integrity Protected Data packet, and MUST appear in no
other place.
A Modification Detection Code packet MUST have a length of 20 octets.
The body of this packet consists of:
* A 20-octet SHA-1 hash of the preceding plaintext data of the
Symmetrically Encrypted Integrity Protected Data packet, including
prefix data, the tag octet, and length octet of the Modification
Detection Code packet.
Note that the Modification Detection Code packet MUST always use a
new format encoding of the packet tag, and a one-octet encoding of
the packet length. The reason for this is that the hashing rules for
modification detection include a one-octet tag and one-octet length
in the data hash. While this is a bit restrictive, it reduces
complexity.
5.16. AEAD Encrypted Data Packet (Tag 20)
This packet contains data encrypted with an authenticated encryption
and additional data (AEAD) construction. When it has been decrypted,
it will typically contain other packets (often a Literal Data packet
or Compressed Data packet).
The body of this packet starts with: 5.14.2. Version 2 Sym. Encrypted Integrity Protected Data Packet Format
* A one-octet version number. The only currently defined value is A version 2 Symmetrically Encrypted Integrity Protected Data packet
1. consists of:
When the version is 1, it is followed by the following fields: * A one-octet version number with value 2.
* A one-octet cipher algorithm. * A one-octet cipher algorithm.
* A one-octet AEAD algorithm. * A one-octet AEAD algorithm.
* A one-octet chunk size. * A one-octet chunk size.
* A initialization vector of size specified by the AEAD algorithm. * Thirty-two octets of salt. The salt is used to derive the message
key and must be unique.
* Encrypted data, the output of the selected symmetric-key cipher * Encrypted data, the output of the selected symmetric-key cipher
operating in the given AEAD mode. operating in the given AEAD mode.
* A final, summary authentication tag for the AEAD mode. * A final, summary authentication tag for the AEAD mode.
An AEAD encrypted data packet consists of one or more chunks of data. The decrypted session key and the salt are used to derive an M-bit
The plaintext of each chunk is of a size specified using the chunk message key and N-64 bits used as initialization vector, where M is
size octet using the method specified below. the key size of the symmetric algorithm and N is the nonce size of
the AEAD algorithm. M + N - 64 bits are derived using HKDF (see
[RFC5869]). The left-most M bits are used as symmetric algorithm
key, the remaining N - 64 bits are used as initialization vector.
HKDF is used with SHA256 as hash algorithm, the session key as
Initial Keying Material (IKM), the salt as salt, and the Packet Tag
in OpenPGP format encoding (bits 7 and 6 set, bits 5-0 carry the
packet tag), version number, cipher algorithm octet, AEAD algorithm
octet, and chunk size octet as info parameter.
The KDF mechanism provides key separation between cipher and AEAD
algorithms. Furthermore, an implementation can securely reply to a
message even if a recipients certificate is unknown by reusing the
encrypted session key packets and replying with a different salt
yielding a new, unique message key.
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
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; it is nevertheless followed
by a full authentication tag. by a full authentication tag.
For each chunk, the AEAD construction is given the Packet Tag in new For each chunk, the AEAD construction is given the Packet Tag in
format encoding (bits 7 and 6 set, bits 5-0 carry the packet tag), OpenPGP format encoding (bits 7 and 6 set, bits 5-0 carry the packet
version number, cipher algorithm octet, AEAD algorithm octet, chunk tag), version number, cipher algorithm octet, AEAD algorithm octet,
size octet, and an eight-octet, big-endian chunk index as additional and chunk size octet as additional data. For example, the additional
data. The index of the first chunk is zero. For example, the data of the first chunk using EAX and AES-128 with a chunk size of
additional data of the first chunk using EAX and AES-128 with a chunk 2**16 octets consists of the octets 0xD2, 0x02, 0x07, 0x01, and 0x10.
size of 2**16 octets consists of the octets 0xD4, 0x01, 0x07, 0x01,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, and 0x00.
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 eight-octet,
big-endian value specifying the total number of plaintext octets big-endian value specifying the total number of plaintext octets
encrypted. This allows detection of a truncated ciphertext. Please encrypted. This allows detection of a truncated ciphertext.
note that the big-endian number representing the chunk index in the
additional data is increased accordingly, although it's not really a
chunk.
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 C), where c is the chunk size octet: formula (in C), where c is the chunk size octet:
chunk_size = ((uint64_t)1 << (c + 6)) chunk_size = ((uint64_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).
A unique, random, unpredictable initialization vector MUST be used The nonce for AEAD mode consists of two parts. Let N be the size of
for each message. Failure to do so for each message can lead to a the nonce. The left-most N - 64 bits are the initialization vector
catastrophic failure depending on the choice of AEAD mode and derived using HKDF. The right-most 64 bits are the chunk index as
symmetric key reuse. big-endian value. The index of the first chunk is zero.
5.16.1. EAX Mode 5.14.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 initialization vector is 16 octets long. EAX authentication tags The nonce is 16 octets long. EAX authentication tags are 16 octets
are 16 octets long. long.
The nonce for EAX mode is computed by treating the initialization
vector as a 16-octet, big-endian value and exclusive-oring the low
eight octets of it with the chunk index.
5.16.2. OCB Mode 5.14.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 initialization vector is 15 octets long. OCB authentication tags The nonce is 15 octets long. OCB authentication tags are 16 octets
are 16 octets long. long.
The nonce for OCB mode is computed by the exclusive-oring of the 5.14.5. GCM Mode
initialization vector as a 15-octet, big endian value, against the
chunk index. The GCM AEAD Algorithm used in this document is defined in
[SP800-38D].
The GCM algorithm can only use block ciphers with 16-octet blocks.
The nonce is 12 octets long. GCM authentication tags are 16 octets
long.
5.15. Padding Packet (Tag 21)
The Padding packet contains random data, and can be used to defend
against traffic analysis (see Section 15.4) on version 2 SEIPD
messages (see Section 5.14.2) and Transferable Public Keys (see
Section 11.1).
Such a packet MUST be ignored when received.
Its contents SHOULD be random octets to make the length obfuscation
it provides more robust even when compressed.
An implementation adding padding to an OpenPGP stream SHOULD place
such a packet:
* At the end of a v5 Transferable Public Key that is transferred
over an encrypted channel (see Section 11.1).
* As the last packet of an Optionally Padded Message within a
version 2 Symmetrically Encrypted Integrity Protected Data Packet
(see Section 11.3.1).
An implementation MUST be able to process padding packets anywhere
else in an OpenPGP stream, so that future revisions of this document
may specify further locations for padding.
Policy about how large to make such a packet to defend against
traffic analysis is beyond the scope of this document.
6. Radix-64 Conversions 6. Radix-64 Conversions
As stated in the introduction, OpenPGP's underlying native As stated in the introduction, OpenPGP's underlying native
representation for objects is a stream of arbitrary octets, and some representation for objects is a stream of arbitrary octets, and some
systems desire these objects to be immune to damage caused by systems desire these objects to be immune to damage caused by
character set translation, data conversions, etc. character set 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
skipping to change at page 70, line 45 skipping to change at page 77, line 43
encoding of the binary data and an optional checksum. The base64 encoding of the binary data and an optional checksum. The base64
encoding is identical to the MIME base64 content-transfer-encoding encoding is identical to the MIME base64 content-transfer-encoding
[RFC2045]. [RFC2045].
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 radix-64 encoding by the same MIME converted to four characters of radix-64 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 radix-64, rather than on the converted data. A sample converted to radix-64, rather than on the converted data. A sample
implementation of this algorithm is in the next section. implementation of this algorithm is in Section 6.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.
Rationale for CRC-24: The size of 24 bits fits evenly into printable Rationale for CRC-24: The size of 24 bits fits evenly into printable
base64. The nonzero initialization can detect more errors than a base64. The nonzero initialization can detect more errors than a
zero initialization. zero initialization.
6.1. An Implementation of the CRC-24 in "C" 6.1. An Implementation of the CRC-24 in "C"
skipping to change at page 72, line 5 skipping to change at page 79, line 5
* 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 Armor Checksum * An Armor Checksum
* The Armor Tail, which depends on the Armor Header Line * The Armor Tail, which depends on the 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 surrounded by five (5) dashes (-, 0x2D) on either side of the header
header line text. The header line text is chosen based upon the type line text. The header line text is chosen based upon the type of
of data that is being encoded in Armor, and how it is being encoded. data that is being encoded in Armor, and how it is being encoded.
Header line texts include the following strings: Header line texts include the following strings:
BEGIN PGP MESSAGE BEGIN PGP MESSAGE
Used for signed, encrypted, or compressed files. Used for signed, encrypted, or compressed files.
BEGIN PGP PUBLIC KEY BLOCK BEGIN PGP PUBLIC KEY BLOCK
Used for armoring public keys. Used for armoring public keys.
BEGIN PGP PRIVATE KEY BLOCK BEGIN PGP PRIVATE KEY BLOCK
Used for armoring private keys. Used for armoring private keys.
skipping to change at page 72, line 30 skipping to change at page 79, line 30
Used for multi-part messages, where the armor is split amongst Y Used for multi-part messages, where the armor is split amongst Y
parts, and this is the Xth part out of Y. parts, and this is the Xth part out of Y.
BEGIN PGP MESSAGE, PART X BEGIN PGP MESSAGE, PART X
Used for multi-part messages, where this is the Xth part of an Used for multi-part messages, where this is the Xth part of an
unspecified number of parts. Requires the MESSAGE-ID Armor Header unspecified number of parts. Requires the MESSAGE-ID Armor Header
to be used. to be used.
BEGIN PGP SIGNATURE BEGIN PGP SIGNATURE
Used for detached signatures, OpenPGP/MIME signatures, and Used for detached signatures, OpenPGP/MIME signatures, and
cleartext signatures. Note that PGP 2 uses BEGIN PGP MESSAGE for cleartext signatures.
detached signatures.
Note that all these Armor Header Lines are to consist of a complete Note that all these Armor Header Lines are to consist of a complete
line. That is to say, there is always a line ending preceding the line. That is to say, there is always a line ending preceding the
starting five dashes, and following the ending five dashes. The starting five dashes, and following the ending five dashes. The
header lines, therefore, MUST start at the beginning of a line, and header lines, therefore, MUST start at the beginning of a line, and
MUST NOT have text other than whitespace following them on the same MUST NOT have text other than whitespace following them on the same
line. These line endings are considered a part of the Armor Header line. These line endings are considered a part of the Armor Header
Line for the purposes of determining the content they delimit. This Line for the purposes of determining the content they delimit. This
is particularly important when computing a cleartext signature (see is particularly important when computing a cleartext signature (see
below). Section 7).
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 a
part of the message, and hence are not protected by any signatures part of the message, and hence are not protected by any signatures
applied to the message. applied to 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
(":" 0x38) and a single space (0x20) separate the key and value. (: 0x38) and a single space (0x20) separate the key and value.
OpenPGP should consider improperly formatted Armor Headers to be OpenPGP should consider improperly formatted Armor Headers to be
corruption of the ASCII Armor. Unknown keys should be reported to corruption of the ASCII Armor. Unknown keys should be reported to
the user, but OpenPGP should continue to process the message. the user, but OpenPGP should continue to process the message.
Note that some transport methods are sensitive to line length. While Note that some transport methods are sensitive to line length. While
there is a limit of 76 characters for the Radix-64 data there is a limit of 76 characters for the Radix-64 data
(Section 6.3), there is no limit to the length of Armor Headers. (Section 6.3), there is no limit to the length of Armor Headers.
Care should be taken that the Armor Headers are short enough to Care should be taken that the Armor Headers are short enough to
survive transport. One way to do this is to repeat an Armor Header survive transport. One way to do this is to repeat an Armor Header
Key multiple times with different values for each so that no one line Key multiple times with different values for each so that no one line
skipping to change at page 73, line 50 skipping to change at page 80, line 50
message. If it appears at all, it MUST be computed from the message. If it appears at all, it MUST be computed from the
finished (encrypted, signed, etc.) message in a deterministic finished (encrypted, signed, etc.) message in a deterministic
fashion, rather than contain a purely random value. This is to fashion, rather than contain a purely random value. This is to
allow the legitimate recipient to determine that the MessageID allow the legitimate recipient to determine that the MessageID
cannot serve as a covert means of leaking cryptographic key cannot serve as a covert means of leaking cryptographic key
information. information.
* "Hash", a comma-separated list of hash algorithms used in this * "Hash", a comma-separated list of hash algorithms used in this
message. This is used only in cleartext signed messages. message. This is used only in cleartext signed messages.
* "SaltedHash", a salt and hash algorithm used in this message.
This is used only in cleartext signed messages that are followed
by a v5 Signature.
* "Charset", a description of the character set that the plaintext * "Charset", a description of the character set that the plaintext
is in. Please note that OpenPGP defines text to be in UTF-8. An is in. Please note that OpenPGP defines text to be in UTF-8. An
implementation will get best results by translating into and out implementation will get best results by translating into and out
of UTF-8. However, there are many instances where this is easier of UTF-8. However, there are many instances where this is easier
said than done. Also, there are communities of users who have no said than done. Also, there are communities of users who have no
need for UTF-8 because they are all happy with a character set need for UTF-8 because they are all happy with a character set
like ISO Latin-5 or a Japanese character set. In such instances, like ISO Latin-5 or a Japanese character set. In such instances,
an implementation MAY override the UTF-8 default by using this an implementation MAY override the UTF-8 default by using this
header key. An implementation MAY implement this key and any header key. An implementation MAY implement this key and any
translations it cares to; an implementation MAY ignore it and translations it cares to; an implementation MAY ignore it and
skipping to change at page 75, line 43 skipping to change at page 82, line 43
+-----+--------++-----+---------++-----+----------++-----+----------+ +-----+--------++-----+---------++-----+----------++-----+----------+
| 13|N || 30|e || 47| v || | | | 13|N || 30|e || 47| v || | |
+-----+--------++-----+---------++-----+----------++-----+----------+ +-----+--------++-----+---------++-----+----------++-----+----------+
| 14|O || 31|f || 48| w ||(pad)| = | | 14|O || 31|f || 48| w ||(pad)| = |
+-----+--------++-----+---------++-----+----------++-----+----------+ +-----+--------++-----+---------++-----+----------++-----+----------+
| 15|P || 32|g || 49| x || | | | 15|P || 32|g || 49| x || | |
+-----+--------++-----+---------++-----+----------++-----+----------+ +-----+--------++-----+---------++-----+----------++-----+----------+
| 16|Q || 33|h || 50| y || | | | 16|Q || 33|h || 50| y || | |
+-----+--------++-----+---------++-----+----------++-----+----------+ +-----+--------++-----+---------++-----+----------++-----+----------+
Table 14: Encoding for Radix-64 Table 16: Encoding for Radix-64
The encoded output stream must be represented in lines of no more The encoded output stream must be represented in lines of no more
than 76 characters each. than 76 characters each.
Special processing is performed if fewer than 24 bits are available Special processing is performed if fewer than 24 bits are available
at the end of the data being encoded. There are three possibilities: at the end of the data being encoded. There are three possibilities:
1. The last data group has 24 bits (3 octets). No special 1. The last data group has 24 bits (3 octets). No special
processing is needed. processing is needed.
skipping to change at page 78, line 5 skipping to change at page 85, line 5
ASCII armoring the stream itself, so the signed text is still ASCII armoring the stream itself, so the signed text is still
readable without special software. In order to bind a signature to readable without special software. In order to bind a signature to
such a cleartext, this framework is used, which follows the same such a cleartext, this framework is used, which follows the same
basic format and restrictions as the ASCII armoring described in basic format and restrictions as the ASCII armoring described in
Section 6.2. (Note that this framework is not intended to be Section 6.2. (Note that this framework is not intended to be
reversible. [RFC3156] defines another way to sign cleartext messages reversible. [RFC3156] defines another way to sign cleartext messages
for environments that support MIME.) for environments that support MIME.)
The cleartext signed message consists of: The 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,
* One or more "Hash" Armor Headers, * If the message is signed using v3 or v4 Signatures, one or more
"Hash" Armor Headers,
* If the message is signed using v5 Signatures, one or more
"SaltedHash" Armor Headers,
* Exactly one empty line not included into the message digest, * Exactly one empty line not included into the message digest,
* The dash-escaped cleartext that is included into the message * The dash-escaped cleartext that is included into the message
digest, 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.
If the "Hash" Armor Header is given, the specified message digest If the "Hash" Armor Header is given, the specified message digest
algorithm(s) are used for the signature. If there are no such algorithm(s) are used for the signature. If more than one message
headers, MD5 is used. If MD5 is the only hash used, then an digest is used in the signature, the "Hash" armor header contains a
implementation MAY omit this header for improved V2.x compatibility. comma-delimited list of used message digests.
If more than one message digest is used in the signature, the "Hash"
armor header contains a comma-delimited list of used message digests.
Current message digest names are described below with the algorithm If the "SaltedHash" Armor Header is given, the specified message
IDs. digest algorithm and salt are used for a signature. The message
digest name is followed by a colon (:) followed by 22 characters of
Radix-64 encoded salt without padding. Note: The "SaltedHash" Armor
Header contains digest algorithm and salt for a single signature; a
second signature requires a second "SaltedHash" Armor Header.
Current message digest names are described with the algorithm IDs in
Section 9.5.
An implementation SHOULD add a line break after the cleartext, but An implementation SHOULD add a line break after the cleartext, but
MAY omit it if the cleartext ends with a line break. This is for MAY omit it if the cleartext ends with a line break. This is for
visual clarity. visual clarity.
7.1. Dash-Escaped Text 7.1. 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 "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.
As with binary signatures on text documents, a cleartext signature is As with binary signatures on text documents, a cleartext signature is
calculated on the text using canonical <CR><LF> line endings. The calculated on the text using canonical <CR><LF> line endings. The
line ending (i.e., the <CR><LF>) before the "-----BEGIN PGP line ending (that is, the <CR><LF>) before the -----BEGIN PGP
SIGNATURE-----" line that terminates the signed text is not SIGNATURE----- line that terminates the signed text is not considered
considered part of the signed text. part of the signed text.
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 "-" - if it occurs at the beginning of a line, and SHOULD warn on - and
and any character other than a space at the beginning of a line. any character other than a space at the beginning of a line.
Also, any trailing whitespace -- spaces (0x20) and tabs (0x09) -- at Also, any trailing whitespace --- spaces (0x20) and tabs (0x09) ---
the end of any line is removed when the cleartext signature is at the end of any line is removed when the cleartext signature is
generated. generated.
8. Regular Expressions 8. Regular Expressions
A regular expression is zero or more branches, separated by "|". It A regular expression is zero or more branches, separated by |. It
matches anything that matches one of the branches. matches anything that matches one of the branches.
A branch is zero or more pieces, concatenated. It matches a match A branch is zero or more pieces, concatenated. It matches a match
for the first, followed by a match for the second, etc. for the first, followed by a match for the second, etc.
A piece is an atom possibly followed by "*", "+", or "?". An atom A piece is an atom possibly followed by *, +, or ?. An atom followed
followed by "*" matches a sequence of 0 or more matches of the atom. by * matches a sequence of 0 or more matches of the atom. An atom
An atom followed by "+" matches a sequence of 1 or more matches of followed by + matches a sequence of 1 or more matches of the atom.
the atom. An atom followed by "?" matches a match of the atom, or An atom followed by ? matches a match of the atom, or the null
the null string. string.
An atom is a regular expression in parentheses (matching a match for An atom is a regular expression in parentheses (matching a match for
the regular expression), a range (see below), "." (matching any the regular expression), a range (see below), . (matching any single
single character), "^" (matching the null string at the beginning of character), ^ (matching the null string at the beginning of the input
the input string), "$" (matching the null string at the end of the string), $ (matching the null string at the end of the input string),
input string), a "\" followed by a single character (matching that a \ followed by a single character (matching that character), or a
character), or a single character with no other significance single character with no other significance (matching that
(matching that character). character).
A range is a sequence of characters enclosed in "[]". It normally A range is a sequence of characters enclosed in []. It normally
matches any single character from the sequence. If the sequence matches any single character from the sequence. If the sequence
begins with "^", it matches any single character not from the rest of begins with ^, it matches any single character not from the rest of
the sequence. If two characters in the sequence are separated by the sequence. If two characters in the sequence are separated by -,
"-", this is shorthand for the full list of ASCII characters between this is shorthand for the full list of ASCII characters between them
them (e.g., "[0-9]" matches any decimal digit). To include a literal (for example, [0-9] matches any decimal digit). To include a literal
"]" in the sequence, make it the first character (following a ] in the sequence, make it the first character (following a possible
possible "^"). To include a literal "-", make it the first or last ^). To include a literal -, make it the first or last character.
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 not on these lists, so long as the
algorithm numbers are chosen from the private or experimental algorithm numbers are chosen from the private or experimental
algorithm range. algorithm range.
See Section 14 for more discussion of the algorithms. See Section 14 for more discussion of the algorithms.
9.1. Public-Key Algorithms 9.1. Public-Key Algorithms
+===+==============+==========+=============+===========+===========+ +===+==============+===========+============+===========+===========+
| ID|Algorithm |Public Key|Secret Key | Signature |PKESK | | ID|Algorithm |Public Key |Secret Key | Signature |PKESK |
| | |Format |Format | Format |Format | | | |Format |Format | Format |Format |
+===+==============+==========+=============+===========+===========+ +===+==============+===========+============+===========+===========+
| 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) [HAC]|MPI(e) |MPI(p), | mod n) |mod n) | | |or Sign) [HAC]|MPI(e) |MPI(p), | mod n) |mod n) |
| | |[Section |MPI(q), | [Section |[Section | | | |[Section |MPI(q), | [Section |[Section |
| | |5.6.1] |MPI(u) | 5.2.3.1] |5.1.1] | | | |5.6.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 [HAC] |MPI(e) |MPI(p), | |mod n) | | |Only [HAC] |MPI(e) |MPI(p), | |mod n) |
| | |[Section |MPI(q), | |[Section | | | |[Section |MPI(q), | |[Section |
| | |5.6.1] |MPI(u) | |5.1.1] | | | |5.6.1] |MPI(u) | |5.1.3] |
+---+--------------+----------+-------------+-----------+-----------+ +---+--------------+-----------+------------+-----------+-----------+
| 3|RSA Sign-Only |MPI(n), |MPI(d), | MPI(m**d |N/A | | 3|RSA Sign-Only |MPI(n), |MPI(d), | MPI(m**d |N/A |
| |[HAC] |MPI(e) |MPI(p), | mod n) | | | |[HAC] |MPI(e) |MPI(p), | mod n) | |
| | |[Section |MPI(q), | [Section | | | | |[Section |MPI(q), | [Section | |
| | |5.6.1] |MPI(u) | 5.2.3.1] | | | | |5.6.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-Only)|MPI(g), | | |mod p), MPI| | |(Encrypt-Only)|MPI(g), | | |mod p), MPI|
| |[ELGAMAL] |MPI(y) | | |(m * y**k | | |[ELGAMAL] |MPI(y) | | |(m * y**k |
| |[HAC] |[Section | | |mod p) | | |[HAC] |[Section | | |mod p) |
| | |5.6.3] | | |[Section | | | |5.6.3] | | |[Section |
| | | | | |5.1.2] | | | | | | |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] | |
| |[HAC] |[Section | | | | | |[HAC] |[Section | | | |
| | |5.6.2] | | | | | | |5.6.2] | | | |
+---+--------------+----------+-------------+-----------+-----------+ +---+--------------+-----------+------------+-----------+-----------+
| 18|ECDH public |OID, |MPI(secret) | N/A |MPI(point | | 18|ECDH public |OID, |MPI(value in| N/A |MPI(point |
| |key algorithm |MPI(point | | |in curve- | | |key algorithm |MPI(point |curve- | |in curve- |
| | |in curve- | | |specific | | | |in curve- |specific | |specific |
| | |specific | | |point | | | |specific |format) | |point |
| | |point | | |format), | | | |point |[Section | |format), |
| | |format), | | |size octet,| | | |format), |9.2.1] | |size octet,|
| | |KDFParams | | |encoded key| | | |KDFParams | | |encoded key|
| | |[see | | |[Section | | | |[see | | |[Section |
| | |Section | | |9.2.1, | | | |Section | | |9.2.1, |
| | |9.2.1, | | |Section | | | |9.2.1, | | |Section |
| | |Section | | |5.1.3, | | | |Section | | |5.1.5, |
| | |5.6.6] | | |Section | | | |5.6.6] | | |Section |
| | | | | |13.5] | | | | | | |13.5] |
+---+--------------+----------+-------------+-----------+-----------+ +---+--------------+-----------+------------+-----------+-----------+
| 19|ECDSA public |OID, |MPI(secret) | MPI(r), |N/A | | 19|ECDSA public |OID, |MPI(value) | MPI(r), |N/A |
| |key algorithm |MPI(point | | MPI(s) | | | |key algorithm |MPI(point | | MPI(s) | |
| |[FIPS186] |in SEC1 | | [Section | | | |[FIPS186] |in SEC1 | | [Section | |
| | |format) | | 5.2.3.2] | | | | |format) | | 5.2.3.2] | |
| | |[Section | | | | | | |[Section | | | |
| | |5.6.4] | | | | | | |5.6.4] | | | |
+---+--------------+----------+-------------+-----------+-----------+ +---+--------------+-----------+------------+-----------+-----------+
| 20|Reserved | | | | | | 20|Reserved | | | | |
| |(formerly | | | | | | |(formerly | | | | |
| |Elgamal | | | | | | |Elgamal | | | | |
| |Encrypt or | | | | | | |Encrypt or | | | | |
| |Sign) | | | | | | |Sign) | | | | |
+---+--------------+----------+-------------+-----------+-----------+ +---+--------------+-----------+------------+-----------+-----------+
| 21|Reserved for | | | | | | 21|Reserved for | | | | |
| |Diffie-Hellman| | | | | | |Diffie-Hellman| | | | |
| |(X9.42, as | | | | | | |(X9.42, as | | | | |
| |defined for | | | | | | |defined for | | | | |
| |IETF-S/MIME) | | | | | | |IETF-S/MIME) | | | | |
+---+--------------+----------+-------------+-----------+-----------+ +---+--------------+-----------+------------+-----------+-----------+
| 22|EdDSA |OID, |MPI(value in | MPI, MPI |N/A | | 22|EdDSA |OID, |MPI(value in| MPI, MPI |N/A |
| |[RFC8032] |MPI(point |curve- | [see | | | |[RFC8032] |MPI(point |curve- | [see | |
| | |in |specific | Section | | | | |in prefixed|specific | Section | |
| | |prefixed |format) [see | 9.2.1, | | | | |native |format) [see| 9.2.1, | |
| | |native |Section | Section | | | | |format) |Section | Section | |
| | |format) |9.2.1] | 5.2.3.3] | | | | |[see |9.2.1] | 5.2.3.3] | |
| | |[Section | | | | | | |Section | | | |
| | |5.6.5] | | | | | | |13.2.2, | | | |
+---+--------------+----------+-------------+-----------+-----------+ | | |Section | | | |
| 23|Reserved | | | | | | | |5.6.5] | | | |
| |(AEDH) | | | | | +---+--------------+-----------+------------+-----------+-----------+
+---+--------------+----------+-------------+-----------+-----------+ | 23|Reserved | | | | |
| 24|Reserved | | | | | | |(AEDH) | | | | |
| |(AEDSA) | | | | | +---+--------------+-----------+------------+-----------+-----------+
+---+--------------+----------+-------------+-----------+-----------+ | 24|Reserved | | | | |
|100|Private/ | | | | | | |(AEDSA) | | | | |
| to|Experimental | | | | | +---+--------------+-----------+------------+-----------+-----------+
|110|algorithm | | | | | |100|Private/ | | | | |
+---+--------------+----------+-------------+-----------+-----------+ | to|Experimental | | | | |
|110|algorithm | | | | |
+---+--------------+-----------+------------+-----------+-----------+
Table 15: Public-key algorithm registry Table 17: Public-key algorithm registry
Implementations MUST implement DSA for signatures, and Elgamal for Implementations MUST implement EdDSA (19) for signatures, and ECDH
encryption. Implementations SHOULD implement RSA keys (1). RSA (18) for encryption. Implementations SHOULD implement RSA (1) for
Encrypt-Only (2) and RSA Sign-Only (3) are deprecated and SHOULD NOT signatures and encryption.
be generated, but may be interpreted. See Section 14.5. See
Section 14.9 for notes on Elgamal Encrypt or Sign (20), and X9.42 RSA Encrypt-Only (2) and RSA Sign-Only (3) are deprecated and SHOULD
NOT be generated, but may be interpreted. See Section 14.4. See
Section 14.8 for notes on Elgamal Encrypt or Sign (20), and X9.42
(21). Implementations MAY implement any other algorithm. (21). Implementations MAY implement any other algorithm.
Note that an implementation conforming to the previous version of
this standard ([RFC4880]) have only DSA (17) and Elgamal (16) as its
MUST-implement algorithms.
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 13.5 of this Signatures" and in [SEC1]; ECDH is defined in Section 13.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 define a named The parameter curve OID is an array of octets that define 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
skipping to change at page 82, line 52 skipping to change at page 90, line 31
| | |DA 47 0F 01 | | | | | | |DA 47 0F 01 | | | |
+----------------------+---+--------------+----------+------+-------+ +----------------------+---+--------------+----------+------+-------+
|1.3.101.113 |3 |2B 65 71 |Ed448 |EdDSA |57 | |1.3.101.113 |3 |2B 65 71 |Ed448 |EdDSA |57 |
+----------------------+---+--------------+----------+------+-------+ +----------------------+---+--------------+----------+------+-------+
|1.3.6.1.4.1.3029.1.5.1|10 |2B 06 01 04 01|Curve25519|ECDH |32 | |1.3.6.1.4.1.3029.1.5.1|10 |2B 06 01 04 01|Curve25519|ECDH |32 |
| | |97 55 01 05 01| | | | | | |97 55 01 05 01| | | |
+----------------------+---+--------------+----------+------+-------+ +----------------------+---+--------------+----------+------+-------+
|1.3.101.111 |3 |2B 65 6F |X448 |ECDH |56 | |1.3.101.111 |3 |2B 65 6F |X448 |ECDH |56 |
+----------------------+---+--------------+----------+------+-------+ +----------------------+---+--------------+----------+------+-------+
Table 16: ECC Curve OID and usage registry Table 18: ECC Curve OID 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, native point representations, or scalars for a point on the curve, native point representations, or scalars
with high enough entropy for the curve can be represented in that with high enough entropy for the curve can be represented in that
many octets. many octets.
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 one 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.
Implementations MUST implement Ed25519 for use with EdDSA, and
Curve25519 for use with ECDH. Implementations SHOULD implement Ed448
for use with EdDSA, and X448 for use with ECDH.
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 |EdDSA |EdDSA |EdDSA | |Curve |ECDH |ECDH Secret |EdDSA |EdDSA |EdDSA |
| |Point |Secret |Secret |Signature |Signature | | |Point |Key MPI |Secret |Signature|Signature |
| |Format |Key MPI |Key MPI |first MPI |second MPI | | |Format | |Key MPI |first MPI|second MPI |
+============+========+========+=========+===========+==============+ +===========+========+============+========+=========+==============+
| NIST P-256 |SEC1 |integer |N/A |N/A |N/A | |NIST P-256 |SEC1 |integer |N/A |N/A |N/A |
+------------+--------+--------+---------+-----------+--------------+ +-----------+--------+------------+--------+---------+--------------+
| NIST P-384 |SEC1 |integer |N/A |N/A |N/A | |NIST P-384 |SEC1 |integer |N/A |N/A |N/A |
+------------+--------+--------+---------+-----------+--------------+ +-----------+--------+------------+--------+---------+--------------+
| NIST P-521 |SEC1 |integer |N/A |N/A |N/A | |NIST P-521 |SEC1 |integer |N/A |N/A |N/A |
+------------+--------+--------+---------+-----------+--------------+ +-----------+--------+------------+--------+---------+--------------+
| Ed25519 |N/A |N/A |32 octets|32 octets |32 octets of S| |Ed25519 |N/A |N/A |32 |32 octets|32 octets of S|
| | | |of secret|of R | | | | | |octets |of R | |
+------------+--------+--------+---------+-----------+--------------+ | | | |of | | |
| Ed448 |N/A |N/A |prefixed |prefixed |0 [this is an | | | | |secret | | |
| | | |57 octets|114 octets |unused | +-----------+--------+------------+--------+---------+--------------+
| | | |of secret|of |placeholder] | |Ed448 |N/A |N/A |prefixed|prefixed |0 [this is an |
| | | | |signature | | | | | |57 |114 |unused |
+------------+--------+--------+---------+-----------+--------------+ | | | |octets |octets of|placeholder] |
| Curve25519 |prefixed|integer |N/A |N/A |N/A | | | | |of |signature| |
| |native | | | | | | | | |secret | | |
+------------+--------+--------+---------+-----------+--------------+ +-----------+--------+------------+--------+---------+--------------+
| X448 |prefixed|prefixed|N/A |N/A |N/A | |Curve25519 |prefixed|integer (see|N/A |N/A |N/A |
| |native |56 | | | | | |native |Section | | | |
| | |octets | | | | | | |5.6.6.1.1) | | | |
| | |of | | | | +-----------+--------+------------+--------+---------+--------------+
| | |secret | | | | |X448 |prefixed|prefixed 56 |N/A |N/A |N/A |
+------------+--------+--------+---------+-----------+--------------+ | |native |octets of | | | |
| | |secret | | | |
+-----------+--------+------------+--------+---------+--------------+
Table 17: Curve-specific wire formats Table 19: Curve-specific wire formats
For the native octet-string forms of EdDSA values, see [RFC8032]. For the native octet-string forms of EdDSA values, see [RFC8032].
For the native octet-string forms of ECDH secret scalars and points, For the native octet-string forms of ECDH secret scalars and points,
see [RFC7748]. see [RFC7748].
9.3. Symmetric-Key Algorithms 9.3. Symmetric-Key Algorithms
+==========+====================================================+ +==========+====================================================+
| ID | Algorithm | | ID | Algorithm |
+==========+====================================================+ +==========+====================================================+
skipping to change at page 85, line 32 skipping to change at page 92, line 46
+----------+----------------------------------------------------+ +----------+----------------------------------------------------+
| 13 | Camellia with 256-bit key | | 13 | Camellia with 256-bit key |
+----------+----------------------------------------------------+ +----------+----------------------------------------------------+
| 100 to | Private/Experimental algorithm | | 100 to | Private/Experimental algorithm |
| 110 | | | 110 | |
+----------+----------------------------------------------------+ +----------+----------------------------------------------------+
| 253, 254 | Reserved to avoid collision with Secret Key | | 253, 254 | Reserved to avoid collision with Secret Key |
| and 255 | Encryption (see Section 3.7.2.1 and Section 5.5.3) | | and 255 | Encryption (see Section 3.7.2.1 and Section 5.5.3) |
+----------+----------------------------------------------------+ +----------+----------------------------------------------------+
Table 18: Symmetric-key algorithm registry Table 20: Symmetric-key algorithm registry
Implementations MUST implement TripleDES. Implementations SHOULD Implementations MUST implement AES-128. Implementations SHOULD
implement AES-128 and CAST5. Implementations that interoperate with implement AES-256. Implementations MUST NOT encrypt data with IDEA,
PGP 2.6 or earlier need to support IDEA, as that is the only TripleDES, or CAST5. Implementations MAY decrypt data that uses
symmetric cipher those versions use. Implementations MAY implement IDEA, TripleDES, or CAST5 for the sake of reading older messages or
any other algorithm. new messages from legacy clients. Implementations 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 to 110 | Private/Experimental algorithm |
+------------+--------------------------------+ +------------+--------------------------------+
Table 19: Compression algorithm registry Table 21: Compression algorithm registry
Implementations MUST implement uncompressed data. Implementations Implementations MUST implement uncompressed data. Implementations
SHOULD implement ZIP. Implementations MAY implement any other SHOULD implement ZLIB. For interoperability reasons implementations
algorithm. SHOULD be able to decompress using ZIP. Implementations MAY
implement any other algorithm.
9.5. Hash Algorithms 9.5. Hash Algorithms
+============+================================+=============+ +============+================================+=============+
| ID | Algorithm | Text Name | | ID | Algorithm | Text Name |
+============+================================+=============+ +============+================================+=============+
| 1 | MD5 [HAC] | "MD5" | | 1 | MD5 [HAC] | "MD5" |
+------------+--------------------------------+-------------+ +------------+--------------------------------+-------------+
| 2 | SHA-1 [FIPS180] | "SHA1" | | 2 | SHA-1 [FIPS180] | "SHA1" |
+------------+--------------------------------+-------------+ +------------+--------------------------------+-------------+
skipping to change at page 86, line 50 skipping to change at page 94, line 22
+------------+--------------------------------+-------------+ +------------+--------------------------------+-------------+
| 12 | SHA3-256 [FIPS202] | "SHA3-256" | | 12 | SHA3-256 [FIPS202] | "SHA3-256" |
+------------+--------------------------------+-------------+ +------------+--------------------------------+-------------+
| 13 | Reserved | | | 13 | Reserved | |
+------------+--------------------------------+-------------+ +------------+--------------------------------+-------------+
| 14 | SHA3-512 [FIPS202] | "SHA3-512" | | 14 | SHA3-512 [FIPS202] | "SHA3-512" |
+------------+--------------------------------+-------------+ +------------+--------------------------------+-------------+
| 100 to 110 | Private/Experimental algorithm | | | 100 to 110 | Private/Experimental algorithm | |
+------------+--------------------------------+-------------+ +------------+--------------------------------+-------------+
Table 20: Hash algorithm registry Table 22: Hash algorithm registry
Implementations MUST implement SHA-1. Implementations MAY implement Implementations MUST implement SHA2-256. Implementations SHOULD
other algorithms. MD5 is deprecated. implement SHA2-384 and SHA2-512. Implementations MAY implement other
algorithms. Implementations SHOULD NOT create messages which require
the use of SHA-1 with the exception of computing version 4 key
fingerprints and for purposes of the Modification Detection Code
(MDC) in version 1 Symmetrically Encrypted Integrity Protected Data
packets. Implementations MUST NOT generate signatures with MD5, SHA-
1, or RIPE-MD/160. Implementations MUST NOT use MD5, SHA-1, or RIPE-
MD/160 as a hash function in an ECDH KDF. Implementations MUST NOT
validate any recent signature that depends on MD5, SHA-1, or RIPE-
MD/160. Implementations SHOULD NOT validate any old signature that
depends on MD5, SHA-1, or RIPE-MD/160 unless the signature's creation
date predates known weakness of the algorithm used, and the
implementation is confident that the message has been in the secure
custody of the user the whole time.
9.6. AEAD Algorithms 9.6. AEAD Algorithms
+========+======================+===========+====================+ +========+======================+===========+====================+
| ID | Algorithm | IV length | authentication tag | | ID | Algorithm | IV length | authentication tag |
| | | (octets) | length (octets) | | | | (octets) | length (octets) |
+========+======================+===========+====================+ +========+======================+===========+====================+
| 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 |
+--------+----------------------+-----------+--------------------+
| 100 to | Private/Experimental | | | | 100 to | Private/Experimental | | |
| 110 | algorithm | | | | 110 | algorithm | | |
+--------+----------------------+-----------+--------------------+ +--------+----------------------+-----------+--------------------+
Table 21: AEAD algorithm registry Table 23: AEAD algorithm registry
Implementations MUST implement OCB. Implementations MAY implement
EAX, GCM and other algorithms.
10. IANA Considerations 10. IANA Considerations
Because this document obsoletes [RFC4880], IANA is requested to Because this document obsoletes [RFC4880], IANA is requested to
update all registration information that references [RFC4880] to update all registration information that references [RFC4880] to
instead reference this RFC. instead reference this RFC.
OpenPGP is highly parameterized, and consequently there are a number OpenPGP is highly parameterized, and consequently there are a number
of considerations for allocating parameters for extensions. This of considerations for allocating parameters for extensions. This
section describes how IANA should look at extensions to the protocol section describes how IANA should look at extensions to the protocol
skipping to change at page 89, line 16 skipping to change at page 96, line 50
OpenPGP signatures further contain a mechanism for extensions in OpenPGP signatures further contain a mechanism for extensions in
signatures. These are the Notation Data subpackets, which contain a signatures. These are the Notation Data subpackets, which contain a
key/value pair. Notations contain a user space that is completely key/value pair. Notations contain a user space that is completely
unmanaged and an IETF space. unmanaged and an IETF space.
This specification creates a registry of Signature Notation Data This specification creates a registry of Signature Notation Data
types. The registry includes the Signature Notation Data type, the types. The registry includes the Signature Notation Data type, the
name of the Signature Notation Data, its allowed values, and a name of the Signature Notation Data, its allowed values, and a
reference to the defining specification. The initial values for this reference to the defining specification. The initial values for this
registry can be found in Section 5.2.3.20. Adding a new Signature registry can be found in Section 5.2.3.21. Adding a new Signature
Notation Data subpacket MUST be done through the SPECIFICATION Notation Data subpacket MUST be done through the SPECIFICATION
REQUIRED method, as described in [RFC8126]. REQUIRED method, as described in [RFC8126].
10.2.2.2. Signature Notation Data Subpacket Notation Flags 10.2.2.2. Signature Notation Data Subpacket Notation Flags
This specification creates a new registry of Signature Notation Data This specification creates a new registry of Signature Notation Data
Subpacket Notation Flags. The registry includes the columns "Flag", Subpacket Notation Flags. The registry includes the columns "Flag",
"Description", "Security Recommended", "Interoperability "Description", "Security Recommended", "Interoperability
Recommended", and "Reference". The initial values for this registry Recommended", and "Reference". The initial values for this registry
can be found in Section 5.2.3.20. Adding a new item MUST be done can be found in Section 5.2.3.21. Adding a new item MUST be done
through the SPECIFICATION REQUIRED method, as described in [RFC8126]. through the SPECIFICATION REQUIRED method, as described in [RFC8126].
10.2.2.3. Key Server Preference Extensions 10.2.2.3. Key Server Preference Extensions
OpenPGP signatures contain a mechanism for preferences to be OpenPGP signatures contain a mechanism for preferences to be
specified about key servers. This specification creates a registry specified about key servers. This specification creates a registry
of key server preferences. The registry includes the key server of key server preferences. The registry includes the key server
preference, the name of the preference, and a reference to the preference, the name of the preference, and a reference to the
defining specification. The initial values for this registry can be defining specification. The initial values for this registry can be
found in Section 5.2.3.21. Adding a new key server preference MUST found in Section 5.2.3.22. Adding a new key server preference MUST
be done through the SPECIFICATION REQUIRED method, as described in be done through the SPECIFICATION REQUIRED method, as described in
[RFC8126]. [RFC8126].
10.2.2.4. Key Flags Extensions 10.2.2.4. Key Flags Extensions
OpenPGP signatures contain a mechanism for flags to be specified OpenPGP signatures contain a mechanism for flags to be specified
about key usage. This specification creates a registry of key usage about key usage. This specification creates a registry of key usage
flags. The registry includes the key flags value, the name of the flags. The registry includes the key flags value, the name of the
flag, and a reference to the defining specification. The initial flag, and a reference to the defining specification. The initial
values for this registry can be found in Section 5.2.3.25. Adding a values for this registry can be found in Section 5.2.3.26. Adding a
new key usage flag MUST be done through the SPECIFICATION REQUIRED new key usage flag MUST be done through the SPECIFICATION REQUIRED
method, as described in [RFC8126]. method, as described in [RFC8126].
10.2.2.5. Reason for Revocation Extensions 10.2.2.5. Reason for Revocation Extensions
OpenPGP signatures contain a mechanism for flags to be specified OpenPGP signatures contain a mechanism for flags to be specified
about why a key was revoked. This specification creates a registry about why a key was revoked. This specification creates a registry
of "Reason for Revocation" flags. The registry includes the "Reason of "Reason for Revocation" flags. The registry includes the "Reason
for Revocation" flags value, the name of the flag, and a reference to for Revocation" flags value, the name of the flag, and a reference to
the defining specification. The initial values for this registry can the defining specification. The initial values for this registry can
be found in Section 5.2.3.27. Adding a new feature flag MUST be done be found in Section 5.2.3.28. Adding a new feature flag MUST be done
through the SPECIFICATION REQUIRED method, as described in [RFC8126]. through the SPECIFICATION REQUIRED method, as described in [RFC8126].
10.2.2.6. Implementation Features 10.2.2.6. Implementation Features
OpenPGP signatures contain a mechanism for flags to be specified OpenPGP signatures contain a mechanism for flags to be specified
stating which optional features an implementation supports. This stating which optional features an implementation supports. This
specification creates a registry of feature-implementation flags. specification creates a registry of feature-implementation flags.
The registry includes the feature-implementation flags value, the The registry includes the feature-implementation flags value, the
name of the flag, and a reference to the defining specification. The name of the flag, and a reference to the defining specification. The
initial values for this registry can be found in Section 5.2.3.28. initial values for this registry can be found in Section 5.2.3.29.
Adding a new feature-implementation flag MUST be done through the Adding a new feature-implementation flag MUST be done through the
SPECIFICATION REQUIRED method, as described in [RFC8126]. SPECIFICATION REQUIRED method, as described in [RFC8126].
Also see Section 14.13 for more information about when feature flags Also see Section 14.11 for more information about when feature flags
are needed. are needed.
10.2.3. New Packet Versions 10.2.3. New Packet Versions
The core OpenPGP packets all have version numbers, and can be revised The core OpenPGP packets all have version numbers, and can be revised
by introducing a new version of an existing packet. This by introducing a new version of an existing packet. This
specification creates a registry of packet types. The registry specification creates a registry of packet types. The registry
includes the packet type, the number of the version, and a reference includes the packet type, the number of the version, and a reference
to the defining specification. The initial values for this registry to the defining specification. The initial values for this registry
can be found in Section 5. Adding a new packet version MUST be done can be found in Section 5. Adding a new packet version MUST be done
skipping to change at page 91, line 21 skipping to change at page 99, line 8
initial values for this registry can be found in Section 9.1. Adding initial values for this registry can be found in Section 9.1. Adding
a new public-key algorithm MUST be done through the SPECIFICATION a new public-key algorithm MUST be done through the SPECIFICATION
REQUIRED method, as described in [RFC8126]. REQUIRED method, as described in [RFC8126].
This document requests IANA register the following new public-key This document requests IANA register the following new public-key
algorithm: algorithm:
+====+============================+========================+ +====+============================+========================+
| ID | Algorithm | Reference | | ID | Algorithm | Reference |
+====+============================+========================+ +====+============================+========================+
| 22 | EdDSA public key algorithm | This doc, Section 14.8 | | 22 | EdDSA public key algorithm | This doc, Section 14.7 |
+----+----------------------------+------------------------+ +----+----------------------------+------------------------+
Table 22: New public-Key algorithms registered Table 24: New public-Key algorithms registered
[ Note to RFC-Editor: Please remove the table above on publication. ] [ Note to RFC-Editor: Please remove the table above on publication. ]
10.3.2. Symmetric-Key Algorithms 10.3.2. Symmetric-Key Algorithms
OpenPGP specifies a number of symmetric-key algorithms. This OpenPGP specifies a number of symmetric-key algorithms. This
specification creates a registry of symmetric-key algorithm specification creates a registry of symmetric-key algorithm
identifiers. The registry includes the algorithm name, its key sizes identifiers. The registry includes the algorithm name, its key sizes
and block size, and a reference to the defining specification. The and block size, and a reference to the defining specification. The
initial values for this registry can be found in Section 9.3. Adding initial values for this registry can be found in Section 9.3. Adding
skipping to change at page 92, line 15 skipping to change at page 99, line 49
+====+===========+===========+ +====+===========+===========+
| ID | Algorithm | Reference | | ID | Algorithm | Reference |
+====+===========+===========+ +====+===========+===========+
| 12 | SHA3-256 | This doc | | 12 | SHA3-256 | This doc |
+----+-----------+-----------+ +----+-----------+-----------+
| 13 | Reserved | | | 13 | Reserved | |
+----+-----------+-----------+ +----+-----------+-----------+
| 14 | SHA3-512 | This doc | | 14 | SHA3-512 | This doc |
+----+-----------+-----------+ +----+-----------+-----------+
Table 23: New hash Table 25: New hash
algorithms registered algorithms registered
[Notes to RFC-Editor: Please remove the table above on publication. [Notes to RFC-Editor: Please remove the table above on publication.
It is desirable not to reuse old or reserved algorithms because some It is desirable not to reuse old or reserved algorithms because some
existing tools might print a wrong description. The ID 13 has been existing tools might print a wrong description. The ID 13 has been
reserved so that the SHA3 algorithm IDs align nicely with their SHA2 reserved so that the SHA3 algorithm IDs align nicely with their SHA2
counterparts.] counterparts.]
10.3.4. Compression Algorithms 10.3.4. Compression Algorithms
skipping to change at page 94, line 9 skipping to change at page 101, line 44
11.1. Transferable Public Keys 11.1. Transferable Public Keys
OpenPGP users may transfer public keys. The essential elements of a OpenPGP users may transfer public keys. The essential elements of a
transferable public key are as follows: transferable public key are as follows:
* One Public-Key packet * One Public-Key packet
* Zero or more revocation signatures * Zero or more revocation signatures
* One or more User ID packets * Zero or more User ID packets
* After each User ID packet, zero or more Signature packets * After each User ID packet, zero or more Signature packets
(certifications) (certifications)
* Zero or more User Attribute packets * Zero or more User Attribute packets
* After each User Attribute packet, zero or more Signature packets * After each User Attribute packet, zero or more Signature packets
(certifications) (certifications)
* Zero or more Subkey packets * Zero or more Subkey packets
* After each Subkey packet, one Signature packet, plus optionally a * After each Subkey packet, one Signature packet, plus optionally a
revocation revocation
* An optional Padding packet
The Public-Key packet occurs first. Each of the following User ID The Public-Key packet occurs first. Each of the following User ID
packets provides the identity of the owner of this public key. If packets provides the identity of the owner of this public key. If
there are multiple User ID packets, this corresponds to multiple there are multiple User ID packets, this corresponds to multiple
means of identifying the same unique individual user; for example, a means of identifying the same unique individual user; for example, a
user may have more than one email address, and construct a User ID user may have more than one email address, and construct a User ID
for each one. for each one. A transferable public key SHOULD include at least one
User ID packet unless storage 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 his or her
belief that this public key belongs to the user identified by this belief that 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
skipping to change at page 95, line 24 skipping to change at page 103, line 11
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 (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
traffic analysis (see Section 15.4). For maximum interoperability,
if the Public-Key packet is a V4 key, the optional Padding packet
SHOULD NOT be present unless the recipient has indicated that they
are capable of ignoring it successfully. An implementation that is
capable of receiving a transferable public key with a V5 Public-Key
primary key MUST be able to accept (and ignore) the 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. transferring multiple public keys in one operation.
11.2. Transferable Secret Keys 11.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 are used instead of the public secret-key and secret-subkey packets are used instead of the public
key and public-subkey packets. Implementations SHOULD include self- key and public-subkey packets. Implementations SHOULD include self-
signatures on any User IDs and subkeys, as this allows for a complete signatures on any User IDs and subkeys, as this allows for a complete
skipping to change at page 96, line 9 skipping to change at page 104, line 6
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 Encrypted Integrity Protected Data Packet | AEAD Symmetrically Encrypted Integrity Protected Data Packet
Encrypted 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, Corresponding Signature Packet. Message, Corresponding Signature Packet.
Signed Message :- Signature Packet, OpenPGP Message | One-Pass Signed Message :- Signature Packet, OpenPGP Message | One-Pass
Signed Message. Signed Message.
In addition, decrypting a Symmetrically Encrypted and Integrity Optionally Padded Message :- OpenPGP Message | OpenPGP Message,
Protected Data packet, an AEAD Encrypted Data packet, or -- for Padding Packet.
historic data -- a Symmetrically Encrypted Data packet must yield a
valid OpenPGP Message. Decompressing a Compressed Data packet must 11.3.1. Unwrapping Encrypted and Compressed Messages
also yield a valid OpenPGP Message.
In addition to the above grammar, certain messages can be "unwrapped"
to yield new messages. In particular:
* Decrypting a version 2 Symmetrically Encrypted and Integrity
Protected Data packet must yield a valid Optionally Padded
Message.
* Decrypting a version 1 Symmetrically Encrypted and Integrity
Protected Data packet or --- for historic data --- a Symmetrically
Encrypted Data packet must yield a valid OpenPGP Message.
* Decompressing a Compressed Data packet must also yield a valid
OpenPGP Message.
When either such unwrapping is performed, the resulting stream of
octets is parsed into a series OpenPGP packets like any other stream
of octets. The packet boundaries found in the series of octets are
expected to align with the length of the unwrapped octet stream. An
implementation MUST NOT interpret octets beyond the boundaries of the
unwrapped octet stream as part of any OpenPGP packet. If an
implementation encounters a packet whose header length indicates that
it would extend beyond the boundaries of the unwrapped octet stream,
the implementation MUST reject that packet as malformed and unusable.
11.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. For example, a v5 SKESK this grammar are nonetheless unacceptable.
packet cannot effectively precede a SEIPD packet, since that
combination does not include any information about the choice of 11.3.2.1. Packet Versions in Encrypted Messages
symmetric cipher used for SEIPD (see Section 5.3.1 for more details).
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
(Section 5.14) payload. In some historic data, the payload may be a
deprecated SED (Section 5.8) packet instead of SEIPD, though
implementations MUST NOT generate SED packets (see Section 15.1).
The versions of the preceding ESK packets within an Encrypted Message
MUST align with the version of the payload SEIPD packet, as described
in this section.
v3 PKESK and v4 SKESK packets both contain in their cleartext the
symmetric cipher algorithm identifier in addition to the session key
for the subsequent SEIPD packet. Since a v1 SEIPD does not contain a
symmetric algorithm identifier, so all ESK packets preceding a v1
SEIPD payload MUST be either v3 PKESK or v4 SKESK.
On the other hand, the cleartext of the v5 ESK packets (either PKESK
or SKESK) do not contain a symmetric cipher algorithm identifier, so
they cannot be used in combination with a v1 SEIPD payload. The
payload following any v5 PKESK or v5 SKESK packet MUST be a v2 SEIPD.
Additionally, to avoid potentially conflicting cipher algorithm
identifiers, and for simplicity, implementations MUST NOT precede a
v2 SEIPD payload with either v3 PKESK or v4 SKESK packets.
The acceptable versions of packets in an Encrypted Message are
summarized in the following table:
+======================+======================+===================+
| Version of Encrypted | Version of preceding | Version of |
| Data payload | Symmetric-Key ESK | preceding Public- |
| | (if any) | Key ESK (if any) |
+======================+======================+===================+
| v1 SEIPD | v4 SKESK | v3 PKESK |
+----------------------+----------------------+-------------------+
| v2 SEIPD | v5 SKESK | v5 PKESK |
+----------------------+----------------------+-------------------+
Table 26: Encrypted Message Packet Version Alignment
An implementation processing an Encrypted Message MUST discard any
preceding ESK packet with a version that does not align with the
version of the payload.
11.4. Detached Signatures 11.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 a Signature packet stored separately from the signatures are simply a Signature packet stored separately from the
data for which they are a signature. data for which they are a signature.
12. Enhanced Key Formats 12. Enhanced Key Formats
skipping to change at page 97, line 17 skipping to change at page 106, line 37
have many signatures. V3 keys are deprecated. Implementations MUST have many signatures. V3 keys are deprecated. Implementations MUST
NOT generate new V3 keys, but MAY continue to use existing ones. NOT generate new V3 keys, but MAY continue to use existing ones.
The format of an OpenPGP V4 key that uses multiple public keys is The format of an OpenPGP V4 key that uses multiple public keys is
similar except that the other keys are added to the end as "subkeys" similar except that the other keys are added to the end as "subkeys"
of the primary key. of the primary key.
Primary-Key Primary-Key
[Revocation Self Signature] [Revocation Self Signature]
[Direct Key Signature...] [Direct Key Signature...]
User ID [Signature ...]
[User ID [Signature ...] ...] [User ID [Signature ...] ...]
[User Attribute [Signature ...] ...] [User Attribute [Signature ...] ...]
[[Subkey [Binding-Signature-Revocation ...] [[Subkey [Binding-Signature-Revocation ...]
Subkey-Binding-Signature ...] ...] Subkey-Binding-Signature ...] ...]
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 V3 or V4 format, but SHOULD
be V4. Subkeys that can issue signatures MUST have a V4 binding be V4. Subkeys that can issue signatures MUST have a V4 binding
signature due to the REQUIRED embedded primary key binding signature. signature due to the REQUIRED embedded primary key binding signature.
In a V4 key, the primary key MUST be a key capable of certification. In order to create self-signatures (see Section 5.2.3.7), the primary
The subkeys may be keys of any other type. There may be other key MUST be an algorithm capable of making signatures (that is, not
constructions of V4 keys, too. For example, there may be a single- an encryption-only algorithm). The subkeys may be keys of any type.
key RSA key in V4 format, a DSA primary key with an RSA encryption For example, there may be a single-key RSA key, an EdDSA primary key
key, or RSA primary key with an Elgamal subkey, etc. with an RSA encryption key, or an EdDSA primary key with an ECDH
subkey, etc.
It is also possible to have a signature-only subkey. This permits a It is also possible to have a signature-only subkey. This permits a
primary key that collects certifications (key signatures), but is primary key that collects certifications (key signatures), but is
used only for certifying subkeys that are used for encryption and used only for certifying subkeys that are used for encryption and
signatures. signatures.
12.2. Key IDs and Fingerprints 12.2. Key IDs and Fingerprints
For a V3 key, the eight-octet Key ID consists of the low 64 bits of For a V3 key, the eight-octet Key ID consists of the low 64 bits of
the public modulus of the RSA key. 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 V3 key is formed by hashing the body (but not
the two-octet length) of the MPIs that form the key material (public the two-octet length) of the MPIs that form the key material (public
modulus n, followed by exponent e) with MD5. Note that both V3 keys modulus n, followed by exponent e) with MD5. Note that both V3 keys
and MD5 are deprecated. and MD5 are deprecated.
A V4 fingerprint is the 160-bit SHA-1 hash of the octet 0x99, A V4 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 two-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
low-order 64 bits of the fingerprint. Here are the fields of the low-order 64 bits of the fingerprint. Here are the fields of the
hash material, with the example of a DSA key: hash material, with the example of an EdDSA 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) two-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): 17 = DSA (example); d) algorithm (1 octet): 22 = EdDSA (example);
e) Algorithm-specific fields. e) Algorithm-specific fields.
Algorithm-Specific Fields for DSA keys (example): Algorithm-Specific Fields for EdDSA keys (example):
e.1) MPI of DSA prime p;
e.2) MPI of DSA group order q (q is a prime divisor of p-1); e.1) A one-octet size of the following field;
e.3) MPI of DSA group generator g; e.2) The octets representing a curve OID, defined in Section 9.2;
e.4) MPI of DSA public-key value y (= g**x mod p where x is secret). e.3) An MPI of an EC point representing a public key Q in prefixed
native form (see Section 13.2.2).
A V5 fingerprint is the 256-bit SHA2-256 hash of the octet 0x9A, A V5 fingerprint is the 256-bit SHA2-256 hash of the octet 0x9A,
followed by the four-octet packet length, followed by the entire followed by the four-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 a DSA key: hash material, with the example of an EdDSA key:
a.1) 0x9A (1 octet) a.1) 0x9A (1 octet)
a.2) four-octet scalar octet count of (b)-(f) a.2) four-octet scalar octet count of (b)-(f)
b) version number = 5 (1 octet); b) version number = 5 (1 octet);
c) timestamp of key creation (4 octets); c) timestamp of key creation (4 octets);
d) algorithm (1 octet): 17 = DSA (example); d) algorithm (1 octet): 22 = EdDSA (example);
e) four-octet scalar octet count for the following key material; e) four-octet scalar octet count for the following key material;
f) algorithm-specific fields. f) algorithm-specific fields.
Algorithm-Specific Fields for DSA keys (example): Algorithm-Specific Fields for EdDSA keys (example):
f.1) MPI of DSA prime p;
f.2) MPI of DSA group order q (q is a prime divisor of p-1); f.1) A one-octet size of the following field;
f.3) MPI of DSA group generator g; f.2) The octets representing a curve OID, defined in Section 9.2;
f.4) MPI of DSA public-key value y (= g**x mod p where x is secret). f.3) An MPI of an EC point representing a public key Q in prefixed
native form (see Section 13.2.2).
Note that it is possible for there to be collisions of Key IDs -- two Note that it is possible for there to be collisions of Key IDs ---
different keys with the same Key ID. Note that there is a much two different keys with the same Key ID. Note that there is a much
smaller, but still non-zero, probability that two different keys have smaller, but still non-zero, probability that two different keys have
the same fingerprint. the same fingerprint.
Also note that if V3, V4, and V5 format keys share the same RSA key Also note that if V3, V4, and V5 format keys share the same RSA key
material, they will have different Key IDs as well as different material, they will have different Key IDs as well as different
fingerprints. 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 (V3 and V4 key) or same way as for a primary key, including the 0x99 (V4 key) or 0x9A
0x9A (V5 key) as the first octet (even though this is not a valid (V5 key) as the first octet (even though this is not a valid packet
packet ID for a public subkey). ID for a public subkey).
13. Elliptic Curve Cryptography 13. 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].
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
generate a uniformly distributed ECC private key.
13.1. Supported ECC Curves 13.1. Supported 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". These [FIPS186] as "Curve P-256", "Curve P-384", and "Curve P-521". These
three [FIPS186] curves can be used with ECDSA and ECDH public key three [FIPS186] curves can be used with ECDSA and ECDH public key
algorithms. Additionally, curve "Curve25519" and "Curve448" are algorithms. Additionally, curve "Curve25519" and "Curve448" are
referenced for use with Ed25519 and Ed448 (EdDSA signing, see referenced for use with Ed25519 and Ed448 (EdDSA signing, see
[RFC8032]); and X25519 and X448 (ECDH encryption, see [RFC7748]). [RFC8032]); and X25519 and X448 (ECDH encryption, see [RFC7748]).
The named curves are referenced as a sequence of octets in this The named curves are referenced as a sequence of octets in this
skipping to change at page 100, line 21 skipping to change at page 109, line 38
constant size. constant size.
+=================+================+================+ +=================+================+================+
| Name | Wire Format | Reference | | Name | Wire Format | Reference |
+=================+================+================+ +=================+================+================+
| SEC1 | 0x04 || x || y | Section 13.2.1 | | SEC1 | 0x04 || x || y | Section 13.2.1 |
+-----------------+----------------+----------------+ +-----------------+----------------+----------------+
| Prefixed native | 0x40 || native | Section 13.2.2 | | Prefixed native | 0x40 || native | Section 13.2.2 |
+-----------------+----------------+----------------+ +-----------------+----------------+----------------+
Table 24: Elliptic Curve Point Wire Formats Table 27: Elliptic Curve Point Wire Formats
13.2.1. SEC1 EC Point Wire Format 13.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
skipping to change at page 101, line 27 skipping to change at page 110, line 38
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 than the wire format
associated with the curve. associated with the curve.
13.3. EC Scalar Wire Formats 13.3. EC Scalar Wire Formats
Some non-curve values in elliptic curve cryptography (e.g. secret Some non-curve values in elliptic curve cryptography (for example,
keys and signature components) are not points on a curve, but are secret keys and signature components) are not points on a curve, but
also encoded on the wire in OpenPGP as an MPI. 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 |
+==========+=====================================+===========+ +==========+=====================================+===========+
skipping to change at page 102, line 22 skipping to change at page 111, line 22
| string | that may be shorter on the wire due | 13.3.1 | | string | that may be shorter on the wire due | 13.3.1 |
| | to leading zeros being stripped by | | | | to leading zeros being stripped by | |
| | the MPI encoding, and may need to | | | | the MPI encoding, and may need to | |
| | be zero-padded before usage | | | | be zero-padded before usage | |
+----------+-------------------------------------+-----------+ +----------+-------------------------------------+-----------+
| 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 | 13.3.2 | | N octets | prefixed with octet 0x40 to ensure | 13.3.2 |
| | no leading zero octet | | | | no leading zero octet | |
+----------+-------------------------------------+-----------+ +----------+-------------------------------------+-----------+
Table 25: Elliptic Curve Scalar Encodings Table 28: Elliptic Curve Scalar Encodings
13.3.1. EC Octet String Wire Format 13.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 For example, a five-octet opaque string (MPI(5 octets of X)) where X
"X" has the value "00 02 ee 19 00" would be represented on the wire has the value 00 02 ee 19 00 would be represented on the wire as an
as an MPI like so: "00 1a 02 ee 19 00". MPI 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, we set the MPI's two-octet bit
counter to the value of the highest set bit (bit 26, or 0x001a), and counter to the value of the highest set bit (bit 26, or 0x001a), and
do not transfer the leading all-zero octet to the wire. do not 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 that knows this value has
an expected length of 5 octets can take the following steps: an expected length of 5 octets can take the following steps:
* ensure that the MPI's two-octet bitcount is less than or equal to * ensure that the MPI's two-octet bitcount 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
13.3.2. Elliptic Curve Prefixed Octet String Wire Format 13.3.2. Elliptic Curve Prefixed Octet String Wire Format
Another way to ensure that a fixed-length bytestring is encoded Another way to ensure that a fixed-length bytestring 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 bytestring 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 standard as
"MPI(prefixed N octets of X)", where "N" is the known bytestring MPI(prefixed N octets of X), where N is the known bytestring length.
length.
For example, a five-octet opaque string using "MPI(prefixed 5 octets For example, a five-octet opaque string using MPI(prefixed 5 octets
of X)" where "X" has the value "00 02 ee 19 00" would be written to of X) where X has the value 00 02 ee 19 00 would be written to the
the wire form as: "00 2f 40 00 02 ee 19 00". wire 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, we prefix it with the octet 0x40 (whose 7th bit
is set), then set the MPI's two-octet bit counter to 47 (0x002f, 7 is set), then set the MPI's two-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 two 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 13.2.2. encodings found in Section 13.2.2.
13.4. Key Derivation Function 13.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
skipping to change at page 105, line 13 skipping to change at page 114, line 13
reserved for future extensions, reserved for future extensions,
- A one-octet value 0x01, reserved for future extensions, - A one-octet value 0x01, reserved for future extensions,
- A one-octet hash function ID used with the KDF, - A one-octet hash function ID used with the KDF,
- A one-octet algorithm ID for the symmetric algorithm used to - A one-octet algorithm ID for the symmetric algorithm used to
wrap the symmetric key for message encryption; see Section 13.5 wrap the symmetric key for message encryption; see Section 13.5
for details; 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 Sender , which is the octet sequence 41 6E 6F 6E 79 6D 6F 75 73
73 20 53 65 6E 64 65 72 20 20 20 20; 20 53 65 6E 64 65 72 20 20 20 20;
* 20 octets representing a recipient encryption subkey or a primary * A variable-length field containing the fingerprint of the
key fingerprint identifying the key material that is needed for recipient encryption subkey or a primary key fingerprint
decryption (for version 5 keys the 20 leftmost octets of the identifying the key material that is needed for decryption. For
fingerprint are used). version 4 keys, this field is 20 octets. For version 5 keys, this
field is 32 octets.
The size of the KDF parameters sequence, defined above, is either 54 The size in octets of the KDF parameters sequence, defined above, for
for the NIST curve P-256, 51 for the curves P-384 and P-521, 56 for encrypting to a v4 key is either 54 for curve P-256, 51 for curves
Curve25519, or 49 for X448. P-384 and P-521, 56 for Curve25519, or 49 for X448. For encrypting
to a v5 key, the size of the sequence is either 66 for curve P-256,
63 for curves P-384 and P-521, 68 for Curve25519, or 61 for X448.
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 key-encryption key (KEK) as
specified in [RFC3394]. Refer to Section 15 for the details specified in [RFC3394]. Refer to Section 15 for the details
regarding the choice of the KEK algorithm, which SHOULD be one of regarding the choice of the KEK algorithm, which SHOULD be one of
three AES algorithms. Key wrapping and unwrapping is performed with three AES algorithms. Key wrapping and unwrapping is performed with
the default initial value of [RFC3394]. the default initial value of [RFC3394].
The input to the key wrapping method is the value "m" derived from The input to the key wrapping method is the plaintext described in
the session key, as described in Section 5.1, "Public-Key Encrypted Section 5.1, "Public-Key Encrypted Session Key Packets (Tag 1)",
Session Key Packets (Tag 1)", except that the PKCS #1.5 padding step padded using the method described in [PKCS5] to an 8-octet
is omitted. The result is padded using the method described in granularity.
[PKCS5] to an 8-octet granularity. For example, the following
AES-256 session key, in which 32 octets are denoted from k0 to k31, For example, in a V4 Public-Key Encrypted Session Key packet, the
is composed to form the following 40 octet sequence: following AES-256 session key, in which 32 octets are denoted from k0
to k31, is composed to form the following 40 octet 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 s0 and s1 above denote the checksum of the session key
octets. This encoding allows the sender to obfuscate the size of the
symmetric encryption 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 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 key wrapping method.
The octets s0 and s1 above denote the checksum. This encoding allows In a V5 Public-Key Encrypted Session Key packet, the symmetric
the sender to obfuscate the size of the symmetric encryption key used algorithm is not included, as described in Section 5.1. For example,
to encrypt the data. For example, assuming that an AES algorithm is an AES-256 session key would be composed as follows:
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, to provide k0 k1 ... k31 s0 s1 06 06 06 06 06 06
the same number of octets, 40 total, as an input to the key wrapping
method. 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
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,
respectively, to provide the same number of octets, 40 total, as an
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
skipping to change at page 106, line 31 skipping to change at page 116, line 4
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 key pair {v, V=vG} * Generate an ephemeral 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 || Anonymous
Sender " || recipient_fingerprint; Sender || 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 ) as per [RFC3394]
* 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 obtains the shared secret by calculating recipient obtains the shared secret by calculating
S = rV = rvG, where (r,R) is the recipient's key pair. S = rV = rvG, where (r,R) is the recipient's key pair.
Consistent with Section 5.16 and Section 5.14, AEAD encryption or a Consistent with Section 5.14, AEAD encryption or a Modification
Modification Detection Code (MDC) MUST be used anytime the symmetric Detection Code (MDC) MUST be used anytime the symmetric key is
key is protected by ECDH. protected by ECDH.
14. Notes on Algorithms 14. Notes on Algorithms
14.1. PKCS#1 Encoding in OpenPGP 14.1. PKCS#1 Encoding in OpenPGP
This standard makes use of the PKCS#1 functions EME-PKCS1-v1_5 and This standard makes use of the PKCS#1 functions EME-PKCS1-v1_5 and
EMSA-PKCS1-v1_5. However, the calling conventions of these functions EMSA-PKCS1-v1_5. However, the calling conventions of these functions
has changed in the past. To avoid potential confusion and has 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 [RFC3447]. [RFC3447] 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.
14.1.1. EME-PKCS1-v1_5-ENCODE 14.1.1. EME-PKCS1-v1_5-ENCODE
Input: Input:
k = the length in octets of the key modulus. k = the length in octets of the key modulus.
skipping to change at page 109, line 46 skipping to change at page 119, line 19
14.2. Symmetric Algorithm Preferences 14.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 TripleDES is the MUST-implement algorithm, if it is not Since AES-128 is the MUST-implement algorithm, 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 a TripleDES-only implementation. implicitly an AES-128-only implementation. Note further that
implementations conforming to previous versions of this standard
[RFC4880] have TripleDES as its only MUST-implement algorithm.
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 the
MUST-implement algorithm, TripleDES, ensures that the intersection is MUST-implement algorithm, AES-128, ensures that the intersection is
not null. The implementation may use any mechanism to pick an not null. The implementation may use any mechanism to pick an
algorithm in the intersection. 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 MUST warn the keyholder that the protocol has
been violated. For example, suppose that Alice, above, has software been violated. For example, suppose that Alice, above, has software
that implements all algorithms in this specification. Nonetheless, that implements all algorithms in this specification. Nonetheless,
she prefers subsets for work or home. If she is sent a message she prefers subsets for work or home. If she is sent a message
encrypted with IDEA, which is not in her preferences, the software encrypted with IDEA, which is not in her preferences, the software
warns her that someone sent her an IDEA-encrypted message, but it warns her that someone sent her an IDEA-encrypted message, but it
would ideally decrypt it anyway. would ideally decrypt it anyway.
14.2.1. Plaintext
Algorithm 0, "plaintext", may only be used to denote secret keys that
ar