idnits 2.17.1 draft-ietf-openpgp-rfc4880bis-08.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There is 1 instance of too long lines in the document, the longest one being 1 character in excess of 72. -- The draft header indicates that this document obsoletes RFC6637, but the abstract doesn't seem to mention this, which it should. -- The draft header indicates that this document obsoletes RFC4880, but the abstract doesn't seem to directly say this. It does mention RFC4880 though, so this could be OK. -- The draft header indicates that this document obsoletes RFC5581, but the abstract doesn't seem to mention this, which it should. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 5665 has weird spacing: '...0 dc ae dc 5b...' -- The document date (September 6, 2019) is 1693 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '0' on line 399 -- Looks like a reference, but probably isn't: '1' on line 4790 -- Looks like a reference, but probably isn't: '2' on line 399 -- Looks like a reference, but probably isn't: '3' on line 4799 == Missing Reference: 'REGEX' is mentioned on line 1507, but not defined == Missing Reference: 'Optional' is mentioned on line 2380, but not defined == Missing Reference: 'TBD1' is mentioned on line 2776, but not defined == Missing Reference: 'Binding-Signature-Revocation' is mentioned on line 4126, but not defined == Missing Reference: 'BS' is mentioned on line 4790, but not defined == Missing Reference: 'JKS02' is mentioned on line 4931, but not defined == Missing Reference: 'MZ05' is mentioned on line 4990, but not defined -- Possible downref: Non-RFC (?) normative reference: ref. 'AES' -- Possible downref: Non-RFC (?) normative reference: ref. 'BLOWFISH' -- Possible downref: Non-RFC (?) normative reference: ref. 'BZ2' -- Possible downref: Non-RFC (?) normative reference: ref. 'EAX' -- Possible downref: Non-RFC (?) normative reference: ref. 'ELGAMAL' -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS180' -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS186' -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS202' -- Possible downref: Non-RFC (?) normative reference: ref. 'HAC' -- Possible downref: Non-RFC (?) normative reference: ref. 'IDEA' -- Possible downref: Non-RFC (?) normative reference: ref. 'ISO10646' -- Possible downref: Non-RFC (?) normative reference: ref. 'JFIF' -- Possible downref: Non-RFC (?) normative reference: ref. 'PKCS5' ** Downref: Normative reference to an Informational RFC: RFC 1950 ** Downref: Normative reference to an Informational RFC: RFC 1951 ** Downref: Normative reference to an Informational RFC: RFC 2144 ** Obsolete normative reference: RFC 2822 (Obsoleted by RFC 5322) ** Downref: Normative reference to an Informational RFC: RFC 3394 ** Obsolete normative reference: RFC 3447 (Obsoleted by RFC 8017) ** Downref: Normative reference to an Informational RFC: RFC 3713 ** Downref: Normative reference to an Informational RFC: RFC 5639 ** Downref: Normative reference to an Informational RFC: RFC 7253 ** Downref: Normative reference to an Informational RFC: RFC 7748 ** Downref: Normative reference to an Informational RFC: RFC 8032 -- Possible downref: Non-RFC (?) normative reference: ref. 'SCHNEIER' -- Possible downref: Non-RFC (?) normative reference: ref. 'SP800-56A' -- Possible downref: Non-RFC (?) normative reference: ref. 'SuiteB' -- Possible downref: Non-RFC (?) normative reference: ref. 'TWOFISH' -- Obsolete informational reference (is this intentional?): RFC 1991 (Obsoleted by RFC 4880) -- Obsolete informational reference (is this intentional?): RFC 2440 (Obsoleted by RFC 4880) Summary: 12 errors (**), 0 flaws (~~), 9 warnings (==), 28 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group W. Koch 3 Internet-Draft GnuPG e.V. 4 Obsoletes: 4880, 5581, 6637 (if B. Carlson 5 approved) 6 Intended status: Standards Track R. Tse 7 Expires: March 9, 2020 Ribose 8 D. Atkins 10 D. Gillmor 12 September 6, 2019 14 OpenPGP Message Format 15 draft-ietf-openpgp-rfc4880bis-08 17 Abstract 19 { Work in progress to update the OpenPGP specification from RFC4880 } 21 This document specifies the message formats used in OpenPGP. OpenPGP 22 provides encryption with public-key or symmetric cryptographic 23 algorithms, digital signatures, compression and key management. 25 This document is maintained in order to publish all necessary 26 information needed to develop interoperable applications based on the 27 OpenPGP format. It is not a step-by-step cookbook for writing an 28 application. It describes only the format and methods needed to 29 read, check, generate, and write conforming packets crossing any 30 network. It does not deal with storage and implementation questions. 31 It does, however, discuss implementation issues necessary to avoid 32 security flaws. 34 Status of This Memo 36 This Internet-Draft is submitted in full conformance with the 37 provisions of BCP 78 and BCP 79. 39 Internet-Drafts are working documents of the Internet Engineering 40 Task Force (IETF). Note that other groups may also distribute 41 working documents as Internet-Drafts. The list of current Internet- 42 Drafts is at http://datatracker.ietf.org/drafts/current/. 44 Internet-Drafts are draft documents valid for a maximum of six months 45 and may be updated, replaced, or obsoleted by other documents at any 46 time. It is inappropriate to use Internet-Drafts as reference 47 material or to cite them other than as "work in progress." 48 This Internet-Draft will expire on March 9, 2020. 50 Copyright Notice 52 Copyright (c) 2019 IETF Trust and the persons identified as the 53 document authors. All rights reserved. 55 This document is subject to BCP 78 and the IETF Trust's Legal 56 Provisions Relating to IETF Documents 57 (http://trustee.ietf.org/license-info) in effect on the date of 58 publication of this document. Please review these documents 59 carefully, as they describe your rights and restrictions with respect 60 to this document. Code Components extracted from this document must 61 include Simplified BSD License text as described in Section 4.e of 62 the Trust Legal Provisions and are provided without warranty as 63 described in the Simplified BSD License. 65 Table of Contents 67 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5 68 1.1. Terms . . . . . . . . . . . . . . . . . . . . . . . . . . 6 69 2. General functions . . . . . . . . . . . . . . . . . . . . . . 6 70 2.1. Confidentiality via Encryption . . . . . . . . . . . . . 7 71 2.2. Authentication via Digital Signature . . . . . . . . . . 8 72 2.3. Compression . . . . . . . . . . . . . . . . . . . . . . . 8 73 2.4. Conversion to Radix-64 . . . . . . . . . . . . . . . . . 8 74 2.5. Signature-Only Applications . . . . . . . . . . . . . . . 9 75 3. Data Element Formats . . . . . . . . . . . . . . . . . . . . 9 76 3.1. Scalar Numbers . . . . . . . . . . . . . . . . . . . . . 9 77 3.2. Multiprecision Integers . . . . . . . . . . . . . . . . . 9 78 3.3. Key IDs . . . . . . . . . . . . . . . . . . . . . . . . . 10 79 3.4. Text . . . . . . . . . . . . . . . . . . . . . . . . . . 10 80 3.5. Time Fields . . . . . . . . . . . . . . . . . . . . . . . 10 81 3.6. Keyrings . . . . . . . . . . . . . . . . . . . . . . . . 10 82 3.7. String-to-Key (S2K) Specifiers . . . . . . . . . . . . . 10 83 3.7.1. String-to-Key (S2K) Specifier Types . . . . . . . . . 10 84 3.7.2. String-to-Key Usage . . . . . . . . . . . . . . . . . 13 85 4. Packet Syntax . . . . . . . . . . . . . . . . . . . . . . . . 14 86 4.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 14 87 4.2. Packet Headers . . . . . . . . . . . . . . . . . . . . . 14 88 4.2.1. Old Format Packet Lengths . . . . . . . . . . . . . . 15 89 4.2.2. New Format Packet Lengths . . . . . . . . . . . . . . 15 90 4.2.3. Packet Length Examples . . . . . . . . . . . . . . . 17 91 4.3. Packet Tags . . . . . . . . . . . . . . . . . . . . . . . 17 92 5. Packet Types . . . . . . . . . . . . . . . . . . . . . . . . 18 93 5.1. Public-Key Encrypted Session Key Packets (Tag 1) . . . . 18 94 5.2. Signature Packet (Tag 2) . . . . . . . . . . . . . . . . 20 95 5.2.1. Signature Types . . . . . . . . . . . . . . . . . . . 20 96 5.2.2. Version 3 Signature Packet Format . . . . . . . . . . 22 97 5.2.3. Version 4 and 5 Signature Packet Formats . . . . . . 25 98 5.2.4. Computing Signatures . . . . . . . . . . . . . . . . 44 99 5.3. Symmetric-Key Encrypted Session Key Packets (Tag 3) . . . 46 100 5.4. One-Pass Signature Packets (Tag 4) . . . . . . . . . . . 48 101 5.5. Key Material Packet . . . . . . . . . . . . . . . . . . . 49 102 5.5.1. Key Packet Variants . . . . . . . . . . . . . . . . . 49 103 5.5.2. Public-Key Packet Formats . . . . . . . . . . . . . . 50 104 5.5.3. Secret-Key Packet Formats . . . . . . . . . . . . . . 51 105 5.6. Algorithm-specific Parts of Keys . . . . . . . . . . . . 53 106 5.6.1. Algorithm-Specific Part for RSA Keys . . . . . . . . 53 107 5.6.2. Algorithm-Specific Part for DSA Keys . . . . . . . . 54 108 5.6.3. Algorithm-Specific Part for Elgamal Keys . . . . . . 54 109 5.6.4. Algorithm-Specific Part for ECDSA Keys . . . . . . . 54 110 5.6.5. Algorithm-Specific Part for EdDSA Keys . . . . . . . 55 111 5.6.6. Algorithm-Specific Part for ECDH Keys . . . . . . . . 55 112 5.7. Compressed Data Packet (Tag 8) . . . . . . . . . . . . . 56 113 5.8. Symmetrically Encrypted Data Packet (Tag 9) . . . . . . . 57 114 5.9. Marker Packet (Obsolete Literal Packet) (Tag 10) . . . . 58 115 5.10. Literal Data Packet (Tag 11) . . . . . . . . . . . . . . 58 116 5.11. Trust Packet (Tag 12) . . . . . . . . . . . . . . . . . . 59 117 5.12. User ID Packet (Tag 13) . . . . . . . . . . . . . . . . . 59 118 5.13. User Attribute Packet (Tag 17) . . . . . . . . . . . . . 59 119 5.13.1. The Image Attribute Subpacket . . . . . . . . . . . 60 120 5.13.2. User ID Attribute Subpacket . . . . . . . . . . . . 61 121 5.14. Sym. Encrypted Integrity Protected Data Packet (Tag 18) . 61 122 5.15. Modification Detection Code Packet (Tag 19) . . . . . . . 64 123 5.16. AEAD Encrypted Data Packet (Tag 20) . . . . . . . . . . . 65 124 5.16.1. EAX Mode . . . . . . . . . . . . . . . . . . . . . . 66 125 5.16.2. OCB Mode . . . . . . . . . . . . . . . . . . . . . . 67 126 6. Radix-64 Conversions . . . . . . . . . . . . . . . . . . . . 67 127 6.1. An Implementation of the CRC-24 in "C" . . . . . . . . . 68 128 6.2. Forming ASCII Armor . . . . . . . . . . . . . . . . . . . 68 129 6.3. Encoding Binary in Radix-64 . . . . . . . . . . . . . . . 71 130 6.4. Decoding Radix-64 . . . . . . . . . . . . . . . . . . . . 72 131 6.5. Examples of Radix-64 . . . . . . . . . . . . . . . . . . 73 132 6.6. Example of an ASCII Armored Message . . . . . . . . . . . 73 133 7. Cleartext Signature Framework . . . . . . . . . . . . . . . . 74 134 7.1. Dash-Escaped Text . . . . . . . . . . . . . . . . . . . . 74 135 8. Regular Expressions . . . . . . . . . . . . . . . . . . . . . 75 136 9. Constants . . . . . . . . . . . . . . . . . . . . . . . . . . 76 137 9.1. Public-Key Algorithms . . . . . . . . . . . . . . . . . . 76 138 9.2. ECC Curve OID . . . . . . . . . . . . . . . . . . . . . . 77 139 9.3. Symmetric-Key Algorithms . . . . . . . . . . . . . . . . 78 140 9.4. Compression Algorithms . . . . . . . . . . . . . . . . . 78 141 9.5. Hash Algorithms . . . . . . . . . . . . . . . . . . . . . 79 142 9.6. AEAD Algorithms . . . . . . . . . . . . . . . . . . . . . 79 143 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 79 144 10.1. New String-to-Key Specifier Types . . . . . . . . . . . 80 145 10.2. New Packets . . . . . . . . . . . . . . . . . . . . . . 80 146 10.2.1. User Attribute Types . . . . . . . . . . . . . . . . 80 147 10.2.2. Image Format Subpacket Types . . . . . . . . . . . . 80 148 10.2.3. New Signature Subpackets . . . . . . . . . . . . . . 81 149 10.2.4. New Packet Versions . . . . . . . . . . . . . . . . 84 150 10.3. New Algorithms . . . . . . . . . . . . . . . . . . . . . 84 151 10.3.1. Public-Key Algorithms . . . . . . . . . . . . . . . 84 152 10.3.2. Symmetric-Key Algorithms . . . . . . . . . . . . . . 85 153 10.3.3. Hash Algorithms . . . . . . . . . . . . . . . . . . 85 154 10.3.4. Compression Algorithms . . . . . . . . . . . . . . . 85 155 11. Packet Composition . . . . . . . . . . . . . . . . . . . . . 86 156 11.1. Transferable Public Keys . . . . . . . . . . . . . . . . 86 157 11.2. Transferable Secret Keys . . . . . . . . . . . . . . . . 87 158 11.3. OpenPGP Messages . . . . . . . . . . . . . . . . . . . . 88 159 11.4. Detached Signatures . . . . . . . . . . . . . . . . . . 88 160 12. Enhanced Key Formats . . . . . . . . . . . . . . . . . . . . 88 161 12.1. Key Structures . . . . . . . . . . . . . . . . . . . . . 89 162 12.2. Key IDs and Fingerprints . . . . . . . . . . . . . . . . 90 163 13. Elliptic Curve Cryptography . . . . . . . . . . . . . . . . . 92 164 13.1. Supported ECC Curves . . . . . . . . . . . . . . . . . . 92 165 13.2. ECDSA and ECDH Conversion Primitives . . . . . . . . . . 92 166 13.3. EdDSA Point Format . . . . . . . . . . . . . . . . . . . 93 167 13.4. Key Derivation Function . . . . . . . . . . . . . . . . 93 168 13.5. EC DH Algorithm (ECDH) . . . . . . . . . . . . . . . . . 94 169 14. Notes on Algorithms . . . . . . . . . . . . . . . . . . . . . 96 170 14.1. PKCS#1 Encoding in OpenPGP . . . . . . . . . . . . . . . 97 171 14.1.1. EME-PKCS1-v1_5-ENCODE . . . . . . . . . . . . . . . 97 172 14.1.2. EME-PKCS1-v1_5-DECODE . . . . . . . . . . . . . . . 97 173 14.1.3. EMSA-PKCS1-v1_5 . . . . . . . . . . . . . . . . . . 98 174 14.2. Symmetric Algorithm Preferences . . . . . . . . . . . . 99 175 14.3. Other Algorithm Preferences . . . . . . . . . . . . . . 100 176 14.3.1. Compression Preferences . . . . . . . . . . . . . . 100 177 14.3.2. Hash Algorithm Preferences . . . . . . . . . . . . . 101 178 14.4. Plaintext . . . . . . . . . . . . . . . . . . . . . . . 101 179 14.5. RSA . . . . . . . . . . . . . . . . . . . . . . . . . . 101 180 14.6. DSA . . . . . . . . . . . . . . . . . . . . . . . . . . 101 181 14.7. Elgamal . . . . . . . . . . . . . . . . . . . . . . . . 102 182 14.8. EdDSA . . . . . . . . . . . . . . . . . . . . . . . . . 102 183 14.9. Reserved Algorithm Numbers . . . . . . . . . . . . . . . 102 184 14.10. OpenPGP CFB Mode . . . . . . . . . . . . . . . . . . . . 103 185 14.11. Private or Experimental Parameters . . . . . . . . . . . 104 186 14.12. Meta-Considerations for Expansion . . . . . . . . . . . 104 187 15. Security Considerations . . . . . . . . . . . . . . . . . . . 105 188 16. Compatibility Profiles . . . . . . . . . . . . . . . . . . . 112 189 16.1. OpenPGP ECC Profile . . . . . . . . . . . . . . . . . . 112 190 16.2. Suite-B Profile . . . . . . . . . . . . . . . . . . . . 112 191 16.2.1. Security Strength at 192 Bits . . . . . . . . . . . 112 192 16.2.2. Security Strength at 128 Bits . . . . . . . . . . . 113 193 17. Implementation Nits . . . . . . . . . . . . . . . . . . . . . 113 194 18. References . . . . . . . . . . . . . . . . . . . . . . . . . 114 195 18.1. Normative References . . . . . . . . . . . . . . . . . . 114 196 18.2. Informative References . . . . . . . . . . . . . . . . . 117 197 Appendix A. Test vectors . . . . . . . . . . . . . . . . . . . . 118 198 A.1. Sample EdDSA key . . . . . . . . . . . . . . . . . . . . 118 199 A.2. Sample EdDSA signature . . . . . . . . . . . . . . . . . 119 200 A.3. Sample AEAD-EAX encryption and decryption . . . . . . . . 119 201 A.3.1. Sample Parameters . . . . . . . . . . . . . . . . . . 119 202 A.3.2. Sample symmetric-key encrypted session key packet 203 (v5) . . . . . . . . . . . . . . . . . . . . . . . . 120 204 A.3.3. Starting AEAD-EAX decryption of CEK . . . . . . . . . 120 205 A.3.4. Sample AEAD encrypted data packet . . . . . . . . . . 121 206 A.3.5. Decryption of data . . . . . . . . . . . . . . . . . 121 207 A.3.6. Complete AEAD-EAX encrypted packet sequence . . . . . 122 208 A.4. Sample AEAD-OCB encryption and decryption . . . . . . . . 122 209 A.4.1. Sample Parameters . . . . . . . . . . . . . . . . . . 122 210 A.4.2. Sample symmetric-key encrypted session key packet 211 (v5) . . . . . . . . . . . . . . . . . . . . . . . . 123 212 A.4.3. Starting AEAD-OCB decryption of CEK . . . . . . . . . 123 213 A.4.4. Sample AEAD encrypted data packet . . . . . . . . . . 123 214 A.4.5. Decryption of data . . . . . . . . . . . . . . . . . 124 215 A.4.6. Complete AEAD-OCB encrypted packet sequence . . . . . 125 216 Appendix B. ECC Point compression flag bytes . . . . . . . . . . 125 217 Appendix C. Changes since RFC-4880 . . . . . . . . . . . . . . . 125 218 Appendix D. The principal authors of RFC-4880 . . . . . . . . . 127 219 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 127 221 1. Introduction 223 { This is work in progress to update OpenPGP. Editorial notes are 224 enclosed in curly braces. } 226 This document provides information on the message-exchange packet 227 formats used by OpenPGP to provide encryption, decryption, signing, 228 and key management functions. It is a revision of RFC 4880, "OpenPGP 229 Message Format", which is a revision of RFC 2440, which itself 230 replaces RFC 1991, "PGP Message Exchange Formats" [RFC1991] [RFC2440] 231 [RFC4880]. 233 This document obsoletes: RFC 4880 (OpenPGP), RFC 5581 (Camellia 234 cipher) and RFC 6637 (ECC for OpenPGP). 236 1.1. Terms 238 o OpenPGP - This is a term for security software that uses PGP 5 as 239 a basis, formalized in this document. 241 o PGP - Pretty Good Privacy. PGP is a family of software systems 242 developed by Philip R. Zimmermann from which OpenPGP is based. 244 o PGP 2 - This version of PGP has many variants; where necessary a 245 more detailed version number is used here. PGP 2 uses only RSA, 246 MD5, and IDEA for its cryptographic transforms. An informational 247 RFC, RFC 1991, was written describing this version of PGP. 249 o PGP 5 - This version of PGP is formerly known as "PGP 3" in the 250 community. It has new formats and corrects a number of problems 251 in the PGP 2 design. It is referred to here as PGP 5 because that 252 software was the first release of the "PGP 3" code base. 254 o GnuPG - GNU Privacy Guard, also called GPG. GnuPG is an OpenPGP 255 implementation that avoids all encumbered algorithms. 256 Consequently, early versions of GnuPG did not include RSA public 257 keys. 259 "PGP", "Pretty Good", and "Pretty Good Privacy" are trademarks of PGP 260 Corporation and are used with permission. The term "OpenPGP" refers 261 to the protocol described in this and related documents. 263 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 264 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 265 document are to be interpreted as described in [RFC2119]. 267 The key words "PRIVATE USE", "EXPERT REVIEW", "SPECIFICATION 268 REQUIRED", "RFC REQUIRED", and "IETF REVIEW" that appear in this 269 document when used to describe namespace allocation are to be 270 interpreted as described in [RFC8126]. 272 2. General functions 274 OpenPGP provides data integrity services for messages and data files 275 by using these core technologies: 277 o digital signatures 279 o encryption 281 o compression 283 o Radix-64 conversion 284 In addition, OpenPGP provides key management and certificate 285 services, but many of these are beyond the scope of this document. 287 2.1. Confidentiality via Encryption 289 OpenPGP combines symmetric-key encryption and public-key encryption 290 to provide confidentiality. When made confidential, first the object 291 is encrypted using a symmetric encryption algorithm. Each symmetric 292 key is used only once, for a single object. A new "session key" is 293 generated as a random number for each object (sometimes referred to 294 as a session). Since it is used only once, the session key is bound 295 to the message and transmitted with it. To protect the key, it is 296 encrypted with the receiver's public key. The sequence is as 297 follows: 299 1. The sender creates a message. 301 2. The sending OpenPGP generates a random number to be used as a 302 session key for this message only. 304 3. The session key is encrypted using each recipient's public key. 305 These "encrypted session keys" start the message. 307 4. The sending OpenPGP encrypts the message using the session key, 308 which forms the remainder of the message. Note that the message 309 is also usually compressed. 311 5. The receiving OpenPGP decrypts the session key using the 312 recipient's private key. 314 6. The receiving OpenPGP decrypts the message using the session key. 315 If the message was compressed, it will be decompressed. 317 With symmetric-key encryption, an object may be encrypted with a 318 symmetric key derived from a passphrase (or other shared secret), or 319 a two-stage mechanism similar to the public-key method described 320 above in which a session key is itself encrypted with a symmetric 321 algorithm keyed from a shared secret. 323 Both digital signature and confidentiality services may be applied to 324 the same message. First, a signature is generated for the message 325 and attached to the message. Then the message plus signature is 326 encrypted using a symmetric session key. Finally, the session key is 327 encrypted using public-key encryption and prefixed to the encrypted 328 block. 330 2.2. Authentication via Digital Signature 332 The digital signature uses a hash code or message digest algorithm, 333 and a public-key signature algorithm. The sequence is as follows: 335 1. The sender creates a message. 337 2. The sending software generates a hash code of the message. 339 3. The sending software generates a signature from the hash code 340 using the sender's private key. 342 4. The binary signature is attached to the message. 344 5. The receiving software keeps a copy of the message signature. 346 6. The receiving software generates a new hash code for the received 347 message and verifies it using the message's signature. If the 348 verification is successful, the message is accepted as authentic. 350 2.3. Compression 352 OpenPGP implementations SHOULD compress the message after applying 353 the signature but before encryption. 355 If an implementation does not implement compression, its authors 356 should be aware that most OpenPGP messages in the world are 357 compressed. Thus, it may even be wise for a space-constrained 358 implementation to implement decompression, but not compression. 360 Furthermore, compression has the added side effect that some types of 361 attacks can be thwarted by the fact that slightly altered, compressed 362 data rarely uncompresses without severe errors. This is hardly 363 rigorous, but it is operationally useful. These attacks can be 364 rigorously prevented by implementing and using Modification Detection 365 Codes as described in sections following. 367 2.4. Conversion to Radix-64 369 OpenPGP's underlying native representation for encrypted messages, 370 signature certificates, and keys is a stream of arbitrary octets. 371 Some systems only permit the use of blocks consisting of seven-bit, 372 printable text. For transporting OpenPGP's native raw binary octets 373 through channels that are not safe to raw binary data, a printable 374 encoding of these binary octets is needed. OpenPGP provides the 375 service of converting the raw 8-bit binary octet stream to a stream 376 of printable ASCII characters, called Radix-64 encoding or ASCII 377 Armor. 379 Implementations SHOULD provide Radix-64 conversions. 381 2.5. Signature-Only Applications 383 OpenPGP is designed for applications that use both encryption and 384 signatures, but there are a number of problems that are solved by a 385 signature-only implementation. Although this specification requires 386 both encryption and signatures, it is reasonable for there to be 387 subset implementations that are non-conformant only in that they omit 388 encryption. 390 3. Data Element Formats 392 This section describes the data elements used by OpenPGP. 394 3.1. Scalar Numbers 396 Scalar numbers are unsigned and are always stored in big-endian 397 format. Using n[k] to refer to the kth octet being interpreted, the 398 value of a two-octet scalar is ((n[0] << 8) + n[1]). The value of a 399 four-octet scalar is ((n[0] << 24) + (n[1] << 16) + (n[2] << 8) + 400 n[3]). 402 3.2. Multiprecision Integers 404 Multiprecision integers (also called MPIs) are unsigned integers used 405 to hold large integers such as the ones used in cryptographic 406 calculations. 408 An MPI consists of two pieces: a two-octet scalar that is the length 409 of the MPI in bits followed by a string of octets that contain the 410 actual integer. 412 These octets form a big-endian number; a big-endian number can be 413 made into an MPI by prefixing it with the appropriate length. 415 Examples: 417 (all numbers are in hexadecimal) 419 The string of octets [00 01 01] forms an MPI with the value 1. The 420 string [00 09 01 FF] forms an MPI with the value of 511. 422 Additional rules: 424 The size of an MPI is ((MPI.length + 7) / 8) + 2 octets. 426 The length field of an MPI describes the length starting from its 427 most significant non-zero bit. Thus, the MPI [00 02 01] is not 428 formed correctly. It should be [00 01 01]. 430 Unused bits of an MPI MUST be zero. 432 Also note that when an MPI is encrypted, the length refers to the 433 plaintext MPI. It may be ill-formed in its ciphertext. 435 3.3. Key IDs 437 A Key ID is an eight-octet scalar that identifies a key. 438 Implementations SHOULD NOT assume that Key IDs are unique. The 439 section "Enhanced Key Formats" below describes how Key IDs are 440 formed. 442 3.4. Text 444 Unless otherwise specified, the character set for text is the UTF-8 445 [RFC3629] encoding of Unicode [ISO10646]. 447 3.5. Time Fields 449 A time field is an unsigned four-octet number containing the number 450 of seconds elapsed since midnight, 1 January 1970 UTC. 452 3.6. Keyrings 454 A keyring is a collection of one or more keys in a file or database. 455 Traditionally, a keyring is simply a sequential list of keys, but may 456 be any suitable database. It is beyond the scope of this standard to 457 discuss the details of keyrings or other databases. 459 3.7. String-to-Key (S2K) Specifiers 461 String-to-key (S2K) specifiers are used to convert passphrase strings 462 into symmetric-key encryption/decryption keys. They are used in two 463 places, currently: to encrypt the secret part of private keys in the 464 private keyring, and to convert passphrases to encryption keys for 465 symmetrically encrypted messages. 467 3.7.1. String-to-Key (S2K) Specifier Types 469 There are three types of S2K specifiers currently supported, and some 470 reserved values: 472 +-------------+---------------------------+ 473 | ID | S2K Type | 474 +-------------+---------------------------+ 475 | 0 | Simple S2K | 476 | 1 | Salted S2K | 477 | 2 | Reserved value | 478 | 3 | Iterated and Salted S2K | 479 | 100 to 110 | Private/Experimental S2K | 480 +-------------+---------------------------+ 482 These are described in the following Sections. 484 3.7.1.1. Simple S2K 486 This directly hashes the string to produce the key data. See below 487 for how this hashing is done. 489 Octet 0: 0x00 490 Octet 1: hash algorithm 492 Simple S2K hashes the passphrase to produce the session key. The 493 manner in which this is done depends on the size of the session key 494 (which will depend on the cipher used) and the size of the hash 495 algorithm's output. If the hash size is greater than the session key 496 size, the high-order (leftmost) octets of the hash are used as the 497 key. 499 If the hash size is less than the key size, multiple instances of the 500 hash context are created -- enough to produce the required key data. 501 These instances are preloaded with 0, 1, 2, ... octets of zeros (that 502 is to say, the first instance has no preloading, the second gets 503 preloaded with 1 octet of zero, the third is preloaded with two 504 octets of zeros, and so forth). 506 As the data is hashed, it is given independently to each hash 507 context. Since the contexts have been initialized differently, they 508 will each produce different hash output. Once the passphrase is 509 hashed, the output data from the multiple hashes is concatenated, 510 first hash leftmost, to produce the key data, with any excess octets 511 on the right discarded. 513 3.7.1.2. Salted S2K 515 This includes a "salt" value in the S2K specifier -- some arbitrary 516 data -- that gets hashed along with the passphrase string, to help 517 prevent dictionary attacks. 519 Octet 0: 0x01 520 Octet 1: hash algorithm 521 Octets 2-9: 8-octet salt value 523 Salted S2K is exactly like Simple S2K, except that the input to the 524 hash function(s) consists of the 8 octets of salt from the S2K 525 specifier, followed by the passphrase. 527 3.7.1.3. Iterated and Salted S2K 529 This includes both a salt and an octet count. The salt is combined 530 with the passphrase and the resulting value is hashed repeatedly. 531 This further increases the amount of work an attacker must do to try 532 dictionary attacks. 534 Octet 0: 0x03 535 Octet 1: hash algorithm 536 Octets 2-9: 8-octet salt value 537 Octet 10: count, a one-octet, coded value 539 The count is coded into a one-octet number using the following 540 formula: 542 #define EXPBIAS 6 543 count = ((Int32)16 + (c & 15)) << ((c >> 4) + EXPBIAS); 545 The above formula is in C, where "Int32" is a type for a 32-bit 546 integer, and the variable "c" is the coded count, Octet 10. 548 Iterated-Salted S2K hashes the passphrase and salt data multiple 549 times. The total number of octets to be hashed is specified in the 550 encoded count in the S2K specifier. Note that the resulting count 551 value is an octet count of how many octets will be hashed, not an 552 iteration count. 554 Initially, one or more hash contexts are set up as with the other S2K 555 algorithms, depending on how many octets of key data are needed. 556 Then the salt, followed by the passphrase data, is repeatedly hashed 557 until the number of octets specified by the octet count has been 558 hashed. The one exception is that if the octet count is less than 559 the size of the salt plus passphrase, the full salt plus passphrase 560 will be hashed even though that is greater than the octet count. 561 After the hashing is done, the data is unloaded from the hash 562 context(s) as with the other S2K algorithms. 564 3.7.2. String-to-Key Usage 566 Implementations SHOULD use salted or iterated-and-salted S2K 567 specifiers, as simple S2K specifiers are more vulnerable to 568 dictionary attacks. 570 3.7.2.1. Secret-Key Encryption 572 An S2K specifier can be stored in the secret keyring to specify how 573 to convert the passphrase to a key that unlocks the secret data. 574 Older versions of PGP just stored a cipher algorithm octet preceding 575 the secret data or a zero to indicate that the secret data was 576 unencrypted. The MD5 hash function was always used to convert the 577 passphrase to a key for the specified cipher algorithm. 579 For compatibility, when an S2K specifier is used, the special value 580 253, 254, or 255 is stored in the position where the hash algorithm 581 octet would have been in the old data structure. This is then 582 followed immediately by a one-octet algorithm identifier, and then by 583 the S2K specifier as encoded above. 585 Therefore, preceding the secret data there will be one of these 586 possibilities: 588 0: secret data is unencrypted (no passphrase) 589 255, 254, or 253: followed by algorithm octet and S2K specifier 590 Cipher alg: use Simple S2K algorithm using MD5 hash 592 This last possibility, the cipher algorithm number with an implicit 593 use of MD5 and IDEA, is provided for backward compatibility; it MAY 594 be understood, but SHOULD NOT be generated, and is deprecated. 596 These are followed by an Initial Vector of the same length as the 597 block size of the cipher for the decryption of the secret values, if 598 they are encrypted, and then the secret-key values themselves. 600 3.7.2.2. Symmetric-Key Message Encryption 602 OpenPGP can create a Symmetric-key Encrypted Session Key (ESK) packet 603 at the front of a message. This is used to allow S2K specifiers to 604 be used for the passphrase conversion or to create messages with a 605 mix of symmetric-key ESKs and public-key ESKs. This allows a message 606 to be decrypted either with a passphrase or a public-key pair. 608 PGP 2 always used IDEA with Simple string-to-key conversion when 609 encrypting a message with a symmetric algorithm. This is deprecated, 610 but MAY be used for backward-compatibility. 612 4. Packet Syntax 614 This section describes the packets used by OpenPGP. 616 4.1. Overview 618 An OpenPGP message is constructed from a number of records that are 619 traditionally called packets. A packet is a chunk of data that has a 620 tag specifying its meaning. An OpenPGP message, keyring, 621 certificate, and so forth consists of a number of packets. Some of 622 those packets may contain other OpenPGP packets (for example, a 623 compressed data packet, when uncompressed, contains OpenPGP packets). 625 Each packet consists of a packet header, followed by the packet body. 626 The packet header is of variable length. 628 4.2. Packet Headers 630 The first octet of the packet header is called the "Packet Tag". It 631 determines the format of the header and denotes the packet contents. 632 The remainder of the packet header is the length of the packet. 634 Note that the most significant bit is the leftmost bit, called bit 7. 635 A mask for this bit is 0x80 in hexadecimal. 637 +---------------+ 638 PTag |7 6 5 4 3 2 1 0| 639 +---------------+ 640 Bit 7 -- Always one 641 Bit 6 -- New packet format if set 643 PGP 2.6.x only uses old format packets. Thus, software that 644 interoperates with those versions of PGP must only use old format 645 packets. If interoperability is not an issue, the new packet format 646 is RECOMMENDED. Note that old format packets have four bits of 647 packet tags, and new format packets have six; some features cannot be 648 used and still be backward-compatible. 650 Also note that packets with a tag greater than or equal to 16 MUST 651 use new format packets. The old format packets can only express tags 652 less than or equal to 15. 654 Old format packets contain: 656 Bits 5-2 -- packet tag 657 Bits 1-0 -- length-type 659 New format packets contain: 661 Bits 5-0 -- packet tag 663 4.2.1. Old Format Packet Lengths 665 The meaning of the length-type in old format packets is: 667 0 The packet has a one-octet length. The header is 2 octets long. 669 1 The packet has a two-octet length. The header is 3 octets long. 671 2 The packet has a four-octet length. The header is 5 octets long. 673 3 The packet is of indeterminate length. The header is 1 octet 674 long, and the implementation must determine how long the packet 675 is. If the packet is in a file, this means that the packet 676 extends until the end of the file. In general, an implementation 677 SHOULD NOT use indeterminate-length packets except where the end 678 of the data will be clear from the context, and even then it is 679 better to use a definite length, or a new format header. The new 680 format headers described below have a mechanism for precisely 681 encoding data of indeterminate length. 683 4.2.2. New Format Packet Lengths 685 New format packets have four possible ways of encoding length: 687 1. A one-octet Body Length header encodes packet lengths of up to 688 191 octets. 690 2. A two-octet Body Length header encodes packet lengths of 192 to 691 8383 octets. 693 3. A five-octet Body Length header encodes packet lengths of up to 694 4,294,967,295 (0xFFFFFFFF) octets in length. (This actually 695 encodes a four-octet scalar number.) 697 4. When the length of the packet body is not known in advance by the 698 issuer, Partial Body Length headers encode a packet of 699 indeterminate length, effectively making it a stream. 701 4.2.2.1. One-Octet Lengths 703 A one-octet Body Length header encodes a length of 0 to 191 octets. 704 This type of length header is recognized because the one octet value 705 is less than 192. The body length is equal to: 707 bodyLen = 1st_octet; 709 4.2.2.2. Two-Octet Lengths 711 A two-octet Body Length header encodes a length of 192 to 8383 712 octets. It is recognized because its first octet is in the range 192 713 to 223. The body length is equal to: 715 bodyLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192 717 4.2.2.3. Five-Octet Lengths 719 A five-octet Body Length header consists of a single octet holding 720 the value 255, followed by a four-octet scalar. The body length is 721 equal to: 723 bodyLen = (2nd_octet << 24) | (3rd_octet << 16) | 724 (4th_octet << 8) | 5th_octet 726 This basic set of one, two, and five-octet lengths is also used 727 internally to some packets. 729 4.2.2.4. Partial Body Lengths 731 A Partial Body Length header is one octet long and encodes the length 732 of only part of the data packet. This length is a power of 2, from 1 733 to 1,073,741,824 (2 to the 30th power). It is recognized by its one 734 octet value that is greater than or equal to 224, and less than 255. 735 The Partial Body Length is equal to: 737 partialBodyLen = 1 << (1st_octet & 0x1F); 739 Each Partial Body Length header is followed by a portion of the 740 packet body data. The Partial Body Length header specifies this 741 portion's length. Another length header (one octet, two-octet, five- 742 octet, or partial) follows that portion. The last length header in 743 the packet MUST NOT be a Partial Body Length header. Partial Body 744 Length headers may only be used for the non-final parts of the 745 packet. 747 Note also that the last Body Length header can be a zero-length 748 header. 750 An implementation MAY use Partial Body Lengths for data packets, be 751 they literal, compressed, or encrypted. The first partial length 752 MUST be at least 512 octets long. Partial Body Lengths MUST NOT be 753 used for any other packet types. 755 4.2.3. Packet Length Examples 757 These examples show ways that new format packets might encode the 758 packet lengths. 760 A packet with length 100 may have its length encoded in one octet: 761 0x64. This is followed by 100 octets of data. 763 A packet with length 1723 may have its length encoded in two octets: 764 0xC5, 0xFB. This header is followed by the 1723 octets of data. 766 A packet with length 100000 may have its length encoded in five 767 octets: 0xFF, 0x00, 0x01, 0x86, 0xA0. 769 It might also be encoded in the following octet stream: 0xEF, first 770 32768 octets of data; 0xE1, next two octets of data; 0xE0, next one 771 octet of data; 0xF0, next 65536 octets of data; 0xC5, 0xDD, last 1693 772 octets of data. This is just one possible encoding, and many 773 variations are possible on the size of the Partial Body Length 774 headers, as long as a regular Body Length header encodes the last 775 portion of the data. 777 Please note that in all of these explanations, the total length of 778 the packet is the length of the header(s) plus the length of the 779 body. 781 4.3. Packet Tags 783 The packet tag denotes what type of packet the body holds. Note that 784 old format headers can only have tags less than 16, whereas new 785 format headers can have tags as great as 63. The defined tags (in 786 decimal) are as follows: 788 +-----------+-----------------------------------------------------+ 789 | Tag | Packet Type | 790 +-----------+-----------------------------------------------------+ 791 | 0 | Reserved - a packet tag MUST NOT have this value | 792 | 1 | Public-Key Encrypted Session Key Packet | 793 | 2 | Signature Packet | 794 | 3 | Symmetric-Key Encrypted Session Key Packet | 795 | 4 | One-Pass Signature Packet | 796 | 5 | Secret-Key Packet | 797 | 6 | Public-Key Packet | 798 | 7 | Secret-Subkey Packet | 799 | 8 | Compressed Data Packet | 800 | 9 | Symmetrically Encrypted Data Packet | 801 | 10 | Marker Packet | 802 | 11 | Literal Data Packet | 803 | 12 | Trust Packet | 804 | 13 | User ID Packet | 805 | 14 | Public-Subkey Packet | 806 | 17 | User Attribute Packet | 807 | 18 | Sym. Encrypted and Integrity Protected Data Packet | 808 | 19 | Modification Detection Code Packet | 809 | 20 | AEAD Encrypted Data Packet | 810 | 60 to 63 | Private or Experimental Values | 811 +-----------+-----------------------------------------------------+ 813 5. Packet Types 815 5.1. Public-Key Encrypted Session Key Packets (Tag 1) 817 A Public-Key Encrypted Session Key packet holds the session key used 818 to encrypt a message. Zero or more Public-Key Encrypted Session Key 819 packets and/or Symmetric-Key Encrypted Session Key packets may 820 precede a Symmetrically Encrypted Data Packet, which holds an 821 encrypted message. The message is encrypted with the session key, 822 and the session key is itself encrypted and stored in the Encrypted 823 Session Key packet(s). The Symmetrically Encrypted Data Packet is 824 preceded by one Public-Key Encrypted Session Key packet for each 825 OpenPGP key to which the message is encrypted. The recipient of the 826 message finds a session key that is encrypted to their public key, 827 decrypts the session key, and then uses the session key to decrypt 828 the message. 830 The body of this packet consists of: 832 o A one-octet number giving the version number of the packet type. 833 The currently defined value for packet version is 3. 835 o An eight-octet number that gives the Key ID of the public key to 836 which the session key is encrypted. If the session key is 837 encrypted to a subkey, then the Key ID of this subkey is used here 838 instead of the Key ID of the primary key. 840 o A one-octet number giving the public-key algorithm used. 842 o A string of octets that is the encrypted session key. This string 843 takes up the remainder of the packet, and its contents are 844 dependent on the public-key algorithm used. 846 Algorithm Specific Fields for RSA encryption: 848 * Multiprecision integer (MPI) of RSA encrypted value m**e mod n. 850 Algorithm Specific Fields for Elgamal encryption: 852 * MPI of Elgamal (Diffie-Hellman) value g**k mod p. 854 * MPI of Elgamal (Diffie-Hellman) value m * y**k mod p. 856 Algorithm-Specific Fields for ECDH encryption: 858 * MPI of an EC point representing an ephemeral public key. 860 * a one-octet size, followed by a symmetric key encoded using the 861 method described in Section 13.5. 863 The value "m" in the above formulas is derived from the session key 864 as follows. First, the session key is prefixed with a one-octet 865 algorithm identifier that specifies the symmetric encryption 866 algorithm used to encrypt the following Symmetrically Encrypted Data 867 Packet. Then a two-octet checksum is appended, which is equal to the 868 sum of the preceding session key octets, not including the algorithm 869 identifier, modulo 65536. This value is then encoded as described in 870 PKCS#1 block encoding EME-PKCS1-v1_5 in Section 7.2.1 of [RFC3447] to 871 form the "m" value used in the formulas above. See Section 14.1 of 872 this document for notes on OpenPGP's use of PKCS#1. 874 Note that when an implementation forms several PKESKs with one 875 session key, forming a message that can be decrypted by several keys, 876 the implementation MUST make a new PKCS#1 encoding for each key. 878 An implementation MAY accept or use a Key ID of zero as a "wild card" 879 or "speculative" Key ID. In this case, the receiving implementation 880 would try all available private keys, checking for a valid decrypted 881 session key. This format helps reduce traffic analysis of messages. 883 5.2. Signature Packet (Tag 2) 885 A Signature packet describes a binding between some public key and 886 some data. The most common signatures are a signature of a file or a 887 block of text, and a signature that is a certification of a User ID. 889 Three versions of Signature packets are defined. Version 3 provides 890 basic signature information, while versions 4 and 5 provide an 891 expandable format with subpackets that can specify more information 892 about the signature. PGP 2.6.x only accepts version 3 signatures. 894 Implementations MUST generate version 5 signatures when using a 895 version 5 key. Implementations SHOULD generate V4 signatures with 896 version 4 keys. Implementations MUST NOT create version 3 897 signatures; they MAY accept version 3 signatures. 899 5.2.1. Signature Types 901 There are a number of possible meanings for a signature, which are 902 indicated in a signature type octet in any given signature. Please 903 note that the vagueness of these meanings is not a flaw, but a 904 feature of the system. Because OpenPGP places final authority for 905 validity upon the receiver of a signature, it may be that one 906 signer's casual act might be more rigorous than some other 907 authority's positive act. See Section 5.2.4, "Computing Signatures", 908 for detailed information on how to compute and verify signatures of 909 each type. 911 These meanings are as follows: 913 0x00 Signature of a binary document. This means the signer owns it, 914 created it, or certifies that it has not been modified. 916 0x01 Signature of a canonical text document. This means the signer 917 owns it, created it, or certifies that it has not been modified. 918 The signature is calculated over the text data with its line 919 endings converted to . 921 0x02 Standalone signature. This signature is a signature of only 922 its own subpacket contents. It is calculated identically to a 923 signature over a zero-length binary document. Note that it 924 doesn't make sense to have a V3 standalone signature. 926 0x10 Generic certification of a User ID and Public-Key packet. The 927 issuer of this certification does not make any particular 928 assertion as to how well the certifier has checked that the owner 929 of the key is in fact the person described by the User ID. 931 0x11 Persona certification of a User ID and Public-Key packet. The 932 issuer of this certification has not done any verification of the 933 claim that the owner of this key is the User ID specified. 935 0x12 Casual certification of a User ID and Public-Key packet. The 936 issuer of this certification has done some casual verification of 937 the claim of identity. 939 0x13 Positive certification of a User ID and Public-Key packet. The 940 issuer of this certification has done substantial verification of 941 the claim of identity. 943 Most OpenPGP implementations make their "key signatures" as 0x10 944 certifications. Some implementations can issue 0x11-0x13 945 certifications, but few differentiate between the types. 947 0x16 Attestion Key Signature. This signature is issued by the 948 primary key over itself and its user ID (or user attribute). It 949 MUST contain an "Attested Certifications" subpacket and a 950 "Signature Creation Time" subpacket. This type of key signature 951 does not replace or override any standard certification 952 (0x10-0x13). 954 Only the most recent Attestation Key Signature is valid for any 955 given pair. If more than one Certification 956 Attestation Key Signature is present with the same Signature 957 Creation Time, the set of attestations should be treated as the 958 union of all "Attested Certifications" subpackets from all such 959 signatures with the same timestamp. 961 0x18 Subkey Binding Signature. This signature is a statement by the 962 top-level signing key that indicates that it owns the subkey. 963 This signature is calculated directly on the primary key and 964 subkey, and not on any User ID or other packets. A signature that 965 binds a signing subkey MUST have an Embedded Signature subpacket 966 in this binding signature that contains a 0x19 signature made by 967 the signing subkey on the primary key and subkey. 969 0x19 Primary Key Binding Signature. This signature is a statement 970 by a signing subkey, indicating that it is owned by the primary 971 key and subkey. This signature is calculated the same way as a 972 0x18 signature: directly on the primary key and subkey, and not on 973 any User ID or other packets. 975 0x1F Signature directly on a key. This signature is calculated 976 directly on a key. It binds the information in the Signature 977 subpackets to the key, and is appropriate to be used for 978 subpackets that provide information about the key, such as the 979 Revocation Key subpacket. It is also appropriate for statements 980 that non-self certifiers want to make about the key itself, rather 981 than the binding between a key and a name. 983 0x20 Key revocation signature. The signature is calculated directly 984 on the key being revoked. A revoked key is not to be used. Only 985 revocation signatures by the key being revoked, or by an 986 authorized revocation key, should be considered valid revocation 987 signatures. 989 0x28 Subkey revocation signature. The signature is calculated 990 directly on the subkey being revoked. A revoked subkey is not to 991 be used. Only revocation signatures by the top-level signature 992 key that is bound to this subkey, or by an authorized revocation 993 key, should be considered valid revocation signatures. 995 0x30 Certification revocation signature. This signature revokes an 996 earlier User ID certification signature (signature class 0x10 997 through 0x13) or direct-key signature (0x1F). It should be issued 998 by the same key that issued the revoked signature or an authorized 999 revocation key. The signature is computed over the same data as 1000 the certificate that it revokes, and should have a later creation 1001 date than that certificate. 1003 0x40 Timestamp signature. This signature is only meaningful for the 1004 timestamp contained in it. 1006 0x50 Third-Party Confirmation signature. This signature is a 1007 signature over some other OpenPGP Signature packet(s). It is 1008 analogous to a notary seal on the signed data. A third-party 1009 signature SHOULD include Signature Target subpacket(s) to give 1010 easy identification. Note that we really do mean SHOULD. There 1011 are plausible uses for this (such as a blind party that only sees 1012 the signature, not the key or source document) that cannot include 1013 a target subpacket. 1015 5.2.2. Version 3 Signature Packet Format 1017 The body of a version 3 Signature Packet contains: 1019 o One-octet version number (3). 1021 o One-octet length of following hashed material. MUST be 5. 1023 o One-octet signature type. 1025 o Four-octet creation time. 1027 o Eight-octet Key ID of signer. 1029 o One-octet public-key algorithm. 1031 o One-octet hash algorithm. 1033 o Two-octet field holding left 16 bits of signed hash value. 1035 o One or more multiprecision integers comprising the signature. 1036 This portion is algorithm specific, as described below. 1038 The concatenation of the data to be signed, the signature type, 1039 and creation time from the Signature packet (5 additional octets) 1040 is hashed. The resulting hash value is used in the signature 1041 algorithm. The high 16 bits (first two octets) of the hash are 1042 included in the Signature packet to provide a quick test to reject 1043 some invalid signatures. 1045 Algorithm-Specific Fields for RSA signatures: 1047 * Multiprecision integer (MPI) of RSA signature value m**d mod n. 1049 Algorithm-Specific Fields for DSA and ECDSA signatures: 1051 * MPI of DSA or ECDSA value r. 1053 * MPI of DSA or ECDSA value s. 1055 The signature calculation is based on a hash of the signed data, as 1056 described above. The details of the calculation are different for 1057 DSA signatures than for RSA signatures. 1059 With RSA signatures, the hash value is encoded using PKCS#1 encoding 1060 type EMSA-PKCS1-v1_5 as described in Section 9.2 of RFC 3447. This 1061 requires inserting the hash value as an octet string into an ASN.1 1062 structure. The object identifier for the type of hash being used is 1063 included in the structure. The hexadecimal representations for the 1064 currently defined hash algorithms are as follows: 1066 - MD5: 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05 1068 - RIPEMD-160: 0x2B, 0x24, 0x03, 0x02, 0x01 1070 - SHA-1: 0x2B, 0x0E, 0x03, 0x02, 0x1A 1072 - SHA2-224: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04 1074 - SHA2-256: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01 1076 - SHA2-384: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02 1078 - SHA2-512: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03 1080 The ASN.1 Object Identifiers (OIDs) are as follows: 1082 - MD5: 1.2.840.113549.2.5 1084 - RIPEMD-160: 1.3.36.3.2.1 1086 - SHA-1: 1.3.14.3.2.26 1088 - SHA2-224: 2.16.840.1.101.3.4.2.4 1090 - SHA2-256: 2.16.840.1.101.3.4.2.1 1092 - SHA2-384: 2.16.840.1.101.3.4.2.2 1094 - SHA2-512: 2.16.840.1.101.3.4.2.3 1096 The full hash prefixes for these are as follows: 1098 - MD5: 0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 1099 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00, 1100 0x04, 0x10 1102 - RIPEMD-160: 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x24, 1103 0x03, 0x02, 0x01, 0x05, 0x00, 0x04, 0x14 1105 - SHA-1: 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0E, 1106 0x03, 0x02, 0x1A, 0x05, 0x00, 0x04, 0x14 1108 - SHA2-224: 0x30, 0x2D, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1109 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, 0x05, 1110 0x00, 0x04, 0x1C 1112 - SHA2-256: 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1113 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 1114 0x00, 0x04, 0x20 1116 - SHA2-384: 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1117 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 1118 0x00, 0x04, 0x30 1120 - SHA2-512: 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1121 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 1122 0x00, 0x04, 0x40 1124 DSA signatures MUST use hashes that are equal in size to the number 1125 of bits of q, the group generated by the DSA key's generator value. 1127 If the output size of the chosen hash is larger than the number of 1128 bits of q, the hash result is truncated to fit by taking the number 1129 of leftmost bits equal to the number of bits of q. This (possibly 1130 truncated) hash function result is treated as a number and used 1131 directly in the DSA signature algorithm. 1133 5.2.3. Version 4 and 5 Signature Packet Formats 1135 The body of a V4 or V5 Signature packet contains: 1137 o One-octet version number. This is 4 for V4 signatures and 5 for 1138 V5 signatures. 1140 o One-octet signature type. 1142 o One-octet public-key algorithm. 1144 o One-octet hash algorithm. 1146 o Two-octet scalar octet count for following hashed subpacket data. 1147 Note that this is the length in octets of all of the hashed 1148 subpackets; a pointer incremented by this number will skip over 1149 the hashed subpackets. 1151 o Hashed subpacket data set (zero or more subpackets). 1153 o Two-octet scalar octet count for the following unhashed subpacket 1154 data. Note that this is the length in octets of all of the 1155 unhashed subpackets; a pointer incremented by this number will 1156 skip over the unhashed subpackets. 1158 o Unhashed subpacket data set (zero or more subpackets). 1160 o Two-octet field holding the left 16 bits of the signed hash value. 1162 o One or more multiprecision integers comprising the signature. 1163 This portion is algorithm specific: 1165 Algorithm-Specific Fields for RSA signatures: 1167 * Multiprecision integer (MPI) of RSA signature value m**d mod n. 1169 Algorithm-Specific Fields for DSA or ECDSA signatures: 1171 * MPI of DSA or ECDSA value r. 1173 * MPI of DSA or ECDSA value s. 1175 Algorithm-Specific Fields for EdDSA signatures: 1177 * MPI of EdDSA compressed value r. 1179 * MPI of EdDSA compressed value s. 1181 The compressed version of R and S for use with EdDSA is described in 1182 [RFC8032]. A version 3 signature MUST NOT be created and MUST NOT be 1183 used with EdDSA. 1185 The concatenation of the data being signed and the signature data 1186 from the version number through the hashed subpacket data (inclusive) 1187 is hashed. The resulting hash value is what is signed. The left 16 1188 bits of the hash are included in the Signature packet to provide a 1189 quick test to reject some invalid signatures. 1191 There are two fields consisting of Signature subpackets. The first 1192 field is hashed with the rest of the signature data, while the second 1193 is unhashed. The second set of subpackets is not cryptographically 1194 protected by the signature and should include only advisory 1195 information. 1197 The difference between a V4 and V5 signature is that the latter 1198 includes additional meta data. 1200 The algorithms for converting the hash function result to a signature 1201 are described in a section below. 1203 5.2.3.1. Signature Subpacket Specification 1205 A subpacket data set consists of zero or more Signature subpackets. 1206 In Signature packets, the subpacket data set is preceded by a two- 1207 octet scalar count of the length in octets of all the subpackets. A 1208 pointer incremented by this number will skip over the subpacket data 1209 set. 1211 Each subpacket consists of a subpacket header and a body. The header 1212 consists of: 1214 o the subpacket length (1, 2, or 5 octets), 1216 o the subpacket type (1 octet), 1218 and is followed by the subpacket-specific data. 1220 The length includes the type octet but not this length. Its format 1221 is similar to the "new" format packet header lengths, but cannot have 1222 Partial Body Lengths. That is: 1224 if the 1st octet < 192, then 1225 lengthOfLength = 1 1226 subpacketLen = 1st_octet 1228 if the 1st octet >= 192 and < 255, then 1229 lengthOfLength = 2 1230 subpacketLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192 1232 if the 1st octet = 255, then 1233 lengthOfLength = 5 1234 subpacket length = [four-octet scalar starting at 2nd_octet] 1236 The value of the subpacket type octet may be: 1238 +-------------+-----------------------------------------+ 1239 | Type | Description | 1240 +-------------+-----------------------------------------+ 1241 | 0 | Reserved | 1242 | 1 | Reserved | 1243 | 2 | Signature Creation Time | 1244 | 3 | Signature Expiration Time | 1245 | 4 | Exportable Certification | 1246 | 5 | Trust Signature | 1247 | 6 | Regular Expression | 1248 | 7 | Revocable | 1249 | 8 | Reserved | 1250 | 9 | Key Expiration Time | 1251 | 10 | Placeholder for backward compatibility | 1252 | 11 | Preferred Symmetric Algorithms | 1253 | 12 | Revocation Key | 1254 | 13 to 15 | Reserved | 1255 | 16 | Issuer | 1256 | 17 to 19 | Reserved | 1257 | 20 | Notation Data | 1258 | 21 | Preferred Hash Algorithms | 1259 | 22 | Preferred Compression Algorithms | 1260 | 23 | Key Server Preferences | 1261 | 24 | Preferred Key Server | 1262 | 25 | Primary User ID | 1263 | 26 | Policy URI | 1264 | 27 | Key Flags | 1265 | 28 | Signer's User ID | 1266 | 29 | Reason for Revocation | 1267 | 30 | Features | 1268 | 31 | Signature Target | 1269 | 32 | Embedded Signature | 1270 | 33 | Issuer Fingerprint | 1271 | 34 | Preferred AEAD Algorithms | 1272 | 35 | Intended Recipient Fingerprint | 1273 | 37 | Attested Certifications | 1274 | 100 to 110 | Private or experimental | 1275 +-------------+-----------------------------------------+ 1277 An implementation SHOULD ignore any subpacket of a type that it does 1278 not recognize. 1280 Bit 7 of the subpacket type is the "critical" bit. If set, it 1281 denotes that the subpacket is one that is critical for the evaluator 1282 of the signature to recognize. If a subpacket is encountered that is 1283 marked critical but is unknown to the evaluating software, the 1284 evaluator SHOULD consider the signature to be in error. 1286 An evaluator may "recognize" a subpacket, but not implement it. The 1287 purpose of the critical bit is to allow the signer to tell an 1288 evaluator that it would prefer a new, unknown feature to generate an 1289 error than be ignored. 1291 Implementations SHOULD implement the four preferred algorithm 1292 subpackets (11, 21, 22, and 34), as well as the "Reason for 1293 Revocation" subpacket. Note, however, that if an implementation 1294 chooses not to implement some of the preferences, it is required to 1295 behave in a polite manner to respect the wishes of those users who do 1296 implement these preferences. 1298 5.2.3.2. Signature Subpacket Types 1300 A number of subpackets are currently defined. Some subpackets apply 1301 to the signature itself and some are attributes of the key. 1302 Subpackets that are found on a self-signature are placed on a 1303 certification made by the key itself. Note that a key may have more 1304 than one User ID, and thus may have more than one self-signature, and 1305 differing subpackets. 1307 A subpacket may be found either in the hashed or unhashed subpacket 1308 sections of a signature. If a subpacket is not hashed, then the 1309 information in it cannot be considered definitive because it is not 1310 part of the signature proper. 1312 5.2.3.3. Notes on Self-Signatures 1314 A self-signature is a binding signature made by the key to which the 1315 signature refers. There are three types of self-signatures, the 1316 certification signatures (types 0x10-0x13), the direct-key signature 1317 (type 0x1F), and the subkey binding signature (type 0x18). For 1318 certification self-signatures, each User ID may have a self- 1319 signature, and thus different subpackets in those self-signatures. 1320 For subkey binding signatures, each subkey in fact has a self- 1321 signature. Subpackets that appear in a certification self-signature 1322 apply to the user name, and subpackets that appear in the subkey 1323 self-signature apply to the subkey. Lastly, subpackets on the 1324 direct-key signature apply to the entire key. 1326 Implementing software should interpret a self-signature's preference 1327 subpackets as narrowly as possible. For example, suppose a key has 1328 two user names, Alice and Bob. Suppose that Alice prefers the 1329 symmetric algorithm AES-256, and Bob prefers Camellia-256 or AES-128. 1330 If the software locates this key via Alice's name, then the preferred 1331 algorithm is AES-256; if software locates the key via Bob's name, 1332 then the preferred algorithm is Camellia-256. If the key is located 1333 by Key ID, the algorithm of the primary User ID of the key provides 1334 the preferred symmetric algorithm. 1336 Revoking a self-signature or allowing it to expire has a semantic 1337 meaning that varies with the signature type. Revoking the self- 1338 signature on a User ID effectively retires that user name. The self- 1339 signature is a statement, "My name X is tied to my signing key K" and 1340 is corroborated by other users' certifications. If another user 1341 revokes their certification, they are effectively saying that they no 1342 longer believe that name and that key are tied together. Similarly, 1343 if the users themselves revoke their self-signature, then the users 1344 no longer go by that name, no longer have that email address, etc. 1345 Revoking a binding signature effectively retires that subkey. 1346 Revoking a direct-key signature cancels that signature. Please see 1347 the "Reason for Revocation" subpacket (Section 5.2.3.24) for more 1348 relevant detail. 1350 Since a self-signature contains important information about the key's 1351 use, an implementation SHOULD allow the user to rewrite the self- 1352 signature, and important information in it, such as preferences and 1353 key expiration. 1355 It is good practice to verify that a self-signature imported into an 1356 implementation doesn't advertise features that the implementation 1357 doesn't support, rewriting the signature as appropriate. 1359 An implementation that encounters multiple self-signatures on the 1360 same object may resolve the ambiguity in any way it sees fit, but it 1361 is RECOMMENDED that priority be given to the most recent self- 1362 signature. 1364 5.2.3.4. Signature Creation Time 1366 (4-octet time field) 1368 The time the signature was made. 1370 MUST be present in the hashed area. 1372 5.2.3.5. Issuer 1374 (8-octet Key ID) 1376 The OpenPGP Key ID of the key issuing the signature. If the version 1377 of that key is greater than 4, this subpacket MUST NOT be included in 1378 the signature. 1380 5.2.3.6. Key Expiration Time 1382 (4-octet time field) 1384 The validity period of the key. This is the number of seconds after 1385 the key creation time that the key expires. If this is not present 1386 or has a value of zero, the key never expires. This is found only on 1387 a self-signature. 1389 5.2.3.7. Preferred Symmetric Algorithms 1391 (array of one-octet values) 1393 Symmetric algorithm numbers that indicate which algorithms the key 1394 holder prefers to use. The subpacket body is an ordered list of 1395 octets with the most preferred listed first. It is assumed that only 1396 algorithms listed are supported by the recipient's software. 1397 Algorithm numbers are in Section 9. This is only found on a self- 1398 signature. 1400 5.2.3.8. Preferred AEAD Algorithms 1402 (array of one-octet values) 1404 AEAD algorithm numbers that indicate which AEAD algorithms the key 1405 holder prefers to use. The subpacket body is an ordered list of 1406 octets with the most preferred listed first. It is assumed that only 1407 algorithms listed are supported by the recipient's software. 1408 Algorithm numbers are in Section 9.6. This is only found on a self- 1409 signature. Note that support for the AEAD Encrypted Data packet in 1410 the general is indicated by a Feature Flag. 1412 5.2.3.9. Preferred Hash Algorithms 1414 (array of one-octet values) 1416 Message digest algorithm numbers that indicate which algorithms the 1417 key holder prefers to receive. Like the preferred symmetric 1418 algorithms, the list is ordered. Algorithm numbers are in 1419 Section 9.5. This is only found on a self-signature. 1421 5.2.3.10. Preferred Compression Algorithms 1423 (array of one-octet values) 1425 Compression algorithm numbers that indicate which algorithms the key 1426 holder prefers to use. Like the preferred symmetric algorithms, the 1427 list is ordered. Algorithm numbers are in Section 9.4. If this 1428 subpacket is not included, ZIP is preferred. A zero denotes that 1429 uncompressed data is preferred; the key holder's software might have 1430 no compression software in that implementation. This is only found 1431 on a self-signature. 1433 5.2.3.11. Signature Expiration Time 1435 (4-octet time field) 1437 The validity period of the signature. This is the number of seconds 1438 after the signature creation time that the signature expires. If 1439 this is not present or has a value of zero, it never expires. 1441 5.2.3.12. Exportable Certification 1443 (1 octet of exportability, 0 for not, 1 for exportable) 1445 This subpacket denotes whether a certification signature is 1446 "exportable", to be used by other users than the signature's issuer. 1447 The packet body contains a Boolean flag indicating whether the 1448 signature is exportable. If this packet is not present, the 1449 certification is exportable; it is equivalent to a flag containing a 1450 1. 1452 Non-exportable, or "local", certifications are signatures made by a 1453 user to mark a key as valid within that user's implementation only. 1455 Thus, when an implementation prepares a user's copy of a key for 1456 transport to another user (this is the process of "exporting" the 1457 key), any local certification signatures are deleted from the key. 1459 The receiver of a transported key "imports" it, and likewise trims 1460 any local certifications. In normal operation, there won't be any, 1461 assuming the import is performed on an exported key. However, there 1462 are instances where this can reasonably happen. For example, if an 1463 implementation allows keys to be imported from a key database in 1464 addition to an exported key, then this situation can arise. 1466 Some implementations do not represent the interest of a single user 1467 (for example, a key server). Such implementations always trim local 1468 certifications from any key they handle. 1470 5.2.3.13. Revocable 1472 (1 octet of revocability, 0 for not, 1 for revocable) 1474 Signature's revocability status. The packet body contains a Boolean 1475 flag indicating whether the signature is revocable. Signatures that 1476 are not revocable have any later revocation signatures ignored. They 1477 represent a commitment by the signer that he cannot revoke his 1478 signature for the life of his key. If this packet is not present, 1479 the signature is revocable. 1481 5.2.3.14. Trust Signature 1483 (1 octet "level" (depth), 1 octet of trust amount) 1485 Signer asserts that the key is not only valid but also trustworthy at 1486 the specified level. Level 0 has the same meaning as an ordinary 1487 validity signature. Level 1 means that the signed key is asserted to 1488 be a valid trusted introducer, with the 2nd octet of the body 1489 specifying the degree of trust. Level 2 means that the signed key is 1490 asserted to be trusted to issue level 1 trust signatures, i.e., that 1491 it is a "meta introducer". Generally, a level n trust signature 1492 asserts that a key is trusted to issue level n-1 trust signatures. 1493 The trust amount is in a range from 0-255, interpreted such that 1494 values less than 120 indicate partial trust and values of 120 or 1495 greater indicate complete trust. Implementations SHOULD emit values 1496 of 60 for partial trust and 120 for complete trust. 1498 5.2.3.15. Regular Expression 1500 (null-terminated regular expression) 1502 Used in conjunction with trust Signature packets (of level > 0) to 1503 limit the scope of trust that is extended. Only signatures by the 1504 target key on User IDs that match the regular expression in the body 1505 of this packet have trust extended by the trust Signature subpacket. 1506 The regular expression uses the same syntax as the Henry Spencer's 1507 "almost public domain" regular expression [REGEX] package. A 1508 description of the syntax is found in Section 8 below. 1510 5.2.3.16. Revocation Key 1512 (1 octet of class, 1 octet of public-key algorithm ID, 20 or 32 1513 octets of fingerprint) 1515 V4 keys use the full 20 octet fingerprint; V5 keys use the full 32 1516 octet fingerprint 1518 Authorizes the specified key to issue revocation signatures for this 1519 key. Class octet must have bit 0x80 set. If the bit 0x40 is set, 1520 then this means that the revocation information is sensitive. Other 1521 bits are for future expansion to other kinds of authorizations. This 1522 is only found on a direct-key self-signature (type 0x1f). The use on 1523 other types of self-signatures is unspecified. 1525 If the "sensitive" flag is set, the keyholder feels this subpacket 1526 contains private trust information that describes a real-world 1527 sensitive relationship. If this flag is set, implementations SHOULD 1528 NOT export this signature to other users except in cases where the 1529 data needs to be available: when the signature is being sent to the 1530 designated revoker, or when it is accompanied by a revocation 1531 signature from that revoker. Note that it may be appropriate to 1532 isolate this subpacket within a separate signature so that it is not 1533 combined with other subpackets that need to be exported. 1535 5.2.3.17. Notation Data 1537 (4 octets of flags, 2 octets of name length (M), 1538 2 octets of value length (N), 1539 M octets of name data, 1540 N octets of value data) 1542 This subpacket describes a "notation" on the signature that the 1543 issuer wishes to make. The notation has a name and a value, each of 1544 which are strings of octets. There may be more than one notation in 1545 a signature. Notations can be used for any extension the issuer of 1546 the signature cares to make. The "flags" field holds four octets of 1547 flags. 1549 All undefined flags MUST be zero. Defined flags are as follows: 1551 First octet: 0x80 = human-readable. This note value is text. 1552 Other octets: none. 1554 Notation names are arbitrary strings encoded in UTF-8. They reside 1555 in two namespaces: The IETF namespace and the user namespace. 1557 The IETF namespace is registered with IANA. These names MUST NOT 1558 contain the "@" character (0x40). This is a tag for the user 1559 namespace. 1561 Names in the user namespace consist of a UTF-8 string tag followed by 1562 "@" followed by a DNS domain name. Note that the tag MUST NOT 1563 contain an "@" character. For example, the "sample" tag used by 1564 Example Corporation could be "sample@example.com". 1566 Names in a user space are owned and controlled by the owners of that 1567 domain. Obviously, it's bad form to create a new name in a DNS space 1568 that you don't own. 1570 Since the user namespace is in the form of an email address, 1571 implementers MAY wish to arrange for that address to reach a person 1572 who can be consulted about the use of the named tag. Note that due 1573 to UTF-8 encoding, not all valid user space name tags are valid email 1574 addresses. 1576 If there is a critical notation, the criticality applies to that 1577 specific notation and not to notations in general. 1579 The following subsections define a set of standard notations. 1581 5.2.3.17.1. The 'charset' Notation 1583 The "charset" notation is a description of the character set used to 1584 encode the signed plaintext. The default value is "UTF-8". If used, 1585 the value MUST be encoded as human readable and MUST be present in 1586 the hashed subpacket section of the signature. This notation is 1587 useful for cleartext signatures in cases where it is not possible to 1588 encode the text in UTF-8. By having the used character set a part of 1589 the signed data, attacks exploiting different representation of code 1590 points will be mitigated. 1592 5.2.3.17.2. The 'manu' Notation 1594 The "manu" notation is a string that declares the device 1595 manufacturer's name. The certifier key is asserting this string 1596 (which may or may not be related to the User ID of the certifier's 1597 key). 1599 5.2.3.17.3. The 'make' Notation 1601 This notation defines the product make. It is a free form string. 1603 5.2.3.17.4. The 'model' Notation 1605 This notation defines the product model name/number. It is a free 1606 form string. 1608 5.2.3.17.5. The 'prodid' Notation 1610 This notation contains the product identifier. It is a free form 1611 string. 1613 5.2.3.17.6. The 'pvers' Notation 1615 This notation defines the product version number (which could be a 1616 release number, year, or some other identifier to differentiate 1617 different versions of the same make/model). It is a free form 1618 string. 1620 5.2.3.17.7. The 'lot' Notation 1622 This notation defines the product lot number (which is an indicator 1623 of the batch of product). It is a free form string. 1625 5.2.3.17.8. The 'qty' Notation 1627 This notation defines the quantity of items in this package. It is a 1628 decimal integer representation with no punctuation, e.g. "10", 1629 "1000", "10000", etc. 1631 5.2.3.17.9. The 'loc' and 'dest' Notations 1633 The "loc" and 'dest' notations declare a GeoLocation as defined by 1634 RFC 5870 [RFC5870] but without the leading "geo:" header. For 1635 example, if you had a GeoLocation URI of "geo:13.4125,103.8667" you 1636 would encode that in these notations as "13.4125,103.8667". 1638 The 'loc' notation is meant to encode the geo location where the 1639 signature was made. The 'dest' notation is meant to encode the geo 1640 location where the device is "destined" (i.e., a "destination" for 1641 the device). 1643 5.2.3.17.10. The 'hash' Notation 1645 A 'hash' notation is a means to include external data in the contents 1646 of a signature without including the data itself. This is done by 1647 hashing the external data separately and then including the data's 1648 name and hash in the signature via this notation. This is useful, 1649 for example, to have an external "manifest," "image," or other data 1650 that might not be vital to the signature itself but still needs to be 1651 protected and authenticated without requiring a second signature. 1653 The 'hash' notation has the following structure: * A single byte 1654 specifying the length of the name of the hashed data * A UTF-8 string 1655 of the name of the hashed data * A single byte specifying the hash 1656 algorithm (see section 9.4) * The binary hash output of the hashed 1657 data using the specified algorithm. (The length of this data is 1658 implicit based on the algorithm specified). 1660 Due to its nature a 'hash' notation is not human readable and MUST 1661 NOT be marked as such when used. 1663 5.2.3.18. Key Server Preferences 1665 (N octets of flags) 1666 This is a list of one-bit flags that indicate preferences that the 1667 key holder has about how the key is handled on a key server. All 1668 undefined flags MUST be zero. 1670 First octet: 0x80 = No-modify 1672 The key holder requests that this key only be modified or updated 1673 by the key holder or an administrator of the key server. 1675 If No-modify is set on the most recent self-sig over a user ID, 1676 then a keyserver should only redistribute those third-party 1677 certifications over that user ID that have been attested to in the 1678 most recent Attestation Key Signature packet (see "Attested 1679 Certifications" below). 1681 This is found only on a self-signature. 1683 5.2.3.19. Preferred Key Server 1685 (String) 1687 This is a URI of a key server that the key holder prefers be used for 1688 updates. Note that keys with multiple User IDs can have a preferred 1689 key server for each User ID. Note also that since this is a URI, the 1690 key server can actually be a copy of the key retrieved by ftp, http, 1691 finger, etc. 1693 5.2.3.20. Primary User ID 1695 (1 octet, Boolean) 1697 This is a flag in a User ID's self-signature that states whether this 1698 User ID is the main User ID for this key. It is reasonable for an 1699 implementation to resolve ambiguities in preferences, etc. by 1700 referring to the primary User ID. If this flag is absent, its value 1701 is zero. If more than one User ID in a key is marked as primary, the 1702 implementation may resolve the ambiguity in any way it sees fit, but 1703 it is RECOMMENDED that priority be given to the User ID with the most 1704 recent self-signature. 1706 When appearing on a self-signature on a User ID packet, this 1707 subpacket applies only to User ID packets. When appearing on a self- 1708 signature on a User Attribute packet, this subpacket applies only to 1709 User Attribute packets. That is to say, there are two different and 1710 independent "primaries" -- one for User IDs, and one for User 1711 Attributes. 1713 5.2.3.21. Policy URI 1715 (String) 1717 This subpacket contains a URI of a document that describes the policy 1718 under which the signature was issued. 1720 5.2.3.22. Key Flags 1722 (N octets of flags) 1724 This subpacket contains a list of binary flags that hold information 1725 about a key. It is a string of octets, and an implementation MUST 1726 NOT assume a fixed size. This is so it can grow over time. If a 1727 list is shorter than an implementation expects, the unstated flags 1728 are considered to be zero. The defined flags are as follows: 1730 First octet: 1732 0x01 - This key may be used to certify other keys. 1734 0x02 - This key may be used to sign data. 1736 0x04 - This key may be used to encrypt communications. 1738 0x08 - This key may be used to encrypt storage. 1740 0x10 - The private component of this key may have been split by a 1741 secret-sharing mechanism. 1743 0x20 - This key may be used for authentication. 1745 0x80 - The private component of this key may be in the possession 1746 of more than one person. 1748 Second octet: 1750 0x04 - This key may be used as an additional decryption subkey (ADSK). 1752 0x08 - This key may be used for timestamping. 1754 Usage notes: 1756 The flags in this packet may appear in self-signatures or in 1757 certification signatures. They mean different things depending on 1758 who is making the statement --- for example, a certification 1759 signature that has the "sign data" flag is stating that the 1760 certification is for that use. On the other hand, the 1761 "communications encryption" flag in a self-signature is stating a 1762 preference that a given key be used for communications. Note 1763 however, that it is a thorny issue to determine what is 1764 "communications" and what is "storage". This decision is left wholly 1765 up to the implementation; the authors of this document do not claim 1766 any special wisdom on the issue and realize that accepted opinion may 1767 change. 1769 The "split key" (0x10) and "group key" (0x80) flags are placed on a 1770 self-signature only; they are meaningless on a certification 1771 signature. They SHOULD be placed only on a direct-key signature 1772 (type 0x1F) or a subkey signature (type 0x18), one that refers to the 1773 key the flag applies to. 1775 The ADSK flag helps to figure out an encryption subkey. 1777 5.2.3.23. Signer's User ID 1779 (String) 1781 This subpacket allows a keyholder to state which User ID is 1782 responsible for the signing. Many keyholders use a single key for 1783 different purposes, such as business communications as well as 1784 personal communications. This subpacket allows such a keyholder to 1785 state which of their roles is making a signature. 1787 This subpacket is not appropriate to use to refer to a User Attribute 1788 packet. 1790 5.2.3.24. Reason for Revocation 1792 (1 octet of revocation code, N octets of reason string) 1794 This subpacket is used only in key revocation and certification 1795 revocation signatures. It describes the reason why the key or 1796 certificate was revoked. 1798 The first octet contains a machine-readable code that denotes the 1799 reason for the revocation: 1801 +----------+--------------------------------------------------------+ 1802 | Code | Reason | 1803 +----------+--------------------------------------------------------+ 1804 | 0 | No reason specified (key revocations or cert | 1805 | | revocations) | 1806 | 1 | Key is superseded (key revocations) | 1807 | 2 | Key material has been compromised (key revocations) | 1808 | 3 | Key is retired and no longer used (key revocations) | 1809 | 32 | User ID information is no longer valid (cert | 1810 | | revocations) | 1811 | 100-110 | Private Use | 1812 +----------+--------------------------------------------------------+ 1814 Following the revocation code is a string of octets that gives 1815 information about the Reason for Revocation in human-readable form 1816 (UTF-8). The string may be null, that is, of zero length. The 1817 length of the subpacket is the length of the reason string plus one. 1818 An implementation SHOULD implement this subpacket, include it in all 1819 revocation signatures, and interpret revocations appropriately. 1820 There are important semantic differences between the reasons, and 1821 there are thus important reasons for revoking signatures. 1823 If a key has been revoked because of a compromise, all signatures 1824 created by that key are suspect. However, if it was merely 1825 superseded or retired, old signatures are still valid. If the 1826 revoked signature is the self-signature for certifying a User ID, a 1827 revocation denotes that that user name is no longer in use. Such a 1828 revocation SHOULD include a 0x20 code. 1830 Note that any signature may be revoked, including a certification on 1831 some other person's key. There are many good reasons for revoking a 1832 certification signature, such as the case where the keyholder leaves 1833 the employ of a business with an email address. A revoked 1834 certification is no longer a part of validity calculations. 1836 5.2.3.25. Features 1838 (N octets of flags) 1840 The Features subpacket denotes which advanced OpenPGP features a 1841 user's implementation supports. This is so that as features are 1842 added to OpenPGP that cannot be backwards-compatible, a user can 1843 state that they can use that feature. The flags are single bits that 1844 indicate that a given feature is supported. 1846 This subpacket is similar to a preferences subpacket, and only 1847 appears in a self-signature. 1849 An implementation SHOULD NOT use a feature listed when sending to a 1850 user who does not state that they can use it. 1852 Defined features are as follows: 1854 First octet: 1856 0x01 - Modification Detection (packets 18 and 19) 1858 0x02 - AEAD Encrypted Data Packet (packet 20) and version 5 1859 Symmetric-Key Encrypted Session Key Packets (packet 3) 1861 0x04 - Version 5 Public-Key Packet format and corresponding new 1862 fingerprint format 1864 If an implementation implements any of the defined features, it 1865 SHOULD implement the Features subpacket, too. 1867 An implementation may freely infer features from other suitable 1868 implementation-dependent mechanisms. 1870 5.2.3.26. Signature Target 1872 (1 octet public-key algorithm, 1 octet hash algorithm, N octets hash) 1874 This subpacket identifies a specific target signature to which a 1875 signature refers. For revocation signatures, this subpacket provides 1876 explicit designation of which signature is being revoked. For a 1877 third-party or timestamp signature, this designates what signature is 1878 signed. All arguments are an identifier of that target signature. 1880 The N octets of hash data MUST be the size of the hash of the 1881 signature. For example, a target signature with a SHA-1 hash MUST 1882 have 20 octets of hash data. 1884 5.2.3.27. Embedded Signature 1886 (1 signature packet body) 1888 This subpacket contains a complete Signature packet body as specified 1889 in Section 5.2 above. It is useful when one signature needs to refer 1890 to, or be incorporated in, another signature. 1892 5.2.3.28. Issuer Fingerprint 1894 (1 octet key version number, N octets of fingerprint) 1895 The OpenPGP Key fingerprint of the key issuing the signature. This 1896 subpacket SHOULD be included in all signatures. If the version of 1897 the issuing key is 4 and an Issuer subpacket is also included in the 1898 signature, the key ID of the Issuer subpacket MUST match the low 64 1899 bits of the fingerprint. 1901 Note that the length N of the fingerprint for a version 4 key is 20 1902 octets; for a version 5 key N is 32. 1904 5.2.3.29. Intended Recipient Fingerprint 1906 (1 octet key version number, N octets of fingerprint) 1908 The OpenPGP Key fingerprint of the intended recipient primary key. 1909 If one or more subpackets of this type are included in a signature, 1910 it SHOULD be considered valid only in an encrypted context, where the 1911 key it was encrypted to is one of the indicated primary keys, or one 1912 of their subkeys. This can be used to prevent forwarding a signature 1913 outside of its intended, encrypted context. 1915 Note that the length N of the fingerprint for a version 4 key is 20 1916 octets; for a version 5 key N is 32. 1918 5.2.3.30. Attested Certifications 1920 (N octets of certification digests) 1922 This subpacket MUST only appear as a hashed subpacket of an 1923 Attestation Key Signature. It has no meaning in any other signature 1924 type. It is used by the primary key to attest to a set of third- 1925 party certifications over the associated User ID or User Attribute. 1926 This enables the holder of an OpenPGP primary key to mark specific 1927 third-party certifications as re-distributable with the rest of the 1928 Transferable Public Key (see the "No-modify" flag in "Key Server 1929 Preferences", above). Implementations MUST include exactly one 1930 Attested Certification subpacket in any generated Attestation Key 1931 Signature. 1933 The contents of the subpacket consists of a series of digests using 1934 the same hash algorithm used by the signature itself. Each digest is 1935 made over one third-party signature (any Certification, i.e., 1936 signature type 0x10-0x13) that covers the same Primary Key and User 1937 ID (or User Attribute). For example, an Attestation Key Signature 1938 made by key X over user ID U using hash algorithm SHA256 might 1939 contain an Attested Certifications subpacket of 192 octets (6*32 1940 octets) covering six third-party certification Signatures over . 1941 They SHOULD be ordered by binary hash value from low to high (e.g., a 1942 hash with hexadecimal value 037a... precedes a hash with value 1943 0392..., etc). The length of this subpacket MUST be an integer 1944 multiple of the length of the hash algorithm used for the enclosing 1945 Attestation Key Signature. 1947 The listed digests MUST be calculated over the third-party 1948 certification's Signature packet as described in the "Computing 1949 Signatures" section, but without a trailer: the hash data starts with 1950 the octet 0x88, followed by the four-octet length of the Signature, 1951 and then the body of the Signature packet. (Note that this is an 1952 old-style packet header for a Signature packet with the length-of- 1953 length field set to zero.) The unhashed subpacket data of the 1954 Signature packet being hashed is not included in the hash, and the 1955 unhashed subpacket data length value is set to zero. 1957 If an implementation encounters more than one such subpacket in an 1958 Attestation Key Signature, it MUST treat it as a single Attested 1959 Certifications subpacket containing the union of all hashes. 1961 The Attested Certifications subpacket in the most recent Attestation 1962 Key Signature over a given user ID supersedes all Attested 1963 Certifications subpackets from any previous Attestation Key 1964 Signature. However, note that if more than one Attestation Key 1965 Signatures has the same (most recent) Signature Creation Time 1966 subpacket, implementations MUST consider the union of the 1967 attestations of all Attestation Key Signatures (this allows the 1968 keyholder to attest to more third-party certifications than could fit 1969 in a single Attestation Key Signature). 1971 If a keyholder Alice has already attested to third-party 1972 certifications from Bob and Carol and she wants to add an attestation 1973 to a certification from David, she should issue a new Attestation Key 1974 Signature (with a more recent Signature Creation timestamp) that 1975 contains an Attested Certifications subpacket covering all three 1976 third-party certifications. 1978 If she later decides that she does not want Carol's certification to 1979 be redistributed with her certificate, she can issue a new 1980 Attestation Key Signature (again, with a more recent Signature 1981 Creation timestamp) that contains an Attested Certifications 1982 subpacket covering only the certifications from Bob and David. 1984 Note that Certification Revocation Signatures are not relevant for 1985 Attestation Key Signatures. To rescind all attestations, the primary 1986 key holder needs only to publish a more recent Attestation Key 1987 Signature with an empty Attested Certifications subpacket. 1989 5.2.4. Computing Signatures 1991 All signatures are formed by producing a hash over the signature 1992 data, and then using the resulting hash in the signature algorithm. 1994 For binary document signatures (type 0x00), the document data is 1995 hashed directly. For text document signatures (type 0x01), the 1996 document is canonicalized by converting line endings to , and 1997 the resulting data is hashed. 1999 When a V4 signature is made over a key, the hash data starts with the 2000 octet 0x99, followed by a two-octet length of the key, and then body 2001 of the key packet; when a V5 signature is made over a key, the hash 2002 data starts with the octet 0x9a, followed by a four-octet length of 2003 the key, and then body of the key packet. A subkey binding signature 2004 (type 0x18) or primary key binding signature (type 0x19) then hashes 2005 the subkey using the same format as the main key (also using 0x99 or 2006 0x9a as the first octet). Primary key revocation signatures (type 2007 0x20) hash only the key being revoked. Subkey revocation signature 2008 (type 0x28) hash first the primary key and then the subkey being 2009 revoked. 2011 A certification signature (type 0x10 through 0x13) hashes the User ID 2012 being bound to the key into the hash context after the above data. A 2013 V3 certification hashes the contents of the User ID or attribute 2014 packet packet, without any header. A V4 or V5 certification hashes 2015 the constant 0xB4 for User ID certifications or the constant 0xD1 for 2016 User Attribute certifications, followed by a four-octet number giving 2017 the length of the User ID or User Attribute data, and then the User 2018 ID or User Attribute data. 2020 An Attestation Key Signature (0x16) hashes the same data boy that a 2021 standard certification signature does: primary key, followed by User 2022 ID or User Attribute. 2024 When a signature is made over a Signature packet (type 0x50, "Third- 2025 Party Confirmation signature"), the hash data starts with the octet 2026 0x88, followed by the four-octet length of the signature, and then 2027 the body of the Signature packet. (Note that this is an old-style 2028 packet header for a Signature packet with the length-of-length field 2029 set to zero.) The unhashed subpacket data of the Signature packet 2030 being hashed is not included in the hash, and the unhashed subpacket 2031 data length value is set to zero. 2033 Once the data body is hashed, then a trailer is hashed. This trailer 2034 depends on the version of the signature. 2036 o A V3 signature hashes five octets of the packet body, starting 2037 from the signature type field. This data is the signature type, 2038 followed by the four-octet signature time. 2040 o A V4 signature hashes the packet body starting from its first 2041 field, the version number, through the end of the hashed subpacket 2042 data and a final extra trailer. Thus, the hashed fields are: 2044 * the signature version (0x04), 2046 * the signature type, 2048 * the public-key algorithm, 2050 * the hash algorithm, 2052 * the hashed subpacket length, 2054 * the hashed subpacket body, 2056 * the two octets 0x04 and 0xFF, 2058 * a four-octet big-endian number that is the length of the hashed 2059 data from the Signature packet stopping right before the 0x04, 2060 0xff octets. 2062 The four-octet big-endian number is considered to be an unsigned 2063 integer modulo 2^32. 2065 o A V5 signature hashes the packet body starting from its first 2066 field, the version number, through the end of the hashed subpacket 2067 data and a final extra trailer. Thus, the hashed fields are: 2069 * the signature version (0x05), 2071 * the signature type, 2073 * the public-key algorithm, 2075 * the hash algorithm, 2077 * the hashed subpacket length, 2079 * the hashed subpacket body, 2081 * Only for document signatures (type 0x00 or 0x01) the following 2082 three data items are hashed here: 2084 + the one-octet content format, 2086 + the file name as a string (one octet length, followed by the 2087 file name), 2089 + a four-octet number that indicates a date, 2091 * the two octets 0x05 and 0xFF, 2093 * a eight-octet big-endian number that is the length of the 2094 hashed data from the Signature packet stopping right before the 2095 0x05, 0xff octets. 2097 The three data items hashed for document signatures need to mirror 2098 the values of the Literal Data packet. For detached and cleartext 2099 signatures 6 zero bytes are hashed instead. 2101 After all this has been hashed in a single hash context, the 2102 resulting hash field is used in the signature algorithm and placed at 2103 the end of the Signature packet. 2105 5.2.4.1. Subpacket Hints 2107 It is certainly possible for a signature to contain conflicting 2108 information in subpackets. For example, a signature may contain 2109 multiple copies of a preference or multiple expiration times. In 2110 most cases, an implementation SHOULD use the last subpacket in the 2111 signature, but MAY use any conflict resolution scheme that makes more 2112 sense. Please note that we are intentionally leaving conflict 2113 resolution to the implementer; most conflicts are simply syntax 2114 errors, and the wishy-washy language here allows a receiver to be 2115 generous in what they accept, while putting pressure on a creator to 2116 be stingy in what they generate. 2118 Some apparent conflicts may actually make sense -- for example, 2119 suppose a keyholder has a V3 key and a V4 key that share the same RSA 2120 key material. Either of these keys can verify a signature created by 2121 the other, and it may be reasonable for a signature to contain an 2122 issuer subpacket for each key, as a way of explicitly tying those 2123 keys to the signature. 2125 5.3. Symmetric-Key Encrypted Session Key Packets (Tag 3) 2127 The Symmetric-Key Encrypted Session Key packet holds the symmetric- 2128 key encryption of a session key used to encrypt a message. Zero or 2129 more Public-Key Encrypted Session Key packets and/or Symmetric-Key 2130 Encrypted Session Key packets may precede a Symmetrically Encrypted 2131 Data packet that holds an encrypted message. The message is 2132 encrypted with a session key, and the session key is itself encrypted 2133 and stored in the Encrypted Session Key packet or the Symmetric-Key 2134 Encrypted Session Key packet. 2136 If the Symmetrically Encrypted Data packet is preceded by one or more 2137 Symmetric-Key Encrypted Session Key packets, each specifies a 2138 passphrase that may be used to decrypt the message. This allows a 2139 message to be encrypted to a number of public keys, and also to one 2140 or more passphrases. This packet type is new and is not generated by 2141 PGP 2 or PGP version 5.0. 2143 A version 4 Symmetric-Key Encrypted Session Key packet consists of: 2145 o A one-octet version number with value 4. 2147 o A one-octet number describing the symmetric algorithm used. 2149 o A string-to-key (S2K) specifier, length as defined above. 2151 o Optionally, the encrypted session key itself, which is decrypted 2152 with the string-to-key object. 2154 If the encrypted session key is not present (which can be detected on 2155 the basis of packet length and S2K specifier size), then the S2K 2156 algorithm applied to the passphrase produces the session key for 2157 decrypting the message, using the symmetric cipher algorithm from the 2158 Symmetric-Key Encrypted Session Key packet. 2160 If the encrypted session key is present, the result of applying the 2161 S2K algorithm to the passphrase is used to decrypt just that 2162 encrypted session key field, using CFB mode with an IV of all zeros. 2163 The decryption result consists of a one-octet algorithm identifier 2164 that specifies the symmetric-key encryption algorithm used to encrypt 2165 the following Symmetrically Encrypted Data packet, followed by the 2166 session key octets themselves. 2168 Note: because an all-zero IV is used for this decryption, the S2K 2169 specifier MUST use a salt value, either a Salted S2K or an Iterated- 2170 Salted S2K. The salt value will ensure that the decryption key is 2171 not repeated even if the passphrase is reused. 2173 A version 5 Symmetric-Key Encrypted Session Key packet consists of: 2175 o A one-octet version number with value 5. 2177 o A one-octet cipher algorithm. 2179 o A one-octet AEAD algorithm. 2181 o A string-to-key (S2K) specifier, length as defined above. 2183 o A starting initialization vector of size specified by the AEAD 2184 algorithm. 2186 o The encrypted session key itself, which is decrypted with the 2187 string-to-key object using the given cipher and AEAD mode. 2189 o An authentication tag for the AEAD mode. 2191 The encrypted session key is encrypted using one of the AEAD 2192 algorithms specified for the AEAD Encrypted Packet. Note that no 2193 chunks are used and that there is only one authentication tag. The 2194 Packet Tag in new format encoding (bits 7 and 6 set, bits 5-0 carry 2195 the packet tag), the packet version number, the cipher algorithm 2196 octet, and the AEAD algorithm octet are given as additional data. 2197 For example, the additional data used with EAX and AES-128 consists 2198 of the octets 0xC3, 0x05, 0x07, and 0x01. 2200 5.4. One-Pass Signature Packets (Tag 4) 2202 The One-Pass Signature packet precedes the signed data and contains 2203 enough information to allow the receiver to begin calculating any 2204 hashes needed to verify the signature. It allows the Signature 2205 packet to be placed at the end of the message, so that the signer can 2206 compute the entire signed message in one pass. 2208 A One-Pass Signature does not interoperate with PGP 2.6.x or earlier. 2210 The body of this packet consists of: 2212 o A one-octet version number. The current version is 3. 2214 o A one-octet signature type. Signature types are described in 2215 Section 5.2.1. 2217 o A one-octet number describing the hash algorithm used. 2219 o A one-octet number describing the public-key algorithm used. 2221 o An eight-octet number holding the Key ID of the signing key. 2223 o A one-octet number holding a flag showing whether the signature is 2224 nested. A zero value indicates that the next packet is another 2225 One-Pass Signature packet that describes another signature to be 2226 applied to the same message data. 2228 Note that if a message contains more than one one-pass signature, 2229 then the Signature packets bracket the message; that is, the first 2230 Signature packet after the message corresponds to the last one-pass 2231 packet and the final Signature packet corresponds to the first one- 2232 pass packet. 2234 5.5. Key Material Packet 2236 A key material packet contains all the information about a public or 2237 private key. There are four variants of this packet type, and two 2238 major versions. Consequently, this section is complex. 2240 5.5.1. Key Packet Variants 2242 5.5.1.1. Public-Key Packet (Tag 6) 2244 A Public-Key packet starts a series of packets that forms an OpenPGP 2245 key (sometimes called an OpenPGP certificate). 2247 5.5.1.2. Public-Subkey Packet (Tag 14) 2249 A Public-Subkey packet (tag 14) has exactly the same format as a 2250 Public-Key packet, but denotes a subkey. One or more subkeys may be 2251 associated with a top-level key. By convention, the top-level key 2252 provides signature services, and the subkeys provide encryption 2253 services. 2255 Note: in PGP version 2.6, tag 14 was intended to indicate a comment 2256 packet. This tag was selected for reuse because no previous version 2257 of PGP ever emitted comment packets but they did properly ignore 2258 them. Public-Subkey packets are ignored by PGP version 2.6 and do 2259 not cause it to fail, providing a limited degree of backward 2260 compatibility. 2262 5.5.1.3. Secret-Key Packet (Tag 5) 2264 A Secret-Key packet contains all the information that is found in a 2265 Public-Key packet, including the public-key material, but also 2266 includes the secret-key material after all the public-key fields. 2268 5.5.1.4. Secret-Subkey Packet (Tag 7) 2270 A Secret-Subkey packet (tag 7) is the subkey analog of the Secret Key 2271 packet and has exactly the same format. 2273 5.5.2. Public-Key Packet Formats 2275 There are three versions of key-material packets. Version 3 packets 2276 were first generated by PGP version 2.6. Version 4 keys first 2277 appeared in PGP 5 and are the preferred key version for OpenPGP. 2279 OpenPGP implementations MUST create keys with version 4 format. V3 2280 keys are deprecated; an implementation MUST NOT generate a V3 key, 2281 but MAY accept it. 2283 A version 3 public key or public-subkey packet contains: 2285 o A one-octet version number (3). 2287 o A four-octet number denoting the time that the key was created. 2289 o A two-octet number denoting the time in days that this key is 2290 valid. If this number is zero, then it does not expire. 2292 o A one-octet number denoting the public-key algorithm of this key. 2294 o A series of multiprecision integers comprising the key material: 2296 * a multiprecision integer (MPI) of RSA public modulus n; 2298 * an MPI of RSA public encryption exponent e. 2300 V3 keys are deprecated. They contain three weaknesses. First, it is 2301 relatively easy to construct a V3 key that has the same Key ID as any 2302 other key because the Key ID is simply the low 64 bits of the public 2303 modulus. Secondly, because the fingerprint of a V3 key hashes the 2304 key material, but not its length, there is an increased opportunity 2305 for fingerprint collisions. Third, there are weaknesses in the MD5 2306 hash algorithm that make developers prefer other algorithms. See 2307 below for a fuller discussion of Key IDs and fingerprints. 2309 V2 keys are identical to the deprecated V3 keys except for the 2310 version number. An implementation MUST NOT generate them and MAY 2311 accept or reject them as it sees fit. 2313 The version 4 format is similar to the version 3 format except for 2314 the absence of a validity period. This has been moved to the 2315 Signature packet. In addition, fingerprints of version 4 keys are 2316 calculated differently from version 3 keys, as described in the 2317 section "Enhanced Key Formats". 2319 A version 4 packet contains: 2321 o A one-octet version number (4). 2323 o A four-octet number denoting the time that the key was created. 2325 o A one-octet number denoting the public-key algorithm of this key. 2327 o A series of values comprising the key material. This is 2328 algorithm-specific and described in Section 5.6. 2330 The version 5 format is similar to the version 4 format except for 2331 the addition of a count for the key material. This count helps 2332 parsing secret key packets (which are an extension of the public key 2333 packet format) in the case of an unknown algoritm. In addition, 2334 fingerprints of version 5 keys are calculated differently from 2335 version 4 keys, as described in the section "Enhanced Key Formats". 2337 A version 5 packet contains: 2339 o A one-octet version number (5). 2341 o A four-octet number denoting the time that the key was created. 2343 o A one-octet number denoting the public-key algorithm of this key. 2345 o A four-octet scalar octet count for the following public key 2346 material. 2348 o A series of values comprising the public key material. This is 2349 algorithm-specific and described in Section 5.6. 2351 5.5.3. Secret-Key Packet Formats 2353 The Secret-Key and Secret-Subkey packets contain all the data of the 2354 Public-Key and Public-Subkey packets, with additional algorithm- 2355 specific secret-key data appended, usually in encrypted form. 2357 The packet contains: 2359 o A Public-Key or Public-Subkey packet, as described above. 2361 o One octet indicating string-to-key usage conventions. Zero 2362 indicates that the secret-key data is not encrypted. 255 or 254 2363 indicates that a string-to-key specifier is being given. Any 2364 other value is a symmetric-key encryption algorithm identifier. A 2365 version 5 packet MUST NOT use the value 255. 2367 o Only for a version 5 packet, a one-octet scalar octet count of the 2368 next 4 optional fields. 2370 o [Optional] If string-to-key usage octet was 255, 254, or 253, a 2371 one-octet symmetric encryption algorithm. 2373 o [Optional] If string-to-key usage octet was 253, a one-octet AEAD 2374 algorithm. 2376 o [Optional] If string-to-key usage octet was 255, 254, or 253, a 2377 string-to-key specifier. The length of the string-to-key 2378 specifier is implied by its type, as described above. 2380 o [Optional] If secret data is encrypted (string-to-key usage octet 2381 not zero), an Initial Vector (IV) of the same length as the 2382 cipher's block size. If string-to-key usage octet was 253 the IV 2383 is used as the nonce for the AEAD algorithm. If the AEAD 2384 algorithm requires a shorter nonce, the high-order bits of the IV 2385 are used and the remaining bits MUST be zero. 2387 o Only for a version 5 packet, a four-octet scalar octet count for 2388 the following secret key material. This includes the encrypted 2389 SHA-1 hash or AEAD tag if the string-to-key usage octet is 254 or 2390 253. 2392 o Plain or encrypted series of values comprising the secret key 2393 material. This is algorithm-specific and described in section 2394 Section 5.6. Note that if the string-to-key usage octet is 254, a 2395 20-octet SHA-1 hash of the plaintext of the algorithm-specific 2396 portion is appended to plaintext and encrypted with it. If the 2397 string-to-key usage octet is 253, then an AEAD authentication tag 2398 is part of that data. 2400 o If the string-to-key usage octet is zero or 255, then a two-octet 2401 checksum of the plaintext of the algorithm-specific portion (sum 2402 of all octets, mod 65536). 2404 Note that the version 5 packet format adds two count values to help 2405 parsing packets with unknown S2K or public key algorithms. 2407 Secret MPI values can be encrypted using a passphrase. If a string- 2408 to-key specifier is given, that describes the algorithm for 2409 converting the passphrase to a key, else a simple MD5 hash of the 2410 passphrase is used. Implementations MUST use a string-to-key 2411 specifier; the simple hash is for backward compatibility and is 2412 deprecated, though implementations MAY continue to use existing 2413 private keys in the old format. The cipher for encrypting the MPIs 2414 is specified in the Secret-Key packet. 2416 Encryption/decryption of the secret data is done in CFB mode using 2417 the key created from the passphrase and the Initial Vector from the 2418 packet. A different mode is used with V3 keys (which are only RSA) 2419 than with other key formats. With V3 keys, the MPI bit count prefix 2420 (i.e., the first two octets) is not encrypted. Only the MPI non- 2421 prefix data is encrypted. Furthermore, the CFB state is 2422 resynchronized at the beginning of each new MPI value, so that the 2423 CFB block boundary is aligned with the start of the MPI data. 2425 With V4 and V5 keys, a simpler method is used. All secret MPI values 2426 are encrypted, including the MPI bitcount prefix. 2428 If the string-to-key usage octet is 253, the encrypted MPI values are 2429 encrypted as one combined plaintext using one of the AEAD algorithms 2430 specified for the AEAD Encrypted Packet. Note that no chunks are 2431 used and that there is only one authentication tag. The Packet Tag 2432 in new format encoding (bits 7 and 6 set, bits 5-0 carry the packet 2433 tag), the packet version number, the cipher algorithm octet, and the 2434 AEAD algorithm octet are given as additional data. For example, the 2435 additional data used with EAX and AES-128 in a Secret-Key Packet of 2436 version 4 consists of the octets 0xC5, 0x04, 0x07, and 0x01; in a 2437 Secret-Subkey Packet the first octet would be 0xC7. 2439 The two-octet checksum that follows the algorithm-specific portion is 2440 the algebraic sum, mod 65536, of the plaintext of all the algorithm- 2441 specific octets (including MPI prefix and data). With V3 keys, the 2442 checksum is stored in the clear. With V4 keys, the checksum is 2443 encrypted like the algorithm-specific data. This value is used to 2444 check that the passphrase was correct. However, this checksum is 2445 deprecated; an implementation SHOULD NOT use it, but should rather 2446 use the SHA-1 hash denoted with a usage octet of 254. The reason for 2447 this is that there are some attacks that involve undetectably 2448 modifying the secret key. If the string-to-key usage octet is 253 no 2449 checksum or SHA-1 hash is used but the authentication tag of the AEAD 2450 algorithm follows. 2452 5.6. Algorithm-specific Parts of Keys 2454 The public and secret key format specifies algorithm-specific parts 2455 of a key. The following sections describe them in detail. 2457 5.6.1. Algorithm-Specific Part for RSA Keys 2459 The public key is this series of multiprecision integers: 2461 o MPI of RSA public modulus n; 2463 o MPI of RSA public encryption exponent e. 2465 The secret key is this series of multiprecision integers: 2467 o MPI of RSA secret exponent d; 2469 o MPI of RSA secret prime value p; 2471 o MPI of RSA secret prime value q (p < q); 2473 o MPI of u, the multiplicative inverse of p, mod q. 2475 5.6.2. Algorithm-Specific Part for DSA Keys 2477 The public key is this series of multiprecision integers: 2479 o MPI of DSA prime p; 2481 o MPI of DSA group order q (q is a prime divisor of p-1); 2483 o MPI of DSA group generator g; 2485 o MPI of DSA public-key value y (= g**x mod p where x is secret). 2487 The secret key is this single multiprecision integer: 2489 o MPI of DSA secret exponent x. 2491 5.6.3. Algorithm-Specific Part for Elgamal Keys 2493 The public key is this series of multiprecision integers: 2495 o MPI of Elgamal prime p; 2497 o MPI of Elgamal group generator g; 2499 o MPI of Elgamal public key value y (= g**x mod p where x is 2500 secret). 2502 The secret key is this single multiprecision integer: 2504 o MPI of Elgamal secret exponent x. 2506 5.6.4. Algorithm-Specific Part for ECDSA Keys 2508 The public key is this series of values: 2510 o a variable-length field containing a curve OID, formatted as 2511 follows: 2513 * a one-octet size of the following field; values 0 and 0xFF are 2514 reserved for future extensions, 2516 * the octets representing a curve OID, defined in Section 9.2; 2518 o a MPI of an EC point representing a public key. 2520 The secret key is this single multiprecision integer: 2522 o MPI of an integer representing the secret key, which is a scalar 2523 of the public EC point. 2525 5.6.5. Algorithm-Specific Part for EdDSA Keys 2527 The public key is this series of values: 2529 o a variable-length field containing a curve OID, formatted as 2530 follows: 2532 * a one-octet size of the following field; values 0 and 0xFF are 2533 reserved for future extensions, 2535 * the octets representing a curve OID, defined in Section 9.2; 2537 o a MPI of an EC point representing a public key Q as described 2538 under EdDSA Point Format below. 2540 The secret key is this single multiprecision integer: 2542 o MPI of an integer representing the secret key, which is a scalar 2543 of the public EC point. 2545 5.6.6. Algorithm-Specific Part for ECDH Keys 2547 The public key is this series of values: 2549 o a variable-length field containing a curve OID, formatted as 2550 follows: 2552 * a one-octet size of the following field; values 0 and 0xFF are 2553 reserved for future extensions, 2555 * the octets representing a curve OID, defined in Section 9.2; 2557 o a MPI of an EC point representing a public key; 2559 o a variable-length field containing KDF parameters, formatted as 2560 follows: 2562 * a one-octet size of the following fields; values 0 and 0xff are 2563 reserved for future extensions; 2565 * a one-octet value 1, reserved for future extensions; 2567 * a one-octet hash function ID used with a KDF; 2569 * a one-octet algorithm ID for the symmetric algorithm used to 2570 wrap the symmetric key used for the message encryption; see 2571 Section 13.5 for details. 2573 Observe that an ECDH public key is composed of the same sequence of 2574 fields that define an ECDSA key, plus the KDF parameters field. 2576 The secret key is this single multiprecision integer: 2578 o MPI of an integer representing the secret key, which is a scalar 2579 of the public EC point. 2581 5.7. Compressed Data Packet (Tag 8) 2583 The Compressed Data packet contains compressed data. Typically, this 2584 packet is found as the contents of an encrypted packet, or following 2585 a Signature or One-Pass Signature packet, and contains a literal data 2586 packet. 2588 The body of this packet consists of: 2590 o One octet that gives the algorithm used to compress the packet. 2592 o Compressed data, which makes up the remainder of the packet. 2594 A Compressed Data Packet's body contains an block that compresses 2595 some set of packets. See section "Packet Composition" for details on 2596 how messages are formed. 2598 ZIP-compressed packets are compressed with raw RFC 1951 [RFC1951] 2599 DEFLATE blocks. Note that PGP V2.6 uses 13 bits of compression. If 2600 an implementation uses more bits of compression, PGP V2.6 cannot 2601 decompress it. 2603 ZLIB-compressed packets are compressed with RFC 1950 [RFC1950] ZLIB- 2604 style blocks. 2606 BZip2-compressed packets are compressed using the BZip2 [BZ2] 2607 algorithm. 2609 5.8. Symmetrically Encrypted Data Packet (Tag 9) 2611 The Symmetrically Encrypted Data packet contains data encrypted with 2612 a symmetric-key algorithm. When it has been decrypted, it contains 2613 other packets (usually a literal data packet or compressed data 2614 packet, but in theory other Symmetrically Encrypted Data packets or 2615 sequences of packets that form whole OpenPGP messages). 2617 This packet is obsolete. An implementation MUST NOT create this 2618 packet. An implementation MAY process such a packet but it MUST 2619 return a clear diagnostic that a non-integrity protected packet has 2620 been processed. The implementation SHOULD also return an error in 2621 this case and stop processing. 2623 The body of this packet consists of: 2625 o Encrypted data, the output of the selected symmetric-key cipher 2626 operating in OpenPGP's variant of Cipher Feedback (CFB) mode. 2628 The symmetric cipher used may be specified in a Public-Key or 2629 Symmetric-Key Encrypted Session Key packet that precedes the 2630 Symmetrically Encrypted Data packet. In that case, the cipher 2631 algorithm octet is prefixed to the session key before it is 2632 encrypted. If no packets of these types precede the encrypted data, 2633 the IDEA algorithm is used with the session key calculated as the MD5 2634 hash of the passphrase, though this use is deprecated. 2636 The data is encrypted in CFB mode, with a CFB shift size equal to the 2637 cipher's block size. The Initial Vector (IV) is specified as all 2638 zeros. Instead of using an IV, OpenPGP prefixes a string of length 2639 equal to the block size of the cipher plus two to the data before it 2640 is encrypted. The first block-size octets (for example, 8 octets for 2641 a 64-bit block length) are random, and the following two octets are 2642 copies of the last two octets of the IV. For example, in an 8-octet 2643 block, octet 9 is a repeat of octet 7, and octet 10 is a repeat of 2644 octet 8. In a cipher of length 16, octet 17 is a repeat of octet 15 2645 and octet 18 is a repeat of octet 16. As a pedantic clarification, 2646 in both these examples, we consider the first octet to be numbered 1. 2648 After encrypting the first block-size-plus-two octets, the CFB state 2649 is resynchronized. The last block-size octets of ciphertext are 2650 passed through the cipher and the block boundary is reset. 2652 The repetition of 16 bits in the random data prefixed to the message 2653 allows the receiver to immediately check whether the session key is 2654 incorrect. See the "Security Considerations" section for hints on 2655 the proper use of this "quick check". 2657 5.9. Marker Packet (Obsolete Literal Packet) (Tag 10) 2659 An experimental version of PGP used this packet as the Literal 2660 packet, but no released version of PGP generated Literal packets with 2661 this tag. With PGP 5, this packet has been reassigned and is 2662 reserved for use as the Marker packet. 2664 The body of this packet consists of: 2666 o The three octets 0x50, 0x47, 0x50 (which spell "PGP" in UTF-8). 2668 Such a packet MUST be ignored when received. It may be placed at the 2669 beginning of a message that uses features not available in PGP 2670 version 2.6 in order to cause that version to report that newer 2671 software is necessary to process the message. 2673 5.10. Literal Data Packet (Tag 11) 2675 A Literal Data packet contains the body of a message; data that is 2676 not to be further interpreted. 2678 The body of this packet consists of: 2680 o A one-octet field that describes how the data is formatted. 2682 If it is a 'b' (0x62), then the Literal packet contains binary 2683 data. If it is a 't' (0x74), then it contains text data, and thus 2684 may need line ends converted to local form, or other text-mode 2685 changes. The tag 'u' (0x75) means the same as 't', but also 2686 indicates that implementation believes that the literal data 2687 contains UTF-8 text. If it is a 'm' (0x6d), then it contains a 2688 MIME message body part [RFC2045]. 2690 Early versions of PGP also defined a value of 'l' as a 'local' 2691 mode for machine-local conversions. RFC 1991 [RFC1991] 2692 incorrectly stated this local mode flag as '1' (ASCII numeral 2693 one). Both of these local modes are deprecated. 2695 o File name as a string (one-octet length, followed by a file name). 2696 This may be a zero-length string. Commonly, if the source of the 2697 encrypted data is a file, this will be the name of the encrypted 2698 file. An implementation MAY consider the file name in the Literal 2699 packet to be a more authoritative name than the actual file name. 2701 If the special name "_CONSOLE" is used, the message is considered 2702 to be "for your eyes only". This advises that the message data is 2703 unusually sensitive, and the receiving program should process it 2704 more carefully, perhaps avoiding storing the received data to 2705 disk, for example. 2707 o A four-octet number that indicates a date associated with the 2708 literal data. Commonly, the date might be the modification date 2709 of a file, or the time the packet was created, or a zero that 2710 indicates no specific time. 2712 o The remainder of the packet is literal data. 2714 Text data is stored with text endings (i.e., network- 2715 normal line endings). These should be converted to native line 2716 endings by the receiving software. 2718 Note that V3 and V4 signatures do not include the formatting octet, 2719 the file name, and the date field of the literal packet in a 2720 signature hash and thus are not protected against tampering in a 2721 signed document. In contrast V5 signatures include them. 2723 5.11. Trust Packet (Tag 12) 2725 The Trust packet is used only within keyrings and is not normally 2726 exported. Trust packets contain data that record the user's 2727 specifications of which key holders are trustworthy introducers, 2728 along with other information that implementing software uses for 2729 trust information. The format of Trust packets is defined by a given 2730 implementation. 2732 Trust packets SHOULD NOT be emitted to output streams that are 2733 transferred to other users, and they SHOULD be ignored on any input 2734 other than local keyring files. 2736 5.12. User ID Packet (Tag 13) 2738 A User ID packet consists of UTF-8 text that is intended to represent 2739 the name and email address of the key holder. By convention, it 2740 includes an RFC 2822 [RFC2822] mail name-addr, but there are no 2741 restrictions on its content. The packet length in the header 2742 specifies the length of the User ID. 2744 5.13. User Attribute Packet (Tag 17) 2746 The User Attribute packet is a variation of the User ID packet. It 2747 is capable of storing more types of data than the User ID packet, 2748 which is limited to text. Like the User ID packet, a User Attribute 2749 packet may be certified by the key owner ("self-signed") or any other 2750 key owner who cares to certify it. Except as noted, a User Attribute 2751 packet may be used anywhere that a User ID packet may be used. 2753 While User Attribute packets are not a required part of the OpenPGP 2754 standard, implementations SHOULD provide at least enough 2755 compatibility to properly handle a certification signature on the 2756 User Attribute packet. A simple way to do this is by treating the 2757 User Attribute packet as a User ID packet with opaque contents, but 2758 an implementation may use any method desired. 2760 The User Attribute packet is made up of one or more attribute 2761 subpackets. Each subpacket consists of a subpacket header and a 2762 body. The header consists of: 2764 o the subpacket length (1, 2, or 5 octets) 2766 o the subpacket type (1 octet) 2768 and is followed by the subpacket specific data. 2770 The following table lists the currently known subpackets: 2772 +----------+------------------------------+ 2773 | Type | Attribute Subpacket | 2774 +----------+------------------------------+ 2775 | 1 | Image Attribute Subpacket | 2776 | [TBD1] | User ID Attribute Subpacket | 2777 | 100-110 | Private/Experimental Use | 2778 +----------+------------------------------+ 2780 An implementation SHOULD ignore any subpacket of a type that it does 2781 not recognize. 2783 5.13.1. The Image Attribute Subpacket 2785 The Image Attribute subpacket is used to encode an image, presumably 2786 (but not required to be) that of the key owner. 2788 The Image Attribute subpacket begins with an image header. The first 2789 two octets of the image header contain the length of the image 2790 header. Note that unlike other multi-octet numerical values in this 2791 document, due to a historical accident this value is encoded as a 2792 little-endian number. The image header length is followed by a 2793 single octet for the image header version. The only currently 2794 defined version of the image header is 1, which is a 16-octet image 2795 header. The first three octets of a version 1 image header are thus 2796 0x10, 0x00, 0x01. 2798 The fourth octet of a version 1 image header designates the encoding 2799 format of the image. The only currently defined encoding format is 2800 the value 1 to indicate JPEG. Image format types 100 through 110 are 2801 reserved for private or experimental use. The rest of the version 1 2802 image header is made up of 12 reserved octets, all of which MUST be 2803 set to 0. 2805 The rest of the image subpacket contains the image itself. As the 2806 only currently defined image type is JPEG, the image is encoded in 2807 the JPEG File Interchange Format (JFIF), a standard file format for 2808 JPEG images [JFIF]. 2810 An implementation MAY try to determine the type of an image by 2811 examination of the image data if it is unable to handle a particular 2812 version of the image header or if a specified encoding format value 2813 is not recognized. 2815 5.13.2. User ID Attribute Subpacket 2817 A User ID Attribute subpacket has type #[IANA -- assignment TBD1]. 2819 A User ID Attribute subpacket, just like a User ID packet, consists 2820 of UTF-8 text that is intended to represent the name and email 2821 address of the key holder. By convention, it includes an RFC 2822 2822 [RFC2822] mail name-addr, but there are no restrictions on its 2823 content. For devices using OpenPGP for device certificates, it may 2824 just be the device identifier. The packet length in the header 2825 specifies the length of the User ID. 2827 Because User Attribute subpackets can be used anywhere a User ID 2828 packet can be used, implementations MAY choose to trust a signed User 2829 Attribute subpacket that includes a User ID Attribute subpacket. 2831 5.14. Sym. Encrypted Integrity Protected Data Packet (Tag 18) 2833 The Symmetrically Encrypted Integrity Protected Data packet is a 2834 variant of the Symmetrically Encrypted Data packet. It is a new 2835 feature created for OpenPGP that addresses the problem of detecting a 2836 modification to encrypted data. It is used in combination with a 2837 Modification Detection Code packet. 2839 There is a corresponding feature in the features Signature subpacket 2840 that denotes that an implementation can properly use this packet 2841 type. An implementation MUST support decrypting these packets and 2842 SHOULD prefer generating them to the older Symmetrically Encrypted 2843 Data packet when possible. Since this data packet protects against 2844 modification attacks, this standard encourages its proliferation. 2845 While blanket adoption of this data packet would create 2846 interoperability problems, rapid adoption is nevertheless important. 2847 An implementation SHOULD specifically denote support for this packet, 2848 but it MAY infer it from other mechanisms. 2850 For example, an implementation might infer from the use of a cipher 2851 such as Advanced Encryption Standard (AES) or Twofish that a user 2852 supports this feature. It might place in the unhashed portion of 2853 another user's key signature a Features subpacket. It might also 2854 present a user with an opportunity to regenerate their own self- 2855 signature with a Features subpacket. 2857 This packet contains data encrypted with a symmetric-key algorithm 2858 and protected against modification by the SHA-1 hash algorithm. When 2859 it has been decrypted, it will typically contain other packets (often 2860 a Literal Data packet or Compressed Data packet). The last decrypted 2861 packet in this packet's payload MUST be a Modification Detection Code 2862 packet. 2864 The body of this packet consists of: 2866 o A one-octet version number. The only defined value is 1. There 2867 won't be any future versions of this packet because the MDC system 2868 has been superseded by the AEAD Encrypted Data packet. 2870 o Encrypted data, the output of the selected symmetric-key cipher 2871 operating in Cipher Feedback mode with shift amount equal to the 2872 block size of the cipher (CFB-n where n is the block size). 2874 The symmetric cipher used MUST be specified in a Public-Key or 2875 Symmetric-Key Encrypted Session Key packet that precedes the 2876 Symmetrically Encrypted Data packet. In either case, the cipher 2877 algorithm octet is prefixed to the session key before it is 2878 encrypted. 2880 The data is encrypted in CFB mode, with a CFB shift size equal to the 2881 cipher's block size. The Initial Vector (IV) is specified as all 2882 zeros. Instead of using an IV, OpenPGP prefixes an octet string to 2883 the data before it is encrypted. The length of the octet string 2884 equals the block size of the cipher in octets, plus two. The first 2885 octets in the group, of length equal to the block size of the cipher, 2886 are random; the last two octets are each copies of their 2nd 2887 preceding octet. For example, with a cipher whose block size is 128 2888 bits or 16 octets, the prefix data will contain 16 random octets, 2889 then two more octets, which are copies of the 15th and 16th octets, 2890 respectively. Unlike the Symmetrically Encrypted Data Packet, no 2891 special CFB resynchronization is done after encrypting this prefix 2892 data. See "OpenPGP CFB Mode" below for more details. 2894 The repetition of 16 bits in the random data prefixed to the message 2895 allows the receiver to immediately check whether the session key is 2896 incorrect. 2898 The plaintext of the data to be encrypted is passed through the SHA-1 2899 hash function, and the result of the hash is appended to the 2900 plaintext in a Modification Detection Code packet. The input to the 2901 hash function includes the prefix data described above; it includes 2902 all of the plaintext, and then also includes two octets of values 2903 0xD3, 0x14. These represent the encoding of a Modification Detection 2904 Code packet tag and length field of 20 octets. 2906 The resulting hash value is stored in a Modification Detection Code 2907 (MDC) packet, which MUST use the two octet encoding just given to 2908 represent its tag and length field. The body of the MDC packet is 2909 the 20-octet output of the SHA-1 hash. 2911 The Modification Detection Code packet is appended to the plaintext 2912 and encrypted along with the plaintext using the same CFB context. 2914 During decryption, the plaintext data should be hashed with SHA-1, 2915 including the prefix data as well as the packet tag and length field 2916 of the Modification Detection Code packet. The body of the MDC 2917 packet, upon decryption, is compared with the result of the SHA-1 2918 hash. 2920 Any failure of the MDC indicates that the message has been modified 2921 and MUST be treated as a security problem. Failures include a 2922 difference in the hash values, but also the absence of an MDC packet, 2923 or an MDC packet in any position other than the end of the plaintext. 2924 Any failure SHOULD be reported to the user. 2926 NON-NORMATIVE EXPLANATION 2928 The MDC system, as packets 18 and 19 are called, were created to 2929 provide an integrity mechanism that is less strong than a 2930 signature, yet stronger than bare CFB encryption. 2932 It is a limitation of CFB encryption that damage to the 2933 ciphertext will corrupt the affected cipher blocks and the block 2934 following. Additionally, if data is removed from the end of a 2935 CFB-encrypted block, that removal is undetectable. (Note also 2936 that CBC mode has a similar limitation, but data removed from 2937 the front of the block is undetectable.) 2939 The obvious way to protect or authenticate an encrypted block is 2940 to digitally sign it. However, many people do not wish to 2941 habitually sign data, for a large number of reasons beyond the 2942 scope of this document. Suffice it to say that many people 2943 consider properties such as deniability to be as valuable as 2944 integrity. 2946 OpenPGP addresses this desire to have more security than raw 2947 encryption and yet preserve deniability with the MDC system. An 2948 MDC is intentionally not a MAC. Its name was not selected by 2949 accident. It is analogous to a checksum. 2951 Despite the fact that it is a relatively modest system, it has 2952 proved itself in the real world. It is an effective defense to 2953 several attacks that have surfaced since it has been created. 2954 It has met its modest goals admirably. 2956 Consequently, because it is a modest security system, it has 2957 modest requirements on the hash function(s) it employs. It does 2958 not rely on a hash function being collision-free, it relies on a 2959 hash function being one-way. If a forger, Frank, wishes to send 2960 Alice a (digitally) unsigned message that says, "I've always 2961 secretly loved you, signed Bob", it is far easier for him to 2962 construct a new message than it is to modify anything 2963 intercepted from Bob. (Note also that if Bob wishes to 2964 communicate secretly with Alice, but without authentication or 2965 identification and with a threat model that includes forgers, he 2966 has a problem that transcends mere cryptography.) 2968 Note also that unlike nearly every other OpenPGP subsystem, 2969 there are no parameters in the MDC system. It hard-defines 2970 SHA-1 as its hash function. This is not an accident. It is an 2971 intentional choice to avoid downgrade and cross-grade attacks 2972 while making a simple, fast system. (A downgrade attack would 2973 be an attack that replaced SHA2-256 with SHA-1, for example. A 2974 cross-grade attack would replace SHA-1 with another 160-bit 2975 hash, such as RIPE-MD/160, for example.) 2977 However, no update will be needed because the MDC will be 2978 replaced by the AEAD encryption described in this document. 2980 5.15. Modification Detection Code Packet (Tag 19) 2982 The Modification Detection Code packet contains a SHA-1 hash of 2983 plaintext data, which is used to detect message modification. It is 2984 only used with a Symmetrically Encrypted Integrity Protected Data 2985 packet. The Modification Detection Code packet MUST be the last 2986 packet in the plaintext data that is encrypted in the Symmetrically 2987 Encrypted Integrity Protected Data packet, and MUST appear in no 2988 other place. 2990 A Modification Detection Code packet MUST have a length of 20 octets. 2992 The body of this packet consists of: 2994 o A 20-octet SHA-1 hash of the preceding plaintext data of the 2995 Symmetrically Encrypted Integrity Protected Data packet, including 2996 prefix data, the tag octet, and length octet of the Modification 2997 Detection Code packet. 2999 Note that the Modification Detection Code packet MUST always use a 3000 new format encoding of the packet tag, and a one-octet encoding of 3001 the packet length. The reason for this is that the hashing rules for 3002 modification detection include a one-octet tag and one-octet length 3003 in the data hash. While this is a bit restrictive, it reduces 3004 complexity. 3006 5.16. AEAD Encrypted Data Packet (Tag 20) 3008 This packet contains data encrypted with an authenticated encryption 3009 and additional data (AEAD) construction. When it has been decrypted, 3010 it will typically contain other packets (often a Literal Data packet 3011 or Compressed Data packet). 3013 The body of this packet consists of: 3015 o A one-octet version number. The only currently defined value is 3016 1. 3018 o A one-octet cipher algorithm. 3020 o A one-octet AEAD algorithm. 3022 o A one-octet chunk size. 3024 o A starting initialization vector of size specified by the AEAD 3025 algorithm. 3027 o Encrypted data, the output of the selected symmetric-key cipher 3028 operating in the given AEAD mode. 3030 o A final, summary authentication tag for the AEAD mode. 3032 An AEAD encrypted data packet consists of one or more chunks of data. 3033 The plaintext of each chunk is of a size specified using the chunk 3034 size octet using the method specified below. 3036 The encrypted data consists of the encryption of each chunk of 3037 plaintext, followed immediately by the relevant authentication tag. 3038 If the last chunk of plaintext is smaller than the chunk size, the 3039 ciphertext for that data may be shorter; it is nevertheless followed 3040 by a full authentication tag. 3042 For each chunk, the AEAD construction is given the Packet Tag in new 3043 format encoding (bits 7 and 6 set, bits 5-0 carry the packet tag), 3044 version number, cipher algorithm octet, AEAD algorithm octet, chunk 3045 size octet, and an eight-octet, big-endian chunk index as additional 3046 data. The index of the first chunk is zero. For example, the 3047 additional data of the first chunk using EAX and AES-128 with a chunk 3048 size of 64 kiByte consists of the octets 0xD4, 0x01, 0x07, 0x01, 3049 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, and 0x00. 3051 After the final chunk, the AEAD algorithm is used to produce a final 3052 authentication tag encrypting the empty string. This AEAD instance 3053 is given the additional data specified above, plus an eight-octet, 3054 big-endian value specifying the total number of plaintext octets 3055 encrypted. This allows detection of a truncated ciphertext. Please 3056 note that the big-endian number representing the chunk index in the 3057 additional data is increased accordingly, although it's not really a 3058 chunk. 3060 The chunk size octet specifies the size of chunks using the following 3061 formula (in C), where c is the chunk size octet: 3063 chunk_size = ((uint64_t)1 << (c + 6)) 3065 An implementation MUST support chunk size octets with values from 0 3066 to 56. Chunk size octets with other values are reserved for future 3067 extensions. Implementations SHOULD NOT create data with a chunk size 3068 octet value larger than 21 (128 MiB chunks) to facilitate buffering 3069 of not yet authenticated plaintext. 3071 A new random initialization vector MUST be used for each message. 3072 Failure to do so for each message will lead to a catastrophic failure 3073 depending on the used AEAD mode. 3075 5.16.1. EAX Mode 3077 The EAX algorithm can only use block ciphers with 16-octet blocks. 3078 The starting initialization vector and authentication tag are both 16 3079 octets long. 3081 The starting initialization vector for this mode MUST be unique and 3082 unpredictable. 3084 The nonce for EAX mode is computed by treating the starting 3085 initialization vector as a 16-octet, big-endian value and exclusive- 3086 oring the low eight octets of it with the chunk index. 3088 The security of EAX requires that the nonce is never reused, hence 3089 the requirement that the starting initialization vector be unique. 3091 5.16.2. OCB Mode 3093 The OCB Authenticated-Encryption Algorithm used in this document is 3094 defined in [RFC7253]. 3096 OCB usage requires specification of the following parameters: 3098 o a blockcipher that operate on 128-bit (16-octet) blocks 3100 o an authentication tag length of 16 octets 3102 o a nonce of 15 octets long (which is the longest nonce allowed 3103 specified by [RFC7253]) 3105 o an initialization vector of at least 15 octets long 3107 In the case that the initialization vector is longer than 15 octets 3108 (such as in Section 5.5.1.3, only the 15 leftmost octets are used in 3109 calculations; the remaining octets MUST be considered as zero. 3111 The nonce for OCB mode is computed by the exclusive-oring of the 3112 initialization vector as a 15-octet, big endian value, against the 3113 chunk index. 3115 Security of OCB mode depends on the non-repeated nature of nonces 3116 used for the same key on distinct plaintext [RFC7253]. Therefore the 3117 initialization vector per message MUST be distinct, and OCB mode 3118 SHOULD only be used in environments when there is certainty to 3119 fulfilling this requirement. 3121 6. Radix-64 Conversions 3123 As stated in the introduction, OpenPGP's underlying native 3124 representation for objects is a stream of arbitrary octets, and some 3125 systems desire these objects to be immune to damage caused by 3126 character set translation, data conversions, etc. 3128 In principle, any printable encoding scheme that met the requirements 3129 of the unsafe channel would suffice, since it would not change the 3130 underlying binary bit streams of the native OpenPGP data structures. 3131 The OpenPGP standard specifies one such printable encoding scheme to 3132 ensure interoperability. 3134 OpenPGP's Radix-64 encoding is composed of two parts: a base64 3135 encoding of the binary data and a checksum. The base64 encoding is 3136 identical to the MIME base64 content-transfer-encoding [RFC2045]. 3138 The checksum is a 24-bit Cyclic Redundancy Check (CRC) converted to 3139 four characters of radix-64 encoding by the same MIME base64 3140 transformation, preceded by an equal sign (=). The CRC is computed 3141 by using the generator 0x864CFB and an initialization of 0xB704CE. 3142 The accumulation is done on the data before it is converted to radix- 3143 64, rather than on the converted data. A sample implementation of 3144 this algorithm is in the next section. 3146 The checksum with its leading equal sign MAY appear on the first line 3147 after the base64 encoded data. 3149 Rationale for CRC-24: The size of 24 bits fits evenly into printable 3150 base64. The nonzero initialization can detect more errors than a 3151 zero initialization. 3153 6.1. An Implementation of the CRC-24 in "C" 3155 3156 #define CRC24_INIT 0xB704CEL 3157 #define CRC24_POLY 0x864CFBL 3159 typedef long crc24; 3160 crc24 crc_octets(unsigned char *octets, size_t len) 3161 { 3162 crc24 crc = CRC24_INIT; 3163 int i; 3164 while (len--) { 3165 crc ^= (*octets++) << 16; 3166 for (i = 0; i < 8; i++) { 3167 crc <<= 1; 3168 if (crc & 0x1000000) 3169 crc ^= CRC24_POLY; 3170 } 3171 } 3172 return crc & 0xFFFFFFL; 3173 } 3174 3176 6.2. Forming ASCII Armor 3178 When OpenPGP encodes data into ASCII Armor, it puts specific headers 3179 around the Radix-64 encoded data, so OpenPGP can reconstruct the data 3180 later. An OpenPGP implementation MAY use ASCII armor to protect raw 3181 binary data. OpenPGP informs the user what kind of data is encoded 3182 in the ASCII armor through the use of the headers. 3184 Concatenating the following data creates ASCII Armor: 3186 o An Armor Header Line, appropriate for the type of data 3188 o Armor Headers 3190 o A blank line 3192 o The ASCII-Armored data 3194 o An Armor Checksum 3196 o The Armor Tail, which depends on the Armor Header Line 3198 An Armor Header Line consists of the appropriate header line text 3199 surrounded by five (5) dashes ('-', 0x2D) on either side of the 3200 header line text. The header line text is chosen based upon the type 3201 of data that is being encoded in Armor, and how it is being encoded. 3202 Header line texts include the following strings: 3204 BEGIN PGP MESSAGE Used for signed, encrypted, or compressed files. 3206 BEGIN PGP PUBLIC KEY BLOCK Used for armoring public keys. 3208 BEGIN PGP PRIVATE KEY BLOCK Used for armoring private keys. 3210 BEGIN PGP MESSAGE, PART X/Y Used for multi-part messages, where the 3211 armor is split amongst Y parts, and this is the Xth part out of Y. 3213 BEGIN PGP MESSAGE, PART X Used for multi-part messages, where this 3214 is the Xth part of an unspecified number of parts. Requires the 3215 MESSAGE-ID Armor Header to be used. 3217 BEGIN PGP SIGNATURE Used for detached signatures, OpenPGP/MIME 3218 signatures, and cleartext signatures. Note that PGP 2 uses BEGIN 3219 PGP MESSAGE for detached signatures. 3221 Note that all these Armor Header Lines are to consist of a complete 3222 line. That is to say, there is always a line ending preceding the 3223 starting five dashes, and following the ending five dashes. The 3224 header lines, therefore, MUST start at the beginning of a line, and 3225 MUST NOT have text other than whitespace -- space (0x20), tab (0x09) 3226 or carriage return (0x0d) -- following them on the same line. These 3227 line endings are considered a part of the Armor Header Line for the 3228 purposes of determining the content they delimit. This is 3229 particularly important when computing a cleartext signature (see 3230 below). 3232 The Armor Headers are pairs of strings that can give the user or the 3233 receiving OpenPGP implementation some information about how to decode 3234 or use the message. The Armor Headers are a part of the armor, not a 3235 part of the message, and hence are not protected by any signatures 3236 applied to the message. 3238 The format of an Armor Header is that of a key-value pair. A colon 3239 (':' 0x38) and a single space (0x20) separate the key and value. 3240 OpenPGP should consider improperly formatted Armor Headers to be 3241 corruption of the ASCII Armor. Unknown keys should be reported to 3242 the user, but OpenPGP should continue to process the message. 3244 Note that some transport methods are sensitive to line length. While 3245 there is a limit of 76 characters for the Radix-64 data 3246 (Section 6.3), there is no limit to the length of Armor Headers. 3247 Care should be taken that the Armor Headers are short enough to 3248 survive transport. One way to do this is to repeat an Armor Header 3249 Key multiple times with different values for each so that no one line 3250 is overly long. 3252 Currently defined Armor Header Keys are as follows: 3254 o "Version", which states the OpenPGP implementation and version 3255 used to encode the message. 3257 o "Comment", a user-defined comment. OpenPGP defines all text to be 3258 in UTF-8. A comment may be any UTF-8 string. However, the whole 3259 point of armoring is to provide seven-bit-clean data. 3260 Consequently, if a comment has characters that are outside the US- 3261 ASCII range of UTF, they may very well not survive transport. 3263 o "Hash", a comma-separated list of hash algorithms used in this 3264 message. This is used only in cleartext signed messages. 3266 o "MessageID", a 32-character string of printable characters. The 3267 string must be the same for all parts of a multi-part message that 3268 uses the "PART X" Armor Header. MessageID strings should be 3269 unique enough that the recipient of the mail can associate all the 3270 parts of a message with each other. A good checksum or 3271 cryptographic hash function is sufficient. 3273 The MessageID SHOULD NOT appear unless it is in a multi-part 3274 message. If it appears at all, it MUST be computed from the 3275 finished (encrypted, signed, etc.) message in a deterministic 3276 fashion, rather than contain a purely random value. This is to 3277 allow the legitimate recipient to determine that the MessageID 3278 cannot serve as a covert means of leaking cryptographic key 3279 information. 3281 o "Charset", a description of the character set that the plaintext 3282 is in. Please note that OpenPGP defines text to be in UTF-8. An 3283 implementation will get best results by translating into and out 3284 of UTF-8. However, there are many instances where this is easier 3285 said than done. Also, there are communities of users who have no 3286 need for UTF-8 because they are all happy with a character set 3287 like ISO Latin-5 or a Japanese character set. In such instances, 3288 an implementation MAY override the UTF-8 default by using this 3289 header key. An implementation MAY implement this key and any 3290 translations it cares to; an implementation MAY ignore it and 3291 assume all text is UTF-8. 3293 The blank line can either be zero-length or contain only whitespace, 3294 that is spaces (0x20), tabs (0x09) or carriage returns (0x0d). 3296 The Armor Tail Line is composed in the same manner as the Armor 3297 Header Line, except the string "BEGIN" is replaced by the string 3298 "END". 3300 6.3. Encoding Binary in Radix-64 3302 The encoding process represents 24-bit groups of input bits as output 3303 strings of 4 encoded characters. Proceeding from left to right, a 3304 24-bit input group is formed by concatenating three 8-bit input 3305 groups. These 24 bits are then treated as four concatenated 6-bit 3306 groups, each of which is translated into a single digit in the 3307 Radix-64 alphabet. When encoding a bit stream with the Radix-64 3308 encoding, the bit stream must be presumed to be ordered with the most 3309 significant bit first. That is, the first bit in the stream will be 3310 the high-order bit in the first 8-bit octet, and the eighth bit will 3311 be the low-order bit in the first 8-bit octet, and so on. 3313 +--first octet--+-second octet--+--third octet--+ 3314 |7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0| 3315 +-----------+---+-------+-------+---+-----------+ 3316 |5 4 3 2 1 0|5 4 3 2 1 0|5 4 3 2 1 0|5 4 3 2 1 0| 3317 +--1.index--+--2.index--+--3.index--+--4.index--+ 3319 Each 6-bit group is used as an index into an array of 64 printable 3320 characters from the table below. The character referenced by the 3321 index is placed in the output string. 3323 Value Encoding Value Encoding Value Encoding Value Encoding 3324 0 A 17 R 34 i 51 z 3325 1 B 18 S 35 j 52 0 3326 2 C 19 T 36 k 53 1 3327 3 D 20 U 37 l 54 2 3328 4 E 21 V 38 m 55 3 3329 5 F 22 W 39 n 56 4 3330 6 G 23 X 40 o 57 5 3331 7 H 24 Y 41 p 58 6 3332 8 I 25 Z 42 q 59 7 3333 9 J 26 a 43 r 60 8 3334 10 K 27 b 44 s 61 9 3335 11 L 28 c 45 t 62 + 3336 12 M 29 d 46 u 63 / 3337 13 N 30 e 47 v 3338 14 O 31 f 48 w (pad) = 3339 15 P 32 g 49 x 3340 16 Q 33 h 50 y 3342 The encoded output stream must be represented in lines of no more 3343 than 76 characters each. 3345 Special processing is performed if fewer than 24 bits are available 3346 at the end of the data being encoded. There are three possibilities: 3348 1. The last data group has 24 bits (3 octets). No special 3349 processing is needed. 3351 2. The last data group has 16 bits (2 octets). The first two 3352 6-bit groups are processed as above. The third (incomplete) 3353 data group has two zero-value bits added to it, and is 3354 processed as above. A pad character (=) is added to the 3355 output. 3357 3. The last data group has 8 bits (1 octet). The first 6-bit 3358 group is processed as above. The second (incomplete) data 3359 group has four zero-value bits added to it, and is processed 3360 as above. Two pad characters (=) are added to the output. 3362 6.4. Decoding Radix-64 3364 In Radix-64 data, characters other than those in the table, line 3365 breaks, and other white space probably indicate a transmission error, 3366 about which a warning message or even a message rejection might be 3367 appropriate under some circumstances. Decoding software must ignore 3368 all white space. 3370 Because it is used only for padding at the end of the data, the 3371 occurrence of any "=" characters may be taken as evidence that the 3372 end of the data has been reached (without truncation in transit). No 3373 such assurance is possible, however, when the number of octets 3374 transmitted was a multiple of three and no "=" characters are 3375 present. 3377 6.5. Examples of Radix-64 3379 Input data: 0x14FB9C03D97E 3380 Hex: 1 4 F B 9 C | 0 3 D 9 7 E 3381 8-bit: 00010100 11111011 10011100 | 00000011 11011001 01111110 3382 6-bit: 000101 001111 101110 011100 | 000000 111101 100101 111110 3383 Decimal: 5 15 46 28 0 61 37 62 3384 Output: F P u c A 9 l + 3385 Input data: 0x14FB9C03D9 3386 Hex: 1 4 F B 9 C | 0 3 D 9 3387 8-bit: 00010100 11111011 10011100 | 00000011 11011001 3388 pad with 00 3389 6-bit: 000101 001111 101110 011100 | 000000 111101 100100 3390 Decimal: 5 15 46 28 0 61 36 3391 pad with = 3392 Output: F P u c A 9 k = 3393 Input data: 0x14FB9C03 3394 Hex: 1 4 F B 9 C | 0 3 3395 8-bit: 00010100 11111011 10011100 | 00000011 3396 pad with 0000 3397 6-bit: 000101 001111 101110 011100 | 000000 110000 3398 Decimal: 5 15 46 28 0 48 3399 pad with = = 3400 Output: F P u c A w = = 3402 6.6. Example of an ASCII Armored Message 3404 -----BEGIN PGP MESSAGE----- 3405 Version: OpenPrivacy 0.99 3407 yDgBO22WxBHv7O8X7O/jygAEzol56iUKiXmV+XmpCtmpqQUKiQrFqclFqUDBovzS 3408 vBSFjNSiVHsuAA== 3409 =njUN 3410 -----END PGP MESSAGE----- 3412 Note that this example has extra indenting; an actual armored message 3413 would have no leading whitespace. 3415 7. Cleartext Signature Framework 3417 It is desirable to be able to sign a textual octet stream without 3418 ASCII armoring the stream itself, so the signed text is still 3419 readable without special software. In order to bind a signature to 3420 such a cleartext, this framework is used, which follows the same 3421 basic format and restrictions as the ASCII armoring described above 3422 in "Forming ASCII Armor" (Section 6.2). (Note that this framework is 3423 not intended to be reversible. RFC 3156 [RFC3156] defines another 3424 way to sign cleartext messages for environments that support MIME.) 3426 The cleartext signed message consists of: 3428 o The cleartext header '-----BEGIN PGP SIGNED MESSAGE-----' on a 3429 single line, 3431 o One or more "Hash" Armor Headers, 3433 o Exactly one blank line not included into the message digest, 3435 o The dash-escaped cleartext that is included into the message 3436 digest, 3438 o The ASCII armored signature(s) including the '-----BEGIN PGP 3439 SIGNATURE-----' Armor Header and Armor Tail Lines. 3441 If the "Hash" Armor Header is given, the specified message digest 3442 algorithm(s) are used for the signature. If there are no such 3443 headers, MD5 is used. If MD5 is the only hash used, then an 3444 implementation MAY omit this header for improved V2.x compatibility. 3445 If more than one message digest is used in the signature, the "Hash" 3446 armor header contains a comma-delimited list of used message digests. 3448 Current message digest names are described below with the algorithm 3449 IDs. 3451 An implementation SHOULD add a line break after the cleartext, but 3452 MAY omit it if the cleartext ends with a line break. This is for 3453 visual clarity. 3455 7.1. Dash-Escaped Text 3457 The cleartext content of the message must also be dash-escaped. 3459 Dash-escaped cleartext is the ordinary cleartext where every line 3460 starting with a dash '-' (0x2D) is prefixed by the sequence dash '-' 3461 (0x2D) and space ' ' (0x20). This prevents the parser from 3462 recognizing armor headers of the cleartext itself. An implementation 3463 MAY dash-escape any line, SHOULD dash-escape lines commencing "From" 3464 followed by a space, and MUST dash-escape any line commencing in a 3465 dash. The message digest is computed using the cleartext itself, not 3466 the dash-escaped form. 3468 As with binary signatures on text documents, a cleartext signature is 3469 calculated on the text using canonical line endings. The 3470 line ending (i.e., the ) before the '-----BEGIN PGP 3471 SIGNATURE-----' line that terminates the signed text is not 3472 considered part of the signed text. 3474 When reversing dash-escaping, an implementation MUST strip the string 3475 "- " if it occurs at the beginning of a line, and SHOULD warn on "-" 3476 and any character other than a space at the beginning of a line. 3478 Also, any trailing whitespace -- spaces (0x20), tabs (0x09) or 3479 carriage returns (0x0d) -- at the end of any line is removed when the 3480 cleartext signature is generated and verified. 3482 8. Regular Expressions 3484 A regular expression is zero or more branches, separated by '|'. It 3485 matches anything that matches one of the branches. 3487 A branch is zero or more pieces, concatenated. It matches a match 3488 for the first, followed by a match for the second, etc. 3490 A piece is an atom possibly followed by '_', '+', or '?'. An atom 3491 followed by '_' matches a sequence of 0 or more matches of the atom. 3492 An atom followed by '+' matches a sequence of 1 or more matches of 3493 the atom. An atom followed by '?' matches a match of the atom, or 3494 the null string. 3496 An atom is a regular expression in parentheses (matching a match for 3497 the regular expression), a range (see below), '.' (matching any 3498 single character), '^' (matching the null string at the beginning of 3499 the input string), '$' (matching the null string at the end of the 3500 input string), a '\' followed by a single character (matching that 3501 character), or a single character with no other significance 3502 (matching that character). 3504 A range is a sequence of characters enclosed in '[]'. It normally 3505 matches any single character from the sequence. If the sequence 3506 begins with '^', it matches any single character not from the rest of 3507 the sequence. If two characters in the sequence are separated by 3508 '-', this is shorthand for the full list of ASCII characters between 3509 them (e.g., '[0-9]' matches any decimal digit). To include a literal 3510 ']' in the sequence, make it the first character (following a 3511 possible '^'). To include a literal '-', make it the first or last 3512 character. 3514 9. Constants 3516 This section describes the constants used in OpenPGP. 3518 Note that these tables are not exhaustive lists; an implementation 3519 MAY implement an algorithm not on these lists, so long as the 3520 algorithm numbers are chosen from the private or experimental 3521 algorithm range. 3523 See the section "Notes on Algorithms" below for more discussion of 3524 the algorithms. 3526 9.1. Public-Key Algorithms 3528 +-----------+----------------------------------------------------+ 3529 | ID | Algorithm | 3530 +-----------+----------------------------------------------------+ 3531 | 1 | RSA (Encrypt or Sign) [HAC] | 3532 | 2 | RSA Encrypt-Only [HAC] | 3533 | 3 | RSA Sign-Only [HAC] | 3534 | 16 | Elgamal (Encrypt-Only) [ELGAMAL] [HAC] | 3535 | 17 | DSA (Digital Signature Algorithm) [FIPS186] [HAC] | 3536 | 18 | ECDH public key algorithm | 3537 | 19 | ECDSA public key algorithm [FIPS186] | 3538 | 20 | Reserved (formerly Elgamal Encrypt or Sign) | 3539 | 21 | Reserved for Diffie-Hellman | 3540 | | (X9.42, as defined for IETF-S/MIME) | 3541 | 22 | EdDSA [RFC8032] | 3542 | 23 | Reserved for AEDH | 3543 | 24 | Reserved for AEDSA | 3544 | 100--110 | Private/Experimental algorithm | 3545 +-----------+----------------------------------------------------+ 3547 Implementations MUST implement RSA (1) and ECDSA (19) for signatures, 3548 and RSA (1) and ECDH (18) for encryption. Implementations SHOULD 3549 implement EdDSA (22) keys. 3551 RSA Encrypt-Only (2) and RSA Sign-Only (3) are deprecated and SHOULD 3552 NOT be generated, but may be interpreted. See Section 14.5. See 3553 Section 14.9 for notes on Elgamal Encrypt or Sign (20), and X9.42 3554 (21). Implementations MAY implement any other algorithm. 3556 Note that implementations conforming to previous versions of this 3557 standard (RFC-4880) have DSA (17) and Elgamal (16) as its only MUST- 3558 implement algorithm. 3560 A compatible specification of ECDSA is given in [RFC6090] as "KT-I 3561 Signatures" and in [SEC1]; ECDH is defined in Section 13.5 this 3562 document. 3564 9.2. ECC Curve OID 3566 The parameter curve OID is an array of octets that define a named 3567 curve. The table below specifies the exact sequence of bytes for 3568 each named curve referenced in this document: 3570 +------------------------+-----+------------------+-----------------+ 3571 | ASN.1 Object | OID | Curve OID bytes | Curve name | 3572 | Identifier | len | in hexadecimal | | 3573 | | | representation | | 3574 +------------------------+-----+------------------+-----------------+ 3575 | 1.2.840.10045.3.1.7 | 8 | 2A 86 48 CE 3D | NIST P-256 | 3576 | | | 03 01 07 | | 3577 | 1.3.132.0.34 | 5 | 2B 81 04 00 22 | NIST P-384 | 3578 | 1.3.132.0.35 | 5 | 2B 81 04 00 23 | NIST P-521 | 3579 | 1.3.36.3.3.2.8.1.1.7 | 9 | 2B 24 03 03 02 | brainpoolP256r1 | 3580 | | | 08 01 01 07 | | 3581 | 1.3.36.3.3.2.8.1.1.13 | 9 | 2B 24 03 03 02 | brainpoolP512r1 | 3582 | | | 08 01 01 0D | | 3583 | 1.3.6.1.4.1.11591.15.1 | 9 | 2B 06 01 04 01 | Ed25519 | 3584 | | | DA 47 0F 01 | | 3585 | 1.3.6.1.4.1.3029.1.5.1 | 10 | 2B 06 01 04 01 | Curve25519 | 3586 | | | 97 55 01 05 01 | | 3587 +------------------------+-----+------------------+-----------------+ 3589 The sequence of octets in the third column is the result of applying 3590 the Distinguished Encoding Rules (DER) to the ASN.1 Object Identifier 3591 with subsequent truncation. The truncation removes the two fields of 3592 encoded Object Identifier. The first omitted field is one octet 3593 representing the Object Identifier tag, and the second omitted field 3594 is the length of the Object Identifier body. For example, the 3595 complete ASN.1 DER encoding for the NIST P-256 curve OID is "06 08 2A 3596 86 48 CE 3D 03 01 07", from which the first entry in the table above 3597 is constructed by omitting the first two octets. Only the truncated 3598 sequence of octets is the valid representation of a curve OID. 3600 9.3. Symmetric-Key Algorithms 3602 +-----------+-----------------------------------------------+ 3603 | ID | Algorithm | 3604 +-----------+-----------------------------------------------+ 3605 | 0 | Plaintext or unencrypted data | 3606 | 1 | IDEA [IDEA] | 3607 | 2 | TripleDES (DES-EDE, [SCHNEIER] [HAC] | 3608 | | - 168 bit key derived from 192) | 3609 | 3 | CAST5 (128 bit key, as per [RFC2144]) | 3610 | 4 | Blowfish (128 bit key, 16 rounds) [BLOWFISH] | 3611 | 5 | Reserved | 3612 | 6 | Reserved | 3613 | 7 | AES with 128-bit key [AES] | 3614 | 8 | AES with 192-bit key | 3615 | 9 | AES with 256-bit key | 3616 | 10 | Twofish with 256-bit key [TWOFISH] | 3617 | 11 | Camellia with 128-bit key [RFC3713] | 3618 | 12 | Camellia with 192-bit key | 3619 | 13 | Camellia with 256-bit key | 3620 | 100--110 | Private/Experimental algorithm | 3621 +-----------+-----------------------------------------------+ 3623 Implementations MUST implement AES-128. Implementations SHOULD 3624 implement AES-256. Implementations that interoperate with RFC-4880 3625 implementations need to support TripleDES and CAST5. Implementations 3626 that interoperate with PGP 2.6 or earlier need to support IDEA, as 3627 that is the only symmetric cipher those versions use. 3628 Implementations MAY implement any other algorithm. 3630 9.4. Compression Algorithms 3632 +-----------+---------------------------------+ 3633 | ID | Algorithm | 3634 +-----------+---------------------------------+ 3635 | 0 | Uncompressed | 3636 | 1 | ZIP [RFC1951] | 3637 | 2 | ZLIB [RFC1950] | 3638 | 3 | BZip2 [BZ2] | 3639 | 100--110 | Private/Experimental algorithm | 3640 +-----------+---------------------------------+ 3642 Implementations MUST implement uncompressed data. Implementations 3643 SHOULD implement ZLIB. For interoperability reasons implementations 3644 SHOULD be able to decompress using ZIP. Implementations MAY 3645 implement any other algorithm. 3647 9.5. Hash Algorithms 3649 +-----------+---------------------------------+--------------+ 3650 | ID | Algorithm | Text Name | 3651 +-----------+---------------------------------+--------------+ 3652 | 1 | MD5 [HAC] | "MD5" | 3653 | 2 | SHA-1 [FIPS180] | "SHA1" | 3654 | 3 | RIPE-MD/160 [HAC] | "RIPEMD160" | 3655 | 4 | Reserved | | 3656 | 5 | Reserved | | 3657 | 6 | Reserved | | 3658 | 7 | Reserved | | 3659 | 8 | SHA2-256 [FIPS180] | "SHA256" | 3660 | 9 | SHA2-384 [FIPS180] | "SHA384" | 3661 | 10 | SHA2-512 [FIPS180] | "SHA512" | 3662 | 11 | SHA2-224 [FIPS180] | "SHA224" | 3663 | 12 | SHA3-256 [FIPS202] | "SHA3-256" | 3664 | 13 | Reserved | | 3665 | 14 | SHA3-512 [FIPS202] | "SHA3-512" | 3666 | 100--110 | Private/Experimental algorithm | | 3667 +-----------+---------------------------------+--------------+ 3669 Implementations MUST implement SHA2-256. Implementations MAY 3670 implement other algorithms. Implementations SHOULD NOT create 3671 messages which require the use of SHA-1 with the exception of 3672 computing version 4 key fingerprints and for purposes of the MDC 3673 packet. Implementations SHOULD NOT use MD5 or RIPE-MD/160. 3675 9.6. AEAD Algorithms 3677 +-----------+---------------------------------+ 3678 | ID | Algorithm | 3679 +-----------+---------------------------------+ 3680 | 1 | EAX [EAX] | 3681 | 2 | OCB [RFC7253] | 3682 | 100--110 | Private/Experimental algorithm | 3683 +-----------+---------------------------------+ 3685 Implementations MUST implement EAX. Implementations MAY implement 3686 OCB and other algorithms. 3688 10. IANA Considerations 3690 OpenPGP is highly parameterized, and consequently there are a number 3691 of considerations for allocating parameters for extensions. This 3692 section describes how IANA should look at extensions to the protocol 3693 as described in this document. 3695 { FIXME: Also add forward references, like "The list of S2K specifier 3696 types is maintained by IANA as described in Section 10." } 3698 10.1. New String-to-Key Specifier Types 3700 OpenPGP S2K specifiers contain a mechanism for new algorithms to turn 3701 a string into a key. This specification creates a registry of S2K 3702 specifier types. The registry includes the S2K type, the name of the 3703 S2K, and a reference to the defining specification. The initial 3704 values for this registry can be found in Section 3.7.1. Adding a new 3705 S2K specifier MUST be done through the SPECIFICATION REQUIRED method, 3706 as described in [RFC8126]. 3708 10.2. New Packets 3710 Major new features of OpenPGP are defined through new packet types. 3711 This specification creates a registry of packet types. The registry 3712 includes the packet type, the name of the packet, and a reference to 3713 the defining specification. The initial values for this registry can 3714 be found in Section 4.3. Adding a new packet type MUST be done 3715 through the RFC REQUIRED method, as described in [RFC8126]. 3717 10.2.1. User Attribute Types 3719 The User Attribute packet permits an extensible mechanism for other 3720 types of certificate identification. This specification creates a 3721 registry of User Attribute types. The registry includes the User 3722 Attribute type, the name of the User Attribute, and a reference to 3723 the defining specification. The initial values for this registry can 3724 be found in Section 5.13. Adding a new User Attribute type MUST be 3725 done through the SPECIFICATION REQUIRED method, as described in 3726 [RFC8126]. 3728 This document requests that IANA register the User ID Attribute Type 3729 found in Section 5.13.2: 3731 +--------+------------+-------------------------------+ 3732 | Value | Attribute | Reference | 3733 +--------+------------+-------------------------------+ 3734 | TBD1 | User ID | This Document Section 5.13.2 | 3735 +--------+------------+-------------------------------+ 3737 10.2.2. Image Format Subpacket Types 3739 Within User Attribute packets, there is an extensible mechanism for 3740 other types of image-based user attributes. This specification 3741 creates a registry of Image Attribute subpacket types. The registry 3742 includes the Image Attribute subpacket type, the name of the Image 3743 Attribute subpacket, and a reference to the defining specification. 3744 The initial values for this registry can be found in Section 5.13.1. 3745 Adding a new Image Attribute subpacket type MUST be done through the 3746 SPECIFICATION REQUIRED method, as described in [RFC8126]. 3748 10.2.3. New Signature Subpackets 3750 OpenPGP signatures contain a mechanism for signed (or unsigned) data 3751 to be added to them for a variety of purposes in the Signature 3752 subpackets as discussed in Section 5.2.3.1. This specification 3753 creates a registry of Signature subpacket types. The registry 3754 includes the Signature subpacket type, the name of the subpacket, and 3755 a reference to the defining specification. The initial values for 3756 this registry can be found in Section 5.2.3.1. Adding a new 3757 Signature subpacket MUST be done through the SPECIFICATION REQUIRED 3758 method, as described in [RFC8126]. 3760 10.2.3.1. Signature Notation Data Subpackets 3762 OpenPGP signatures further contain a mechanism for extensions in 3763 signatures. These are the Notation Data subpackets, which contain a 3764 key/value pair. Notations contain a user space that is completely 3765 unmanaged and an IETF space. 3767 This specification creates a registry of Signature Notation Data 3768 types. The registry includes the Signature Notation Data type, the 3769 name of the Signature Notation Data, its allowed values, and a 3770 reference to the defining specification. The initial values for this 3771 registry can be found in Section 5.2.3.17. Adding a new Signature 3772 Notation Data subpacket MUST be done through the SPECIFICATION 3773 REQUIRED method, as described in [RFC8126]. 3775 This document requests IANA register the following Signature Notation 3776 Data types: 3778 +------------+---------+--------------------+-----------------------+ 3779 | Allowed | Name | Type | Reference | 3780 | Values | | | | 3781 +------------+---------+--------------------+-----------------------+ 3782 | A String | charset | Character Set | This Doc Section | 3783 | | | | 5.2.3.17.1 | 3784 | Any String | manu | Manufacturer Name | This Doc Section | 3785 | | | | 5.2.3.17.2 | 3786 | Any String | make | Product Make | This Doc Section | 3787 | | | | 5.2.3.17.3 | 3788 | Any String | model | Product Model | This Doc Section | 3789 | | | | 5.2.3.17.4 | 3790 | Any String | prodid | Product ID | This Doc Section | 3791 | | | | 5.2.3.17.5 | 3792 | Any String | pvers | Product Version | This Doc Section | 3793 | | | | 5.2.3.17.6 | 3794 | Any String | lot | Product Lot Number | This Doc Section | 3795 | | | | 5.2.3.17.7 | 3796 | Decimal | qty | Package Quantity | This Doc Section | 3797 | Integer | | | 5.2.3.17.8 | 3798 | String | | | | 3799 | A geo: URI | loc | Current Geo- | This Doc Section | 3800 | | | | 5.2.3.17.9 | 3801 | without | | location | | 3802 | the | | | | 3803 | "geo:" | | Latitude/Longitude | | 3804 | A geo: URI | dest | Destination Geo- | This Doc Section | 3805 | | | | 5.2.3.17.9 | 3806 | without | | location | | 3807 | the | | | | 3808 | "geo:" | | Latitude/Longitude | | 3809 | Hash | hash | The Hash of | This Doc Section | 3810 | Notation | | | 5.2.3.17.10 | 3811 | data | | external data | | 3812 +------------+---------+--------------------+-----------------------+ 3814 10.2.3.2. Signature Notation Data Subpacket Notation Flags 3816 This specification creates a new registry of Signature Notation Data 3817 Subpacket Notation Flags. The registry includes the columns "Flag", 3818 "Description", "Security Recommended", "Interoperability 3819 Recommended", and "Reference". The initial values for this registry 3820 can be found in Section 5.2.3.17. Adding a new item MUST be done 3821 through the SPECIFICATION REQUIRED method, as described in [RFC8126]. 3823 10.2.3.3. Key Server Preference Extensions 3825 OpenPGP signatures contain a mechanism for preferences to be 3826 specified about key servers. This specification creates a registry 3827 of key server preferences. The registry includes the key server 3828 preference, the name of the preference, and a reference to the 3829 defining specification. The initial values for this registry can be 3830 found in Section 5.2.3.18. Adding a new key server preference MUST 3831 be done through the SPECIFICATION REQUIRED method, as described in 3832 [RFC8126]. 3834 10.2.3.4. Key Flags Extensions 3836 OpenPGP signatures contain a mechanism for flags to be specified 3837 about key usage. This specification creates a registry of key usage 3838 flags. The registry includes the key flags value, the name of the 3839 flag, and a reference to the defining specification. The initial 3840 values for this registry can be found in Section 5.2.3.22. Adding a 3841 new key usage flag MUST be done through the SPECIFICATION REQUIRED 3842 method, as described in [RFC8126]. 3844 10.2.3.5. Reason for Revocation Extensions 3846 OpenPGP signatures contain a mechanism for flags to be specified 3847 about why a key was revoked. This specification creates a registry 3848 of "Reason for Revocation" flags. The registry includes the "Reason 3849 for Revocation" flags value, the name of the flag, and a reference to 3850 the defining specification. The initial values for this registry can 3851 be found in Section 5.2.3.24. Adding a new feature flag MUST be done 3852 through the SPECIFICATION REQUIRED method, as described in [RFC8126]. 3854 10.2.3.6. Implementation Features 3856 OpenPGP signatures contain a mechanism for flags to be specified 3857 stating which optional features an implementation supports. This 3858 specification creates a registry of feature-implementation flags. 3859 The registry includes the feature-implementation flags value, the 3860 name of the flag, and a reference to the defining specification. The 3861 initial values for this registry can be found in Section 5.2.3.25. 3862 Adding a new feature-implementation flag MUST be done through the 3863 SPECIFICATION REQUIRED method, as described in [RFC8126]. 3865 Also see Section 14.12 for more information about when feature flags 3866 are needed. 3868 10.2.4. New Packet Versions 3870 The core OpenPGP packets all have version numbers, and can be revised 3871 by introducing a new version of an existing packet. This 3872 specification creates a registry of packet types. The registry 3873 includes the packet type, the number of the version, and a reference 3874 to the defining specification. The initial values for this registry 3875 can be found in Section 5. Adding a new packet version MUST be done 3876 through the RFC REQUIRED method, as described in [RFC8126]. 3878 10.3. New Algorithms 3880 Section 9 lists the core algorithms that OpenPGP uses. Adding in a 3881 new algorithm is usually simple. For example, adding in a new 3882 symmetric cipher usually would not need anything more than allocating 3883 a constant for that cipher. If that cipher had other than a 64-bit 3884 or 128-bit block size, there might need to be additional 3885 documentation describing how OpenPGP-CFB mode would be adjusted. 3886 Similarly, when DSA was expanded from a maximum of 1024-bit public 3887 keys to 3072-bit public keys, the revision of FIPS 186 contained 3888 enough information itself to allow implementation. Changes to this 3889 document were made mainly for emphasis. 3891 10.3.1. Public-Key Algorithms 3893 OpenPGP specifies a number of public-key algorithms. This 3894 specification creates a registry of public-key algorithm identifiers. 3895 The registry includes the algorithm name, its key sizes and 3896 parameters, and a reference to the defining specification. The 3897 initial values for this registry can be found in Section 9.1. Adding 3898 a new public-key algorithm MUST be done through the SPECIFICATION 3899 REQUIRED method, as described in [RFC8126]. 3901 This document requests IANA register the following new public-key 3902 algorithm: 3904 +-----+-----------------------------+-------------------------+ 3905 | ID | Algorithm | Reference | 3906 +-----+-----------------------------+-------------------------+ 3907 | 22 | EdDSA public key algorithm | This doc, Section 14.8 | 3908 | 23 | Reserved for AEDH | This doc | 3909 | 24 | Reserved for AEDSA | This doc | 3910 +-----+-----------------------------+-------------------------+ 3912 [Notes to RFC-Editor: Please remove the table above on publication. 3913 It is desirable not to reuse old or reserved algorithms because some 3914 existing tools might print a wrong description. A higher number is 3915 also an indication for a newer algorithm. As of now 22 is the next 3916 free number.] 3918 10.3.2. Symmetric-Key Algorithms 3920 OpenPGP specifies a number of symmetric-key algorithms. This 3921 specification creates a registry of symmetric-key algorithm 3922 identifiers. The registry includes the algorithm name, its key sizes 3923 and block size, and a reference to the defining specification. The 3924 initial values for this registry can be found in Section 9.3. Adding 3925 a new symmetric-key algorithm MUST be done through the SPECIFICATION 3926 REQUIRED method, as described in [RFC8126]. 3928 10.3.3. Hash Algorithms 3930 OpenPGP specifies a number of hash algorithms. This specification 3931 creates a registry of hash algorithm identifiers. The registry 3932 includes the algorithm name, a text representation of that name, its 3933 block size, an OID hash prefix, and a reference to the defining 3934 specification. The initial values for this registry can be found in 3935 Section 9.5 for the algorithm identifiers and text names, and 3936 Section 9.2 for the OIDs and expanded signature prefixes. Adding a 3937 new hash algorithm MUST be done through the SPECIFICATION REQUIRED 3938 method, as described in [RFC8126]. 3940 This document requests IANA register the following hash algorithms: 3942 +-----+------------+------------+ 3943 | ID | Algorithm | Reference | 3944 +-----+------------+------------+ 3945 | 12 | SHA3-256 | This doc | 3946 | 13 | Reserved | | 3947 | 14 | SHA3-512 | This doc | 3948 +-----+------------+------------+ 3950 [Notes to RFC-Editor: Please remove the table above on publication. 3951 It is desirable not to reuse old or reserved algorithms because some 3952 existing tools might print a wrong description. The ID 13 has been 3953 reserved so that the SHA3 algorithm IDs align nicely with their SHA2 3954 counterparts.] 3956 10.3.4. Compression Algorithms 3958 OpenPGP specifies a number of compression algorithms. This 3959 specification creates a registry of compression algorithm 3960 identifiers. The registry includes the algorithm name and a 3961 reference to the defining specification. The initial values for this 3962 registry can be found in Section 9.4. Adding a new compression key 3963 algorithm MUST be done through the SPECIFICATION REQUIRED method, as 3964 described in [RFC8126]. 3966 11. Packet Composition 3968 OpenPGP packets are assembled into sequences in order to create 3969 messages and to transfer keys. Not all possible packet sequences are 3970 meaningful and correct. This section describes the rules for how 3971 packets should be placed into sequences. 3973 11.1. Transferable Public Keys 3975 OpenPGP users may transfer public keys. The essential elements of a 3976 transferable public key are as follows: 3978 o One Public-Key packet 3980 o Zero or more revocation signatures 3982 o Zero or more User ID packets 3984 o After each User ID packet, zero or more Signature packets 3985 (certifications and attestation key signatures) 3987 o Zero or more User Attribute packets 3989 o After each User Attribute packet, zero or more Signature packets 3990 (certifications and attestation key signatures) 3992 o Zero or more Subkey packets 3994 o After each Subkey packet, one Signature packet, plus optionally a 3995 revocation 3997 The Public-Key packet occurs first. Each of the following User ID 3998 packets provides the identity of the owner of this public key. If 3999 there are multiple User ID packets, this corresponds to multiple 4000 means of identifying the same unique individual user; for example, a 4001 user may have more than one email address, and construct a User ID 4002 for each one. 4004 Immediately following each User ID packet, there are zero or more 4005 Signature packets. Each Signature packet is calculated on the 4006 immediately preceding User ID packet and the initial Public-Key 4007 packet. The signature serves to certify the corresponding public key 4008 and User ID. In effect, the signer is testifying to his or her 4009 belief that this public key belongs to the user identified by this 4010 User ID. Intermixed with these certifications may be Attestation Key 4011 Signature packets issued by the primary key over the same User ID and 4012 Public Key packet. The most recent of these is used to attest to 4013 third-party certifications over the associated User ID. 4015 Within the same section as the User ID packets, there are zero or 4016 more User Attribute packets. Like the User ID packets, a User 4017 Attribute packet is followed by zero or more Signature packets 4018 calculated on the immediately preceding User Attribute packet and the 4019 initial Public-Key packet. 4021 User Attribute packets and User ID packets may be freely intermixed 4022 in this section, so long as the signatures that follow them are 4023 maintained on the proper User Attribute or User ID packet. 4025 After the User ID packet or Attribute packet, there may be zero or 4026 more Subkey packets. In general, subkeys are provided in cases where 4027 the top-level public key is a signature-only key. However, any V4 or 4028 V5 key may have subkeys, and the subkeys may be encryption-only keys, 4029 signature-only keys, or general-purpose keys. V3 keys MUST NOT have 4030 subkeys. 4032 Each Subkey packet MUST be followed by one Signature packet, which 4033 should be a subkey binding signature issued by the top-level key. 4034 For subkeys that can issue signatures, the subkey binding signature 4035 MUST contain an Embedded Signature subpacket with a primary key 4036 binding signature (0x19) issued by the subkey on the top-level key. 4038 Subkey and Key packets may each be followed by a revocation Signature 4039 packet to indicate that the key is revoked. Revocation signatures 4040 are only accepted if they are issued by the key itself, or by a key 4041 that is authorized to issue revocations via a Revocation Key 4042 subpacket in a self-signature by the top-level key. 4044 Transferable public-key packet sequences may be concatenated to allow 4045 transferring multiple public keys in one operation. 4047 11.2. Transferable Secret Keys 4049 OpenPGP users may transfer secret keys. The format of a transferable 4050 secret key is the same as a transferable public key except that 4051 secret-key and secret-subkey packets are used instead of the public 4052 key and public-subkey packets. Implementations SHOULD include self- 4053 signatures on any user IDs and subkeys, as this allows for a complete 4054 public key to be automatically extracted from the transferable secret 4055 key. Implementations MAY choose to omit the self-signatures, 4056 especially if a transferable public key accompanies the transferable 4057 secret key. 4059 11.3. OpenPGP Messages 4061 An OpenPGP message is a packet or sequence of packets that 4062 corresponds to the following grammatical rules (comma represents 4063 sequential composition, and vertical bar separates alternatives): 4065 OpenPGP Message :- Encrypted Message | Signed Message | 4066 Compressed Message | Literal Message. 4068 Compressed Message :- Compressed Data Packet. 4070 Literal Message :- Literal Data Packet. 4072 ESK :- Public-Key Encrypted Session Key Packet | 4073 Symmetric-Key Encrypted Session Key Packet. 4075 ESK Sequence :- ESK | ESK Sequence, ESK. 4077 Encrypted Data :- Symmetrically Encrypted Data Packet | 4078 Symmetrically Encrypted Integrity Protected Data Packet 4080 Encrypted Message :- Encrypted Data | ESK Sequence, Encrypted Data. 4082 One-Pass Signed Message :- One-Pass Signature Packet, 4083 OpenPGP Message, Corresponding Signature Packet. 4085 Signed Message :- Signature Packet, OpenPGP Message | 4086 One-Pass Signed Message. 4088 In addition, decrypting a Symmetrically Encrypted Data packet or a 4089 Symmetrically Encrypted Integrity Protected Data packet as well as 4090 decompressing a Compressed Data packet must yield a valid OpenPGP 4091 Message. 4093 11.4. Detached Signatures 4095 Some OpenPGP applications use so-called "detached signatures". For 4096 example, a program bundle may contain a file, and with it a second 4097 file that is a detached signature of the first file. These detached 4098 signatures are simply a Signature packet stored separately from the 4099 data for which they are a signature. 4101 12. Enhanced Key Formats 4102 12.1. Key Structures 4104 The format of an OpenPGP V3 key is as follows. Entries in square 4105 brackets are optional and ellipses indicate repetition. 4107 RSA Public Key 4108 [Revocation Self Signature] 4109 User ID [Signature ...] 4110 [User ID [Signature ...] ...] 4112 Each signature certifies the RSA public key and the preceding User 4113 ID. The RSA public key can have many User IDs and each User ID can 4114 have many signatures. V3 keys are deprecated. Implementations MUST 4115 NOT generate new V3 keys, but MAY continue to use existing ones. 4117 The format of an OpenPGP V4 key that uses multiple public keys is 4118 similar except that the other keys are added to the end as "subkeys" 4119 of the primary key. 4121 Primary-Key 4122 [Revocation Self Signature] 4123 [Direct Key Signature...] 4124 [User ID [Signature ...] ...] 4125 [User Attribute [Signature ...] ...] 4126 [[Subkey [Binding-Signature-Revocation] 4127 Primary-Key-Binding-Signature] ...] 4129 A subkey always has a single signature after it that is issued using 4130 the primary key to tie the two keys together. This binding signature 4131 may be in either V3 or V4 format, but SHOULD be V4. Subkeys that can 4132 issue signatures MUST have a V4 binding signature due to the REQUIRED 4133 embedded primary key binding signature. 4135 In the above diagram, if the binding signature of a subkey has been 4136 revoked, the revoked key may be removed, leaving only one key. 4138 In a V4 key, the primary key SHOULD be a key capable of 4139 certification. There are cases, such as device certificates, where 4140 the primary key may not be capable of certification. A primary key 4141 capable of making signatures SHOULD be accompanied by either a 4142 certification signature (on a User ID or User Attribute) or a 4143 signature directly on the key. 4145 Implementations SHOULD accept encryption-only primary keys without a 4146 signature. It also SHOULD allow importing any key accompanied either 4147 by a certification signature or a signature on itself. It MAY accept 4148 signature-capable primary keys without an accompanying signature. 4150 The subkeys may be keys of any other type. There may be other 4151 constructions of V4 keys, too. For example, there may be a single- 4152 key RSA key in V4 format, a DSA primary key with an RSA encryption 4153 key, or RSA primary key with an Elgamal subkey, etc. 4155 It is also possible to have a signature-only subkey. This permits a 4156 primary key that collects certifications (key signatures), but is 4157 used only for certifying subkeys that are used for encryption and 4158 signatures. 4160 12.2. Key IDs and Fingerprints 4162 For a V3 key, the eight-octet Key ID consists of the low 64 bits of 4163 the public modulus of the RSA key. 4165 The fingerprint of a V3 key is formed by hashing the body (but not 4166 the two-octet length) of the MPIs that form the key material (public 4167 modulus n, followed by exponent e) with MD5. Note that both V3 keys 4168 and MD5 are deprecated. 4170 A V4 fingerprint is the 160-bit SHA-1 hash of the octet 0x99, 4171 followed by the two-octet packet length, followed by the entire 4172 Public-Key packet starting with the version field. The Key ID is the 4173 low-order 64 bits of the fingerprint. Here are the fields of the 4174 hash material, with the example of a DSA key: 4176 a.1) 0x99 (1 octet) 4178 a.2) two-octet scalar octet count of (b)-(e) 4180 b) version number = 4 (1 octet); 4182 c) timestamp of key creation (4 octets); 4184 d) algorithm (1 octet): 17 = DSA (example); 4186 e) Algorithm-specific fields. 4188 Algorithm-Specific Fields for DSA keys (example): 4190 e.1) MPI of DSA prime p; 4192 e.2) MPI of DSA group order q (q is a prime divisor of p-1); 4194 e.3) MPI of DSA group generator g; 4196 e.4) MPI of DSA public-key value y (= g\*\*x mod p where x is secret). 4198 A V5 fingerprint is the 256-bit SHA2-256 hash of the octet 0x9A, 4199 followed by the four-octet packet length, followed by the entire 4200 Public-Key packet starting with the version field. The Key ID is the 4201 high-order 64 bits of the fingerprint. Here are the fields of the 4202 hash material, with the example of a DSA key: 4204 a.1) 0x9A (1 octet) 4206 a.2) four-octet scalar octet count of (b)-(f) 4208 b) version number = 5 (1 octet); 4210 c) timestamp of key creation (4 octets); 4212 d) algorithm (1 octet): 17 = DSA (example); 4214 e) four-octet scalar octet count for the following key material; 4216 f) algorithm-specific fields. 4218 Algorithm-Specific Fields for DSA keys (example): 4220 f.1) MPI of DSA prime p; 4222 f.2) MPI of DSA group order q (q is a prime divisor of p-1); 4224 f.3) MPI of DSA group generator g; 4226 f.4) MPI of DSA public-key value y (= g\*\*x mod p where x is secret). 4228 Note that it is possible for there to be collisions of Key IDs -- two 4229 different keys with the same Key ID. Note that there is a much 4230 smaller, but still non-zero, probability that two different keys have 4231 the same fingerprint. 4233 Also note that if V3, V4, and V5 format keys share the same RSA key 4234 material, they will have different Key IDs as well as different 4235 fingerprints. 4237 Finally, the Key ID and fingerprint of a subkey are calculated in the 4238 same way as for a primary key, including the 0x99 (V3 and V4 key) or 4239 0x9A (V5 key) as the first octet (even though this is not a valid 4240 packet ID for a public subkey). 4242 13. Elliptic Curve Cryptography 4244 This section descripes algorithms and parameters used with Elliptic 4245 Curve Cryptography (ECC) keys. A thorough introduction to ECC can be 4246 found in [KOBLITZ]. 4248 13.1. Supported ECC Curves 4250 This document references five named prime field curves, defined in 4251 [FIPS186] as "Curve P-256", "Curve P-384", and "Curve P-521"; and 4252 defined in [RFC5639] as "brainpoolP256r1", and "brainpoolP512r1". 4253 Further curve "Curve25519", defined in [RFC7748] is referenced for 4254 use with Ed25519 (EdDSA signing) and X25519 (encryption). 4256 The named curves are referenced as a sequence of bytes in this 4257 document, called throughout, curve OID. Section 9.2 describes in 4258 detail how this sequence of bytes is formed. 4260 13.2. ECDSA and ECDH Conversion Primitives 4262 This document defines the uncompressed point format for ECDSA and 4263 ECDH and a custom compression format for certain curves. The point 4264 is encoded in the Multiprecision Integer (MPI) format. 4266 For an uncompressed point the content of the MPI is: 4268 B = 04 || x || y 4270 where x and y are coordinates of the point P = (x, y), each encoded 4271 in the big-endian format and zero-padded to the adjusted underlying 4272 field size. The adjusted underlying field size is the underlying 4273 field size that is rounded up to the nearest 8-bit boundary. This 4274 encoding is compatible with the definition given in [SEC1]. 4276 For a custom compressed point the content of the MPI is: 4278 B = 40 || x 4280 where x is the x coordinate of the point P encoded to the rules 4281 defined for the specified curve. This format is used for ECDH keys 4282 based on curves expressed in Montgomery form. 4284 Therefore, the exact size of the MPI payload is 515 bits for "Curve 4285 P-256", 771 for "Curve P-384", 1059 for "Curve P-521", and 263 for 4286 Curve25519. 4288 Even though the zero point, also called the point at infinity, may 4289 occur as a result of arithmetic operations on points of an elliptic 4290 curve, it SHALL NOT appear in data structures defined in this 4291 document. 4293 If other conversion methods are defined in the future, a compliant 4294 application MUST NOT use a new format when in doubt that any 4295 recipient can support it. Consider, for example, that while both the 4296 public key and the per-recipient ECDH data structure, respectively 4297 defined in Section 5.6.6 and Section 5.1, contain an encoded point 4298 field, the format changes to the field in Section 5.1 only affect a 4299 given recipient of a given message. 4301 13.3. EdDSA Point Format 4303 The EdDSA algorithm defines a specific point compression format. To 4304 indicate the use of this compression format and to make sure that the 4305 key can be represented in the Multiprecision Integer (MPI) format the 4306 octet string specifying the point is prefixed with the octet 0x40. 4307 This encoding is an extension of the encoding given in [SEC1] which 4308 uses 0x04 to indicate an uncompressed point. 4310 For example, the length of a public key for the curve Ed25519 is 263 4311 bit: 7 bit to represent the 0x40 prefix octet and 32 octets for the 4312 native value of the public key. 4314 13.4. Key Derivation Function 4316 A key derivation function (KDF) is necessary to implement the EC 4317 encryption. The Concatenation Key Derivation Function (Approved 4318 Alternative 1) [SP800-56A] with the KDF hash function that is 4319 SHA2-256 [FIPS180] or stronger is REQUIRED. See Section 16 for the 4320 details regarding the choice of the hash function. 4322 For convenience, the synopsis of the encoding method is given below 4323 with significant simplifications attributable to the restricted 4324 choice of hash functions in this document. However, [SP800-56A] is 4325 the normative source of the definition. 4327 // Implements KDF( X, oBits, Param ); 4328 // Input: point X = (x,y) 4329 // oBits - the desired size of output 4330 // hBits - the size of output of hash function Hash 4331 // Param - octets representing the parameters 4332 // Assumes that oBits <= hBits 4333 // Convert the point X to the octet string: 4334 // ZB' = 04 || x || y 4335 // and extract the x portion from ZB' 4336 ZB = x; 4337 MB = Hash ( 00 || 00 || 00 || 01 || ZB || Param ); 4338 return oBits leftmost bits of MB. 4340 Note that ZB in the KDF description above is the compact 4341 representation of X, defined in Section 4.2 of [RFC6090]. 4343 13.5. EC DH Algorithm (ECDH) 4345 The method is a combination of an ECC Diffie-Hellman method to 4346 establish a shared secret, a key derivation method to process the 4347 shared secret into a derived key, and a key wrapping method that uses 4348 the derived key to protect a session key used to encrypt a message. 4350 The One-Pass Diffie-Hellman method C(1, 1, ECC CDH) [SP800-56A] MUST 4351 be implemented with the following restrictions: the ECC CDH primitive 4352 employed by this method is modified to always assume the cofactor as 4353 1, the KDF specified in Section 13.4 is used, and the KDF parameters 4354 specified below are used. 4356 The KDF parameters are encoded as a concatenation of the following 5 4357 variable-length and fixed-length fields, compatible with the 4358 definition of the OtherInfo bitstring [SP800-56A]: 4360 o a variable-length field containing a curve OID, formatted as 4361 follows: 4363 * a one-octet size of the following field 4365 * the octets representing a curve OID, defined in Section 9.2 4367 o a one-octet public key algorithm ID defined in Section 9.1 4369 o a variable-length field containing KDF parameters, identical to 4370 the corresponding field in the ECDH public key, formatted as 4371 follows: 4373 * a one-octet size of the following fields; values 0 and 0xff are 4374 reserved for future extensions 4376 * a one-octet value 01, reserved for future extensions 4378 * a one-octet hash function ID used with the KDF 4380 * a one-octet algorithm ID for the symmetric algorithm used to 4381 wrap the symmetric key for message encryption; see Section 13.5 4382 for details 4384 o 20 octets representing the UTF-8 encoding of the string "Anonymous 4385 Sender ", which is the octet sequence 41 6E 6F 6E 79 6D 6F 75 73 4386 20 53 65 6E 64 65 72 20 20 20 20 4388 o 20 octets representing a recipient encryption subkey or a master 4389 key fingerprint, identifying the key material that is needed for 4390 the decryption. For version 5 keys the 20 leftmost octets of the 4391 fingerprint are used. 4393 The size of the KDF parameters sequence, defined above, is either 54 4394 for the NIST curve P-256, 51 for the curves P-384 and P-521, or 56 4395 for Curve25519. 4397 The key wrapping method is described in [RFC3394]. KDF produces a 4398 symmetric key that is used as a key-encryption key (KEK) as specified 4399 in [RFC3394]. Refer to Section 15 for the details regarding the 4400 choice of the KEK algorithm, which SHOULD be one of three AES 4401 algorithms. Key wrapping and unwrapping is performed with the 4402 default initial value of [RFC3394]. 4404 The input to the key wrapping method is the value "m" derived from 4405 the session key, as described in Section 5.1, "Public-Key Encrypted 4406 Session Key Packets (Tag 1)", except that the PKCS #1.5 padding step 4407 is omitted. The result is padded using the method described in 4408 [PKCS5] to the 8-byte granularity. For example, the following 4409 AES-256 session key, in which 32 octets are denoted from k0 to k31, 4410 is composed to form the following 40 octet sequence: 4412 09 k0 k1 ... k31 c0 c1 05 05 05 05 05 4414 The octets c0 and c1 above denote the checksum. This encoding allows 4415 the sender to obfuscate the size of the symmetric encryption key used 4416 to encrypt the data. For example, assuming that an AES algorithm is 4417 used for the session key, the sender MAY use 21, 13, and 5 bytes of 4418 padding for AES-128, AES-192, and AES-256, respectively, to provide 4419 the same number of octets, 40 total, as an input to the key wrapping 4420 method. 4422 The output of the method consists of two fields. The first field is 4423 the MPI containing the ephemeral key used to establish the shared 4424 secret. The second field is composed of the following two fields: 4426 o a one-octet encoding the size in octets of the result of the key 4427 wrapping method; the value 255 is reserved for future extensions; 4429 o up to 254 octets representing the result of the key wrapping 4430 method, applied to the 8-byte padded session key, as described 4431 above. 4433 Note that for session key sizes 128, 192, and 256 bits, the size of 4434 the result of the key wrapping method is, respectively, 32, 40, and 4435 48 octets, unless the size obfuscation is used. 4437 For convenience, the synopsis of the encoding method is given below; 4438 however, this section, [SP800-56A], and [RFC3394] are the normative 4439 sources of the definition. 4441 Obtain the authenticated recipient public key R 4442 Generate an ephemeral key pair {v, V=vG} 4443 Compute the shared point S = vR; 4444 m = symm_alg_ID || session key || checksum || pkcs5_padding; 4445 curve_OID_len = (byte)len(curve_OID); 4446 Param = curve_OID_len || curve_OID || public_key_alg_ID || 03 4447 || 01 || KDF_hash_ID || KEK_alg_ID for AESKeyWrap || "Anonymous 4448 Sender " || recipient_fingerprint; 4449 Z_len = the key size for the KEK_alg_ID used with AESKeyWrap 4450 Compute Z = KDF( S, Z_len, Param ); 4451 Compute C = AESKeyWrap( Z, m ) as per [RFC3394] 4452 VB = convert point V to the octet string 4453 Output (MPI(VB) || len(C) || C). 4455 The decryption is the inverse of the method given. Note that the 4456 recipient obtains the shared secret by calculating 4458 S = rV = rvG, where (r,R) is the recipient's key pair. 4460 Consistent with Section 5.16, "AEAD Encrypted Data Packet (Tag 20)" 4461 and Section 5.14, "Sym. Encrypted Integrity Protected Data Packet 4462 (Tag 18)", AEAD encryption or a Modification Detection Code (MDC) 4463 MUST be used anytime the symmetric key is protected by ECDH. 4465 14. Notes on Algorithms 4466 14.1. PKCS#1 Encoding in OpenPGP 4468 This standard makes use of the PKCS#1 functions EME-PKCS1-v1_5 and 4469 EMSA-PKCS1-v1_5. However, the calling conventions of these functions 4470 has changed in the past. To avoid potential confusion and 4471 interoperability problems, we are including local copies in this 4472 document, adapted from those in PKCS#1 v2.1 [RFC3447]. RFC 3447 4473 should be treated as the ultimate authority on PKCS#1 for OpenPGP. 4474 Nonetheless, we believe that there is value in having a self- 4475 contained document that avoids problems in the future with needed 4476 changes in the conventions. 4478 14.1.1. EME-PKCS1-v1_5-ENCODE 4480 Input: 4482 k = the length in octets of the key modulus. 4484 M = message to be encoded, an octet string of length mLen, 4485 where mLen <= k - 11. 4487 Output: 4489 EM = encoded message, an octet string of length k. 4491 Error: "message too long". 4493 1. Length checking: If mLen > k - 11, output "message too long" 4494 and stop. 4496 2. Generate an octet string PS of length k - mLen - 3 consisting 4497 of pseudo-randomly generated nonzero octets. The length of PS 4498 will be at least eight octets. 4500 3. Concatenate PS, the message M, and other padding to form an 4501 encoded message EM of length k octets as 4503 EM = 0x00 || 0x02 || PS || 0x00 || M. 4505 4. Output EM. 4507 14.1.2. EME-PKCS1-v1_5-DECODE 4508 Input: 4510 EM = encoded message, an octet string 4512 Output: 4514 M = message, an octet string, 4516 Error: "decryption error", 4518 To decode an EME-PKCS1_v1_5 message, separate the encoded message EM 4519 into an octet string PS consisting of nonzero octets and a message M 4520 as follows 4522 EM = 0x00 || 0x02 || PS || 0x00 || M. 4524 If the first octet of EM does not have hexadecimal value 0x00, if the 4525 second octet of EM does not have hexadecimal value 0x02, if there is 4526 no octet with hexadecimal value 0x00 to separate PS from M, or if the 4527 length of PS is less than 8 octets, output "decryption error" and 4528 stop. See also the security note in Section 15 regarding differences 4529 in reporting between a decryption error and a padding error. 4531 14.1.3. EMSA-PKCS1-v1_5 4533 This encoding method is deterministic and only has an encoding 4534 operation. 4536 Option: 4538 Hash - a hash function in which hLen denotes the length in octets 4539 of the hash function output. 4541 Input: 4543 M = message to be encoded. 4545 emLen = intended length in octets of the encoded message, at least 4546 tLen + 11, where tLen is the octet length of the DER encoding 4547 T of a certain value computed during the encoding operation. 4549 Output: 4551 EM = encoded message, an octet string of length emLen. 4553 Errors: "message too long"; 4554 "intended encoded message length too short". 4556 Steps: 4558 1. Apply the hash function to the message M to produce a hash 4559 value H: 4561 H = Hash(M). 4563 If the hash function outputs "message too long," output 4564 "message too long" and stop. 4566 2. Using the list in Section {FIXREF} 5.2.2, "Version 2 Signature Packet 4567 Format", produce an ASN.1 DER value for the hash function 4568 used. Let T be the full hash prefix from the list, and let 4569 tLen be the length in octets of T. 4571 3. If emLen < tLen + 11, output "intended encoded message length 4572 too short" and stop. 4574 4. Generate an octet string PS consisting of emLen - tLen - 3 4575 octets with hexadecimal value 0xFF. The length of PS will be 4576 at least 8 octets. 4578 5. Concatenate PS, the hash prefix T, and other padding to form 4579 the encoded message EM as 4581 EM = 0x00 || 0x01 || PS || 0x00 || T. 4583 6. Output EM. 4585 14.2. Symmetric Algorithm Preferences 4587 The symmetric algorithm preference is an ordered list of algorithms 4588 that the keyholder accepts. Since it is found on a self-signature, 4589 it is possible that a keyholder may have multiple, different 4590 preferences. For example, Alice may have AES-128 only specified for 4591 "alice@work.com" but Camellia-256, Twofish, and AES-128 specified for 4592 "alice@home.org". Note that it is also possible for preferences to 4593 be in a subkey's binding signature. 4595 Since AES-128 is the MUST-implement algorithm, if it is not 4596 explicitly in the list, it is tacitly at the end. However, it is 4597 good form to place it there explicitly. Note also that if an 4598 implementation does not implement the preference, then it is 4599 implicitly an AES-128-only implementation. Note further that 4600 implementations conforming to previous versions of this standard 4601 (RFC-4880) have TripleDES as its only MUST-implement algorithm. 4603 An implementation MUST NOT use a symmetric algorithm that is not in 4604 the recipient's preference list. When encrypting to more than one 4605 recipient, the implementation finds a suitable algorithm by taking 4606 the intersection of the preferences of the recipients. Note that the 4607 MUST-implement algorithm, AES-128, ensures that the intersection is 4608 not null. The implementation may use any mechanism to pick an 4609 algorithm in the intersection. 4611 If an implementation can decrypt a message that a keyholder doesn't 4612 have in their preferences, the implementation SHOULD decrypt the 4613 message anyway, but MUST warn the keyholder that the protocol has 4614 been violated. For example, suppose that Alice, above, has software 4615 that implements all algorithms in this specification. Nonetheless, 4616 she prefers subsets for work or home. If she is sent a message 4617 encrypted with IDEA, which is not in her preferences, the software 4618 warns her that someone sent her an IDEA-encrypted message, but it 4619 would ideally decrypt it anyway. 4621 14.3. Other Algorithm Preferences 4623 Other algorithm preferences work similarly to the symmetric algorithm 4624 preference, in that they specify which algorithms the keyholder 4625 accepts. There are two interesting cases that other comments need to 4626 be made about, though, the compression preferences and the hash 4627 preferences. 4629 14.3.1. Compression Preferences 4631 Compression has been an integral part of PGP since its first days. 4632 OpenPGP and all previous versions of PGP have offered compression. 4633 In this specification, the default is for messages to be compressed, 4634 although an implementation is not required to do so. Consequently, 4635 the compression preference gives a way for a keyholder to request 4636 that messages not be compressed, presumably because they are using a 4637 minimal implementation that does not include compression. 4638 Additionally, this gives a keyholder a way to state that it can 4639 support alternate algorithms. 4641 Like the algorithm preferences, an implementation MUST NOT use an 4642 algorithm that is not in the preference vector. If the preferences 4643 are not present, then they are assumed to be [ZIP(1), 4644 Uncompressed(0)]. 4646 Additionally, an implementation MUST implement this preference to the 4647 degree of recognizing when to send an uncompressed message. A robust 4648 implementation would satisfy this requirement by looking at the 4649 recipient's preference and acting accordingly. A minimal 4650 implementation can satisfy this requirement by never generating a 4651 compressed message, since all implementations can handle messages 4652 that have not been compressed. 4654 14.3.2. Hash Algorithm Preferences 4656 Typically, the choice of a hash algorithm is something the signer 4657 does, rather than the verifier, because a signer rarely knows who is 4658 going to be verifying the signature. This preference, though, allows 4659 a protocol based upon digital signatures ease in negotiation. 4661 Thus, if Alice is authenticating herself to Bob with a signature, it 4662 makes sense for her to use a hash algorithm that Bob's software uses. 4663 This preference allows Bob to state in his key which algorithms Alice 4664 may use. 4666 Since SHA2-256 is the MUST-implement hash algorithm, if it is not 4667 explicitly in the list, it is tacitly at the end. However, it is 4668 good form to place it there explicitly. 4670 14.4. Plaintext 4672 Algorithm 0, "plaintext", may only be used to denote secret keys that 4673 are stored in the clear. Implementations MUST NOT use plaintext in 4674 Symmetrically Encrypted Data packets; they must use Literal Data 4675 packets to encode unencrypted or literal data. 4677 14.5. RSA 4679 There are algorithm types for RSA Sign-Only, and RSA Encrypt-Only 4680 keys. These types are deprecated. The "key flags" subpacket in a 4681 signature is a much better way to express the same idea, and 4682 generalizes it to all algorithms. An implementation SHOULD NOT 4683 create such a key, but MAY interpret it. 4685 An implementation SHOULD NOT implement RSA keys of size less than 4686 1024 bits. 4688 14.6. DSA 4690 An implementation SHOULD NOT implement DSA keys of size less than 4691 1024 bits. It MUST NOT implement a DSA key with a q size of less 4692 than 160 bits. DSA keys MUST also be a multiple of 64 bits, and the 4693 q size MUST be a multiple of 8 bits. The Digital Signature Standard 4694 (DSS) [FIPS186] specifies that DSA be used in one of the following 4695 ways: 4697 o 1024-bit key, 160-bit q, SHA-1, SHA2--224, SHA2-256, SHA2-384, or 4698 SHA2-512 hash 4700 o 2048-bit key, 224-bit q, SHA2-224, SHA2-256, SHA2-384, or SHA2-512 4701 hash 4703 o 2048-bit key, 256-bit q, SHA2-256, SHA2-384, or SHA2-512 hash 4705 o 3072-bit key, 256-bit q, SHA2-256, SHA2-384, or SHA2-512 hash 4707 The above key and q size pairs were chosen to best balance the 4708 strength of the key with the strength of the hash. Implementations 4709 SHOULD use one of the above key and q size pairs when generating DSA 4710 keys. If DSS compliance is desired, one of the specified SHA hashes 4711 must be used as well. [FIPS186] is the ultimate authority on DSS, 4712 and should be consulted for all questions of DSS compliance. 4714 Note that earlier versions of this standard only allowed a 160-bit q 4715 with no truncation allowed, so earlier implementations may not be 4716 able to handle signatures with a different q size or a truncated 4717 hash. 4719 14.7. Elgamal 4721 An implementation SHOULD NOT implement Elgamal keys of size less than 4722 1024 bits. 4724 14.8. EdDSA 4726 Although the EdDSA algorithm allows arbitrary data as input, its use 4727 with OpenPGP requires that a digest of the message is used as input 4728 (pre-hashed). See section Section 5.2.4, "Computing Signatures" for 4729 details. Truncation of the resulting digest is never applied; the 4730 resulting digest value is used verbatim as input to the EdDSA 4731 algorithm. 4733 14.9. Reserved Algorithm Numbers 4735 A number of algorithm IDs have been reserved for algorithms that 4736 would be useful to use in an OpenPGP implementation, yet there are 4737 issues that prevent an implementer from actually implementing the 4738 algorithm. These are marked in Section 9.1, "Public-Key Algorithms", 4739 as "reserved for". 4741 The reserved public-key algorithm X9.42 (21) does not have the 4742 necessary parameters, parameter order, or semantics defined. The 4743 same is currently true for reserved public-key algorithms AEDH (23) 4744 and AEDSA (24). 4746 Previous versions of OpenPGP permitted Elgamal [ELGAMAL] signatures 4747 with a public-key identifier of 20. These are no longer permitted. 4749 An implementation MUST NOT generate such keys. An implementation 4750 MUST NOT generate Elgamal signatures. See [BLEICHENBACHER]. 4752 14.10. OpenPGP CFB Mode 4754 OpenPGP does symmetric encryption using a variant of Cipher Feedback 4755 mode (CFB mode). This section describes the procedure it uses in 4756 detail. This mode is what is used for Symmetrically Encrypted Data 4757 Packets; the mechanism used for encrypting secret-key material is 4758 similar, and is described in the sections above. 4760 In the description below, the value BS is the block size in octets of 4761 the cipher. Most ciphers have a block size of 8 octets. The AES and 4762 Twofish have a block size of 16 octets. Also note that the 4763 description below assumes that the IV and CFB arrays start with an 4764 index of 1 (unlike the C language, which assumes arrays start with a 4765 zero index). 4767 OpenPGP CFB mode uses an initialization vector (IV) of all zeros, and 4768 prefixes the plaintext with BS+2 octets of random data, such that 4769 octets BS+1 and BS+2 match octets BS-1 and BS. It does a CFB 4770 resynchronization after encrypting those BS+2 octets. 4772 Thus, for an algorithm that has a block size of 8 octets (64 bits), 4773 the IV is 10 octets long and octets 7 and 8 of the IV are the same as 4774 octets 9 and 10. For an algorithm with a block size of 16 octets 4775 (128 bits), the IV is 18 octets long, and octets 17 and 18 replicate 4776 octets 15 and 16. Those extra two octets are an easy check for a 4777 correct key. 4779 Step by step, here is the procedure: 4781 1. The feedback register (FR) is set to the IV, which is all zeros. 4783 2. FR is encrypted to produce FRE (FR Encrypted). This is the 4784 encryption of an all-zero value. 4786 3. FRE is xored with the first BS octets of random data prefixed to 4787 the plaintext to produce C[1] through C[BS], the first BS octets 4788 of ciphertext. 4790 4. FR is loaded with C[1] through C[BS]. 4792 5. FR is encrypted to produce FRE, the encryption of the first BS 4793 octets of ciphertext. 4795 6. The left two octets of FRE get xored with the next two octets of 4796 data that were prefixed to the plaintext. This produces C[BS+1] 4797 and C[BS+2], the next two octets of ciphertext. 4799 7. (The resynchronization step) FR is loaded with C[3] through 4800 C[BS+2]. 4802 8. FRE is xored with the first BS octets of the given plaintext, 4803 now that we have finished encrypting the BS+2 octets of prefixed 4804 data. This produces C[BS+3] through C[BS+(BS+2)], the next BS 4805 octets of ciphertext. 4807 9. FR is encrypted to produce FRE. 4809 10. FR is loaded with C[BS+3] to C[BS + (BS+2)] (which is C11-C18 4810 for an 8-octet block). 4812 11. FR is encrypted to produce FRE. 4814 12. FRE is xored with the next BS octets of plaintext, to produce 4815 the next BS octets of ciphertext. These are loaded into FR, and 4816 the process is repeated until the plaintext is used up. 4818 14.11. Private or Experimental Parameters 4820 S2K specifiers, Signature subpacket types, user attribute types, 4821 image format types, and algorithms described in Section 9 all reserve 4822 the range 100 to 110 for private and experimental use. Packet types 4823 reserve the range 60 to 63 for private and experimental use. These 4824 are intentionally managed with the PRIVATE USE method, as described 4825 in [RFC8126]. 4827 However, implementations need to be careful with these and promote 4828 them to full IANA-managed parameters when they grow beyond the 4829 original, limited system. 4831 14.12. Meta-Considerations for Expansion 4833 If OpenPGP is extended in a way that is not backwards-compatible, 4834 meaning that old implementations will not gracefully handle their 4835 absence of a new feature, the extension proposal can be declared in 4836 the key holder's self-signature as part of the Features signature 4837 subpacket. 4839 We cannot state definitively what extensions will not be upwards- 4840 compatible, but typically new algorithms are upwards-compatible, 4841 whereas new packets are not. 4843 If an extension proposal does not update the Features system, it 4844 SHOULD include an explanation of why this is unnecessary. If the 4845 proposal contains neither an extension to the Features system nor an 4846 explanation of why such an extension is unnecessary, the proposal 4847 SHOULD be rejected. 4849 15. Security Considerations 4851 o As with any technology involving cryptography, you should check 4852 the current literature to determine if any algorithms used here 4853 have been found to be vulnerable to attack. 4855 o This specification uses Public-Key Cryptography technologies. It 4856 is assumed that the private key portion of a public-private key 4857 pair is controlled and secured by the proper party or parties. 4859 o Certain operations in this specification involve the use of random 4860 numbers. An appropriate entropy source should be used to generate 4861 these numbers (see [RFC4086]). 4863 o The MD5 hash algorithm has been found to have weaknesses, with 4864 collisions found in a number of cases. MD5 is deprecated for use 4865 in OpenPGP. Implementations MUST NOT generate new signatures 4866 using MD5 as a hash function. They MAY continue to consider old 4867 signatures that used MD5 as valid. 4869 o SHA2-224 and SHA2-384 require the same work as SHA2-256 and 4870 SHA2-512, respectively. In general, there are few reasons to use 4871 them outside of DSS compatibility. You need a situation where one 4872 needs more security than smaller hashes, but does not want to have 4873 the full 256-bit or 512-bit data length. 4875 o Many security protocol designers think that it is a bad idea to 4876 use a single key for both privacy (encryption) and integrity 4877 (signatures). In fact, this was one of the motivating forces 4878 behind the V4 key format with separate signature and encryption 4879 keys. If you as an implementer promote dual-use keys, you should 4880 at least be aware of this controversy. 4882 o The DSA algorithm will work with any hash, but is sensitive to the 4883 quality of the hash algorithm. Verifiers should be aware that 4884 even if the signer used a strong hash, an attacker could have 4885 modified the signature to use a weak one. Only signatures using 4886 acceptably strong hash algorithms should be accepted as valid. 4888 o As OpenPGP combines many different asymmetric, symmetric, and hash 4889 algorithms, each with different measures of strength, care should 4890 be taken that the weakest element of an OpenPGP message is still 4891 sufficiently strong for the purpose at hand. While consensus 4892 about the strength of a given algorithm may evolve, NIST Special 4893 Publication 800-57 [SP800-57] recommends the following list of 4894 equivalent strengths: 4896 Asymmetric | Hash | Symmetric 4897 key size | size | key size 4898 ------------+--------+----------- 4899 1024 160 80 4900 2048 224 112 4901 3072 256 128 4902 7680 384 192 4903 15360 512 256 4905 o There is a somewhat-related potential security problem in 4906 signatures. If an attacker can find a message that hashes to the 4907 same hash with a different algorithm, a bogus signature structure 4908 can be constructed that evaluates correctly. 4910 For example, suppose Alice DSA signs message M using hash 4911 algorithm H. Suppose that Mallet finds a message M' that has the 4912 same hash value as M with H'. Mallet can then construct a 4913 signature block that verifies as Alice's signature of M' with H'. 4914 However, this would also constitute a weakness in either H or H' 4915 or both. Should this ever occur, a revision will have to be made 4916 to this document to revise the allowed hash algorithms. 4918 o If you are building an authentication system, the recipient may 4919 specify a preferred signing algorithm. However, the signer would 4920 be foolish to use a weak algorithm simply because the recipient 4921 requests it. 4923 o Some of the encryption algorithms mentioned in this document have 4924 been analyzed less than others. For example, although CAST5 is 4925 presently considered strong, it has been analyzed less than 4926 TripleDES. Other algorithms may have other controversies 4927 surrounding them. 4929 o In late summer 2002, Jallad, Katz, and Schneier published an 4930 interesting attack on the OpenPGP protocol and some of its 4931 implementations [JKS02]. In this attack, the attacker modifies a 4932 message and sends it to a user who then returns the erroneously 4933 decrypted message to the attacker. The attacker is thus using the 4934 user as a random oracle, and can often decrypt the message. 4936 Compressing data can ameliorate this attack. The incorrectly 4937 decrypted data nearly always decompresses in ways that defeat the 4938 attack. However, this is not a rigorous fix, and leaves open some 4939 small vulnerabilities. For example, if an implementation does not 4940 compress a message before encryption (perhaps because it knows it 4941 was already compressed), then that message is vulnerable. Because 4942 of this happenstance -- that modification attacks can be thwarted 4943 by decompression errors -- an implementation SHOULD treat a 4944 decompression error as a security problem, not merely a data 4945 problem. 4947 This attack can be defeated by the use of modification detection, 4948 provided that the implementation does not let the user naively 4949 return the data to the attacker. The modification detection is 4950 prefereabble implemented by using the AEAD Encrypted Data Packet 4951 and only if the recipients don't supports this by use of the 4952 Symmmetric Encrypted and Integrity Protected Data Packet. An 4953 implementation MUST treat an authentication or MDC failure as a 4954 security problem, not merely a data problem. 4956 In either case, the implementation SHOULD NOT allow the user 4957 access to the erroneous data, and MUST warn the user as to 4958 potential security problems should that data be returned to the 4959 sender. 4961 While this attack is somewhat obscure, requiring a special set of 4962 circumstances to create it, it is nonetheless quite serious as it 4963 permits someone to trick a user to decrypt a message. 4964 Consequently, it is important that: 4966 1. Implementers treat authentication errors, MDC errors, 4967 decompression failures or no use of MDC or AEAD as security 4968 problems. 4970 2. Implementers implement AEAD with all due speed and encourage 4971 its spread. 4973 3. Users migrate to implementations that support AEAD encryption 4974 with all due speed. 4976 o PKCS#1 has been found to be vulnerable to attacks in which a 4977 system that reports errors in padding differently from errors in 4978 decryption becomes a random oracle that can leak the private key 4979 in mere millions of queries. Implementations must be aware of 4980 this attack and prevent it from happening. The simplest solution 4981 is to report a single error code for all variants of decryption 4982 errors so as not to leak information to an attacker. 4984 o Some technologies mentioned here may be subject to government 4985 control in some countries. 4987 o In winter 2005, Serge Mister and Robert Zuccherato from Entrust 4988 released a paper describing a way that the "quick check" in 4989 OpenPGP CFB mode can be used with a random oracle to decrypt two 4990 octets of every cipher block [MZ05]. They recommend as prevention 4991 not using the quick check at all. 4993 Many implementers have taken this advice to heart for any data 4994 that is symmetrically encrypted and for which the session key is 4995 public-key encrypted. In this case, the quick check is not needed 4996 as the public-key encryption of the session key should guarantee 4997 that it is the right session key. In other cases, the 4998 implementation should use the quick check with care. 5000 On the one hand, there is a danger to using it if there is a 5001 random oracle that can leak information to an attacker. In 5002 plainer language, there is a danger to using the quick check if 5003 timing information about the check can be exposed to an attacker, 5004 particularly via an automated service that allows rapidly repeated 5005 queries. 5007 On the other hand, it is inconvenient to the user to be informed 5008 that they typed in the wrong passphrase only after a petabyte of 5009 data is decrypted. There are many cases in cryptographic 5010 engineering where the implementer must use care and wisdom, and 5011 this is one. 5013 o Refer to [FIPS186], B.4.1, for the method to generate a uniformly 5014 distributed ECC private key. 5016 o The curves proposed in this document correspond to the symmetric 5017 key sizes 128 bits, 192 bits, and 256 bits, as described in the 5018 table below. This allows a compliant application to offer 5019 balanced public key security, which is compatible with the 5020 symmetric key strength for each AES algorithm defined here. 5022 The following table defines the hash and the symmetric encryption 5023 algorithm that SHOULD be used with a given curve for ECDSA or 5024 ECDH. A stronger hash algorithm or a symmetric key algorithm MAY 5025 be used for a given ECC curve. However, note that the increase in 5026 the strength of the hash algorithm or the symmetric key algorithm 5027 may not increase the overall security offered by the given ECC 5028 key. 5030 Curve name | ECC | RSA | Hash size | Symmetric 5031 | strength | strength, | | key size 5032 | | informative | | 5033 -----------+----------+-------------+-----------+----------- 5034 NIST P-256 256 3072 256 128 5035 NIST P-384 384 7680 384 192 5036 NIST P-521 521 15360 512 256 5038 Requirement levels indicated elsewhere in this document lead to 5039 the following combinations of algorithms in the OpenPGP profile: 5040 MUST implement NIST curve P-256 / SHA2-256 / AES-128, SHOULD 5041 implement NIST curve P-521 / SHA2-512 / AES-256, MAY implement 5042 NIST curve P-384 / SHA2-384 / AES-256, among other allowed 5043 combinations. 5045 Consistent with the table above, the following table defines the 5046 KDF hash algorithm and the AES KEK encryption algorithm that 5047 SHOULD be used with a given curve for ECDH. A stronger KDF hash 5048 algorithm or AES KEK algorithm MAY be used for a given ECC curve. 5050 Curve name | Recommended KDF | Recommended KEK 5051 | hash algorithm | encryption algorithm 5052 -----------+-----------------+----------------------- 5053 NIST P-256 SHA2-256 AES-128 5054 NIST P-384 SHA2-384 AES-192 5055 NIST P-521 SHA2-512 AES-256 5057 This document explicitly discourages the use of algorithms other 5058 than AES as a KEK algorithm because backward compatibility of the 5059 ECDH format is not a concern. The KEK algorithm is only used 5060 within the scope of a Public-Key Encrypted Session Key Packet, 5061 which represents an ECDH key recipient of a message. Compare this 5062 with the algorithm used for the session key of the message, which 5063 MAY be different from a KEK algorithm. 5065 Compliant applications SHOULD implement, advertise through key 5066 preferences, and use the strongest algorithms specified in this 5067 document. 5069 Note that the symmetric algorithm preference list may make it 5070 impossible to use the balanced strength of symmetric key 5071 algorithms for a corresponding public key. For example, the 5072 presence of the symmetric key algorithm IDs and their order in the 5073 key preference list affects the algorithm choices available to the 5074 encoding side, which in turn may make the adherence to the table 5075 above infeasible. Therefore, compliance with this specification 5076 is a concern throughout the life of the key, starting immediately 5077 after the key generation when the key preferences are first added 5078 to a key. It is generally advisable to position a symmetric 5079 algorithm ID of strength matching the public key at the head of 5080 the key preference list. 5082 Encryption to multiple recipients often results in an unordered 5083 intersection subset. For example, if the first recipient's set is 5084 {A, B} and the second's is {B, A}, the intersection is an 5085 unordered set of two algorithms, A and B. In this case, a 5086 compliant application SHOULD choose the stronger encryption 5087 algorithm. 5089 Resource constraints, such as limited computational power, is a 5090 likely reason why an application might prefer to use the weakest 5091 algorithm. On the other side of the spectrum are applications 5092 that can implement every algorithm defined in this document. Most 5093 applications are expected to fall into either of two categories. 5094 A compliant application in the second, or strongest, category 5095 SHOULD prefer AES-256 to AES-192. 5097 SHA-1 MUST NOT be used with the ECDSA or the KDF in the ECDH 5098 method. 5100 MDC MUST be used when a symmetric encryption key is protected by 5101 ECDH. None of the ECC methods described in this document are 5102 allowed with deprecated V3 keys. A compliant application MUST 5103 only use iterated and salted S2K to protect private keys, as 5104 defined in Section 3.7.1.3, "Iterated and Salted S2K". 5106 Side channel attacks are a concern when a compliant application's 5107 use of the OpenPGP format can be modeled by a decryption or 5108 signing oracle model, for example, when an application is a 5109 network service performing decryption to unauthenticated remote 5110 users. ECC scalar multiplication operations used in ECDSA and 5111 ECDH are vulnerable to side channel attacks. Countermeasures can 5112 often be taken at the higher protocol level, such as limiting the 5113 number of allowed failures or time-blinding of the operations 5114 associated with each network interface. Mitigations at the scalar 5115 multiplication level seek to eliminate any measurable distinction 5116 between the ECC point addition and doubling operations. 5118 o Although technically possible, the EdDSA algorithm MUST NOT be 5119 used with a digest algorithms weaker than SHA2-256. 5121 OpenPGP was designed with security in mind, with many smart, 5122 intelligent people spending a lot of time thinking about the 5123 ramifications of their decisions. Removing the requirement for self- 5124 certifying User ID (and User Attribute) packets on a key means that 5125 someone could surreptitiously add an unwanted ID to a key and sign 5126 it. If enough "trusted" people sign that surreptitious identity then 5127 other people might believe it. The attack could wind up sending 5128 encrypted mail destined for alice to some other target, bob, because 5129 someone added "alice" to bob's key without bob's consent. 5131 In the case of device certificates the device itself does not have 5132 any consent. It is given an identity by the device manufacturer and 5133 the manufacturer can insert that ID on the device certificate, 5134 signing it with the manufacturer's key. If another people wants to 5135 label the device by another name, they can do so. There is no harm 5136 in multiple IDs, because the verification is all done based on who 5137 has signed those IDs. 5139 When a key can self-sign, it is still suggested to self-certify IDs, 5140 even if it no longer required by this modification to OpenPGP. This 5141 at least signals to recipients of keys that yes, the owner of this 5142 key asserts that this identity belongs to herself. Note, however, 5143 that mallet could still assert that he is 'alice' and could even 5144 self-certify that. So the attack is not truly different. Moreover, 5145 in the case of device certificates, it's more the manufacturer than 5146 the device that wants to assert an identity (even if the device could 5147 self-certify). 5149 There is no signaling whether a key is using this looser-requirement 5150 key format. An attacker could therefore just remove the self- 5151 signature off a published key. However one would hope that wide 5152 publication would result in another copy still having that signature 5153 and it being returned quickly. However, the lack of signaling also 5154 means that a user with an application following RFC 4880 directly 5155 would see a key following this specification as "broken" and may not 5156 accept it. 5158 On a different note, including the "geo" notation could leak 5159 information about where a signer is located. However it is just an 5160 assertion (albeit a signed assertion) so there is no verifiable truth 5161 to the location information released. Similarly, all the rest of the 5162 signature notations are pure assertions, so they should be taken with 5163 the trustworthiness of the signer. 5165 Combining the User ID with the User Attribute means that an ID and 5166 image would not be separable. For a person this is probably not 5167 good, but for a device it's unlikely the image will change so it 5168 makes sense to combine the ID and image into a single signed packet 5169 with a single signature. 5171 16. Compatibility Profiles 5173 16.1. OpenPGP ECC Profile 5175 A compliant application MUST implement NIST curve P-256, SHOULD 5176 implement NIST curve P-521, SHOULD implemend Ed25519, SHOULD 5177 implement Curve25519, MAY implement NIST curve P-384, MAY implement 5178 brainpoolP256r1, and MAY implement brainpoolP512r1, as defined in 5179 Section 9.2. A compliant application MUST implement SHA2-256 and 5180 SHOULD implement SHA2-384 and SHA2-512. A compliant application MUST 5181 implement AES-128 and SHOULD implement AES-256. 5183 A compliant application SHOULD follow Section 15 regarding the choice 5184 of the following algorithms for each curve: 5186 o the KDF hash algorithm, 5188 o the KEK algorithm, 5190 o the message digest algorithm and the hash algorithm used in the 5191 key certifications, 5193 o the symmetric algorithm used for message encryption. 5195 It is recommended that the chosen symmetric algorithm for message 5196 encryption be no less secure than the KEK algorithm. 5198 16.2. Suite-B Profile 5200 A subset of algorithms allowed by this document can be used to 5201 achieve [SuiteB] compatibility. The references to [SuiteB] in this 5202 document are informative. This document is primarily concerned with 5203 format specification, leaving additional security restrictions 5204 unspecified, such as matching the assigned security level of 5205 information to authorized recipients or interoperability concerns 5206 arising from fewer allowed algorithms in [SuiteB] than allowed by 5207 this document. 5209 16.2.1. Security Strength at 192 Bits 5211 To achieve the security strength of 192 bits, [SuiteB] requires NIST 5212 curve P-384, AES-256, and SHA2-384. The symmetric algorithm 5213 restriction means that the algorithm of KEK used for key wrapping in 5214 Section 13.5 and an OpenPGP session key used for message encryption 5215 must be AES-256. The hash algorithm restriction means that the hash 5216 algorithms of KDF and the OpenPGP message digest calculation must be 5217 SHA2-384. 5219 16.2.2. Security Strength at 128 Bits 5221 The set of algorithms in Section 16.2.1 is extended to allow NIST 5222 curve P-256, AES-128, and SHA2-256. 5224 17. Implementation Nits 5226 This section is a collection of comments to help an implementer, 5227 particularly with an eye to backward compatibility. Previous 5228 implementations of PGP are not OpenPGP compliant. Often the 5229 differences are small, but small differences are frequently more 5230 vexing than large differences. Thus, this is a non-comprehensive 5231 list of potential problems and gotchas for a developer who is trying 5232 to be backward-compatible. 5234 o The IDEA algorithm is patented, and yet it is required for PGP 2 5235 interoperability. It is also the de-facto preferred algorithm for 5236 a V3 key with a V3 self-signature (or no self- signature). 5238 o When exporting a private key, PGP 2 generates the header "BEGIN 5239 PGP SECRET KEY BLOCK" instead of "BEGIN PGP PRIVATE KEY BLOCK". 5240 All previous versions ignore the implied data type, and look 5241 directly at the packet data type. 5243 o PGP versions 2.0 through 2.5 generated V2 Public-Key packets. 5244 These are identical to the deprecated V3 keys except for the 5245 version number. An implementation MUST NOT generate them and may 5246 accept or reject them as it sees fit. Some older PGP versions 5247 generated V2 PKESK packets (Tag 1) as well. An implementation may 5248 accept or reject V2 PKESK packets as it sees fit, and MUST NOT 5249 generate them. 5251 o PGP version 2.6 will not accept key-material packets with versions 5252 greater than 3. 5254 o There are many ways possible for two keys to have the same key 5255 material, but different fingerprints (and thus Key IDs). Perhaps 5256 the most interesting is an RSA key that has been "upgraded" to V4 5257 format, but since a V4 fingerprint is constructed by hashing the 5258 key creation time along with other things, two V4 keys created at 5259 different times, yet with the same key material will have 5260 different fingerprints. 5262 o If an implementation is using zlib to interoperate with PGP 2, 5263 then the "windowBits" parameter should be set to -13. 5265 o The 0x19 back signatures were not required for signing subkeys 5266 until relatively recently. Consequently, there may be keys in the 5267 wild that do not have these back signatures. Implementing 5268 software may handle these keys as it sees fit. 5270 o OpenPGP does not put limits on the size of public keys. However, 5271 larger keys are not necessarily better keys. Larger keys take 5272 more computation time to use, and this can quickly become 5273 impractical. Different OpenPGP implementations may also use 5274 different upper bounds for public key sizes, and so care should be 5275 taken when choosing sizes to maintain interoperability. As of 5276 2007 most implementations have an upper bound of 4096 bits. 5278 o ASCII armor is an optional feature of OpenPGP. The OpenPGP 5279 working group strives for a minimal set of mandatory-to-implement 5280 features, and since there could be useful implementations that 5281 only use binary object formats, this is not a "MUST" feature for 5282 an implementation. For example, an implementation that is using 5283 OpenPGP as a mechanism for file signatures may find ASCII armor 5284 unnecessary. OpenPGP permits an implementation to declare what 5285 features it does and does not support, but ASCII armor is not one 5286 of these. Since most implementations allow binary and armored 5287 objects to be used indiscriminately, an implementation that does 5288 not implement ASCII armor may find itself with compatibility 5289 issues with general-purpose implementations. Moreover, 5290 implementations of OpenPGP-MIME [RFC3156] already have a 5291 requirement for ASCII armor so those implementations will 5292 necessarily have support. 5294 o The OCB mode is patented and a debate is still underway on whether 5295 it can be included in RFC4880bis or needs to be moved to a 5296 separate document. For the sole purpose of experimenting with the 5297 Preferred AEAD Algorithms signature subpacket it is has been 5298 included in this I-D. 5300 18. References 5302 18.1. Normative References 5304 [AES] NIST, "FIPS PUB 197, Advanced Encryption Standard (AES)", 5305 November 2001, 5306 . 5309 [BLOWFISH] 5310 Schneier, B., "Description of a New Variable-Length Key, 5311 64-Bit Block Cipher (Blowfish)", Fast Software Encryption, 5312 Cambridge Security Workshop Proceedings, Springer-Verlag, 5313 1994, pp191-204, December 1993, 5314 . 5316 [BZ2] Seward, J., "The Bzip2 and libbzip2 home page", 5317 . 5319 [EAX] Bellare, M., Rogaway, P., and D. Wagner, "A Conventional 5320 Authenticated-Encryption Mode", April 2003. 5322 [ELGAMAL] Elgamal, T., "A Public-Key Cryptosystem and a Signature 5323 Scheme Based on Discrete Logarithms,", IEEE Transactions 5324 on Information Theory v. IT-31, n. 4, 1985, pp. 469-472, . 5326 [FIPS180] National Institute of Standards and Technology, U.S. 5327 Department of Commerce, "Secure Hash Standard (SHS), FIPS 5328 180-4", August 2015, 5329 . 5331 [FIPS186] National Institute of Standards and Technology, U.S. 5332 Department of Commerce, "Digital Signature Standard (DSS), 5333 FIPS 186-4", July 2013, 5334 . 5336 [FIPS202] National Institute of Standards and Technology, U.S. 5337 Department of Commerce, "SHA-3 Standard: Permutation-Based 5338 Hash and Extendable-Output Functions, FIPS 202", August 5339 2015, . 5341 [HAC] Menezes, A., Oorschot, P., and S. Vanstone, "Handbook of 5342 Applied Cryptography", 1996. 5344 [IDEA] Lai, X., "On the design and security of block ciphers", 5345 ETH Series in Information Processing, J.L. Massey 5346 (editor), Vol. 1, Hartung-Gorre Verlag Konstanz, 5347 Technische Hochschule (Zurich), 1992. 5349 [ISO10646] 5350 International Organization for Standardization, 5351 "Information Technology - Universal Multiple-octet coded 5352 Character Set (UCS) - Part 1: Architecture and Basic 5353 Multilingual Plane", ISO Standard 10646-1, May 1993. 5355 [JFIF] Eric Hamilton, C-Cube Microsystems, Milpitas, CA, "JPEG 5356 File Interchange Format (Version 1.02).", September 1996. 5358 [PKCS5] RSA Laboratories, "PKCS #5 v2.0: Password-Based 5359 Cryptography Standard", March 1999. 5361 [RFC1950] Deutsch, L. and J-L. Gailly, "ZLIB Compressed Data Format 5362 Specification version 3.3", RFC 1950, May 1996. 5364 [RFC1951] Deutsch, P., "DEFLATE Compressed Data Format Specification 5365 version 1.3", RFC 1951, May 1996. 5367 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 5368 Extensions (MIME) Part One: Format of Internet Message 5369 Bodies", RFC 2045, November 1996. 5371 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 5372 Requirement Levels", BCP 14, RFC 2119, March 1997. 5374 [RFC2144] Adams, C., "The CAST-128 Encryption Algorithm", RFC 2144, 5375 May 1997. 5377 [RFC2822] Resnick, P., "Internet Message Format", RFC 2822, April 5378 2001. 5380 [RFC3156] Elkins, M., Del Torto, D., Levien, R., and T. Roessler, 5381 "MIME Security with OpenPGP", RFC 3156, August 2001. 5383 [RFC3394] Schaad, J. and R. Housley, "Advanced Encryption Standard 5384 (AES) Key Wrap Algorithm", RFC 3394, September 2002. 5386 [RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography 5387 Standards (PKCS) #1: RSA Cryptography Specifications 5388 Version 2.1", RFC 3447, February 2003. 5390 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 5391 10646", STD 63, RFC 3629, November 2003. 5393 [RFC3713] Matsui, M., Nakajima, J., and S. Moriai, "A Description of 5394 the Camellia Encryption Algorithm", RFC 3713, April 2004. 5396 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 5397 Requirements for Security", BCP 106, RFC 4086, June 2005. 5399 [RFC5639] Lochter, M. and J. Merkle, "Elliptic Curve Cryptography 5400 (ECC) Brainpool Standard Curves and Curve Generation", RFC 5401 5639, DOI 10.17487/RFC5639, March 2010, 5402 . 5404 [RFC5870] Mayrhofer, A. and C. Spanring, "A Uniform Resource 5405 Identifier for Geographic Locations ('geo' URI)", RFC 5406 5870, DOI 10.17487/RFC5870, June 2010, 5407 . 5409 [RFC7253] Krovetz, T. and P. Rogaway, "The OCB Authenticated- 5410 Encryption Algorithm", RFC 7253, DOI 10.17487/RFC7253, May 5411 2014, . 5413 [RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves 5414 for Security", RFC 7748, DOI 10.17487/RFC7748, January 5415 2016, . 5417 [RFC8032] Josefsson, S. and I. Liusvaara, "Edwards-Curve Digital 5418 Signature Algorithm (EdDSA)", RFC 8032, DOI 10.17487/ 5419 RFC8032, January 2017, . 5422 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 5423 Writing an IANA Considerations Section in RFCs", BCP 26, 5424 RFC 8126, DOI 10.17487/RFC8126, June 2017, 5425 . 5427 [SCHNEIER] 5428 Schneier, B., "Applied Cryptography Second Edition: 5429 protocols, algorithms, and source code in C", 1996. 5431 [SP800-56A] 5432 Barker, E., Johnson, D., and M. Smid, "Recommendation for 5433 Pair-Wise Key Establishment Schemes Using Discrete 5434 Logarithm Cryptography", NIST Special Publication 800-56A 5435 Revision 1, March 2007. 5437 [SuiteB] National Security Agency, "NSA Suite B Cryptography", 5438 March 2010, 5439 . 5441 [TWOFISH] Schneier, B., Kelsey, J., Whiting, D., Wagner, D., Hall, 5442 C., and N. Ferguson, "The Twofish Encryption Algorithm", 5443 1999. 5445 18.2. Informative References 5447 [BLEICHENBACHER] 5448 Bleichenbacher, D., "Generating ElGamal Signatures Without 5449 Knowing the Secret Key", Lecture Notes in Computer Science 5450 Volume 1070, pp. 10-18, 1996. 5452 [KOBLITZ] Koblitz, N., "A course in number theory and cryptography, 5453 Chapter VI. Elliptic Curves, ISBN: 0-387-96576-9, 5454 Springer-Verlag", 1997. 5456 [RFC1423] Balenson, D., "Privacy Enhancement for Internet Electronic 5457 Mail: Part III: Algorithms, Modes, and Identifiers", RFC 5458 1423, February 1993. 5460 [RFC1991] Atkins, D., Stallings, W., and P. Zimmermann, "PGP Message 5461 Exchange Formats", RFC 1991, August 1996. 5463 [RFC2440] Callas, J., Donnerhacke, L., Finney, H., and R. Thayer, 5464 "OpenPGP Message Format", RFC 2440, November 1998. 5466 [RFC4880] Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R. 5467 Thayer, "OpenPGP Message Format", RFC 4880, DOI 10.17487/ 5468 RFC4880, November 2007, . 5471 [RFC6090] McGrew, D., Igoe, K., and M. Salter, "Fundamental Elliptic 5472 Curve Cryptography Algorithms", RFC 6090, February 2011. 5474 [SEC1] Standards for Efficient Cryptography Group, "SEC 1: 5475 Elliptic Curve Cryptography", September 2000. 5477 [SP800-57] 5478 NIST, "Recommendation on Key Management", NIST Special 5479 Publication 800-57, March 2007, 5480 . 5483 Appendix A. Test vectors 5485 To help implementing this specification a non-normative example for 5486 the EdDSA algorithm is given. 5488 A.1. Sample EdDSA key 5490 The secret key used for this example is: 5492 D: 1a8b1ff05ded48e18bf50166c664ab023ea70003d78d9e41f5758a91d850f8d2 5494 Note that this is the raw secret key used as input to the EdDSA 5495 signing operation. The key was created on 2014-08-19 14:28:27 and 5496 thus the fingerprint of the OpenPGP key is: 5498 C959 BDBA FA32 A2F8 9A15 3B67 8CFD E121 9796 5A9A 5500 The algorithm specific input parameters without the MPI length 5501 headers are: 5503 oid: 2b06010401da470f01 5505 q: 403f098994bdd916ed4053197934e4a87c80733a1280d62f8010992e43ee3b2406 5507 The entire public key packet is thus: 5509 98 33 04 53 f3 5f 0b 16 09 2b 06 01 04 01 da 47 5510 0f 01 01 07 40 3f 09 89 94 bd d9 16 ed 40 53 19 5511 79 34 e4 a8 7c 80 73 3a 12 80 d6 2f 80 10 99 2e 5512 43 ee 3b 24 06 5514 A.2. Sample EdDSA signature 5516 The signature is created using the sample key over the input data 5517 "OpenPGP" on 2015-09-16 12:24:53 and thus the input to the hash 5518 function is: 5520 m: 4f70656e504750040016080006050255f95f9504ff0000000c 5522 Using the SHA2-256 hash algorithm yields the digest: 5524 d: f6220a3f757814f4c2176ffbb68b00249cd4ccdc059c4b34ad871f30b1740280 5526 Which is fed into the EdDSA signature function and yields this 5527 signature: 5529 r: 56f90cca98e2102637bd983fdb16c131dfd27ed82bf4dde5606e0d756aed3366 5531 s: d09c4fa11527f038e0f57f2201d82f2ea2c9033265fa6ceb489e854bae61b404 5533 The entire signature packet is thus: 5535 88 5e 04 00 16 08 00 06 05 02 55 f9 5f 95 00 0a 5536 09 10 8c fd e1 21 97 96 5a 9a f6 22 01 00 56 f9 5537 0c ca 98 e2 10 26 37 bd 98 3f db 16 c1 31 df d2 5538 7e d8 2b f4 dd e5 60 6e 0d 75 6a ed 33 66 01 00 5539 d0 9c 4f a1 15 27 f0 38 e0 f5 7f 22 01 d8 2f 2e 5540 a2 c9 03 32 65 fa 6c eb 48 9e 85 4b ae 61 b4 04 5542 A.3. Sample AEAD-EAX encryption and decryption 5544 Encryption is performed with the string 'Hello, world!' and password 5545 'password', using AES-128 with AEAD-EAX encryption. 5547 A.3.1. Sample Parameters 5549 S2K: 5551 type 3 5553 Iterations: 5555 524288 (144), SHA-256 5557 Salt: 5559 cd5a9f70fbe0bc65 5561 A.3.2. Sample symmetric-key encrypted session key packet (v5) 5563 Packet header: 5565 c3 3e 5567 Version, algorithms, S2K fields: 5569 05 07 01 03 08 cd 5a 9f 70 fb e0 bc 65 90 5571 AEAD IV: 5573 bc 66 9e 34 e5 00 dc ae dc 5b 32 aa 2d ab 02 35 5575 AEAD encrypted CEK: 5577 9d ee 19 d0 7c 34 46 c4 31 2a 34 ae 19 67 a2 fb 5579 Authentication tag: 5581 7e 92 8e a5 b4 fa 80 12 bd 45 6d 17 38 c6 3c 36 5583 A.3.3. Starting AEAD-EAX decryption of CEK 5585 The derived key is: 5587 b2 55 69 b9 54 32 45 66 45 27 c4 97 6e 7a 5d 6e 5589 Authenticated Data: 5591 c3 05 07 01 5593 Nonce: 5595 bc 66 9e 34 e5 00 dc ae dc 5b 32 aa 2d ab 02 35 5597 Decrypted CEK: 5599 86 f1 ef b8 69 52 32 9f 24 ac d3 bf d0 e5 34 6d 5601 A.3.4. Sample AEAD encrypted data packet 5603 Packet header: 5605 d4 4a 5607 Version, AES-128, EAX, Chunk bits (14): 5609 01 07 01 0e 5611 IV: 5613 b7 32 37 9f 73 c4 92 8d e2 5f ac fe 65 17 ec 10 5615 AEAD-EAX Encrypted data chunk #0: 5617 5d c1 1a 81 dc 0c b8 a2 f6 f3 d9 00 16 38 4a 56 5618 fc 82 1a e1 1a e8 5620 Chunk #0 authentication tag: 5622 db cb 49 86 26 55 de a8 8d 06 a8 14 86 80 1b 0f 5624 Final (zero-size chunk #1) authentication tag: 5626 f3 87 bd 2e ab 01 3d e1 25 95 86 90 6e ab 24 76 5628 A.3.5. Decryption of data 5630 Starting AEAD-EAX decryption of data, using the CEK. 5632 Chunk #0: 5634 Authenticated data: 5636 d4 01 07 01 0e 00 00 00 00 00 00 00 00 5638 Nonce: 5640 b7 32 37 9f 73 c4 92 8d e2 5f ac fe 65 17 ec 10 5642 Decrypted chunk #0. 5644 Literal data packet with the string contents 'Hello, world!'. 5646 cb 14 62 00 00 00 00 00 48 65 6c 6c 6f 2c 20 77 5647 6f 72 6c 64 21 0a 5649 Authenticating final tag: 5651 Authenticated data: 5653 d4 01 07 01 0e 00 00 00 00 00 00 00 01 00 00 00 5654 00 00 00 00 16 5656 Nonce: 5658 b7 32 37 9f 73 c4 92 8d e2 5f ac fe 65 17 ec 11 5660 A.3.6. Complete AEAD-EAX encrypted packet sequence 5662 Symmetric-key encrypted session key packet (v5): 5664 c3 3e 05 07 01 03 08 cd 5a 9f 70 fb e0 bc 65 90 5665 bc 66 9e 34 e5 00 dc ae dc 5b 32 aa 2d ab 02 35 5666 9d ee 19 d0 7c 34 46 c4 31 2a 34 ae 19 67 a2 fb 5667 7e 92 8e a5 b4 fa 80 12 bd 45 6d 17 38 c6 3c 36 5669 AEAD encrypted data packet: 5671 d4 4a 01 07 01 0e b7 32 37 9f 73 c4 92 8d e2 5f 5672 ac fe 65 17 ec 10 5d c1 1a 81 dc 0c b8 a2 f6 f3 5673 d9 00 16 38 4a 56 fc 82 1a e1 1a e8 db cb 49 86 5674 26 55 de a8 8d 06 a8 14 86 80 1b 0f f3 87 bd 2e 5675 ab 01 3d e1 25 95 86 90 6e ab 24 76 5677 A.4. Sample AEAD-OCB encryption and decryption 5679 Encryption is performed with the string 'Hello, world!' and password 5680 'password', using AES-128 with AEAD-OCB encryption. 5682 A.4.1. Sample Parameters 5684 S2K: 5686 type 3 5688 Iterations: 5690 524288 (144), SHA-256 5692 Salt: 5694 9f0b7da3e5ea6477 5696 A.4.2. Sample symmetric-key encrypted session key packet (v5) 5698 Packet header: 5700 c3 3d 5702 Version, algorithms, S2K fields: 5704 05 07 02 03 08 9f 0b 7d a3 e5 ea 64 77 90 5706 AEAD IV: 5708 99 e3 26 e5 40 0a 90 93 6c ef b4 e8 eb a0 8c 5710 AEAD encrypted CEK: 5712 67 73 71 6d 1f 27 14 54 0a 38 fc ac 52 99 49 da 5714 Authentication tag: 5716 c5 29 d3 de 31 e1 5b 4a eb 72 9e 33 00 33 db ed 5718 A.4.3. Starting AEAD-OCB decryption of CEK 5720 The derived key is: 5722 eb 9d a7 8a 9d 5d f8 0e c7 02 05 96 39 9b 65 08 5724 Authenticated Data: 5726 c3 05 07 02 5728 Nonce: 5730 99 e3 26 e5 40 0a 90 93 6c ef b4 e8 eb a0 8c 5732 Decrypted CEK: 5734 d1 f0 1b a3 0e 13 0a a7 d2 58 2c 16 e0 50 ae 44 5736 A.4.4. Sample AEAD encrypted data packet 5738 Packet header: 5740 d4 49 5742 Version, AES-128, OCB, Chunk bits (14): 5744 01 07 02 0e 5746 IV: 5748 5e d2 bc 1e 47 0a be 8f 1d 64 4c 7a 6c 8a 56 5750 AEAD-OCB Encrypted data chunk #0: 5752 7b 0f 77 01 19 66 11 a1 54 ba 9c 25 74 cd 05 62 5753 84 a8 ef 68 03 5c 5755 Chunk #0 authentication tag: 5757 62 3d 93 cc 70 8a 43 21 1b b6 ea f2 b2 7f 7c 18 5759 Final (zero-size chunk #1) authentication tag: 5761 d5 71 bc d8 3b 20 ad d3 a0 8b 73 af 15 b9 a0 98 5763 A.4.5. Decryption of data 5765 Starting AEAD-OCB decryption of data, using the CEK. 5767 Chunk #0: 5769 Authenticated data: 5771 r4 01 07 02 0e 00 00 00 00 00 00 00 00 5773 Nonce: 5775 5e d2 bc 1e 47 0a be 8f 1d 64 4c 7a 6c 8a 56 5777 Decrypted chunk #0. 5779 Literal data packet with the string contents 'Hello, world!'. 5781 cb 14 62 00 00 00 00 00 48 65 6c 6c 6f 2c 20 77 5782 6f 72 6c 64 21 0a 5784 Authenticating final tag: 5786 Authenticated data: 5788 d4 01 07 02 0e 00 00 00 00 00 00 00 01 00 00 00 5789 00 00 00 00 16 5791 Nonce: 5793 5e d2 bc 1e 47 0a be 8f 1d 64 4c 7a 6c 8a 57 5795 A.4.6. Complete AEAD-OCB encrypted packet sequence 5797 Symmetric-key encrypted session key packet (v5): 5799 c3 3d 05 07 02 03 08 9f 0b 7d a3 e5 ea 64 77 90 5800 99 e3 26 e5 40 0a 90 93 6c ef b4 e8 eb a0 8c 67 5801 73 71 6d 1f 27 14 54 0a 38 fc ac 52 99 49 da c5 5802 29 d3 de 31 e1 5b 4a eb 72 9e 33 00 33 db ed 5804 AEAD encrypted data packet: 5806 d4 49 01 07 02 0e 5e d2 bc 1e 47 0a be 8f 1d 64 5807 4c 7a 6c 8a 56 7b 0f 77 01 19 66 11 a1 54 ba 9c 5808 25 74 cd 05 62 84 a8 ef 68 03 5c 62 3d 93 cc 70 5809 8a 43 21 1b b6 ea f2 b2 7f 7c 18 d5 71 bc d8 3b 5810 20 ad d3 a0 8b 73 af 15 b9 a0 98 5812 Appendix B. ECC Point compression flag bytes 5814 This specification introduces the new flag byte 0x40 to indicate the 5815 point compression format. The value has been chosen so that the high 5816 bit is not cleared and thus to avoid accidental sign extension. Two 5817 other values might also be interesting for other ECC specifications: 5819 Flag Description 5820 ---- ----------- 5821 0x04 Standard flag for uncompressed format 5822 0x40 Native point format of the curve follows 5823 0x41 Only X coordinate follows. 5824 0x42 Only Y coordinate follows. 5826 Appendix C. Changes since RFC-4880 5828 o Applied errata 2270, 2271, 2242, 3298. 5830 o Added Camellia cipher from RFC 5581. 5832 o Incorporated RFC 6637 (ECC for OpenPGP) 5834 o Added draft-atkins-openpgp-device-certificates 5836 o Added draft-koch-eddsa-for-openpgp-04 5838 o Added Issuer Fingerprint signature subpacket. 5840 o Added a v5 key and fingerprint format. 5842 o Added OIDs for brainpool curves and Curve25519. 5844 o Marked SHA2-256 as MUST implement. 5846 o Marked Curve25519 and Ed25519 as SHOULD implement. 5848 o Marked SHA-1 as SHOULD NOT be used to create messages. 5850 o Marked MD5 as SHOULD NOT implement. 5852 o Changed v5 key fingerprint format to full 32 octets. 5854 o Added Literal Data Packet format octet 'm'. 5856 o Added Feature Flag for v5 key support. 5858 o Added AEAD Encrypted Data Packet. 5860 o Removed notes on extending the MDC packet. 5862 o Added v5 Symmetric-Key Encrypted Session Key packet. 5864 o Added AEAD encryption of secret keys. 5866 o Added test vectors for AEAD. 5868 o Added the Additional Encryption Subkey key flag. 5870 o Deprecated the Symmetrically Encrypted Data Packet. 5872 o Suggest limitation of the AEAD chunksize to 128 MiB. 5874 o Specified the V5 signature format. 5876 o Deprectated the creation of V3 signatures. 5878 o Adapted terms from RFC 8126. 5880 o Removed editorial marks and updated cross-references. 5882 o Added the timestamping usage key flag. 5884 o Added Intended Recipient signature subpacket. 5886 o Added Attested Certifications signature subpacket and signature 5887 class. 5889 { Informational rfcs: [RFC1423] } 5891 Appendix D. The principal authors of RFC-4880 5893 Jon Callas 5894 EMail: jon@callas.org 5896 Lutz Donnerhacke 5897 EMail: lutz@iks-jena.de 5899 Hal Finney 5901 David Shaw 5902 EMail: dshaw@jabberwocky.com 5904 Rodney Thayer 5905 EMail: rodney@canola-jones.com 5907 Authors' Addresses 5909 Werner Koch 5910 GnuPG e.V. 5911 Rochusstr. 44 5912 40479 Duesseldorf 5913 Germany 5915 Email: wk@gnupg.org 5916 URI: https://gnupg.org/verein 5918 brian m. carlson 5920 Email: sandals@crustytoothpaste.net 5922 Ronald Henry Tse 5923 Ribose 5924 Suite 1111, 1 Pedder Street 5925 Central, Hong Kong 5926 Hong Kong 5928 Email: ronald.tse@ribose.com 5929 URI: https://www.ribose.com 5931 Derek Atkins 5933 Email: derek@ihtfp.com 5934 Daniel Kahn Gillmor 5936 Email: dkg@fifthhorseman.net