idnits 2.17.1 draft-koch-openpgp-2015-rfc4880bis-02.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 are 4 instances of lines with non-RFC6890-compliant IPv4 addresses in the document. If these are example addresses, they should be changed. -- The draft header indicates that this document obsoletes RFC6637, but the abstract doesn't seem to directly say this. It does mention RFC6637 though, so this could be OK. -- 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 directly say this. It does mention RFC5581 though, so this could be OK. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (30 May 2023) is 1109 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 389 -- Looks like a reference, but probably isn't: '1' on line 5081 -- Looks like a reference, but probably isn't: '2' on line 389 -- Looks like a reference, but probably isn't: '3' on line 5090 == Missing Reference: 'Optional' is mentioned on line 2520, but not defined == Missing Reference: 'TBD1' is mentioned on line 2918, but not defined == Missing Reference: '0-9' is mentioned on line 3663, but not defined == Missing Reference: 'Binding-Signature-Revocation' is mentioned on line 4377, but not defined == Missing Reference: 'BS' is mentioned on line 5081, 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' -- Possible downref: Non-RFC (?) normative reference: ref. 'SCHNEIER' -- Possible downref: Non-RFC (?) normative reference: ref. 'SP800-56A' -- Possible downref: Non-RFC (?) normative reference: ref. 'TWOFISH' Summary: 0 errors (**), 0 flaws (~~), 7 warnings (==), 25 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 approved) B. Carlson 5 Intended status: Standards Track 6 Expires: 1 December 2023 R.H. Tse 7 Ribose 8 D.A. Atkins 10 D.K. Gillmor 11 30 May 2023 13 OpenPGP Message Format 14 draft-koch-openpgp-2015-rfc4880bis-02 16 Abstract 18 This document specifies the message formats used in OpenPGP. OpenPGP 19 provides encryption with public-key or symmetric cryptographic 20 algorithms, digital signatures, compression and key management. 22 This document is maintained in order to publish all necessary 23 information needed to develop interoperable applications based on the 24 OpenPGP format. It is not a step-by-step cookbook for writing an 25 application. It describes only the format and methods needed to 26 read, check, generate, and write conforming packets crossing any 27 network. It does not deal with storage and implementation questions. 28 It does, however, discuss implementation issues necessary to avoid 29 security flaws. 31 This document obsoletes: RFC 4880 (OpenPGP), RFC 5581 (Camellia in 32 OpenPGP) and RFC 6637 (Elliptic Curves in OpenPGP). 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 https://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 1 December 2023. 50 Copyright Notice 52 Copyright (c) 2023 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 (https://trustee.ietf.org/ 57 license-info) in effect on the date of publication of this document. 58 Please review these documents carefully, as they describe your rights 59 and restrictions with respect to this document. Code Components 60 extracted from this document must include Revised BSD License text as 61 described in Section 4.e of the Trust Legal Provisions and are 62 provided without warranty as described in the Revised BSD License. 64 Table of Contents 66 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5 67 1.1. Terms . . . . . . . . . . . . . . . . . . . . . . . . . . 5 68 2. General functions . . . . . . . . . . . . . . . . . . . . . . 6 69 2.1. Confidentiality via Encryption . . . . . . . . . . . . . 6 70 2.2. Authentication via Digital Signature . . . . . . . . . . 7 71 2.3. Compression . . . . . . . . . . . . . . . . . . . . . . . 8 72 2.4. Conversion to Radix-64 . . . . . . . . . . . . . . . . . 8 73 2.5. Signature-Only Applications . . . . . . . . . . . . . . . 8 74 3. Data Element Formats . . . . . . . . . . . . . . . . . . . . 8 75 3.1. Scalar Numbers . . . . . . . . . . . . . . . . . . . . . 9 76 3.2. Multiprecision Integers . . . . . . . . . . . . . . . . . 9 77 3.3. Key IDs . . . . . . . . . . . . . . . . . . . . . . . . . 9 78 3.4. Text . . . . . . . . . . . . . . . . . . . . . . . . . . 10 79 3.5. Time Fields . . . . . . . . . . . . . . . . . . . . . . . 10 80 3.6. Keyrings . . . . . . . . . . . . . . . . . . . . . . . . 10 81 3.7. String-to-Key (S2K) Specifiers . . . . . . . . . . . . . 10 82 3.7.1. String-to-Key (S2K) Specifier Types . . . . . . . . . 10 83 3.7.2. String-to-Key Usage . . . . . . . . . . . . . . . . . 12 84 4. Packet Syntax . . . . . . . . . . . . . . . . . . . . . . . . 13 85 4.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 14 86 4.2. Packet Headers . . . . . . . . . . . . . . . . . . . . . 14 87 4.2.1. Old Format Packet Lengths . . . . . . . . . . . . . . 15 88 4.2.2. New Format Packet Lengths . . . . . . . . . . . . . . 15 89 4.2.3. Packet Length Examples . . . . . . . . . . . . . . . 17 90 4.3. Packet Tags . . . . . . . . . . . . . . . . . . . . . . . 17 91 5. Packet Types . . . . . . . . . . . . . . . . . . . . . . . . 18 92 5.1. Public-Key Encrypted Session Key Packets (Tag 1) . . . . 18 93 5.2. Signature Packet (Tag 2) . . . . . . . . . . . . . . . . 20 94 5.2.1. Signature Types . . . . . . . . . . . . . . . . . . . 20 95 5.2.2. Version 3 Signature Packet Format . . . . . . . . . . 23 96 5.2.3. Version 4 and 5 Signature Packet Formats . . . . . . 25 97 5.2.4. Computing Signatures . . . . . . . . . . . . . . . . 47 98 5.3. Symmetric-Key Encrypted Session Key Packets (Tag 3) . . . 50 99 5.4. One-Pass Signature Packets (Tag 4) . . . . . . . . . . . 51 100 5.5. Key Material Packet . . . . . . . . . . . . . . . . . . . 52 101 5.5.1. Key Packet Variants . . . . . . . . . . . . . . . . . 52 102 5.5.2. Public-Key Packet Formats . . . . . . . . . . . . . . 53 103 5.5.3. Secret-Key Packet Formats . . . . . . . . . . . . . . 54 104 5.6. Algorithm-specific Parts of Keys . . . . . . . . . . . . 57 105 5.6.1. Algorithm-Specific Part for RSA Keys . . . . . . . . 57 106 5.6.2. Algorithm-Specific Part for DSA Keys . . . . . . . . 57 107 5.6.3. Algorithm-Specific Part for Elgamal Keys . . . . . . 58 108 5.6.4. Algorithm-Specific Part for ECDSA Keys . . . . . . . 58 109 5.6.5. Algorithm-Specific Part for EdDSA Keys . . . . . . . 58 110 5.6.6. Algorithm-Specific Part for ECDH Keys . . . . . . . . 59 111 5.7. Compressed Data Packet (Tag 8) . . . . . . . . . . . . . 60 112 5.8. Symmetrically Encrypted Data Packet (Tag 9) . . . . . . . 60 113 5.9. Marker Packet (Obsolete Literal Packet) (Tag 10) . . . . 61 114 5.10. Literal Data Packet (Tag 11) . . . . . . . . . . . . . . 62 115 5.11. Trust Packet (Tag 12) . . . . . . . . . . . . . . . . . . 63 116 5.12. User ID Packet (Tag 13) . . . . . . . . . . . . . . . . . 63 117 5.13. User Attribute Packet (Tag 17) . . . . . . . . . . . . . 63 118 5.13.1. The Image Attribute Subpacket . . . . . . . . . . . 64 119 5.13.2. User ID Attribute Subpacket . . . . . . . . . . . . 65 120 5.14. Sym. Encrypted Integrity Protected Data Packet (Tag 121 18) . . . . . . . . . . . . . . . . . . . . . . . . . . 65 122 5.15. Modification Detection Code Packet (Tag 19) . . . . . . . 68 123 5.16. OCB Encrypted Data Packet (Tag 20) . . . . . . . . . . . 69 124 5.16.1. EAX Mode . . . . . . . . . . . . . . . . . . . . . . 70 125 5.16.2. OCB Mode . . . . . . . . . . . . . . . . . . . . . . 71 126 6. Radix-64 Conversions . . . . . . . . . . . . . . . . . . . . 71 127 6.1. An Implementation of the CRC-24 in "C" . . . . . . . . . 72 128 6.2. Forming ASCII Armor . . . . . . . . . . . . . . . . . . . 72 129 6.3. Encoding Binary in Radix-64 . . . . . . . . . . . . . . . 75 130 6.4. Decoding Radix-64 . . . . . . . . . . . . . . . . . . . . 76 131 6.5. Examples of Radix-64 . . . . . . . . . . . . . . . . . . 77 132 6.6. Example of an ASCII Armored Message . . . . . . . . . . . 77 133 7. Cleartext Signature Framework . . . . . . . . . . . . . . . . 78 134 7.1. Dash-Escaped Text . . . . . . . . . . . . . . . . . . . . 78 135 8. Regular Expressions . . . . . . . . . . . . . . . . . . . . . 79 136 9. Constants . . . . . . . . . . . . . . . . . . . . . . . . . . 80 137 9.1. Public-Key Algorithms . . . . . . . . . . . . . . . . . . 80 138 9.2. ECC Curve OID . . . . . . . . . . . . . . . . . . . . . . 81 139 9.3. Symmetric-Key Algorithms . . . . . . . . . . . . . . . . 83 140 9.4. Compression Algorithms . . . . . . . . . . . . . . . . . 84 141 9.5. Hash Algorithms . . . . . . . . . . . . . . . . . . . . . 84 142 9.6. Encryption Modes . . . . . . . . . . . . . . . . . . . . 85 143 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 86 144 10.1. New String-to-Key Specifier Types . . . . . . . . . . . 86 145 10.2. New Packets . . . . . . . . . . . . . . . . . . . . . . 86 146 10.2.1. User Attribute Types . . . . . . . . . . . . . . . . 86 147 10.2.2. Image Format Subpacket Types . . . . . . . . . . . . 87 148 10.2.3. New Signature Subpackets . . . . . . . . . . . . . . 87 149 10.2.4. New Packet Versions . . . . . . . . . . . . . . . . 90 150 10.3. New Algorithms . . . . . . . . . . . . . . . . . . . . . 90 151 10.3.1. Public-Key Algorithms . . . . . . . . . . . . . . . 90 152 10.3.2. Symmetric-Key Algorithms . . . . . . . . . . . . . . 91 153 10.3.3. Hash Algorithms . . . . . . . . . . . . . . . . . . 91 154 10.3.4. Compression Algorithms . . . . . . . . . . . . . . . 92 155 11. Packet Composition . . . . . . . . . . . . . . . . . . . . . 92 156 11.1. Transferable Public Keys . . . . . . . . . . . . . . . . 92 157 11.2. Transferable Secret Keys . . . . . . . . . . . . . . . . 94 158 11.3. OpenPGP Messages . . . . . . . . . . . . . . . . . . . . 94 159 11.4. Detached Signatures . . . . . . . . . . . . . . . . . . 95 160 12. Enhanced Key Formats . . . . . . . . . . . . . . . . . . . . 95 161 12.1. Key Structures . . . . . . . . . . . . . . . . . . . . . 95 162 12.2. Key IDs and Fingerprints . . . . . . . . . . . . . . . . 97 163 13. Elliptic Curve Cryptography . . . . . . . . . . . . . . . . . 98 164 13.1. Supported ECC Curves . . . . . . . . . . . . . . . . . . 99 165 13.2. ECDSA and ECDH Conversion Primitives . . . . . . . . . . 99 166 13.3. EdDSA Point Format . . . . . . . . . . . . . . . . . . . 100 167 13.4. Key Derivation Function . . . . . . . . . . . . . . . . 100 168 13.5. ECDH Algorithm . . . . . . . . . . . . . . . . . . . . . 101 169 13.5.1. ECDH Parameters . . . . . . . . . . . . . . . . . . 103 170 14. Notes on Algorithms . . . . . . . . . . . . . . . . . . . . . 104 171 14.1. PKCS#1 Encoding in OpenPGP . . . . . . . . . . . . . . . 104 172 14.1.1. EME-PKCS1-v1_5-ENCODE . . . . . . . . . . . . . . . 104 173 14.1.2. EME-PKCS1-v1_5-DECODE . . . . . . . . . . . . . . . 105 174 14.1.3. EMSA-PKCS1-v1_5 . . . . . . . . . . . . . . . . . . 106 175 14.2. Symmetric Algorithm Preferences . . . . . . . . . . . . 107 176 14.3. Other Algorithm Preferences . . . . . . . . . . . . . . 108 177 14.3.1. Compression Preferences . . . . . . . . . . . . . . 108 178 14.3.2. Hash Algorithm Preferences . . . . . . . . . . . . . 109 179 14.4. Plaintext . . . . . . . . . . . . . . . . . . . . . . . 109 180 14.5. RSA . . . . . . . . . . . . . . . . . . . . . . . . . . 109 181 14.6. DSA . . . . . . . . . . . . . . . . . . . . . . . . . . 110 182 14.7. Elgamal . . . . . . . . . . . . . . . . . . . . . . . . 110 183 14.8. EdDSA . . . . . . . . . . . . . . . . . . . . . . . . . 110 184 14.9. Reserved Algorithm Numbers . . . . . . . . . . . . . . . 111 185 14.10. OpenPGP CFB Mode . . . . . . . . . . . . . . . . . . . . 111 186 14.11. Private or Experimental Parameters . . . . . . . . . . . 112 187 14.12. Meta-Considerations for Expansion . . . . . . . . . . . 113 188 15. Security Considerations . . . . . . . . . . . . . . . . . . . 113 189 16. Compatibility Profiles . . . . . . . . . . . . . . . . . . . 118 190 16.1. OpenPGP ECC Profile . . . . . . . . . . . . . . . . . . 118 191 17. Implementation Nits . . . . . . . . . . . . . . . . . . . . . 119 192 18. References . . . . . . . . . . . . . . . . . . . . . . . . . 120 193 18.1. Normative References . . . . . . . . . . . . . . . . . . 120 194 18.2. Informative References . . . . . . . . . . . . . . . . . 123 195 Appendix A. Test vectors . . . . . . . . . . . . . . . . . . . . 124 196 A.1. Sample EdDSA key . . . . . . . . . . . . . . . . . . . . 125 197 A.2. Sample EdDSA signature . . . . . . . . . . . . . . . . . 125 198 A.3. Sample OCB encryption and decryption . . . . . . . . . . 126 199 A.3.1. Sample Parameters . . . . . . . . . . . . . . . . . . 126 200 A.3.2. Sample symmetric-key encrypted session key packet 201 (v5) . . . . . . . . . . . . . . . . . . . . . . . . 126 202 A.3.3. Starting OCB decryption of CEK . . . . . . . . . . . 127 203 A.3.4. Sample OCB Encrypted Data packet . . . . . . . . . . 127 204 A.3.5. Decryption of data . . . . . . . . . . . . . . . . . 128 205 A.3.6. Complete OCB encrypted packet sequence . . . . . . . 128 206 Appendix B. ECC Point compression flag bytes . . . . . . . . . . 129 207 Appendix C. Changes since RFC-4880 . . . . . . . . . . . . . . . 129 208 Appendix D. The principal authors of RFC-4880 . . . . . . . . . 130 209 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 131 211 1. Introduction 213 This document provides information on the message-exchange packet 214 formats used by OpenPGP to provide encryption, decryption, signing, 215 and key management functions. It is a revision of RFC 4880, "OpenPGP 216 Message Format", which is a revision of RFC 2440, which itself 217 replaces RFC 1991, "PGP Message Exchange Formats" [RFC1991] [RFC2440] 218 [RFC4880]. 220 This document obsoletes: RFC 4880 (OpenPGP), RFC 5581 (Camellia 221 cipher) and RFC 6637 (ECC for OpenPGP). 223 1.1. Terms 225 * OpenPGP - This is a term for security software that uses PGP 5 as 226 a basis, formalized in this document. 228 * PGP - Pretty Good Privacy. PGP is a family of software systems 229 developed by Philip R. Zimmermann from which OpenPGP is based. 231 * PGP 2 - This version of PGP has many variants; where necessary a 232 more detailed version number is used here. PGP 2 uses only RSA, 233 MD5, and IDEA for its cryptographic transforms. An informational 234 RFC, RFC 1991, was written describing this version of PGP. 236 * PGP 5 - This version of PGP is formerly known as "PGP 3" in the 237 community. It has new formats and corrects a number of problems 238 in the PGP 2 design. It is referred to here as PGP 5 because that 239 software was the first release of the "PGP 3" code base. 241 * GnuPG - GNU Privacy Guard, also called GPG, is the leading Open 242 Source implementation of OpenPGP and has been developed along with 243 the OpenPGP standard since 1997. 245 * RNP - Ribose Network PGP is a newer OpenPGP implemention and 246 prominently used by the mail client Thunderbird. 248 "PGP" is a trademark of CA, INC. The use of this, or any other, 249 marks is solely for identification purposes. The term "OpenPGP" 250 refers to the protocol described in this and related documents. 252 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 253 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 254 document are to be interpreted as described in [RFC2119]. 256 The key words "PRIVATE USE", "EXPERT REVIEW", "SPECIFICATION 257 REQUIRED", "RFC REQUIRED", and "IETF REVIEW" that appear in this 258 document when used to describe namespace allocation are to be 259 interpreted as described in [RFC8126]. 261 2. General functions 263 OpenPGP provides data integrity services for messages and data files 264 by using these core technologies: 266 * digital signatures 268 * encryption 270 * compression 272 * Radix-64 conversion 274 In addition, OpenPGP provides key management and certificate 275 services, but many of these are beyond the scope of this document. 277 2.1. Confidentiality via Encryption 279 OpenPGP combines symmetric-key encryption and public-key encryption 280 to provide confidentiality. When made confidential, first the object 281 is encrypted using a symmetric encryption algorithm. Each symmetric 282 key is used only once, for a single object. A new "session key" is 283 generated as a random number for each object (sometimes referred to 284 as a session). Since it is used only once, the session key is bound 285 to the message and transmitted with it. To protect the key, it is 286 encrypted with the receiver's public key. The sequence is as 287 follows: 289 1. The sender creates a message. 291 2. The sending OpenPGP generates a random number to be used as a 292 session key for this message only. 294 3. The session key is encrypted using each recipient's public key. 295 These "encrypted session keys" start the message. 297 4. The sending OpenPGP encrypts the message using the session key, 298 which forms the remainder of the message. Note that the message 299 is also usually compressed. 301 5. The receiving OpenPGP decrypts the session key using the 302 recipient's private key. 304 6. The receiving OpenPGP decrypts the message using the session key. 305 If the message was compressed, it will be decompressed. 307 With symmetric-key encryption, an object may be encrypted with a 308 symmetric key derived from a passphrase (or other shared secret), or 309 a two-stage mechanism similar to the public-key method described 310 above in which a session key is itself encrypted with a symmetric 311 algorithm keyed from a shared secret. 313 Both digital signature and confidentiality services may be applied to 314 the same message. First, a signature is generated for the message 315 and attached to the message. Then the message plus signature is 316 encrypted using a symmetric session key. Finally, the session key is 317 encrypted using public-key encryption and prefixed to the encrypted 318 block. 320 2.2. Authentication via Digital Signature 322 The digital signature uses a hash code or message digest algorithm, 323 and a public-key signature algorithm. The sequence is as follows: 325 1. The sender creates a message. 327 2. The sending software generates a hash code of the message. 329 3. The sending software generates a signature from the hash code 330 using the sender's private key. 332 4. The binary signature is attached to the message. 334 5. The receiving software keeps a copy of the message signature. 336 6. The receiving software generates a new hash code for the received 337 message and verifies it using the message's signature. If the 338 verification is successful, the message is accepted as authentic. 340 2.3. Compression 342 OpenPGP implementations SHOULD compress the message after applying 343 the signature but before encryption. 345 If an implementation does not implement compression, its authors 346 should be aware that most OpenPGP messages in the world are 347 compressed. Thus, it may even be wise for a space-constrained 348 implementation to implement decompression, but not compression. 350 Furthermore, compression has the added side effect that some types of 351 attacks can be thwarted by the fact that slightly altered, compressed 352 data rarely uncompresses without severe errors. This is hardly 353 rigorous, but it is operationally useful. These attacks can be 354 rigorously prevented by implementing and using Modification Detection 355 Codes as described in sections following. 357 2.4. Conversion to Radix-64 359 OpenPGP's underlying native representation for encrypted messages, 360 signature certificates, and keys is a stream of arbitrary octets. 361 Some systems only permit the use of blocks consisting of seven-bit, 362 printable text. For transporting OpenPGP's native raw binary octets 363 through channels that are not safe to raw binary data, a printable 364 encoding of these binary octets is needed. OpenPGP provides the 365 service of converting the raw 8-bit binary octet stream to a stream 366 of printable ASCII characters, called Radix-64 encoding or ASCII 367 Armor. 369 Implementations SHOULD provide Radix-64 conversions. 371 2.5. Signature-Only Applications 373 OpenPGP is designed for applications that use both encryption and 374 signatures, but there are a number of problems that are solved by a 375 signature-only implementation. Although this specification requires 376 both encryption and signatures, it is reasonable for there to be 377 subset implementations that are non-conformant only in that they omit 378 encryption. 380 3. Data Element Formats 382 This section describes the data elements used by OpenPGP. 384 3.1. Scalar Numbers 386 Scalar numbers are unsigned and are always stored in big-endian 387 format. Using n[k] to refer to the kth octet being interpreted, the 388 value of a two-octet scalar is ((n[0] << 8) + n[1]). The value of a 389 four-octet scalar is ((n[0] << 24) + (n[1] << 16) + (n[2] << 8) + 390 n[3]). 392 3.2. Multiprecision Integers 394 Multiprecision integers (also called MPIs) are unsigned integers used 395 to hold large integers such as the ones used in cryptographic 396 calculations. 398 An MPI consists of two pieces: a two-octet scalar that is the length 399 of the MPI in bits followed by a string of octets that contain the 400 actual integer. 402 These octets form a big-endian number; a big-endian number can be 403 made into an MPI by prefixing it with the appropriate length. 405 Examples: 407 (all numbers are in hexadecimal) 409 The string of octets [00 01 01] forms an MPI with the value 1. The 410 string [00 09 01 FF] forms an MPI with the value of 511. 412 Additional rules: 414 The size of an MPI is ((MPI.length + 7) / 8) + 2 octets. 416 The length field of an MPI describes the length starting from its 417 most significant non-zero bit. Thus, the MPI [00 02 01] is not 418 formed correctly. It should be [00 01 01]. 420 Unused bits of an MPI MUST be zero. 422 Also note that when an MPI is encrypted, the length refers to the 423 plaintext MPI. It may be ill-formed in its ciphertext. 425 3.3. Key IDs 427 A Key ID is an eight-octet scalar that identifies a key. 428 Implementations SHOULD NOT assume that Key IDs are unique. The 429 section "Enhanced Key Formats" below describes how Key IDs are 430 formed. 432 3.4. Text 434 Unless otherwise specified, the character set for text is the UTF-8 435 [RFC3629] encoding of Unicode [ISO10646]. 437 3.5. Time Fields 439 A time field is an unsigned four-octet number containing the number 440 of seconds elapsed since midnight, 1 January 1970 UTC. 442 3.6. Keyrings 444 A keyring is a collection of one or more keys in a file or database. 445 Traditionally, a keyring is simply a sequential list of keys, but may 446 be any suitable database. It is beyond the scope of this standard to 447 discuss the details of keyrings or other databases. 449 3.7. String-to-Key (S2K) Specifiers 451 String-to-key (S2K) specifiers are used to convert passphrase strings 452 into symmetric-key encryption/decryption keys. They are used in two 453 places, currently: to encrypt the secret part of private keys in the 454 private keyring, and to convert passphrases to encryption keys for 455 symmetrically encrypted messages. 457 3.7.1. String-to-Key (S2K) Specifier Types 459 There are three types of S2K specifiers currently supported, and some 460 reserved values: 462 +============+==========================+ 463 | ID | S2K Type | 464 +============+==========================+ 465 | 0 | Simple S2K | 466 +------------+--------------------------+ 467 | 1 | Salted S2K | 468 +------------+--------------------------+ 469 | 2 | Reserved value | 470 +------------+--------------------------+ 471 | 3 | Iterated and Salted S2K | 472 +------------+--------------------------+ 473 | 100 to 110 | Private/Experimental S2K | 474 +------------+--------------------------+ 476 Table 1 478 These are described in the following Sections. 480 3.7.1.1. Simple S2K 482 This directly hashes the string to produce the key data. See below 483 for how this hashing is done. 485 Octet 0: 0x00 486 Octet 1: hash algorithm 488 Simple S2K hashes the passphrase to produce the session key. The 489 manner in which this is done depends on the size of the session key 490 (which will depend on the cipher used) and the size of the hash 491 algorithm's output. If the hash size is greater than the session key 492 size, the high-order (leftmost) octets of the hash are used as the 493 key. 495 If the hash size is less than the key size, multiple instances of the 496 hash context are created -- enough to produce the required key data. 497 These instances are preloaded with 0, 1, 2, ... octets of zeros (that 498 is to say, the first instance has no preloading, the second gets 499 preloaded with 1 octet of zero, the third is preloaded with two 500 octets of zeros, and so forth). 502 As the data is hashed, it is given independently to each hash 503 context. Since the contexts have been initialized differently, they 504 will each produce different hash output. Once the passphrase is 505 hashed, the output data from the multiple hashes is concatenated, 506 first hash leftmost, to produce the key data, with any excess octets 507 on the right discarded. 509 3.7.1.2. Salted S2K 511 This includes a "salt" value in the S2K specifier -- some arbitrary 512 data -- that gets hashed along with the passphrase string, to help 513 prevent dictionary attacks. 515 Octet 0: 0x01 516 Octet 1: hash algorithm 517 Octets 2-9: 8-octet salt value 519 Salted S2K is exactly like Simple S2K, except that the input to the 520 hash function(s) consists of the 8 octets of salt from the S2K 521 specifier, followed by the passphrase. 523 3.7.1.3. Iterated and Salted S2K 525 This includes both a salt and an octet count. The salt is combined 526 with the passphrase and the resulting value is hashed repeatedly. 527 This further increases the amount of work an attacker must do to try 528 dictionary attacks. 530 Octet 0: 0x03 531 Octet 1: hash algorithm 532 Octets 2-9: 8-octet salt value 533 Octet 10: count, a one-octet, coded value 535 The count is coded into a one-octet number using the following 536 formula: 538 #define EXPBIAS 6 539 count = ((Int32)16 + (c & 15)) << ((c >> 4) + EXPBIAS); 541 The above formula is in C, where "Int32" is a type for a 32-bit 542 integer, and the variable "c" is the coded count, Octet 10. 544 Iterated-Salted S2K hashes the passphrase and salt data multiple 545 times. The total number of octets to be hashed is specified in the 546 encoded count in the S2K specifier. Note that the resulting count 547 value is an octet count of how many octets will be hashed, not an 548 iteration count. 550 Initially, one or more hash contexts are set up as with the other S2K 551 algorithms, depending on how many octets of key data are needed. 552 Then the salt, followed by the passphrase data, is repeatedly hashed 553 until the number of octets specified by the octet count has been 554 hashed. The one exception is that if the octet count is less than 555 the size of the salt plus passphrase, the full salt plus passphrase 556 will be hashed even though that is greater than the octet count. 557 After the hashing is done, the data is unloaded from the hash 558 context(s) as with the other S2K algorithms. 560 3.7.2. String-to-Key Usage 562 Implementations SHOULD use salted or iterated-and-salted S2K 563 specifiers, as simple S2K specifiers are more vulnerable to 564 dictionary attacks. 566 3.7.2.1. Secret-Key Encryption 568 An S2K specifier can be stored in the secret keyring to specify how 569 to convert the passphrase to a key that unlocks the secret data. 570 Older versions of PGP just stored a cipher algorithm octet preceding 571 the secret data or a zero to indicate that the secret data was 572 unencrypted. The MD5 hash function was always used to convert the 573 passphrase to a key for the specified cipher algorithm. 575 For compatibility, when an S2K specifier is used, the special value 576 253, 254, or 255 is stored in the position where the hash algorithm 577 octet would have been in the old data structure. This is then 578 followed immediately by a one-octet algorithm identifier, and then by 579 the S2K specifier as encoded above. 581 Therefore, preceding the secret data there will be one of these 582 possibilities: 584 0: secret data is unencrypted (no passphrase) 585 255, 254, or 253: followed by algorithm octet and S2K specifier 586 Cipher alg: use Simple S2K algorithm using MD5 hash 588 This last possibility, the cipher algorithm number with an implicit 589 use of MD5 and IDEA, is provided for backward compatibility; it MAY 590 be understood, but SHOULD NOT be generated, and is deprecated. 592 These are followed by an Initial Vector of the same length as the 593 block size of the cipher for the decryption of the secret values, if 594 they are encrypted, and then the secret-key values themselves. 596 3.7.2.2. Symmetric-Key Message Encryption 598 OpenPGP can create a Symmetric-key Encrypted Session Key (ESK) packet 599 at the front of a message. This is used to allow S2K specifiers to 600 be used for the passphrase conversion or to create messages with a 601 mix of symmetric-key ESKs and public-key ESKs. This allows a message 602 to be decrypted either with a passphrase or a public-key pair. 604 PGP 2 always used IDEA with Simple string-to-key conversion when 605 encrypting a message with a symmetric algorithm. This is deprecated, 606 but MAY be used for backward-compatibility. 608 4. Packet Syntax 610 This section describes the packets used by OpenPGP. 612 4.1. Overview 614 An OpenPGP message is constructed from a number of records that are 615 traditionally called packets. A packet is a chunk of data that has a 616 tag specifying its meaning. An OpenPGP message, keyring, 617 certificate, and so forth consists of a number of packets. Some of 618 those packets may contain other OpenPGP packets (for example, a 619 compressed data packet, when uncompressed, contains OpenPGP packets). 621 Each packet consists of a packet header, followed by the packet body. 622 The packet header is of variable length. 624 4.2. Packet Headers 626 The first octet of the packet header is called the "Packet Tag". It 627 determines the format of the header and denotes the packet contents. 628 The remainder of the packet header is the length of the packet. 630 Note that the most significant bit is the leftmost bit, called bit 7. 631 A mask for this bit is 0x80 in hexadecimal. 633 +---------------+ 634 PTag |7 6 5 4 3 2 1 0| 635 +---------------+ 636 Bit 7 -- Always one 637 Bit 6 -- New packet format if set 639 PGP 2.6.x only uses old format packets. Thus, software that 640 interoperates with those versions of PGP must only use old format 641 packets. If interoperability is not an issue, the new packet format 642 is RECOMMENDED. Note that old format packets have four bits of 643 packet tags, and new format packets have six; some features cannot be 644 used and still be backward-compatible. 646 Also note that packets with a tag greater than or equal to 16 MUST 647 use new format packets. The old format packets can only express tags 648 less than or equal to 15. 650 Old format packets contain: 652 Bits 5-2 -- packet tag 653 Bits 1-0 -- length-type 655 New format packets contain: 657 Bits 5-0 -- packet tag 659 4.2.1. Old Format Packet Lengths 661 The meaning of the length-type in old format packets is: 663 0 The packet has a one-octet length. The header is 2 octets long. 665 1 The packet has a two-octet length. The header is 3 octets long. 667 2 The packet has a four-octet length. The header is 5 octets long. 669 3 The packet is of indeterminate length. The header is 1 octet 670 long, and the implementation must determine how long the packet 671 is. If the packet is in a file, this means that the packet 672 extends until the end of the file. In general, an implementation 673 SHOULD NOT use indeterminate-length packets except where the end 674 of the data will be clear from the context, and even then it is 675 better to use a definite length, or a new format header. The new 676 format headers described below have a mechanism for precisely 677 encoding data of indeterminate length. 679 4.2.2. New Format Packet Lengths 681 New format packets have four possible ways of encoding length: 683 1. A one-octet Body Length header encodes packet lengths of up to 684 191 octets. 686 2. A two-octet Body Length header encodes packet lengths of 192 to 687 8383 octets. 689 3. A five-octet Body Length header encodes packet lengths of up to 690 4,294,967,295 (0xFFFFFFFF) octets in length. (This actually 691 encodes a four-octet scalar number.) 693 4. When the length of the packet body is not known in advance by the 694 issuer, Partial Body Length headers encode a packet of 695 indeterminate length, effectively making it a stream. 697 4.2.2.1. One-Octet Lengths 699 A one-octet Body Length header encodes a length of 0 to 191 octets. 700 This type of length header is recognized because the one octet value 701 is less than 192. The body length is equal to: 703 bodyLen = 1st_octet; 705 4.2.2.2. Two-Octet Lengths 707 A two-octet Body Length header encodes a length of 192 to 8383 708 octets. It is recognized because its first octet is in the range 192 709 to 223. The body length is equal to: 711 bodyLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192 713 4.2.2.3. Five-Octet Lengths 715 A five-octet Body Length header consists of a single octet holding 716 the value 255, followed by a four-octet scalar. The body length is 717 equal to: 719 bodyLen = (2nd_octet << 24) | (3rd_octet << 16) | 720 (4th_octet << 8) | 5th_octet 722 This basic set of one, two, and five-octet lengths is also used 723 internally to some packets. 725 4.2.2.4. Partial Body Lengths 727 A Partial Body Length header is one octet long and encodes the length 728 of only part of the data packet. This length is a power of 2, from 1 729 to 1,073,741,824 (2 to the 30th power). It is recognized by its one 730 octet value that is greater than or equal to 224, and less than 255. 731 The Partial Body Length is equal to: 733 partialBodyLen = 1 << (1st_octet & 0x1F); 735 Each Partial Body Length header is followed by a portion of the 736 packet body data. The Partial Body Length header specifies this 737 portion's length. Another length header (one octet, two-octet, five- 738 octet, or partial) follows that portion. The last length header in 739 the packet MUST NOT be a Partial Body Length header. Partial Body 740 Length headers may only be used for the non-final parts of the 741 packet. 743 Note also that the last Body Length header can be a zero-length 744 header. 746 An implementation MAY use Partial Body Lengths for data packets, be 747 they literal, compressed, or encrypted. The first partial length 748 MUST be at least 512 octets long. Partial Body Lengths MUST NOT be 749 used for any other packet types. 751 4.2.3. Packet Length Examples 753 These examples show ways that new format packets might encode the 754 packet lengths. 756 A packet with length 100 may have its length encoded in one octet: 757 0x64. This is followed by 100 octets of data. 759 A packet with length 1723 may have its length encoded in two octets: 760 0xC5, 0xFB. This header is followed by the 1723 octets of data. 762 A packet with length 100000 may have its length encoded in five 763 octets: 0xFF, 0x00, 0x01, 0x86, 0xA0. 765 It might also be encoded in the following octet stream: 0xEF, first 766 32768 octets of data; 0xE1, next two octets of data; 0xE0, next one 767 octet of data; 0xF0, next 65536 octets of data; 0xC5, 0xDD, last 1693 768 octets of data. This is just one possible encoding, and many 769 variations are possible on the size of the Partial Body Length 770 headers, as long as a regular Body Length header encodes the last 771 portion of the data. 773 Please note that in all of these explanations, the total length of 774 the packet is the length of the header(s) plus the length of the 775 body. 777 4.3. Packet Tags 779 The packet tag denotes what type of packet the body holds. Note that 780 old format headers can only have tags less than 16, whereas new 781 format headers can have tags as great as 63. The defined tags (in 782 decimal) are as follows: 784 +==========+====================================================+ 785 | Tag | Packet Type | 786 +==========+====================================================+ 787 | 0 | Reserved - a packet tag MUST NOT have this value | 788 +----------+----------------------------------------------------+ 789 | 1 | Public-Key Encrypted Session Key Packet | 790 +----------+----------------------------------------------------+ 791 | 2 | Signature Packet | 792 +----------+----------------------------------------------------+ 793 | 3 | Symmetric-Key Encrypted Session Key Packet | 794 +----------+----------------------------------------------------+ 795 | 4 | One-Pass Signature Packet | 796 +----------+----------------------------------------------------+ 797 | 5 | Secret-Key Packet | 798 +----------+----------------------------------------------------+ 799 | 6 | Public-Key Packet | 800 +----------+----------------------------------------------------+ 801 | 7 | Secret-Subkey Packet | 802 +----------+----------------------------------------------------+ 803 | 8 | Compressed Data Packet | 804 +----------+----------------------------------------------------+ 805 | 9 | Symmetrically Encrypted Data Packet | 806 +----------+----------------------------------------------------+ 807 | 10 | Marker Packet | 808 +----------+----------------------------------------------------+ 809 | 11 | Literal Data Packet | 810 +----------+----------------------------------------------------+ 811 | 12 | Trust Packet | 812 +----------+----------------------------------------------------+ 813 | 13 | User ID Packet | 814 +----------+----------------------------------------------------+ 815 | 14 | Public-Subkey Packet | 816 +----------+----------------------------------------------------+ 817 | 17 | User Attribute Packet | 818 +----------+----------------------------------------------------+ 819 | 18 | Sym. Encrypted and Integrity Protected Data Packet | 820 +----------+----------------------------------------------------+ 821 | 19 | Modification Detection Code Packet | 822 +----------+----------------------------------------------------+ 823 | 20 | OCB Encrypted Data Packet | 824 +----------+----------------------------------------------------+ 825 | 21 | Reserved | 826 +----------+----------------------------------------------------+ 827 | 26 | Reserved (CMS Encrypted Session Key Packet) | 828 +----------+----------------------------------------------------+ 829 | 60 to 63 | Private or Experimental Values | 830 +----------+----------------------------------------------------+ 832 Table 2 834 5. Packet Types 836 5.1. Public-Key Encrypted Session Key Packets (Tag 1) 838 A Public-Key Encrypted Session Key packet holds the session key used 839 to encrypt a message. Zero or more Public-Key Encrypted Session Key 840 packets and/or Symmetric-Key Encrypted Session Key packets may 841 precede a Symmetrically Encrypted Data Packet, which holds an 842 encrypted message. The message is encrypted with the session key, 843 and the session key is itself encrypted and stored in the Encrypted 844 Session Key packet(s). The Symmetrically Encrypted Data Packet is 845 preceded by one Public-Key Encrypted Session Key packet for each 846 OpenPGP key to which the message is encrypted. The recipient of the 847 message finds a session key that is encrypted to their public key, 848 decrypts the session key, and then uses the session key to decrypt 849 the message. 851 The body of this packet consists of: 853 * A one-octet number giving the version number of the packet type. 854 The currently defined value for packet version is 3. 856 * An eight-octet number that gives the Key ID of the public key to 857 which the session key is encrypted. If the session key is 858 encrypted to a subkey, then the Key ID of this subkey is used here 859 instead of the Key ID of the primary key. 861 * A one-octet number giving the public-key algorithm used. 863 * A string of octets that is the encrypted session key. This string 864 takes up the remainder of the packet, and its contents are 865 dependent on the public-key algorithm used. 867 Algorithm Specific Fields for RSA encryption: 869 - Multiprecision integer (MPI) of RSA encrypted value m**e mod n. 871 Algorithm Specific Fields for Elgamal encryption: 873 - MPI of Elgamal (Diffie-Hellman) value g**k mod p. 875 - MPI of Elgamal (Diffie-Hellman) value m * y**k mod p. 877 Algorithm-Specific Fields for ECDH encryption: 879 - MPI of an EC point representing an ephemeral public key. 881 - a one-octet size, followed by a symmetric key encoded using the 882 method described in Section 13.5. 884 The value "m" in the above formulas is derived from the session key 885 as follows. First, the session key is prefixed with a one-octet 886 algorithm identifier that specifies the symmetric encryption 887 algorithm used to encrypt the following Symmetrically Encrypted Data 888 Packet. Then a two-octet checksum is appended, which is equal to the 889 sum of the preceding session key octets, not including the algorithm 890 identifier, modulo 65536. This value is then encoded as described in 891 PKCS#1 block encoding EME-PKCS1-v1_5 in Section 7.2.1 of [RFC3447] to 892 form the "m" value used in the formulas above. See Section 14.1 of 893 this document for notes on OpenPGP's use of PKCS#1. 895 Note that when an implementation forms several PKESKs with one 896 session key, forming a message that can be decrypted by several keys, 897 the implementation MUST make a new PKCS#1 encoding for each key. 899 An implementation MAY accept or use a Key ID of zero as a "wild card" 900 or "speculative" Key ID. In this case, the receiving implementation 901 would try all available private keys, checking for a valid decrypted 902 session key. This format helps reduce traffic analysis of messages. 904 5.2. Signature Packet (Tag 2) 906 A Signature packet describes a binding between some public key and 907 some data. The most common signatures are a signature of a file or a 908 block of text, and a signature that is a certification of a User ID. 910 Three versions of Signature packets are defined. Version 3 provides 911 basic signature information, while versions 4 and 5 provide an 912 expandable format with subpackets that can specify more information 913 about the signature. PGP 2.6.x only accepts version 3 signatures. 915 Implementations MUST generate version 5 signatures when using a 916 version 5 key. Implementations SHOULD generate V4 signatures with 917 version 4 keys. Implementations MUST NOT create version 3 918 signatures; they MAY accept version 3 signatures. 920 5.2.1. Signature Types 922 There are a number of possible meanings for a signature, which are 923 indicated in a signature type octet in any given signature. Please 924 note that the vagueness of these meanings is not a flaw, but a 925 feature of the system. Because OpenPGP places final authority for 926 validity upon the receiver of a signature, it may be that one 927 signer's casual act might be more rigorous than some other 928 authority's positive act. See Section 5.2.4, "Computing Signatures", 929 for detailed information on how to compute and verify signatures of 930 each type. 932 These meanings are as follows: 934 0x00 Signature of a binary document. This means the signer owns it, 935 created it, or certifies that it has not been modified. 937 0x01 Signature of a canonical text document. This means the signer 938 owns it, created it, or certifies that it has not been modified. 939 The signature is calculated over the text data with its line 940 endings converted to . 942 0x02 Standalone signature. This signature is a signature of only 943 its own subpacket contents. It is calculated identically to a 944 signature over a zero-length binary document. Note that it 945 doesn't make sense to have a V3 standalone signature. 947 0x10 Generic certification of a User ID and Public-Key packet. The 948 issuer of this certification does not make any particular 949 assertion as to how well the certifier has checked that the owner 950 of the key is in fact the person described by the User ID. 952 0x11 Persona certification of a User ID and Public-Key packet. The 953 issuer of this certification has not done any verification of the 954 claim that the owner of this key is the User ID specified. 956 0x12 Casual certification of a User ID and Public-Key packet. The 957 issuer of this certification has done some casual verification of 958 the claim of identity. 960 0x13 Positive certification of a User ID and Public-Key packet. The 961 issuer of this certification has done substantial verification of 962 the claim of identity. Most OpenPGP implementations make their 963 "key signatures" as 0x10 certifications. Some implementations can 964 issue 0x11-0x13 certifications, but few differentiate between the 965 types. 967 0x16 Attested Key Signature. This signature is issued by the 968 primary key over itself and its User ID (or User Attribute). It 969 MUST contain an "Attested Certifications" subpacket and a 970 "Signature Creation Time" subpacket. This type of key signature 971 does not replace or override any standard certification 972 (0x10-0x13). Only the most recent Attestation Key Signature is 973 valid for any given pair. If more than one 974 Certification Attestation Key Signature is present with the same 975 Signature Creation Time, the set of attestations should be treated 976 as the union of all "Attested Certifications" subpackets from all 977 such signatures with the same timestamp. 979 0x18 Subkey Binding Signature. This signature is a statement by the 980 top-level signing key that indicates that it owns the subkey. 981 This signature is calculated directly on the primary key and 982 subkey, and not on any User ID or other packets. A signature that 983 binds a signing subkey MUST have an Embedded Signature subpacket 984 in this binding signature that contains a 0x19 signature made by 985 the signing subkey on the primary key and subkey. 987 0x19 Primary Key Binding Signature. This signature is a statement 988 by a signing subkey, indicating that it is owned by the primary 989 key and subkey. This signature is calculated the same way as a 990 0x18 signature: directly on the primary key and subkey, and not on 991 any User ID or other packets. 993 0x1F Signature directly on a key. This signature is calculated 994 directly on a key. It binds the information in the Signature 995 subpackets to the key, and is appropriate to be used for 996 subpackets that provide information about the key, such as the 997 Revocation Key subpacket. It is also appropriate for statements 998 that non-self certifiers want to make about the key itself, rather 999 than the binding between a key and a name. 1001 0x20 Key revocation signature. The signature is calculated directly 1002 on the key being revoked. A revoked key is not to be used. Only 1003 revocation signatures by the key being revoked, or by an 1004 authorized revocation key, should be considered valid revocation 1005 signatures. 1007 0x28 Subkey revocation signature. The signature is calculated 1008 directly on the subkey being revoked. A revoked subkey is not to 1009 be used. Only revocation signatures by the top-level signature 1010 key that is bound to this subkey, or by an authorized revocation 1011 key, should be considered valid revocation signatures. 1013 0x30 Certification revocation signature. This signature revokes an 1014 earlier User ID certification signature (signature class 0x10 1015 through 0x13) or direct-key signature (0x1F). It should be issued 1016 by the same key that issued the revoked signature or an authorized 1017 revocation key. The signature is computed over the same data as 1018 the certificate that it revokes, and should have a later creation 1019 date than that certificate. 1021 0x40 Timestamp signature. This signature is only meaningful for the 1022 timestamp contained in it. 1024 0x50 Third-Party Confirmation signature. This signature is a 1025 signature over some other OpenPGP Signature packet(s). It is 1026 analogous to a notary seal on the signed data. A third-party 1027 signature SHOULD include Signature Target subpacket(s) to give 1028 easy identification. Note that we really do mean SHOULD. There 1029 are plausible uses for this (such as a blind party that only sees 1030 the signature, not the key or source document) that cannot include 1031 a target subpacket. 1033 5.2.2. Version 3 Signature Packet Format 1035 The body of a version 3 Signature Packet contains: 1037 * One-octet version number (3). 1039 * One-octet length of following hashed material. MUST be 5. 1041 * One-octet signature type. 1043 * Four-octet creation time. 1045 * Eight-octet Key ID of signer. 1047 * One-octet public-key algorithm. 1049 * One-octet hash algorithm. 1051 * Two-octet field holding left 16 bits of signed hash value. 1053 * One or more multiprecision integers comprising the signature. 1054 This portion is algorithm specific, as described below. 1056 The concatenation of the data to be signed, the signature type, 1057 and creation time from the Signature packet (5 additional octets) 1058 is hashed. The resulting hash value is used in the signature 1059 algorithm. The high 16 bits (first two octets) of the hash are 1060 included in the Signature packet to provide a way to reject some 1061 invalid signatures without performing a signature verification. 1063 Algorithm-Specific Fields for RSA signatures: 1065 - Multiprecision integer (MPI) of RSA signature value m**d mod n. 1067 Algorithm-Specific Fields for DSA and ECDSA signatures: 1069 - MPI of DSA or ECDSA value r. 1071 - MPI of DSA or ECDSA value s. 1073 The signature calculation is based on a hash of the signed data, as 1074 described above. The details of the calculation are different for 1075 DSA signatures than for RSA signatures. 1077 With RSA signatures, the hash value is encoded using PKCS#1 encoding 1078 type EMSA-PKCS1-v1_5 as described in Section 9.2 of RFC 3447. This 1079 requires inserting the hash value as an octet string into an ASN.1 1080 structure. The object identifier for the type of hash being used is 1081 included in the structure. The hexadecimal representations for the 1082 currently defined hash algorithms are as follows: 1084 - MD5: 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05 1086 - RIPEMD-160: 0x2B, 0x24, 0x03, 0x02, 0x01 1088 - SHA-1: 0x2B, 0x0E, 0x03, 0x02, 0x1A 1090 - SHA2-224: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04 1092 - SHA2-256: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01 1094 - SHA2-384: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02 1096 - SHA2-512: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03 1098 The ASN.1 Object Identifiers (OIDs) are as follows: 1100 - MD5: 1.2.840.113549.2.5 1102 - RIPEMD-160: 1.3.36.3.2.1 1104 - SHA-1: 1.3.14.3.2.26 1106 - SHA2-224: 2.16.840.1.101.3.4.2.4 1108 - SHA2-256: 2.16.840.1.101.3.4.2.1 1110 - SHA2-384: 2.16.840.1.101.3.4.2.2 1112 - SHA2-512: 2.16.840.1.101.3.4.2.3 1114 The full hash prefixes for these are as follows: 1116 - MD5: 0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 1117 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00, 1118 0x04, 0x10 1120 - RIPEMD-160: 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x24, 1121 0x03, 0x02, 0x01, 0x05, 0x00, 0x04, 0x14 1123 - SHA-1: 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0E, 1124 0x03, 0x02, 0x1A, 0x05, 0x00, 0x04, 0x14 1126 - SHA2-224: 0x30, 0x2D, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1127 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, 0x05, 1128 0x00, 0x04, 0x1C 1130 - SHA2-256: 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1131 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 1132 0x00, 0x04, 0x20 1134 - SHA2-384: 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1135 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 1136 0x00, 0x04, 0x30 1138 - SHA2-512: 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1139 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 1140 0x00, 0x04, 0x40 1142 DSA signatures MUST use hashes that are equal in size to the number 1143 of bits of q, the group generated by the DSA key's generator value. 1145 If the output size of the chosen hash is larger than the number of 1146 bits of q, the hash result is truncated to fit by taking the number 1147 of leftmost bits equal to the number of bits of q. This (possibly 1148 truncated) hash function result is treated as a number and used 1149 directly in the DSA signature algorithm. 1151 5.2.3. Version 4 and 5 Signature Packet Formats 1153 The body of a V4 or V5 Signature packet contains: 1155 * One-octet version number. This is 4 for V4 signatures and 5 for 1156 V5 signatures. 1158 * One-octet signature type. 1160 * One-octet public-key algorithm. 1162 * One-octet hash algorithm. 1164 * Two-octet scalar octet count for following hashed subpacket data. 1165 Note that this is the length in octets of all of the hashed 1166 subpackets; a pointer incremented by this number will skip over 1167 the hashed subpackets. 1169 * Hashed subpacket data set (zero or more subpackets). 1171 * Two-octet scalar octet count for the following unhashed subpacket 1172 data. Note that this is the length in octets of all of the 1173 unhashed subpackets; a pointer incremented by this number will 1174 skip over the unhashed subpackets. 1176 * Unhashed subpacket data set (zero or more subpackets). 1178 * Two-octet field holding the left 16 bits of the signed hash value. 1180 * One or more multiprecision integers comprising the signature. 1181 This portion is algorithm specific: 1183 Algorithm-Specific Fields for RSA signatures: 1185 - Multiprecision integer (MPI) of RSA signature value m**d mod n. 1187 Algorithm-Specific Fields for DSA or ECDSA signatures: 1189 - MPI of DSA or ECDSA value r. 1191 - MPI of DSA or ECDSA value s. 1193 Algorithm-Specific Fields for EdDSA signatures: 1195 - MPI of an EC point r. 1197 - EdDSA value s, in MPI, in the little endian representation. 1199 The format of R and S for use with EdDSA is described in [RFC8032]. 1200 A version 3 signature MUST NOT be created and MUST NOT be used with 1201 EdDSA. 1203 The concatenation of the data being signed and the signature data 1204 from the version number through the hashed subpacket data (inclusive) 1205 is hashed. The resulting hash value is what is signed. The high 16 1206 bits (first two octets) of the hash are included in the Signature 1207 packet to provide a way to reject some invalid signatures without 1208 performing a signature verification. 1210 There are two fields consisting of Signature subpackets. The first 1211 field is hashed with the rest of the signature data, while the second 1212 is unhashed. The second set of subpackets is not cryptographically 1213 protected by the signature and should include only advisory 1214 information. 1216 The difference between a V4 and V5 signature is that the latter 1217 includes additional meta data. 1219 The algorithms for converting the hash function result to a signature 1220 are described in a section below. 1222 5.2.3.1. Signature Subpacket Specification 1224 A subpacket data set consists of zero or more Signature subpackets. 1225 In Signature packets, the subpacket data set is preceded by a two- 1226 octet scalar count of the length in octets of all the subpackets. A 1227 pointer incremented by this number will skip over the subpacket data 1228 set. 1230 Each subpacket consists of a subpacket header and a body. The header 1231 consists of: 1233 * the subpacket length (1, 2, or 5 octets), 1235 * the subpacket type (1 octet), 1237 and is followed by the subpacket-specific data. 1239 The length includes the type octet but not this length. Its format 1240 is similar to the "new" format packet header lengths, but cannot have 1241 Partial Body Lengths. That is: 1243 if the 1st octet < 192, then 1244 lengthOfLength = 1 1245 subpacketLen = 1st_octet 1247 if the 1st octet >= 192 and < 255, then 1248 lengthOfLength = 2 1249 subpacketLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192 1251 if the 1st octet = 255, then 1252 lengthOfLength = 5 1253 subpacket length = [four-octet scalar starting at 2nd_octet] 1255 The value of the subpacket type octet may be: 1257 +============+========================================+ 1258 | Type | Description | 1259 +============+========================================+ 1260 | 0 | Reserved | 1261 +------------+----------------------------------------+ 1262 | 1 | Reserved | 1263 +------------+----------------------------------------+ 1264 | 2 | Signature Creation Time | 1265 +------------+----------------------------------------+ 1266 | 3 | Signature Expiration Time | 1267 +------------+----------------------------------------+ 1268 | 4 | Exportable Certification | 1269 +------------+----------------------------------------+ 1270 | 5 | Trust Signature | 1271 +------------+----------------------------------------+ 1272 | 6 | Regular Expression | 1273 +------------+----------------------------------------+ 1274 | 7 | Revocable | 1275 +------------+----------------------------------------+ 1276 | 8 | Reserved | 1277 +------------+----------------------------------------+ 1278 | 9 | Key Expiration Time | 1279 +------------+----------------------------------------+ 1280 | 10 | Placeholder for backward compatibility | 1281 +------------+----------------------------------------+ 1282 | 11 | Preferred Symmetric Algorithms | 1283 +------------+----------------------------------------+ 1284 | 12 | Revocation Key | 1285 +------------+----------------------------------------+ 1286 | 13 to 15 | Reserved | 1287 +------------+----------------------------------------+ 1288 | 16 | Issuer | 1289 +------------+----------------------------------------+ 1290 | 17 to 19 | Reserved | 1291 +------------+----------------------------------------+ 1292 | 20 | Notation Data | 1293 +------------+----------------------------------------+ 1294 | 21 | Preferred Hash Algorithms | 1295 +------------+----------------------------------------+ 1296 | 22 | Preferred Compression Algorithms | 1297 +------------+----------------------------------------+ 1298 | 23 | Key Server Preferences | 1299 +------------+----------------------------------------+ 1300 | 24 | Preferred Key Server | 1301 +------------+----------------------------------------+ 1302 | 25 | Primary User ID | 1303 +------------+----------------------------------------+ 1304 | 26 | Policy URI | 1305 +------------+----------------------------------------+ 1306 | 27 | Key Flags | 1307 +------------+----------------------------------------+ 1308 | 28 | Signer's User ID | 1309 +------------+----------------------------------------+ 1310 | 29 | Reason for Revocation | 1311 +------------+----------------------------------------+ 1312 | 30 | Features | 1313 +------------+----------------------------------------+ 1314 | 31 | Signature Target | 1315 +------------+----------------------------------------+ 1316 | 32 | Embedded Signature | 1317 +------------+----------------------------------------+ 1318 | 33 | Issuer Fingerprint | 1319 +------------+----------------------------------------+ 1320 | 34 | Preferred Encryption Modes | 1321 +------------+----------------------------------------+ 1322 | 35 | Intended Recipient Fingerprint | 1323 +------------+----------------------------------------+ 1324 | 37 | Attested Certifications | 1325 +------------+----------------------------------------+ 1326 | 38 | Key Block | 1327 +------------+----------------------------------------+ 1328 | 39 | Reserved | 1329 +------------+----------------------------------------+ 1330 | 40 | Literal Data Meta Hash | 1331 +------------+----------------------------------------+ 1332 | 41 | Trust Alias | 1333 +------------+----------------------------------------+ 1334 | 100 to 110 | Private or experimental | 1335 +------------+----------------------------------------+ 1337 Table 3 1339 An implementation SHOULD ignore any subpacket of a type that it does 1340 not recognize. 1342 Bit 7 of the subpacket type is the "critical" bit. If set, it 1343 denotes that the subpacket is one that is critical for the evaluator 1344 of the signature to recognize. If a subpacket is encountered that is 1345 marked critical but is unknown to the evaluating software, the 1346 evaluator SHOULD consider the signature to be in error. 1348 An evaluator may "recognize" a subpacket, but not implement it. The 1349 purpose of the critical bit is to allow the signer to tell an 1350 evaluator that it would prefer a new, unknown feature to generate an 1351 error than be ignored. 1353 Implementations SHOULD implement the four preferred algorithm 1354 subpackets (11, 21, 22, and 34), as well as the "Reason for 1355 Revocation" subpacket. Note, however, that if an implementation 1356 chooses not to implement some of the preferences, it is required to 1357 behave in a polite manner to respect the wishes of those users who do 1358 implement these preferences. 1360 5.2.3.2. Signature Subpacket Types 1362 A number of subpackets are currently defined. Some subpackets apply 1363 to the signature itself and some are attributes of the key. 1364 Subpackets that are found on a self-signature are placed on a 1365 certification made by the key itself. Note that a key may have more 1366 than one User ID, and thus may have more than one self-signature, and 1367 differing subpackets. 1369 A subpacket may be found either in the hashed or unhashed subpacket 1370 sections of a signature. If a subpacket is not hashed, then the 1371 information in it cannot be considered definitive because it is not 1372 part of the signature proper. 1374 5.2.3.3. Notes on Self-Signatures 1376 A self-signature is a binding signature made by the key to which the 1377 signature refers. There are three types of self-signatures, the 1378 certification signatures (types 0x10-0x13), the direct-key signature 1379 (type 0x1F), and the subkey binding signature (type 0x18). For 1380 certification self-signatures, each User ID may have a self- 1381 signature, and thus different subpackets in those self-signatures. 1382 For subkey binding signatures, each subkey in fact has a self- 1383 signature. Subpackets that appear in a certification self-signature 1384 apply to the user name, and subpackets that appear in the subkey 1385 self-signature apply to the subkey. Lastly, subpackets on the 1386 direct-key signature apply to the entire key. 1388 Implementing software should interpret a self-signature's preference 1389 subpackets as narrowly as possible. For example, suppose a key has 1390 two user names, Alice and Bob. Suppose that Alice prefers the 1391 symmetric algorithm AES-256, and Bob prefers Camellia-256 or AES-128. 1392 If the software locates this key via Alice's name, then the preferred 1393 algorithm is AES-256; if software locates the key via Bob's name, 1394 then the preferred algorithm is Camellia-256. If the key is located 1395 by Key ID, the algorithm of the primary User ID of the key provides 1396 the preferred symmetric algorithm. 1398 Revoking a self-signature or allowing it to expire has a semantic 1399 meaning that varies with the signature type. Revoking the self- 1400 signature on a User ID effectively retires that user name. The self- 1401 signature is a statement, "My name X is tied to my signing key K" and 1402 is corroborated by other users' certifications. If another user 1403 revokes their certification, they are effectively saying that they no 1404 longer believe that name and that key are tied together. Similarly, 1405 if the users themselves revoke their self-signature, then the users 1406 no longer go by that name, no longer have that email address, etc. 1407 Revoking a binding signature effectively retires that subkey. 1408 Revoking a direct-key signature cancels that signature. Please see 1409 the "Reason for Revocation" subpacket (Section 5.2.3.25) for more 1410 relevant detail. 1412 Since a self-signature contains important information about the key's 1413 use, an implementation SHOULD allow the user to rewrite the self- 1414 signature, and important information in it, such as preferences and 1415 key expiration. 1417 It is good practice to verify that a self-signature imported into an 1418 implementation doesn't advertise features that the implementation 1419 doesn't support, rewriting the signature as appropriate. 1421 An implementation that encounters multiple self-signatures on the 1422 same object may resolve the ambiguity in any way it sees fit, but it 1423 is RECOMMENDED that priority be given to the most recent self- 1424 signature. 1426 5.2.3.4. Signature Creation Time 1428 (4-octet time field) 1430 The time the signature was made. 1432 MUST be present in the hashed area. 1434 5.2.3.5. Issuer 1436 (8-octet Key ID) 1438 The OpenPGP Key ID of the key issuing the signature. If the version 1439 of that key is greater than 4, this subpacket MUST NOT be included in 1440 the signature. 1442 5.2.3.6. Key Expiration Time 1444 (4-octet time field) 1445 The validity period of the key. This is the number of seconds after 1446 the key creation time that the key expires. If this is not present 1447 or has a value of zero, the key never expires. This is found only on 1448 a self-signature. 1450 5.2.3.7. Preferred Symmetric Algorithms 1452 (array of one-octet values) 1454 Symmetric algorithm numbers that indicate which algorithms the key 1455 holder prefers to use. The subpacket body is an ordered list of 1456 octets with the most preferred listed first. It is assumed that only 1457 algorithms listed are supported by the recipient's software. 1458 Algorithm numbers are in Section 9. This is only found on a self- 1459 signature. 1461 5.2.3.8. Preferred Encryption Modes 1463 (array of one-octet values) 1465 This is a deprecated subpacket with encryption mode numbers to 1466 indicate which modes the key holder prefers to use with OCB Encrypted 1467 Data Pakets. Implementations SHOULD ignore this subpacket and assume 1468 OCB. The subpacket body is an ordered list of octets with the most 1469 preferred listed first. It is assumed that only modes listed are 1470 supported by the recipient's software. Mode numbers are in 1471 Section 9.6. This is only found on a self-signature. Note that 1472 support for the OCB Encrypted Data packet in the general is indicated 1473 by a Feature Flag. 1475 5.2.3.9. Preferred Hash Algorithms 1477 (array of one-octet values) 1479 Message digest algorithm numbers that indicate which algorithms the 1480 key holder prefers to receive. Like the preferred symmetric 1481 algorithms, the list is ordered. Algorithm numbers are in 1482 Section 9.5. This is only found on a self-signature. 1484 5.2.3.10. Preferred Compression Algorithms 1486 (array of one-octet values) 1487 Compression algorithm numbers that indicate which algorithms the key 1488 holder prefers to use. Like the preferred symmetric algorithms, the 1489 list is ordered. Algorithm numbers are in Section 9.4. If this 1490 subpacket is not included, ZIP is preferred. A zero denotes that 1491 uncompressed data is preferred; the key holder's software might have 1492 no compression software in that implementation. This is only found 1493 on a self-signature. 1495 5.2.3.11. Signature Expiration Time 1497 (4-octet time field) 1499 The validity period of the signature. This is the number of seconds 1500 after the signature creation time that the signature expires. If 1501 this is not present or has a value of zero, it never expires. 1503 5.2.3.12. Exportable Certification 1505 (1 octet of exportability, 0 for not, 1 for exportable) 1507 This subpacket denotes whether a certification signature is 1508 "exportable", to be used by other users than the signature's issuer. 1509 The packet body contains a Boolean flag indicating whether the 1510 signature is exportable. If this packet is not present, the 1511 certification is exportable; it is equivalent to a flag containing a 1512 1. 1514 Non-exportable, or "local", certifications are signatures made by a 1515 user to mark a key as valid within that user's implementation only. 1517 Thus, when an implementation prepares a user's copy of a key for 1518 transport to another user (this is the process of "exporting" the 1519 key), any local certification signatures are deleted from the key. 1521 The receiver of a transported key "imports" it, and likewise trims 1522 any local certifications. In normal operation, there won't be any, 1523 assuming the import is performed on an exported key. However, there 1524 are instances where this can reasonably happen. For example, if an 1525 implementation allows keys to be imported from a key database in 1526 addition to an exported key, then this situation can arise. 1528 Some implementations do not represent the interest of a single user 1529 (for example, a key server). Such implementations always trim local 1530 certifications from any key they handle. 1532 5.2.3.13. Revocable 1534 (1 octet of revocability, 0 for not, 1 for revocable) 1536 Signature's revocability status. The packet body contains a Boolean 1537 flag indicating whether the signature is revocable. Signatures that 1538 are not revocable have any later revocation signatures ignored. They 1539 represent a commitment by the signer that he cannot revoke his 1540 signature for the life of his key. If this packet is not present, 1541 the signature is revocable. 1543 5.2.3.14. Trust Signature 1545 (1 octet "level" (depth), 1 octet of trust amount) 1547 Signer asserts that the key is not only valid but also trustworthy at 1548 the specified level. Level 0 has the same meaning as an ordinary 1549 validity signature. Level 1 means that the signed key is asserted to 1550 be a valid trusted introducer, with the 2nd octet of the body 1551 specifying the degree of trust. Level 2 means that the signed key is 1552 asserted to be trusted to issue level 1 trust signatures, i.e., that 1553 it is a "meta introducer". Generally, a level n trust signature 1554 asserts that a key is trusted to issue level n-1 trust signatures. 1555 The trust amount is in a range from 0-255, interpreted such that 1556 values less than 120 indicate partial trust and values of 120 or 1557 greater indicate complete trust. Implementations SHOULD emit values 1558 of 60 for partial trust and 120 for complete trust. 1560 5.2.3.15. Regular Expression 1562 (null-terminated regular expression) 1564 Used in conjunction with Trust Signature packets (of level > 0) to 1565 limit the scope of trust that is extended. Only signatures by the 1566 target key on User IDs that match the regular expression in the body 1567 of this packet have trust extended by the trust Signature subpacket. 1568 The regular expression uses the same syntax as the Henry Spencer's 1569 "almost public domain" regular expression [REGEX] package. A 1570 description of the syntax is found in Section 8 below. 1572 5.2.3.16. Trust Alias 1574 (String) 1576 This subpacket allows a keyholder to state an alias for a mail 1577 address in the User ID. The value is expected to be the UTF-8 1578 encoded addr-spec part of a mail address. 1580 If used in conjunction with a Trust Signature subpacket of level > 0 1581 and a Regular Expression subpacket the User ID is not considered and 1582 the trust is only extended if at least one Trust Alias matches the 1583 regular expression. 1585 If this subpacket is found on a self-signature, a signature done with 1586 a Trust Signature subpacket of level > 0 and a Regular Expression 1587 subpacket is computed over the User ID, an octet 0x00, and the value 1588 of the Trust Alias subpacket. If more than one Trust Alias subpacket 1589 exists all those subpackets are first sorted using binary ordering 1590 and then concatenated using an octet 0x00 as separator. 1592 This subpacket is useful to handle the common case that mails with 1593 and without subdomains are used. For example alice@example.org is 1594 her canonical address but she receives mail also under the address 1595 alice@lab.example.org. All other properties are identical for the 1596 second address and thus a second User ID packet is not useful here. 1598 5.2.3.17. Revocation Key 1600 (1 octet of class, 1 octet of public-key algorithm ID, 20 or 32 1601 octets of fingerprint) 1603 V4 keys use the full 20 octet fingerprint; V5 keys use the full 32 1604 octet fingerprint 1606 Authorizes the specified key to issue revocation signatures for this 1607 key. Class octet must have bit 0x80 set. If the bit 0x40 is set, 1608 then this means that the revocation information is sensitive. Other 1609 bits are for future expansion to other kinds of authorizations. This 1610 is only found on a direct-key self-signature (type 0x1f). The use on 1611 other types of self-signatures is unspecified. 1613 If the "sensitive" flag is set, the keyholder feels this subpacket 1614 contains private trust information that describes a real-world 1615 sensitive relationship. If this flag is set, implementations SHOULD 1616 NOT export this signature to other users except in cases where the 1617 data needs to be available: when the signature is being sent to the 1618 designated revoker, or when it is accompanied by a revocation 1619 signature from that revoker. Note that it may be appropriate to 1620 isolate this subpacket within a separate signature so that it is not 1621 combined with other subpackets that need to be exported. 1623 5.2.3.18. Notation Data 1624 (4 octets of flags, 2 octets of name length (M), 1625 2 octets of value length (N), 1626 M octets of name data, 1627 N octets of value data) 1629 This subpacket describes a "notation" on the signature that the 1630 issuer wishes to make. The notation has a name and a value, each of 1631 which are strings of octets. There may be more than one notation in 1632 a signature. Notations can be used for any extension the issuer of 1633 the signature cares to make. The "flags" field holds four octets of 1634 flags. 1636 All undefined flags MUST be zero. Defined flags are as follows: 1638 First octet: 0x80 = human-readable. This note value is text. 1639 Other octets: none. 1641 Notation names are arbitrary strings encoded in UTF-8. They reside 1642 in two namespaces: The IETF namespace and the user namespace. 1644 The IETF namespace is registered with IANA. These names MUST NOT 1645 contain the "@" character (0x40). This is a tag for the user 1646 namespace. 1648 Names in the user namespace consist of a UTF-8 string tag followed by 1649 "@" followed by a DNS domain name. Note that the tag MUST NOT 1650 contain an "@" character. For example, the "sample" tag used by 1651 Example Corporation could be "sample@example.com". 1653 Names in a user space are owned and controlled by the owners of that 1654 domain. Obviously, it's bad form to create a new name in a DNS space 1655 that you don't own. 1657 Since the user namespace is in the form of an email address, 1658 implementers MAY wish to arrange for that address to reach a person 1659 who can be consulted about the use of the named tag. Note that due 1660 to UTF-8 encoding, not all valid user space name tags are valid email 1661 addresses. 1663 If there is a critical notation, the criticality applies to that 1664 specific notation and not to notations in general. 1666 The following subsections define a set of standard notations. 1668 5.2.3.18.1. The 'charset' Notation 1670 The "charset" notation is a description of the character set used to 1671 encode the signed plaintext. The default value is "UTF-8". If used, 1672 the value MUST be encoded as human readable and MUST be present in 1673 the hashed subpacket section of the signature. This notation is 1674 useful for cleartext signatures in cases where it is not possible to 1675 encode the text in UTF-8. By having the used character set a part of 1676 the signed data, attacks exploiting different representation of code 1677 points will be mitigated. 1679 5.2.3.18.2. The 'manu' Notation 1681 The "manu" notation is a string that declares the device 1682 manufacturer's name. The certifier key is asserting this string 1683 (which may or may not be related to the User ID of the certifier's 1684 key). 1686 5.2.3.18.3. The 'make' Notation 1688 This notation defines the product make. It is a free form string. 1690 5.2.3.18.4. The 'model' Notation 1692 This notation defines the product model name/number. It is a free 1693 form string. 1695 5.2.3.18.5. The 'prodid' Notation 1697 This notation contains the product identifier. It is a free form 1698 string. 1700 5.2.3.18.6. The 'pvers' Notation 1702 This notation defines the product version number (which could be a 1703 release number, year, or some other identifier to differentiate 1704 different versions of the same make/model). It is a free form 1705 string. 1707 5.2.3.18.7. The 'lot' Notation 1709 This notation defines the product lot number (which is an indicator 1710 of the batch of product). It is a free form string. 1712 5.2.3.18.8. The 'qty' Notation 1714 This notation defines the quantity of items in this package. It is a 1715 decimal integer representation with no punctuation, e.g. "10", 1716 "1000", "10000", etc. 1718 5.2.3.18.9. The 'loc' and 'dest' Notations 1720 The "loc" and 'dest' notations declare a GeoLocation as defined by 1721 RFC 5870 [RFC5870] but without the leading "geo:" header. For 1722 example, if you had a GeoLocation URI of "geo:13.4125,103.8667" you 1723 would encode that in these notations as "13.4125,103.8667". 1725 The 'loc' notation is meant to encode the geo location where the 1726 signature was made. The 'dest' notation is meant to encode the geo 1727 location where the device is "destined" (i.e., a "destination" for 1728 the device). 1730 5.2.3.18.10. The 'hash' Notation 1732 A 'hash' notation is a means to include external data in the contents 1733 of a signature without including the data itself. This is done by 1734 hashing the external data separately and then including the data's 1735 name and hash in the signature via this notation. This is useful, 1736 for example, to have an external "manifest," "image," or other data 1737 that might not be vital to the signature itself but still needs to be 1738 protected and authenticated without requiring a second signature. 1740 The 'hash' notation has the following structure: 1742 * A single byte specifying the length of the name of the hashed 1743 data. 1745 * A UTF-8 string of the name of the hashed data. 1747 * A single byte specifying the hash algorithm (see section 9.4). 1749 * The binary hash output of the hashed data using the specified 1750 algorithm. (The length of this data is implicit based on the 1751 algorithm specified). 1753 Due to its nature a 'hash' notation is not human readable and MUST 1754 NOT be marked as such when used. 1756 5.2.3.19. Key Server Preferences 1758 (N octets of flags) 1759 This is a list of one-bit flags that indicate preferences that the 1760 key holder has about how the key is handled on a key server. All 1761 undefined flags MUST be zero. 1763 First octet: 0x80 = No-modify 1765 The key holder requests that this key only be modified or updated 1766 by the key holder or an administrator of the key server. 1768 If No-modify is set on the most recent self-sig over a User ID, 1769 then a keyserver should only redistribute those third-party 1770 certifications over that User ID that have been attested to in the 1771 most recent Attestation Key Signature packet (see "Attested 1772 Certifications" below). 1774 This is found only on a self-signature. 1776 5.2.3.20. Preferred Key Server 1778 (String) 1780 This is a URI of a key server that the key holder prefers be used for 1781 updates. Note that keys with multiple User IDs can have a preferred 1782 key server for each User ID. Note also that since this is a URI, the 1783 key server can actually be a copy of the key retrieved by ftp, http, 1784 finger, etc. 1786 5.2.3.21. Primary User ID 1788 (1 octet, Boolean) 1790 This is a flag in a User ID's self-signature that states whether this 1791 User ID is the main User ID for this key. It is reasonable for an 1792 implementation to resolve ambiguities in preferences, etc. by 1793 referring to the primary User ID. If this flag is absent, its value 1794 is zero. If more than one User ID in a key is marked as primary, the 1795 implementation may resolve the ambiguity in any way it sees fit, but 1796 it is RECOMMENDED that priority be given to the User ID with the most 1797 recent self-signature. 1799 When appearing on a self-signature on a User ID packet, this 1800 subpacket applies only to User ID packets. When appearing on a self- 1801 signature on a User Attribute packet, this subpacket applies only to 1802 User Attribute packets. That is to say, there are two different and 1803 independent "primaries" -- one for User IDs, and one for User 1804 Attributes. 1806 5.2.3.22. Policy URI 1808 (String) 1810 This subpacket contains a URI of a document that describes the policy 1811 under which the signature was issued. 1813 5.2.3.23. Key Flags 1815 (N octets of flags) 1817 This subpacket contains a list of binary flags that hold information 1818 about a key. It is a string of octets, and an implementation MUST 1819 NOT assume a fixed size. This is so it can grow over time. If a 1820 list is shorter than an implementation expects, the unstated flags 1821 are considered to be zero. The defined flags are as follows: 1823 First octet: 1825 0x01 - This key may be used to certify other keys. 1827 0x02 - This key may be used to sign data. 1829 0x04 - This key may be used to encrypt communications. 1831 0x08 - This key may be used to encrypt storage. 1833 0x10 - The private component of this key may have been split by a 1834 secret-sharing mechanism. 1836 0x20 - This key may be used for authentication. 1838 0x80 - The private component of this key may be in the possession 1839 of more than one person. 1841 Second octet: 1843 0x04 - This key may be used to encrypt communications or storage. 1845 0x08 - This key may be used for timestamping. 1847 Usage notes: 1849 The flags in this packet may appear in self-signatures or in 1850 certification signatures. They mean different things depending on 1851 who is making the statement -- for example, a certification signature 1852 that has the "sign data" flag is stating that the certification is 1853 for that use. On the other hand, the "communications encryption" 1854 flag in a self-signature is stating a preference that a given key be 1855 used for communications. Note however, that it is a thorny issue to 1856 determine what is "communications" and what is "storage". This 1857 decision is left wholly up to the implementation; the authors of this 1858 document do not claim any special wisdom on the issue and realize 1859 that accepted opinion may change. 1861 The "split key" (1st,0x10) and "group key" (1st,0x80) flags are 1862 placed on a self-signature only; they are meaningless on a 1863 certification signature. They SHOULD be placed only on a direct-key 1864 signature (type 0x1F) or a subkey signature (type 0x18), one that 1865 refers to the key the flag applies to. 1867 The "restricted encryption key" (2nd,0x04) does not take part in any 1868 automatic selection of encryption keys. It is only found on a subkey 1869 signature (type 0x18), one that refers to the key the flag applies 1870 to. 1872 5.2.3.24. Signer's User ID 1874 (String) 1876 This subpacket allows a keyholder to state which User ID is 1877 responsible for the signing. Many keyholders use a single key for 1878 different purposes, such as business communications as well as 1879 personal communications. This subpacket allows such a keyholder to 1880 state which of their roles is making a signature. 1882 This subpacket is not appropriate to use to refer to a User Attribute 1883 packet. 1885 5.2.3.25. Reason for Revocation 1887 (1 octet of revocation code, N octets of reason string) 1889 This subpacket is used only in key revocation and certification 1890 revocation signatures. It describes the reason why the key or 1891 certificate was revoked. 1893 The first octet contains a machine-readable code that denotes the 1894 reason for the revocation: 1896 +=========+==================================+ 1897 | Code | Reason | 1898 +=========+==================================+ 1899 | 0 | No reason specified (key | 1900 | | revocations or cert revocations) | 1901 +---------+----------------------------------+ 1902 | 1 | Key is superseded (key | 1903 | | revocations) | 1904 +---------+----------------------------------+ 1905 | 2 | Key material has been | 1906 | | compromised (key revocations) | 1907 +---------+----------------------------------+ 1908 | 3 | Key is retired and no longer | 1909 | | used (key revocations) | 1910 +---------+----------------------------------+ 1911 | 32 | User ID information is no longer | 1912 | | valid (cert revocations) | 1913 +---------+----------------------------------+ 1914 | 100-110 | Private Use | 1915 +---------+----------------------------------+ 1917 Table 4 1919 Following the revocation code is a string of octets that gives 1920 information about the Reason for Revocation in human-readable form 1921 (UTF-8). The string may be null, that is, of zero length. The 1922 length of the subpacket is the length of the reason string plus one. 1923 An implementation SHOULD implement this subpacket, include it in all 1924 revocation signatures, and interpret revocations appropriately. 1925 There are important semantic differences between the reasons, and 1926 there are thus important reasons for revoking signatures. 1928 If a key has been revoked because of a compromise, all signatures 1929 created by that key are suspect. However, if it was merely 1930 superseded or retired, old signatures are still valid. If the 1931 revoked signature is the self-signature for certifying a User ID, a 1932 revocation denotes that that user name is no longer in use. Such a 1933 revocation SHOULD include a 0x20 code. 1935 Note that any signature may be revoked, including a certification on 1936 some other person's key. There are many good reasons for revoking a 1937 certification signature, such as the case where the keyholder leaves 1938 the employ of a business with an email address. A revoked 1939 certification is no longer a part of validity calculations. 1941 5.2.3.26. Features 1943 (N octets of flags) 1945 The Features subpacket denotes which advanced OpenPGP features a 1946 user's implementation supports. This is so that as features are 1947 added to OpenPGP that cannot be backwards-compatible, a user can 1948 state that they can use that feature. The flags are single bits that 1949 indicate that a given feature is supported. 1951 This subpacket is similar to a preferences subpacket, and only 1952 appears in a self-signature. 1954 An implementation SHOULD NOT use a feature listed when sending to a 1955 user who does not state that they can use it. 1957 Defined features are as follows: 1959 First octet: 1961 0x01 - Modification Detection (packets 18 and 19) 1963 0x02 - OCB Encrypted Data Packet (packet 20) and version 5 1964 Symmetric-Key Encrypted Session Key Packets (packet 3) 1966 0x04 - Version 5 Public-Key Packet format and corresponding new 1967 fingerprint format 1969 If an implementation implements any of the defined features, it 1970 SHOULD implement the Features subpacket, too. 1972 An implementation may freely infer features from other suitable 1973 implementation-dependent mechanisms. 1975 5.2.3.27. Signature Target 1977 (1 octet public-key algorithm, 1 octet hash algorithm, N octets hash) 1979 This subpacket identifies a specific target signature to which a 1980 signature refers. For revocation signatures, this subpacket provides 1981 explicit designation of which signature is being revoked. For a 1982 third-party or timestamp signature, this designates what signature is 1983 signed. All arguments are an identifier of that target signature. 1985 The N octets of hash data MUST be the size of the hash of the 1986 signature. For example, a target signature with a SHA-1 hash MUST 1987 have 20 octets of hash data. 1989 5.2.3.28. Embedded Signature 1991 (1 signature packet body) 1993 This subpacket contains a complete Signature packet body as specified 1994 in Section 5.2 above. It is useful when one signature needs to refer 1995 to, or be incorporated in, another signature. 1997 5.2.3.29. Issuer Fingerprint 1999 (1 octet key version number, N octets of fingerprint) 2001 The OpenPGP Key fingerprint of the key issuing the signature. This 2002 subpacket SHOULD be included in all signatures. If the version of 2003 the issuing key is 4 and an Issuer subpacket is also included in the 2004 signature, the key ID of the Issuer subpacket MUST match the low 64 2005 bits of the fingerprint. 2007 Note that the length N of the fingerprint for a version 4 key is 20 2008 octets; for a version 5 key N is 32. 2010 5.2.3.30. Intended Recipient Fingerprint 2012 (1 octet key version number, N octets of fingerprint) 2014 The OpenPGP Key fingerprint of the intended recipient primary key. 2015 If one or more subpackets of this type are included in a signature, 2016 it SHOULD be considered valid only in an encrypted context, where the 2017 key it was encrypted to is one of the indicated primary keys, or one 2018 of their subkeys. This can be used to prevent forwarding a signature 2019 outside of its intended, encrypted context. 2021 Note that the length N of the fingerprint for a version 4 key is 20 2022 octets; for a version 5 key N is 32. 2024 5.2.3.31. Attested Certifications 2026 (N octets of certification digests) 2027 This subpacket MUST only appear as a hashed subpacket of an 2028 Attestation Key Signature. It has no meaning in any other signature 2029 type. It is used by the primary key to attest to a set of third- 2030 party certifications over the associated User ID or User Attribute. 2031 This enables the holder of an OpenPGP primary key to mark specific 2032 third-party certifications as re-distributable with the rest of the 2033 Transferable Public Key (see the "No-modify" flag in "Key Server 2034 Preferences", above). Implementations MUST include exactly one 2035 Attested Certification subpacket in any generated Attestation Key 2036 Signature. 2038 The contents of the subpacket consists of a series of digests using 2039 the same hash algorithm used by the signature itself. Each digest is 2040 made over one third-party signature (any Certification, i.e., 2041 signature type 0x10-0x13) that covers the same Primary Key and User 2042 ID (or User Attribute). For example, an Attestation Key Signature 2043 made by key X over User ID U using hash algorithm SHA256 might 2044 contain an Attested Certifications subpacket of 192 octets (6*32 2045 octets) covering six third-party certification Signatures over . 2046 They SHOULD be ordered by binary hash value from low to high (e.g., a 2047 hash with hexadecimal value 037a... precedes a hash with value 2048 0392..., etc). The length of this subpacket MUST be an integer 2049 multiple of the length of the hash algorithm used for the enclosing 2050 Attestation Key Signature. 2052 The listed digests MUST be calculated over the third-party 2053 certification's Signature packet as described in the "Computing 2054 Signatures" section, but without a trailer: the hash data starts with 2055 the octet 0x88, followed by the four-octet length of the Signature, 2056 and then the body of the Signature packet. (Note that this is an 2057 old-style packet header for a Signature packet with the length-of- 2058 length field set to zero.) The unhashed subpacket data of the 2059 Signature packet being hashed is not included in the hash, and the 2060 unhashed subpacket data length value is set to zero. 2062 If an implementation encounters more than one such subpacket in an 2063 Attestation Key Signature, it MUST treat it as a single Attested 2064 Certifications subpacket containing the union of all hashes. 2066 The Attested Certifications subpacket in the most recent Attestation 2067 Key Signature over a given User ID supersedes all Attested 2068 Certifications subpackets from any previous Attestation Key 2069 Signature. However, note that if more than one Attestation Key 2070 Signatures has the same (most recent) Signature Creation Time 2071 subpacket, implementations MUST consider the union of the 2072 attestations of all Attestation Key Signatures (this allows the 2073 keyholder to attest to more third-party certifications than could fit 2074 in a single Attestation Key Signature). 2076 If a keyholder Alice has already attested to third-party 2077 certifications from Bob and Carol and she wants to add an attestation 2078 to a certification from David, she should issue a new Attestation Key 2079 Signature (with a more recent Signature Creation timestamp) that 2080 contains an Attested Certifications subpacket covering all three 2081 third-party certifications. 2083 If she later decides that she does not want Carol's certification to 2084 be redistributed with her certificate, she can issue a new 2085 Attestation Key Signature (again, with a more recent Signature 2086 Creation timestamp) that contains an Attested Certifications 2087 subpacket covering only the certifications from Bob and David. 2089 Note that Certification Revocation Signatures are not relevant for 2090 Attestation Key Signatures. To rescind all attestations, the primary 2091 key holder needs only to publish a more recent Attestation Key 2092 Signature with an empty Attested Certifications subpacket. 2094 5.2.3.32. Key Block 2096 (1 octet with value 0, N octets of key data) 2098 This subpacket MAY be used to convey key data along with a signature 2099 of class 0x00, 0x01, or 0x02. It MUST contain the key used to create 2100 the signature; either as the primary key or as a subkey. The key 2101 SHOULD contain a primary or subkey capable of encryption and the 2102 entire key must be a valid OpenPGP key including at least one User ID 2103 packet and the corresponding self-signatures. 2105 Implementations MUST ignore this subpacket if the first octet does 2106 not have a value of zero or if the key data does not represent a 2107 valid transferable public key. 2109 5.2.3.33. Literal Data Meta Hash 2111 (1 octet with value 0, 32 octets hash value) 2113 This subpacket MAY be used to protect the meta data from the Literal 2114 Data Packet with V4 signatures. The hash is computed using SHA2-256 2115 from this data: 2117 * the one-octet content format, 2119 * the file name as a string (one octet length, followed by the file 2120 name), 2122 * a four-octet number that indicates a date. 2124 These three data items need to mirror the corresponding values of the 2125 Literal Data packet. Implementations encountering this subpacket 2126 must re-create the hash from the received Literal Data packet and 2127 compare them. If the hash values do not match or if this packet is 2128 used in a V5 signature the signature MUST be deemed as invalid. 2130 5.2.4. Computing Signatures 2132 All signatures are formed by producing a hash over the signature 2133 data, and then using the resulting hash in the signature algorithm. 2135 For binary document signatures (type 0x00), the document data is 2136 hashed directly. For text document signatures (type 0x01), the 2137 document is canonicalized by converting line endings to , and 2138 the resulting data is hashed. 2140 When a V4 signature is made over a key, the hash data starts with the 2141 octet 0x99, followed by a two-octet length of the key, and then body 2142 of the key packet; when a V5 signature is made over a key, the hash 2143 data starts with the octet 0x9a, followed by a four-octet length of 2144 the key, and then body of the key packet. A subkey binding signature 2145 (type 0x18) or primary key binding signature (type 0x19) then hashes 2146 the subkey using the same format as the main key (also using 0x99 or 2147 0x9a as the first octet). Primary key revocation signatures (type 2148 0x20) hash only the key being revoked. Subkey revocation signature 2149 (type 0x28) hash first the primary key and then the subkey being 2150 revoked. 2152 A certification signature (type 0x10 through 0x13) hashes the User ID 2153 being bound to the key into the hash context after the above data. A 2154 V3 certification hashes the contents of the User ID or attribute 2155 packet packet, without any header. A V4 or V5 certification hashes 2156 the constant 0xB4 for User ID certifications or the constant 0xD1 for 2157 User Attribute certifications, followed by a four-octet number giving 2158 the length of the User ID or User Attribute data, and then the User 2159 ID or User Attribute data. 2161 An Attestation Key Signature (0x16) hashes the same data body that a 2162 standard certification signature does: primary key, followed by User 2163 ID or User Attribute. 2165 When a signature is made over a Signature packet (type 0x50, "Third- 2166 Party Confirmation signature"), the hash data starts with the octet 2167 0x88, followed by the four-octet length of the signature, and then 2168 the body of the Signature packet. (Note that this is an old-style 2169 packet header for a Signature packet with the length-of-length field 2170 set to zero.) The unhashed subpacket data of the Signature packet 2171 being hashed is not included in the hash, and the unhashed subpacket 2172 data length value is set to zero. 2174 Once the data body is hashed, then a trailer is hashed. This trailer 2175 depends on the version of the signature. 2177 * A V3 signature hashes five octets of the packet body, starting 2178 from the signature type field. This data is the signature type, 2179 followed by the four-octet signature time. 2181 * A V4 signature hashes the packet body starting from its first 2182 field, the version number, through the end of the hashed subpacket 2183 data and a final extra trailer. Thus, the hashed fields are: 2185 - the signature version (0x04), 2187 - the signature type, 2189 - the public-key algorithm, 2191 - the hash algorithm, 2193 - the hashed subpacket length, 2195 - the hashed subpacket body, 2197 - the two octets 0x04 and 0xFF, 2199 - a four-octet big-endian number that is the length of the hashed 2200 data from the Signature packet stopping right before the 0x04, 2201 0xff octets. 2203 The four-octet big-endian number is considered to be an 2204 unsigned integer modulo 2^32. 2206 * A V5 signature hashes the packet body starting from its first 2207 field, the version number, through the end of the hashed subpacket 2208 data and a final extra trailer. Thus, the hashed fields are: 2210 - the signature version (0x05), 2212 - the signature type, 2213 - the public-key algorithm, 2215 - the hash algorithm, 2217 - the hashed subpacket length, 2219 - the hashed subpacket body, 2221 - Only for document signatures (type 0x00 or 0x01) the following 2222 three data items are hashed here: 2224 o the one-octet content format, 2226 o the file name as a string (one octet length, followed by the 2227 file name), 2229 o a four-octet number that indicates a date, 2231 - the two octets 0x05 and 0xFF, 2233 - a eight-octet big-endian number that is the length of the 2234 hashed data from the Signature packet stopping right before the 2235 0x05, 0xff octets. 2237 The three data items hashed for document signatures need to 2238 mirror the values of the Literal Data packet. For detached and 2239 cleartext signatures 6 zero bytes are hashed instead. 2241 After all this has been hashed in a single hash context, the 2242 resulting hash field is used in the signature algorithm and placed at 2243 the end of the Signature packet. 2245 5.2.4.1. Subpacket Hints 2247 It is certainly possible for a signature to contain conflicting 2248 information in subpackets. For example, a signature may contain 2249 multiple copies of a preference or multiple expiration times. In 2250 most cases, an implementation SHOULD use the last subpacket in the 2251 signature, but MAY use any conflict resolution scheme that makes more 2252 sense. Please note that we are intentionally leaving conflict 2253 resolution to the implementer; most conflicts are simply syntax 2254 errors, and the wishy-washy language here allows a receiver to be 2255 generous in what they accept, while putting pressure on a creator to 2256 be stingy in what they generate. 2258 Some apparent conflicts may actually make sense -- for example, 2259 suppose a keyholder has a V3 key and a V4 key that share the same RSA 2260 key material. Either of these keys can verify a signature created by 2261 the other, and it may be reasonable for a signature to contain an 2262 issuer subpacket for each key, as a way of explicitly tying those 2263 keys to the signature. 2265 5.3. Symmetric-Key Encrypted Session Key Packets (Tag 3) 2267 The Symmetric-Key Encrypted Session Key packet holds the symmetric- 2268 key encryption of a session key used to encrypt a message. Zero or 2269 more Public-Key Encrypted Session Key packets and/or Symmetric-Key 2270 Encrypted Session Key packets may precede a Symmetrically Encrypted 2271 Data packet that holds an encrypted message. The message is 2272 encrypted with a session key, and the session key is itself encrypted 2273 and stored in the Encrypted Session Key packet or the Symmetric-Key 2274 Encrypted Session Key packet. 2276 If the Symmetrically Encrypted Data packet is preceded by one or more 2277 Symmetric-Key Encrypted Session Key packets, each specifies a 2278 passphrase that may be used to decrypt the message. This allows a 2279 message to be encrypted to a number of public keys, and also to one 2280 or more passphrases. This packet type is new and is not generated by 2281 PGP 2 or PGP version 5.0. 2283 A version 4 Symmetric-Key Encrypted Session Key packet consists of: 2285 * A one-octet version number with value 4. 2287 * A one-octet number describing the symmetric algorithm used. 2289 * A string-to-key (S2K) specifier, length as defined above. 2291 * Optionally, the encrypted session key itself, which is decrypted 2292 with the string-to-key object. 2294 If the encrypted session key is not present (which can be detected on 2295 the basis of packet length and S2K specifier size), then the S2K 2296 algorithm applied to the passphrase produces the session key for 2297 decrypting the message, using the symmetric cipher algorithm from the 2298 Symmetric-Key Encrypted Session Key packet. 2300 If the encrypted session key is present, the result of applying the 2301 S2K algorithm to the passphrase is used to decrypt just that 2302 encrypted session key field, using CFB mode with an IV of all zeros. 2303 The decryption result consists of a one-octet algorithm identifier 2304 that specifies the symmetric-key encryption algorithm used to encrypt 2305 the following Symmetrically Encrypted Data packet, followed by the 2306 session key octets themselves. 2308 Note: because an all-zero IV is used for this decryption, the S2K 2309 specifier MUST use a salt value, either a Salted S2K or an Iterated- 2310 Salted S2K. The salt value will ensure that the decryption key is 2311 not repeated even if the passphrase is reused. 2313 A version 5 Symmetric-Key Encrypted Session Key packet consists of: 2315 * A one-octet version number with value 5. 2317 * A one-octet cipher algorithm. 2319 * A one-octet encryption mode number which SHOULD be 2 to indicate 2320 OCB. 2322 * A string-to-key (S2K) specifier, length as defined above. 2324 * A starting initialization vector of size specified by the mode. 2326 * The encrypted session key itself, which is decrypted with the 2327 string-to-key object using the given cipher and encryption mode. 2329 * An authentication tag for the encryption mode. 2331 The encrypted session key is encrypted using the encryption mode 2332 specified for the OCB Encrypted Packet. Note that no chunks are used 2333 and that there is only one authentication tag. The Packet Tag in new 2334 format encoding (bits 7 and 6 set, bits 5-0 carry the packet tag), 2335 the packet version number, the cipher algorithm octet, and the mode 2336 octet are given as additional data. For example, the additional data 2337 used with OCB and AES-128 consists of the octets 0xC3, 0x05, 0x07, 2338 and 0x02. 2340 5.4. One-Pass Signature Packets (Tag 4) 2342 The One-Pass Signature packet precedes the signed data and contains 2343 enough information to allow the receiver to begin calculating any 2344 hashes needed to verify the signature. It allows the Signature 2345 packet to be placed at the end of the message, so that the signer can 2346 compute the entire signed message in one pass. 2348 A One-Pass Signature does not interoperate with PGP 2.6.x or earlier. 2350 The body of this packet consists of: 2352 * A one-octet version number. The current version is 3. 2354 * A one-octet signature type. Signature types are described in 2355 Section 5.2.1. 2357 * A one-octet number describing the hash algorithm used. 2359 * A one-octet number describing the public-key algorithm used. 2361 * An eight-octet number holding the Key ID of the signing key. 2363 * A one-octet number holding a flag showing whether the signature is 2364 nested. A zero value indicates that the next packet is another 2365 One-Pass Signature packet that describes another signature to be 2366 applied to the same message data. 2368 Note that if a message contains more than one one-pass signature, 2369 then the Signature packets bracket the message; that is, the first 2370 Signature packet after the message corresponds to the last one-pass 2371 packet and the final Signature packet corresponds to the first one- 2372 pass packet. 2374 5.5. Key Material Packet 2376 A key material packet contains all the information about a public or 2377 private key. There are four variants of this packet type, and two 2378 major versions. Consequently, this section is complex. 2380 5.5.1. Key Packet Variants 2382 5.5.1.1. Public-Key Packet (Tag 6) 2384 A Public-Key packet starts a series of packets that forms an OpenPGP 2385 key (sometimes called an OpenPGP certificate). 2387 5.5.1.2. Public-Subkey Packet (Tag 14) 2389 A Public-Subkey packet (tag 14) has exactly the same format as a 2390 Public-Key packet, but denotes a subkey. One or more subkeys may be 2391 associated with a top-level key. By convention, the top-level key 2392 provides signature services, and the subkeys provide encryption 2393 services. 2395 Note: in PGP version 2.6, tag 14 was intended to indicate a comment 2396 packet. This tag was selected for reuse because no previous version 2397 of PGP ever emitted comment packets but they did properly ignore 2398 them. Public-Subkey packets are ignored by PGP version 2.6 and do 2399 not cause it to fail, providing a limited degree of backward 2400 compatibility. 2402 5.5.1.3. Secret-Key Packet (Tag 5) 2404 A Secret-Key packet contains all the information that is found in a 2405 Public-Key packet, including the public-key material, but also 2406 includes the secret-key material after all the public-key fields. 2408 5.5.1.4. Secret-Subkey Packet (Tag 7) 2410 A Secret-Subkey packet (tag 7) is the subkey analog of the Secret Key 2411 packet and has exactly the same format. 2413 5.5.2. Public-Key Packet Formats 2415 There are three versions of key-material packets. Version 3 packets 2416 were first generated by PGP version 2.6. Version 4 keys first 2417 appeared in PGP 5 and are the preferred key version for OpenPGP. 2419 OpenPGP implementations MUST create keys with version 4 format. V3 2420 keys are deprecated; an implementation MUST NOT generate a V3 key, 2421 but MAY accept it. 2423 A version 3 public key or public-subkey packet contains: 2425 * A one-octet version number (3). 2427 * A four-octet number denoting the time that the key was created. 2429 * A two-octet number denoting the time in days that this key is 2430 valid. If this number is zero, then it does not expire. 2432 * A one-octet number denoting the public-key algorithm of this key. 2434 * A series of multiprecision integers comprising the key material: 2436 - a multiprecision integer (MPI) of RSA public modulus n; 2438 - an MPI of RSA public encryption exponent e. 2440 V3 keys are deprecated. They contain three weaknesses. First, it is 2441 relatively easy to construct a V3 key that has the same Key ID as any 2442 other key because the Key ID is simply the low 64 bits of the public 2443 modulus. Secondly, because the fingerprint of a V3 key hashes the 2444 key material, but not its length, there is an increased opportunity 2445 for fingerprint collisions. Third, there are weaknesses in the MD5 2446 hash algorithm that make developers prefer other algorithms. See 2447 below for a fuller discussion of Key IDs and fingerprints. 2449 V2 keys are identical to the deprecated V3 keys except for the 2450 version number. An implementation MUST NOT generate them and MAY 2451 accept or reject them as it sees fit. 2453 The version 4 format is similar to the version 3 format except for 2454 the absence of a validity period. This has been moved to the 2455 Signature packet. In addition, fingerprints of version 4 keys are 2456 calculated differently from version 3 keys, as described in the 2457 section "Enhanced Key Formats". 2459 A version 4 packet contains: 2461 * A one-octet version number (4). 2463 * A four-octet number denoting the time that the key was created. 2465 * A one-octet number denoting the public-key algorithm of this key. 2467 * A series of values comprising the key material. This is 2468 algorithm-specific and described in Section 5.6. 2470 The version 5 format is similar to the version 4 format except for 2471 the addition of a count for the key material. This count helps 2472 parsing secret key packets (which are an extension of the public key 2473 packet format) in the case of an unknown algoritm. In addition, 2474 fingerprints of version 5 keys are calculated differently from 2475 version 4 keys, as described in the section "Enhanced Key Formats". 2477 A version 5 packet contains: 2479 * A one-octet version number (5). 2481 * A four-octet number denoting the time that the key was created. 2483 * A one-octet number denoting the public-key algorithm of this key. 2485 * A four-octet scalar octet count for the following public key 2486 material. 2488 * A series of values comprising the public key material. This is 2489 algorithm-specific and described in Section 5.6. 2491 5.5.3. Secret-Key Packet Formats 2493 The Secret-Key and Secret-Subkey packets contain all the data of the 2494 Public-Key and Public-Subkey packets, with additional algorithm- 2495 specific secret-key data appended, usually in encrypted form. 2497 The packet contains: 2499 * A Public-Key or Public-Subkey packet, as described above. 2501 * One octet indicating string-to-key usage conventions. Zero 2502 indicates that the secret-key data is not encrypted. 255 or 254 2503 indicates that a string-to-key specifier is being given. Any 2504 other value is a symmetric-key encryption algorithm identifier. A 2505 version 5 packet MUST NOT use the value 255. 2507 * Only for a version 5 packet, a one-octet scalar octet count of the 2508 next 4 optional fields. 2510 * [Optional] If string-to-key usage octet was 255, 254, or 253, a 2511 one-octet symmetric encryption algorithm. 2513 * [Optional] If string-to-key usage octet was 253, an octet with the 2514 values 0x02 to indicate the OCB encryption mode. 2516 * [Optional] If string-to-key usage octet was 255, 254, or 253, a 2517 string-to-key specifier. The length of the string-to-key 2518 specifier is implied by its type, as described above. 2520 * [Optional] If secret data is encrypted (string-to-key usage octet 2521 not zero), an Initial Vector (IV) of the same length as the 2522 cipher's block size. If string-to-key usage octet was 253 the IV 2523 is used as the nonce for the OCB mode. If the OCB mode requires a 2524 shorter nonce, the high-order bits of the IV are used and the 2525 remaining bits MUST be zero. 2527 * Only for a version 5 packet, a four-octet scalar octet count for 2528 the following secret key material. This includes the encrypted 2529 SHA-1 hash or OCB tag if the string-to-key usage octet is 254 or 2530 253. 2532 * Plain or encrypted series of values comprising the secret key 2533 material. This is algorithm-specific and described in section 2534 Section 5.6. Note that if the string-to-key usage octet is 254, a 2535 20-octet SHA-1 hash of the plaintext of the algorithm-specific 2536 portion is appended to plaintext and encrypted with it. If the 2537 string-to-key usage octet is 253, then the OCB authentication tag 2538 is part of that data. 2540 * If the string-to-key usage octet is zero or 255, then a two-octet 2541 checksum of the plaintext of the algorithm-specific portion (sum 2542 of all octets, mod 65536). 2544 Note that the version 5 packet format adds two count values to help 2545 parsing packets with unknown S2K or public key algorithms. 2547 Secret MPI values can be encrypted using a passphrase. If a string- 2548 to-key specifier is given, that describes the algorithm for 2549 converting the passphrase to a key, else a simple MD5 hash of the 2550 passphrase is used. Implementations MUST use a string-to-key 2551 specifier; the simple hash is for backward compatibility and is 2552 deprecated, though implementations MAY continue to use existing 2553 private keys in the old format. The cipher for encrypting the MPIs 2554 is specified in the Secret-Key packet. 2556 Encryption/decryption of the secret data is done in CFB mode using 2557 the key created from the passphrase and the Initial Vector from the 2558 packet. A different mode is used with V3 keys (which are only RSA) 2559 than with other key formats. With V3 keys, the MPI bit count prefix 2560 (i.e., the first two octets) is not encrypted. Only the MPI non- 2561 prefix data is encrypted. Furthermore, the CFB state is 2562 resynchronized at the beginning of each new MPI value, so that the 2563 CFB block boundary is aligned with the start of the MPI data. 2565 With V4 and V5 keys, a simpler method is used. All secret MPI values 2566 are encrypted, including the MPI bitcount prefix. 2568 If the string-to-key usage octet is 253, the encrypted MPI values are 2569 encrypted as one combined plaintext using OCB mode. Note that no 2570 chunks are used and that there is only one authentication tag. The 2571 Packet Tag in new format encoding (bits 7 and 6 set, bits 5-0 carry 2572 the packet tag), the cipher algorithm octet, an octet with value 0x02 2573 (to indicate OCB mode), followed by the public-key packet fields, 2574 starting with its packet version number are given as additional data. 2575 For example, the additional data used with AES-128 in a Secret-Key 2576 Packet of version 4 consists of the octets 0xC5, 0x07, 0x02, 0x04, 2577 followed by the creation time field up to the last value of the 2578 public-key material; in a Secret-Subkey Packet the first octet would 2579 be 0xC7. 2581 The two-octet checksum that follows the algorithm-specific portion is 2582 the algebraic sum, mod 65536, of the plaintext of all the algorithm- 2583 specific octets (including MPI prefix and data). With V3 keys, the 2584 checksum is stored in the clear. With V4 keys, the checksum is 2585 encrypted like the algorithm-specific data. This value is used to 2586 check that the passphrase was correct. However, this checksum is 2587 deprecated; an implementation SHOULD NOT use it, but should rather 2588 use the SHA-1 hash denoted with a usage octet of 254. The reason for 2589 this is that there are some attacks that involve undetectably 2590 modifying the secret key. If the string-to-key usage octet is 253 no 2591 checksum or SHA-1 hash is used but the authentication tag of the OCB 2592 mode follows. 2594 5.6. Algorithm-specific Parts of Keys 2596 The public and secret key format specifies algorithm-specific parts 2597 of a key. The following sections describe them in detail. 2599 5.6.1. Algorithm-Specific Part for RSA Keys 2601 The public key is this series of multiprecision integers: 2603 * MPI of RSA public modulus n; 2605 * MPI of RSA public encryption exponent e. 2607 The secret key is this series of multiprecision integers: 2609 * MPI of RSA secret exponent d; 2611 * MPI of RSA secret prime value p; 2613 * MPI of RSA secret prime value q (p < q); 2615 * MPI of u, the multiplicative inverse of p, mod q. 2617 5.6.2. Algorithm-Specific Part for DSA Keys 2619 The public key is this series of multiprecision integers: 2621 * MPI of DSA prime p; 2623 * MPI of DSA group order q (q is a prime divisor of p-1); 2625 * MPI of DSA group generator g; 2627 * MPI of DSA public-key value y (= g**x mod p where x is secret). 2629 The secret key is this single multiprecision integer: 2631 * MPI of DSA secret exponent x. 2633 5.6.3. Algorithm-Specific Part for Elgamal Keys 2635 The public key is this series of multiprecision integers: 2637 * MPI of Elgamal prime p; 2639 * MPI of Elgamal group generator g; 2641 * MPI of Elgamal public key value y (= g**x mod p where x is 2642 secret). 2644 The secret key is this single multiprecision integer: 2646 * MPI of Elgamal secret exponent x. 2648 5.6.4. Algorithm-Specific Part for ECDSA Keys 2650 The public key is this series of values: 2652 * a variable-length field containing a curve OID, formatted as 2653 follows: 2655 - a one-octet size of the following field; values 0 and 0xFF are 2656 reserved for future extensions, 2658 - the octets representing a curve OID, defined in Section 9.2; 2660 * a MPI of an EC point representing a public key. 2662 The secret key is this single multiprecision integer: 2664 * MPI of an integer representing the secret key, which is a scalar 2665 of the public EC point. 2667 5.6.5. Algorithm-Specific Part for EdDSA Keys 2669 The public key is this series of values: 2671 * a variable-length field containing a curve OID, formatted as 2672 follows: 2674 - a one-octet size of the following field; values 0 and 0xFF are 2675 reserved for future extensions, 2677 - the octets representing a curve OID, defined in Section 9.2; 2679 * a MPI of an EC point representing a public key Q as described 2680 under EdDSA Point Format below. 2682 The secret key is this single multiprecision integer: 2684 * MPI of an integer representing the secret key, which is a scalar 2685 of the public EC point. 2687 5.6.6. Algorithm-Specific Part for ECDH Keys 2689 The public key is this series of values: 2691 * a variable-length field containing a curve OID, formatted as 2692 follows: 2694 - a one-octet size of the following field; values 0 and 0xFF are 2695 reserved for future extensions, 2697 - the octets representing a curve OID, defined in Section 9.2; 2699 * a MPI of an EC point representing a public key; 2701 * a variable-length field containing KDF parameters, formatted as 2702 follows: 2704 - a one-octet size of the following fields; values 0 and 0xff are 2705 reserved for future extensions; 2707 - a one-octet value 1, reserved for future extensions; 2709 - a one-octet hash function ID used with a KDF; 2711 - a one-octet algorithm ID for the symmetric algorithm used to 2712 wrap the symmetric key used for the message encryption; see 2713 Section 13.5 for details. 2715 Observe that an ECDH public key is composed of the same sequence of 2716 fields that define an ECDSA key, plus the KDF parameters field. 2718 The secret key is this single multiprecision integer: 2720 * MPI of an integer representing the secret key, which is a scalar 2721 of the public EC point. 2723 5.7. Compressed Data Packet (Tag 8) 2725 The Compressed Data packet contains compressed data. Typically, this 2726 packet is found as the contents of an encrypted packet, or following 2727 a Signature or One-Pass Signature packet, and contains a literal data 2728 packet. 2730 The body of this packet consists of: 2732 * One octet that gives the algorithm used to compress the packet. 2734 * Compressed data, which makes up the remainder of the packet. 2736 A Compressed Data Packet's body contains an block that compresses 2737 some set of packets. See section "Packet Composition" for details on 2738 how messages are formed. 2740 ZIP-compressed packets are compressed with raw RFC 1951 [RFC1951] 2741 DEFLATE blocks. Note that PGP V2.6 uses 13 bits of compression. If 2742 an implementation uses more bits of compression, PGP V2.6 cannot 2743 decompress it. 2745 ZLIB-compressed packets are compressed with RFC 1950 [RFC1950] ZLIB- 2746 style blocks. 2748 BZip2-compressed packets are compressed using the BZip2 [BZ2] 2749 algorithm. 2751 5.8. Symmetrically Encrypted Data Packet (Tag 9) 2753 The Symmetrically Encrypted Data packet contains data encrypted with 2754 a symmetric-key algorithm. When it has been decrypted, it contains 2755 other packets (usually a literal data packet or compressed data 2756 packet, but in theory other Symmetrically Encrypted Data packets or 2757 sequences of packets that form whole OpenPGP messages). 2759 This packet is obsolete. An implementation MUST NOT create this 2760 packet. An implementation MAY process such a packet but it MUST 2761 return a clear diagnostic that a non-integrity protected packet has 2762 been processed. The implementation SHOULD also return an error in 2763 this case and stop processing. 2765 The body of this packet consists of: 2767 * Encrypted data, the output of the selected symmetric-key cipher 2768 operating in OpenPGP's variant of Cipher Feedback (CFB) mode. 2770 The symmetric cipher used may be specified in a Public-Key or 2771 Symmetric-Key Encrypted Session Key packet that precedes the 2772 Symmetrically Encrypted Data packet. In that case, the cipher 2773 algorithm octet is prefixed to the session key before it is 2774 encrypted. If no packets of these types precede the encrypted data, 2775 the IDEA algorithm is used with the session key calculated as the MD5 2776 hash of the passphrase, though this use is deprecated. 2778 The data is encrypted in CFB mode, with a CFB shift size equal to the 2779 cipher's block size. The Initial Vector (IV) is specified as all 2780 zeros. Instead of using an IV, OpenPGP prefixes a string of length 2781 equal to the block size of the cipher plus two to the data before it 2782 is encrypted. The first block-size octets (for example, 8 octets for 2783 a 64-bit block length) are random, and the following two octets are 2784 copies of the last two octets of the IV. For example, in an 8-octet 2785 block, octet 9 is a repeat of octet 7, and octet 10 is a repeat of 2786 octet 8. In a cipher of length 16, octet 17 is a repeat of octet 15 2787 and octet 18 is a repeat of octet 16. As a pedantic clarification, 2788 in both these examples, we consider the first octet to be numbered 1. 2790 After encrypting the first block-size-plus-two octets, the CFB state 2791 is resynchronized. The last block-size octets of ciphertext are 2792 passed through the cipher and the block boundary is reset. 2794 The repetition of 16 bits in the random data prefixed to the message 2795 allows the receiver to immediately check whether the session key is 2796 incorrect. See the "Security Considerations" section for hints on 2797 the proper use of this "quick check". 2799 5.9. Marker Packet (Obsolete Literal Packet) (Tag 10) 2801 An experimental version of PGP used this packet as the Literal 2802 packet, but no released version of PGP generated Literal packets with 2803 this tag. With PGP 5, this packet has been reassigned and is 2804 reserved for use as the Marker packet. 2806 The body of this packet consists of: 2808 * The three octets 0x50, 0x47, 0x50 (which spell "PGP" in UTF-8). 2810 Such a packet MUST be ignored when received. It may be placed at the 2811 beginning of a message that uses features not available in PGP 2812 version 2.6 in order to cause that version to report that newer 2813 software is necessary to process the message. 2815 5.10. Literal Data Packet (Tag 11) 2817 A Literal Data packet contains the body of a message; data that is 2818 not to be further interpreted. 2820 The body of this packet consists of: 2822 * A one-octet field that describes how the data is formatted. 2824 If it is a b (0x62), then the Literal packet contains binary data. 2825 If it is a t (0x74), then it contains text data, and thus may need 2826 line ends converted to local form, or other text-mode changes. 2827 The tag u (0x75) means the same as t, but also indicates that 2828 implementation believes that the literal data contains UTF-8 text. 2829 If it is a m (0x6d), then it contains a MIME message body part 2830 [RFC2045]. 2832 Early versions of PGP also defined a value of l as a 'local' mode 2833 for machine-local conversions. RFC 1991 [RFC1991] incorrectly 2834 stated this local mode flag as 1 (ASCII numeral one). Both of 2835 these local modes are deprecated. 2837 * File name as a string (one-octet length, followed by a file name). 2838 This may be a zero-length string. Commonly, if the source of the 2839 encrypted data is a file, this will be the name of the encrypted 2840 file. An implementation MAY consider the file name in the Literal 2841 packet to be a more authoritative name than the actual file name. 2843 If the special name "_CONSOLE" is used, the message is considered 2844 to be "for your eyes only". This advises that the message data is 2845 unusually sensitive, and the receiving program should process it 2846 more carefully, perhaps avoiding storing the received data to 2847 disk, for example. 2849 * A four-octet number that indicates a date associated with the 2850 literal data. Commonly, the date might be the modification date 2851 of a file, or the time the packet was created, or a zero that 2852 indicates no specific time. 2854 * The remainder of the packet is literal data. 2856 Text data is stored with text endings (i.e., network- 2857 normal line endings). These should be converted to native line 2858 endings by the receiving software. 2860 Note that V3 and V4 signatures do not include the formatting octet, 2861 the file name, and the date field of the literal packet in a 2862 signature hash and thus are not protected against tampering in a 2863 signed document. In contrast V5 signatures include them. 2865 5.11. Trust Packet (Tag 12) 2867 The Trust packet is used only within keyrings and is not normally 2868 exported. Trust packets contain data that record the user's 2869 specifications of which key holders are trustworthy introducers, 2870 along with other information that implementing software uses for 2871 trust information. The format of Trust packets is defined by a given 2872 implementation. 2874 Trust packets SHOULD NOT be emitted to output streams that are 2875 transferred to other users, and they SHOULD be ignored on any input 2876 other than local keyring files. 2878 5.12. User ID Packet (Tag 13) 2880 A User ID packet consists of UTF-8 text that is intended to represent 2881 the name and email address of the key holder. By convention, it 2882 includes an RFC 2822 [RFC2822] mail name-addr, but there are no 2883 restrictions on its content. The packet length in the header 2884 specifies the length of the User ID. 2886 5.13. User Attribute Packet (Tag 17) 2888 The User Attribute packet is a variation of the User ID packet. It 2889 is capable of storing more types of data than the User ID packet, 2890 which is limited to text. Like the User ID packet, a User Attribute 2891 packet may be certified by the key owner ("self-signed") or any other 2892 key owner who cares to certify it. Except as noted, a User Attribute 2893 packet may be used anywhere that a User ID packet may be used. 2895 While User Attribute packets are not a required part of the OpenPGP 2896 standard, implementations SHOULD provide at least enough 2897 compatibility to properly handle a certification signature on the 2898 User Attribute packet. A simple way to do this is by treating the 2899 User Attribute packet as a User ID packet with opaque contents, but 2900 an implementation may use any method desired. 2902 The User Attribute packet is made up of one or more attribute 2903 subpackets. Each subpacket consists of a subpacket header and a 2904 body. The header consists of: 2906 * the subpacket length (1, 2, or 5 octets) 2907 * the subpacket type (1 octet) 2909 and is followed by the subpacket specific data. 2911 The following table lists the currently known subpackets: 2913 +=========+=============================+ 2914 | Type | Attribute Subpacket | 2915 +=========+=============================+ 2916 | 1 | Image Attribute Subpacket | 2917 +---------+-----------------------------+ 2918 | [TBD1] | User ID Attribute Subpacket | 2919 +---------+-----------------------------+ 2920 | 100-110 | Private/Experimental Use | 2921 +---------+-----------------------------+ 2923 Table 5 2925 An implementation SHOULD ignore any subpacket of a type that it does 2926 not recognize. 2928 5.13.1. The Image Attribute Subpacket 2930 The Image Attribute subpacket is used to encode an image, presumably 2931 (but not required to be) that of the key owner. 2933 The Image Attribute subpacket begins with an image header. The first 2934 two octets of the image header contain the length of the image 2935 header. Note that unlike other multi-octet numerical values in this 2936 document, due to a historical accident this value is encoded as a 2937 little-endian number. The image header length is followed by a 2938 single octet for the image header version. The only currently 2939 defined version of the image header is 1, which is a 16-octet image 2940 header. The first three octets of a version 1 image header are thus 2941 0x10, 0x00, 0x01. 2943 The fourth octet of a version 1 image header designates the encoding 2944 format of the image. The only currently defined encoding format is 2945 the value 1 to indicate JPEG. Image format types 100 through 110 are 2946 reserved for private or experimental use. The rest of the version 1 2947 image header is made up of 12 reserved octets, all of which MUST be 2948 set to 0. 2950 The rest of the image subpacket contains the image itself. As the 2951 only currently defined image type is JPEG, the image is encoded in 2952 the JPEG File Interchange Format (JFIF), a standard file format for 2953 JPEG images [JFIF]. 2955 An implementation MAY try to determine the type of an image by 2956 examination of the image data if it is unable to handle a particular 2957 version of the image header or if a specified encoding format value 2958 is not recognized. 2960 5.13.2. User ID Attribute Subpacket 2962 A User ID Attribute subpacket has type [IANA -- assignment TBD1]. 2964 A User ID Attribute subpacket, just like a User ID packet, consists 2965 of UTF-8 text that is intended to represent the name and email 2966 address of the key holder. By convention, it includes an RFC 2822 2967 [RFC2822] mail name-addr, but there are no restrictions on its 2968 content. For devices using OpenPGP for device certificates, it may 2969 just be the device identifier. The packet length in the header 2970 specifies the length of the User ID. 2972 Because User Attribute subpackets can be used anywhere a User ID 2973 packet can be used, implementations MAY choose to trust a signed User 2974 Attribute subpacket that includes a User ID Attribute subpacket. 2976 5.14. Sym. Encrypted Integrity Protected Data Packet (Tag 18) 2978 The Symmetrically Encrypted Integrity Protected Data packet is a 2979 variant of the Symmetrically Encrypted Data packet. It is a new 2980 feature created for OpenPGP that addresses the problem of detecting a 2981 modification to encrypted data. It is used in combination with a 2982 Modification Detection Code packet. 2984 There is a corresponding feature in the features Signature subpacket 2985 that denotes that an implementation can properly use this packet 2986 type. An implementation MUST support decrypting these packets and 2987 SHOULD prefer generating them to the older Symmetrically Encrypted 2988 Data packet when possible. Since this data packet protects against 2989 modification attacks, this standard encourages its proliferation. 2990 While blanket adoption of this data packet would create 2991 interoperability problems, rapid adoption is nevertheless important. 2992 An implementation SHOULD specifically denote support for this packet, 2993 but it MAY infer it from other mechanisms. 2995 For example, an implementation might infer from the use of a cipher 2996 such as Advanced Encryption Standard (AES) or Twofish that a user 2997 supports this feature. It might place in the unhashed portion of 2998 another user's key signature a Features subpacket. It might also 2999 present a user with an opportunity to regenerate their own self- 3000 signature with a Features subpacket. 3002 This packet contains data encrypted with a symmetric-key algorithm 3003 and protected against modification by the SHA-1 hash algorithm. When 3004 it has been decrypted, it will typically contain other packets (often 3005 a Literal Data packet or Compressed Data packet). The last decrypted 3006 packet in this packet's payload MUST be a Modification Detection Code 3007 packet. 3009 The body of this packet consists of: 3011 * A one-octet version number. The only defined value is 1. There 3012 won't be any future versions of this packet because the MDC system 3013 has been superseded by the OCB Encrypted Data packet. 3015 * Encrypted data, the output of the selected symmetric-key cipher 3016 operating in Cipher Feedback mode with shift amount equal to the 3017 block size of the cipher (CFB-n where n is the block size). 3019 The symmetric cipher used MUST be specified in a Public-Key or 3020 Symmetric-Key Encrypted Session Key packet that precedes the 3021 Symmetrically Encrypted Data packet. In either case, the cipher 3022 algorithm octet is prefixed to the session key before it is 3023 encrypted. 3025 The data is encrypted in CFB mode, with a CFB shift size equal to the 3026 cipher's block size. The Initial Vector (IV) is specified as all 3027 zeros. Instead of using an IV, OpenPGP prefixes an octet string to 3028 the data before it is encrypted. The length of the octet string 3029 equals the block size of the cipher in octets, plus two. The first 3030 octets in the group, of length equal to the block size of the cipher, 3031 are random; the last two octets are each copies of their 2nd 3032 preceding octet. For example, with a cipher whose block size is 128 3033 bits or 16 octets, the prefix data will contain 16 random octets, 3034 then two more octets, which are copies of the 15th and 16th octets, 3035 respectively. Unlike the Symmetrically Encrypted Data Packet, no 3036 special CFB resynchronization is done after encrypting this prefix 3037 data. See "OpenPGP CFB Mode" below for more details. 3039 The repetition of 16 bits in the random data prefixed to the message 3040 allows the receiver to immediately check whether the session key is 3041 incorrect. 3043 The plaintext of the data to be encrypted is passed through the SHA-1 3044 hash function, and the result of the hash is appended to the 3045 plaintext in a Modification Detection Code packet. The input to the 3046 hash function includes the prefix data described above; it includes 3047 all of the plaintext, and then also includes two octets of values 3048 0xD3, 0x14. These represent the encoding of a Modification Detection 3049 Code packet tag and length field of 20 octets. 3051 The resulting hash value is stored in a Modification Detection Code 3052 (MDC) packet, which MUST use the two octet encoding just given to 3053 represent its tag and length field. The body of the MDC packet is 3054 the 20-octet output of the SHA-1 hash. 3056 The Modification Detection Code packet is appended to the plaintext 3057 and encrypted along with the plaintext using the same CFB context. 3059 During decryption, the plaintext data should be hashed with SHA-1, 3060 including the prefix data as well as the packet tag and length field 3061 of the Modification Detection Code packet. The body of the MDC 3062 packet, upon decryption, is compared with the result of the SHA-1 3063 hash. 3065 Any failure of the MDC indicates that the message has been modified 3066 and MUST be treated as a security problem. Failures include a 3067 difference in the hash values, but also the absence of an MDC packet, 3068 or an MDC packet in any position other than the end of the plaintext. 3069 Any failure SHOULD be reported to the user. 3071 NON-NORMATIVE EXPLANATION 3073 The MDC system, as packets 18 and 19 are called, were created to 3074 provide an integrity mechanism that is less strong than a 3075 signature, yet stronger than bare CFB encryption. 3077 It is a limitation of CFB encryption that damage to the 3078 ciphertext will corrupt the affected cipher blocks and the block 3079 following. Additionally, if data is removed from the end of a 3080 CFB-encrypted block, that removal is undetectable. (Note also 3081 that CBC mode has a similar limitation, but data removed from 3082 the front of the block is undetectable.) 3084 The obvious way to protect or authenticate an encrypted block is 3085 to digitally sign it. However, many people do not wish to 3086 habitually sign data, for a large number of reasons beyond the 3087 scope of this document. Suffice it to say that many people 3088 consider properties such as deniability to be as valuable as 3089 integrity. 3091 OpenPGP addresses this desire to have more security than raw 3092 encryption and yet preserve deniability with the MDC system. An 3093 MDC is intentionally not a MAC. Its name was not selected by 3094 accident. It is analogous to a checksum. 3096 Despite the fact that it is a relatively modest system, it has 3097 proved itself in the real world. It is an effective defense to 3098 several attacks that have surfaced since it has been created. 3100 It has met its modest goals admirably. 3102 Consequently, because it is a modest security system, it has 3103 modest requirements on the hash function(s) it employs. It does 3104 not rely on a hash function being collision-free, it relies on a 3105 hash function being one-way. If a forger, Frank, wishes to send 3106 Alice a (digitally) unsigned message that says, "I've always 3107 secretly loved you, signed Bob", it is far easier for him to 3108 construct a new message than it is to modify anything 3109 intercepted from Bob. (Note also that if Bob wishes to 3110 communicate secretly with Alice, but without authentication or 3111 identification and with a threat model that includes forgers, he 3112 has a problem that transcends mere cryptography.) 3114 Note also that unlike nearly every other OpenPGP subsystem, 3115 there are no parameters in the MDC system. It hard-defines 3116 SHA-1 as its hash function. This is not an accident. It is an 3117 intentional choice to avoid downgrade and cross-grade attacks 3118 while making a simple, fast system. (A downgrade attack would 3119 be an attack that replaced SHA2-256 with SHA-1, for example. A 3120 cross-grade attack would replace SHA-1 with another 160-bit 3121 hash, such as RIPE-MD/160, for example.) 3123 However, no update will be needed because the MDC will be 3124 replaced by the OCB encryption described in this document. 3126 5.15. Modification Detection Code Packet (Tag 19) 3128 The Modification Detection Code packet contains a SHA-1 hash of 3129 plaintext data, which is used to detect message modification. It is 3130 only used with a Symmetrically Encrypted Integrity Protected Data 3131 packet. The Modification Detection Code packet MUST be the last 3132 packet in the plaintext data that is encrypted in the Symmetrically 3133 Encrypted Integrity Protected Data packet, and MUST appear in no 3134 other place. 3136 A Modification Detection Code packet MUST have a length of 20 octets. 3138 The body of this packet consists of: 3140 * A 20-octet SHA-1 hash of the preceding plaintext data of the 3141 Symmetrically Encrypted Integrity Protected Data packet, including 3142 prefix data, the tag octet, and length octet of the Modification 3143 Detection Code packet. 3145 Note that the Modification Detection Code packet MUST always use a 3146 new format encoding of the packet tag, and a one-octet encoding of 3147 the packet length. The reason for this is that the hashing rules for 3148 modification detection include a one-octet tag and one-octet length 3149 in the data hash. While this is a bit restrictive, it reduces 3150 complexity. 3152 5.16. OCB Encrypted Data Packet (Tag 20) 3154 This packet contains data encrypted with an authenticated encryption 3155 and additional data (AEAD) construction. When it has been decrypted, 3156 it will typically contain other packets (often a Literal Data packet 3157 or Compressed Data packet). 3159 The body of this packet consists of: 3161 * A one-octet version number. The only currently defined value is 3162 1. 3164 * A one-octet cipher algorithm. 3166 * A one-octet encryption mode octet with the fixed value 0x02. If 3167 decryption using the EAX mode is supported this octet may have the 3168 value 0x01. 3170 * A one-octet chunk size. 3172 * A starting initialization vector of size specified by the 3173 encryption mode (15 octets for OCB). 3175 * Encrypted data, the output of the selected symmetric-key cipher 3176 operating in the given encryption mode. 3178 * A final, summary authentication tag for the encryption mode (16 3179 octets for OCB). 3181 An OCB Encrypted Data packet consists of one or more chunks of data. 3182 The plaintext of each chunk is of a size specified using the chunk 3183 size octet using the method specified below. 3185 The encrypted data consists of the encryption of each chunk of 3186 plaintext, followed immediately by the relevant authentication tag. 3187 If the last chunk of plaintext is smaller than the chunk size, the 3188 ciphertext for that data may be shorter; it is nevertheless followed 3189 by a full authentication tag. 3191 For each chunk, the AEAD construction is given the Packet Tag in new 3192 format encoding (bits 7 and 6 set, bits 5-0 carry the packet tag), 3193 version number, cipher algorithm octet, encryption mode octet, chunk 3194 size octet, and an eight-octet, big-endian chunk index as additional 3195 data. The index of the first chunk is zero. For example, the 3196 additional data of the first chunk using OCB and AES-128 with a chunk 3197 size of 64 kiByte consists of the octets 0xD4, 0x01, 0x07, 0x02, 3198 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, and 0x00. 3200 After the final chunk, the encryption mode is used to produce a final 3201 authentication tag encrypting the empty string. This AEAD instance 3202 is given the additional data specified above, plus an eight-octet, 3203 big-endian value specifying the total number of plaintext octets 3204 encrypted. This allows detection of a truncated ciphertext. Please 3205 note that the big-endian number representing the chunk index in the 3206 additional data is increased accordingly, although it's not really a 3207 chunk. 3209 The chunk size octet specifies the size of chunks using the following 3210 formula (in C), where c is the chunk size octet: 3212 chunk_size = ((uint64_t)1 << (c + 6)) 3214 To facilitate interoperability between a wide variety of 3215 implementations, from constrained to large compute environments, a 3216 chunk size maximum is specified: An implementation MUST accept chunk 3217 size octets with values from 0 to 16. An implementation MUST NOT 3218 create data with a chunk size octet value larger than 16 (4 MiB 3219 chunks). 3221 A new random initialization vector MUST be used for each message. 3222 Failure to do so for each message will lead to a catastrophic failure 3223 depending on the used encryption mode. 3225 5.16.1. EAX Mode 3227 The EAX algorithm can only use block ciphers with 16-octet blocks. 3228 The starting initialization vector and authentication tag are both 16 3229 octets long. 3231 The starting initialization vector for this mode MUST be unique and 3232 unpredictable. 3234 The nonce for EAX mode is computed by treating the starting 3235 initialization vector as a 16-octet, big-endian value and exclusive- 3236 oring the low eight octets of it with the chunk index. 3238 The security of EAX requires that the nonce is never reused, hence 3239 the requirement that the starting initialization vector be unique. 3241 EAX mode is deprecated due to the far better properties of the OCB 3242 mode. Implementations may use EAX mode only for decryption of 3243 existing data. 3245 5.16.2. OCB Mode 3247 The OCB Authenticated-Encryption Algorithm used in this document is 3248 defined in [RFC7253]. 3250 OCB usage requires specification of the following parameters: 3252 * a blockcipher that operate on 128-bit (16-octet) blocks 3254 * an authentication tag length of 16 octets 3256 * a nonce of 15 octets long (which is the longest nonce allowed 3257 specified by [RFC7253]) 3259 * an initialization vector of at least 15 octets long 3261 In the case that the initialization vector is longer than 15 octets 3262 (such as in Section 5.5.1.3, only the 15 leftmost octets are used in 3263 calculations; the remaining octets MUST be considered as zero. 3265 The nonce for OCB mode is computed by the exclusive-oring of the 3266 initialization vector as a 15-octet, big endian value, against the 3267 chunk index. 3269 Security of OCB mode depends on the non-repeated nature of nonces 3270 used for the same key on distinct plaintext [RFC7253]. Therefore the 3271 initialization vector per message MUST be distinct, and OCB mode 3272 SHOULD only be used in environments when there is certainty to 3273 fulfilling this requirement. 3275 6. Radix-64 Conversions 3277 As stated in the introduction, OpenPGP's underlying native 3278 representation for objects is a stream of arbitrary octets, and some 3279 systems desire these objects to be immune to damage caused by 3280 character set translation, data conversions, etc. 3282 In principle, any printable encoding scheme that met the requirements 3283 of the unsafe channel would suffice, since it would not change the 3284 underlying binary bit streams of the native OpenPGP data structures. 3285 The OpenPGP standard specifies one such printable encoding scheme to 3286 ensure interoperability. 3288 OpenPGP's Radix-64 encoding is composed of two parts: a base64 3289 encoding of the binary data and a checksum. The base64 encoding is 3290 identical to the MIME base64 content-transfer-encoding [RFC2045]. 3292 The checksum is a 24-bit Cyclic Redundancy Check (CRC) converted to 3293 four characters of radix-64 encoding by the same MIME base64 3294 transformation, preceded by an equal sign (=). The CRC is computed 3295 by using the generator 0x864CFB and an initialization of 0xB704CE. 3296 The accumulation is done on the data before it is converted to radix- 3297 64, rather than on the converted data. A sample implementation of 3298 this algorithm is in the next section. 3300 The checksum with its leading equal sign MAY appear on the first line 3301 after the base64 encoded data. 3303 Rationale for CRC-24: The size of 24 bits fits evenly into printable 3304 base64. The nonzero initialization can detect more errors than a 3305 zero initialization. 3307 6.1. An Implementation of the CRC-24 in "C" 3309 3310 #define CRC24_INIT 0xB704CEL 3311 #define CRC24_POLY 0x864CFBL 3313 typedef long crc24; 3314 crc24 crc_octets(unsigned char *octets, size_t len) 3315 { 3316 crc24 crc = CRC24_INIT; 3317 int i; 3318 while (len--) { 3319 crc ^= (*octets++) << 16; 3320 for (i = 0; i < 8; i++) { 3321 crc <<= 1; 3322 if (crc & 0x1000000) 3323 crc ^= CRC24_POLY; 3324 } 3325 } 3326 return crc & 0xFFFFFFL; 3327 } 3328 3330 6.2. Forming ASCII Armor 3332 When OpenPGP encodes data into ASCII Armor, it puts specific headers 3333 around the Radix-64 encoded data, so OpenPGP can reconstruct the data 3334 later. An OpenPGP implementation MAY use ASCII armor to protect raw 3335 binary data. OpenPGP informs the user what kind of data is encoded 3336 in the ASCII armor through the use of the headers. 3338 Concatenating the following data creates ASCII Armor: 3340 * An Armor Header Line, appropriate for the type of data 3342 * Armor Headers 3344 * A blank line 3346 * The ASCII-Armored data 3348 * An Armor Checksum 3350 * The Armor Tail, which depends on the Armor Header Line 3352 An Armor Header Line consists of the appropriate header line text 3353 surrounded by five (5) dashes (-, 0x2D) on either side of the header 3354 line text. The header line text is chosen based upon the type of 3355 data that is being encoded in Armor, and how it is being encoded. 3356 Header line texts include the following strings: 3358 BEGIN PGP MESSAGE Used for signed, encrypted, or compressed files. 3360 BEGIN PGP PUBLIC KEY BLOCK Used for armoring public keys. 3362 BEGIN PGP PRIVATE KEY BLOCK Used for armoring private keys. 3364 BEGIN PGP MESSAGE, PART X/Y Used for multi-part messages, where the 3365 armor is split amongst Y parts, and this is the Xth part out of Y. 3367 BEGIN PGP MESSAGE, PART X Used for multi-part messages, where this 3368 is the Xth part of an unspecified number of parts. Requires the 3369 MESSAGE-ID Armor Header to be used. 3371 BEGIN PGP SIGNATURE Used for detached signatures, OpenPGP/MIME 3372 signatures, and cleartext signatures. Note that PGP 2 uses BEGIN 3373 PGP MESSAGE for detached signatures. 3375 Note that all these Armor Header Lines are to consist of a complete 3376 line. That is to say, there is always a line ending preceding the 3377 starting five dashes, and following the ending five dashes. The 3378 header lines, therefore, MUST start at the beginning of a line, and 3379 MUST NOT have text other than whitespace -- space (0x20), tab (0x09) 3380 or carriage return (0x0d) -- following them on the same line. These 3381 line endings are considered a part of the Armor Header Line for the 3382 purposes of determining the content they delimit. This is 3383 particularly important when computing a cleartext signature (see 3384 below). 3386 The Armor Headers are pairs of strings that can give the user or the 3387 receiving OpenPGP implementation some information about how to decode 3388 or use the message. The Armor Headers are a part of the armor, not a 3389 part of the message, and hence are not protected by any signatures 3390 applied to the message. 3392 The format of an Armor Header is that of a key-value pair. A colon 3393 (: 0x38) and a single space (0x20) separate the key and value. 3394 OpenPGP should consider improperly formatted Armor Headers to be 3395 corruption of the ASCII Armor. Unknown keys should be reported to 3396 the user, but OpenPGP should continue to process the message. 3398 Note that some transport methods are sensitive to line length. While 3399 there is a limit of 76 characters for the Radix-64 data 3400 (Section 6.3), there is no limit to the length of Armor Headers. 3401 Care should be taken that the Armor Headers are short enough to 3402 survive transport. One way to do this is to repeat an Armor Header 3403 Key multiple times with different values for each so that no one line 3404 is overly long. 3406 Currently defined Armor Header Keys are as follows: 3408 * "Version", which states the OpenPGP implementation and version 3409 used to encode the message. 3411 * "Comment", a user-defined comment. OpenPGP defines all text to be 3412 in UTF-8. A comment may be any UTF-8 string. However, the whole 3413 point of armoring is to provide seven-bit-clean data. 3414 Consequently, if a comment has characters that are outside the US- 3415 ASCII range of UTF, they may very well not survive transport. 3417 * "Hash", a comma-separated list of hash algorithms used in this 3418 message. This is used only in cleartext signed messages. 3420 * "MessageID", a 32-character string of printable characters. The 3421 string must be the same for all parts of a multi-part message that 3422 uses the "PART X" Armor Header. MessageID strings should be 3423 unique enough that the recipient of the mail can associate all the 3424 parts of a message with each other. A good checksum or 3425 cryptographic hash function is sufficient. 3427 The MessageID SHOULD NOT appear unless it is in a multi-part 3428 message. If it appears at all, it MUST be computed from the 3429 finished (encrypted, signed, etc.) message in a deterministic 3430 fashion, rather than contain a purely random value. This is to 3431 allow the legitimate recipient to determine that the MessageID 3432 cannot serve as a covert means of leaking cryptographic key 3433 information. 3435 * "Charset", a description of the character set that the plaintext 3436 is in. Please note that OpenPGP defines text to be in UTF-8. An 3437 implementation will get best results by translating into and out 3438 of UTF-8. However, there are many instances where this is easier 3439 said than done. Also, there are communities of users who have no 3440 need for UTF-8 because they are all happy with a character set 3441 like ISO Latin-5 or a Japanese character set. In such instances, 3442 an implementation MAY override the UTF-8 default by using this 3443 header key. An implementation MAY implement this key and any 3444 translations it cares to; an implementation MAY ignore it and 3445 assume all text is UTF-8. 3447 The blank line can either be zero-length or contain only whitespace, 3448 that is spaces (0x20), tabs (0x09) or carriage returns (0x0d). 3450 The Armor Tail Line is composed in the same manner as the Armor 3451 Header Line, except the string "BEGIN" is replaced by the string 3452 "END". 3454 6.3. Encoding Binary in Radix-64 3456 The encoding process represents 24-bit groups of input bits as output 3457 strings of 4 encoded characters. Proceeding from left to right, a 3458 24-bit input group is formed by concatenating three 8-bit input 3459 groups. These 24 bits are then treated as four concatenated 6-bit 3460 groups, each of which is translated into a single digit in the 3461 Radix-64 alphabet. When encoding a bit stream with the Radix-64 3462 encoding, the bit stream must be presumed to be ordered with the most 3463 significant bit first. That is, the first bit in the stream will be 3464 the high-order bit in the first 8-bit octet, and the eighth bit will 3465 be the low-order bit in the first 8-bit octet, and so on. 3467 +--first octet--+-second octet--+--third octet--+ 3468 |7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0| 3469 +-----------+---+-------+-------+---+-----------+ 3470 |5 4 3 2 1 0|5 4 3 2 1 0|5 4 3 2 1 0|5 4 3 2 1 0| 3471 +--1.index--+--2.index--+--3.index--+--4.index--+ 3473 Each 6-bit group is used as an index into an array of 64 printable 3474 characters from the table below. The character referenced by the 3475 index is placed in the output string. 3477 Value Encoding Value Encoding Value Encoding Value Encoding 3478 0 A 17 R 34 i 51 z 3479 1 B 18 S 35 j 52 0 3480 2 C 19 T 36 k 53 1 3481 3 D 20 U 37 l 54 2 3482 4 E 21 V 38 m 55 3 3483 5 F 22 W 39 n 56 4 3484 6 G 23 X 40 o 57 5 3485 7 H 24 Y 41 p 58 6 3486 8 I 25 Z 42 q 59 7 3487 9 J 26 a 43 r 60 8 3488 10 K 27 b 44 s 61 9 3489 11 L 28 c 45 t 62 + 3490 12 M 29 d 46 u 63 / 3491 13 N 30 e 47 v 3492 14 O 31 f 48 w (pad) = 3493 15 P 32 g 49 x 3494 16 Q 33 h 50 y 3496 The encoded output stream must be represented in lines of no more 3497 than 76 characters each. 3499 Special processing is performed if fewer than 24 bits are available 3500 at the end of the data being encoded. There are three possibilities: 3502 1. The last data group has 24 bits (3 octets). No special 3503 processing is needed. 3505 2. The last data group has 16 bits (2 octets). The first two 3506 6-bit groups are processed as above. The third (incomplete) 3507 data group has two zero-value bits added to it, and is 3508 processed as above. A pad character (=) is added to the 3509 output. 3511 3. The last data group has 8 bits (1 octet). The first 6-bit 3512 group is processed as above. The second (incomplete) data 3513 group has four zero-value bits added to it, and is processed 3514 as above. Two pad characters (=) are added to the output. 3516 6.4. Decoding Radix-64 3518 In Radix-64 data, characters other than those in the table, line 3519 breaks, and other white space probably indicate a transmission error, 3520 about which a warning message or even a message rejection might be 3521 appropriate under some circumstances. Decoding software must ignore 3522 all white space. 3524 Because it is used only for padding at the end of the data, the 3525 occurrence of any "=" characters may be taken as evidence that the 3526 end of the data has been reached (without truncation in transit). No 3527 such assurance is possible, however, when the number of octets 3528 transmitted was a multiple of three and no "=" characters are 3529 present. 3531 6.5. Examples of Radix-64 3533 Input data: 0x14FB9C03D97E 3534 Hex: 1 4 F B 9 C | 0 3 D 9 7 E 3535 8-bit: 00010100 11111011 10011100 | 00000011 11011001 01111110 3536 6-bit: 000101 001111 101110 011100 | 000000 111101 100101 111110 3537 Decimal: 5 15 46 28 0 61 37 62 3538 Output: F P u c A 9 l + 3539 Input data: 0x14FB9C03D9 3540 Hex: 1 4 F B 9 C | 0 3 D 9 3541 8-bit: 00010100 11111011 10011100 | 00000011 11011001 3542 pad with 00 3543 6-bit: 000101 001111 101110 011100 | 000000 111101 100100 3544 Decimal: 5 15 46 28 0 61 36 3545 pad with = 3546 Output: F P u c A 9 k = 3547 Input data: 0x14FB9C03 3548 Hex: 1 4 F B 9 C | 0 3 3549 8-bit: 00010100 11111011 10011100 | 00000011 3550 pad with 0000 3551 6-bit: 000101 001111 101110 011100 | 000000 110000 3552 Decimal: 5 15 46 28 0 48 3553 pad with = = 3554 Output: F P u c A w = = 3556 6.6. Example of an ASCII Armored Message 3558 -----BEGIN PGP MESSAGE----- 3559 Version: OpenPrivacy 0.99 3561 yDgBO22WxBHv7O8X7O/jygAEzol56iUKiXmV+XmpCtmpqQUKiQrFqclFqUDBovzS 3562 vBSFjNSiVHsuAA== 3563 =njUN 3564 -----END PGP MESSAGE----- 3566 Note that this example has extra indenting; an actual armored message 3567 would have no leading whitespace. 3569 7. Cleartext Signature Framework 3571 It is desirable to be able to sign a textual octet stream without 3572 ASCII armoring the stream itself, so the signed text is still 3573 readable without special software. In order to bind a signature to 3574 such a cleartext, this framework is used, which follows the same 3575 basic format and restrictions as the ASCII armoring described above 3576 in "Forming ASCII Armor" (Section 6.2). (Note that this framework is 3577 not intended to be reversible. RFC 3156 [RFC3156] defines another 3578 way to sign cleartext messages for environments that support MIME.) 3580 The cleartext signed message consists of: 3582 * The cleartext header -----BEGIN PGP SIGNED MESSAGE----- on a 3583 single line, 3585 * One or more "Hash" Armor Headers, 3587 * Exactly one blank line not included into the message digest, 3589 * The dash-escaped cleartext that is included into the message 3590 digest, 3592 * The ASCII armored signature(s) including the -----BEGIN PGP 3593 SIGNATURE----- Armor Header and Armor Tail Lines. 3595 If the "Hash" Armor Header is given, the specified message digest 3596 algorithm(s) are used for the signature. If there are no such 3597 headers, MD5 is used. If MD5 is the only hash used, then an 3598 implementation MAY omit this header for improved V2.x compatibility. 3599 If more than one message digest is used in the signature, the "Hash" 3600 armor header contains a comma-delimited list of used message digests. 3602 Current message digest names are described below with the algorithm 3603 IDs. 3605 An implementation SHOULD add a line break after the cleartext, but 3606 MAY omit it if the cleartext ends with a line break. This is for 3607 visual clarity. 3609 7.1. Dash-Escaped Text 3611 The cleartext content of the message must also be dash-escaped. 3613 Dash-escaped cleartext is the ordinary cleartext where every line 3614 starting with a dash - (0x2D) is prefixed by the sequence dash - 3615 (0x2D) and space ` ` (0x20). This prevents the parser from 3616 recognizing armor headers of the cleartext itself. An implementation 3617 MAY dash-escape any line, SHOULD dash-escape lines commencing "From" 3618 followed by a space, and MUST dash-escape any line commencing in a 3619 dash. The message digest is computed using the cleartext itself, not 3620 the dash-escaped form. 3622 As with binary signatures on text documents, a cleartext signature is 3623 calculated on the text using canonical line endings. The 3624 line ending (i.e., the ) before the -----BEGIN PGP 3625 SIGNATURE----- line that terminates the signed text is not considered 3626 part of the signed text. 3628 When reversing dash-escaping, an implementation MUST strip the string 3629 "- " if it occurs at the beginning of a line, and SHOULD warn on "-" 3630 and any character other than a space at the beginning of a line. 3632 Also, any trailing whitespace -- spaces (0x20), tabs (0x09) or 3633 carriage returns (0x0d) -- at the end of any line is removed when the 3634 cleartext signature is generated and verified. 3636 8. Regular Expressions 3638 A regular expression is zero or more branches, separated by |. It 3639 matches anything that matches one of the branches. 3641 A branch is zero or more pieces, concatenated. It matches a match 3642 for the first, followed by a match for the second, etc. 3644 A piece is an atom possibly followed by *, +, or ?. An atom followed 3645 by * matches a sequence of 0 or more matches of the atom. An atom 3646 followed by + matches a sequence of 1 or more matches of the atom. 3647 An atom followed by ? matches a match of the atom, or the null 3648 string. 3650 An atom is a regular expression in parentheses (matching a match for 3651 the regular expression), a range (see below), . (matching any single 3652 character), ^ (matching the null string at the beginning of the input 3653 string), $ (matching the null string at the end of the input string), 3654 a \ followed by a single character (matching that character), or a 3655 single character with no other significance (matching that 3656 character). 3658 A range is a sequence of characters enclosed in []. It normally 3659 matches any single character from the sequence. If the sequence 3660 begins with ^, it matches any single character not from the rest of 3661 the sequence. If two characters in the sequence are separated by -, 3662 this is shorthand for the full list of ASCII characters between them 3663 (e.g., [0-9] matches any decimal digit). To include a literal ] in 3664 the sequence, make it the first character (following a possible ^). 3665 To include a literal -, make it the first or last character. 3667 9. Constants 3669 This section describes the constants used in OpenPGP. 3671 Note that these tables are not exhaustive lists; an implementation 3672 MAY implement an algorithm not on these lists, so long as the 3673 algorithm numbers are chosen from the private or experimental 3674 algorithm range. 3676 See the section "Notes on Algorithms" below for more discussion of 3677 the algorithms. 3679 9.1. Public-Key Algorithms 3681 +=========+===================================================+ 3682 | ID | Algorithm | 3683 +=========+===================================================+ 3684 | 1 | RSA (Encrypt or Sign) [HAC] | 3685 +---------+---------------------------------------------------+ 3686 | 2 | RSA Encrypt-Only [HAC] | 3687 +---------+---------------------------------------------------+ 3688 | 3 | RSA Sign-Only [HAC] | 3689 +---------+---------------------------------------------------+ 3690 | 16 | Elgamal (Encrypt-Only) [ELGAMAL] [HAC] | 3691 +---------+---------------------------------------------------+ 3692 | 17 | DSA (Digital Signature Algorithm) [FIPS186] [HAC] | 3693 +---------+---------------------------------------------------+ 3694 | 18 | ECDH public key algorithm | 3695 +---------+---------------------------------------------------+ 3696 | 19 | ECDSA public key algorithm [FIPS186] | 3697 +---------+---------------------------------------------------+ 3698 | 20 | Reserved (formerly Elgamal Encrypt or Sign) | 3699 +---------+---------------------------------------------------+ 3700 | 21 | Reserved for Diffie-Hellman (X9.42, as defined | 3701 | | for IETF-S/MIME) | 3702 +---------+---------------------------------------------------+ 3703 | 22 | EdDSA [RFC8032] | 3704 +---------+---------------------------------------------------+ 3705 | 23 | Reserved for AEDH | 3706 +---------+---------------------------------------------------+ 3707 | 24 | Reserved for AEDSA | 3708 +---------+---------------------------------------------------+ 3709 | 100-110 | Private/Experimental algorithm | 3710 +---------+---------------------------------------------------+ 3712 Table 6 3714 Implementations MUST implement RSA (1) and ECDSA (19) for signatures, 3715 and RSA (1) and ECDH (18) for encryption. Implementations SHOULD 3716 implement EdDSA (22) keys. 3718 RSA Encrypt-Only (2) and RSA Sign-Only (3) are deprecated and SHOULD 3719 NOT be generated, but may be interpreted. See Section 14.5. See 3720 Section 14.9 for notes on Elgamal Encrypt or Sign (20), and X9.42 3721 (21). Implementations MAY implement any other algorithm. 3723 Note that implementations conforming to previous versions of this 3724 standard (RFC-4880) have DSA (17) and Elgamal (16) as its only MUST- 3725 implement algorithm. 3727 A compatible specification of ECDSA is given in [RFC6090] as "KT-I 3728 Signatures" and in [SEC1]; ECDH is defined in Section 13.5 this 3729 document. 3731 9.2. ECC Curve OID 3733 The parameter curve OID is an array of octets that define a named 3734 curve. The table below specifies the exact sequence of bytes for 3735 each named curve referenced in this document: 3737 +========================+=====+=================+=================+ 3738 | ASN.1 Object | OID | Curve OID bytes | Curve name | 3739 | Identifier | len | in hexadecimal | | 3740 | | | representation | | 3741 +========================+=====+=================+=================+ 3742 | 1.2.840.10045.3.1.7 | 8 | 2A 86 48 CE 3D | NIST P-256 | 3743 | | | 03 01 07 | | 3744 +------------------------+-----+-----------------+-----------------+ 3745 | 1.3.132.0.34 | 5 | 2B 81 04 00 22 | NIST P-384 | 3746 +------------------------+-----+-----------------+-----------------+ 3747 | 1.3.132.0.35 | 5 | 2B 81 04 00 23 | NIST P-521 | 3748 +------------------------+-----+-----------------+-----------------+ 3749 | 1.3.36.3.3.2.8.1.1.7 | 9 | 2B 24 03 03 02 | brainpoolP256r1 | 3750 | | | 08 01 01 07 | | 3751 +------------------------+-----+-----------------+-----------------+ 3752 | 1.3.36.3.3.2.8.1.1.11 | 9 | 2B 24 03 03 02 | brainpoolP384r1 | 3753 | | | 08 01 01 0B | | 3754 +------------------------+-----+-----------------+-----------------+ 3755 | 1.3.36.3.3.2.8.1.1.13 | 9 | 2B 24 03 03 02 | brainpoolP512r1 | 3756 | | | 08 01 01 0D | | 3757 +------------------------+-----+-----------------+-----------------+ 3758 | 1.3.6.1.4.1.11591.15.1 | 9 | 2B 06 01 04 01 | Ed25519 | 3759 | | | DA 47 0F 01 | | 3760 +------------------------+-----+-----------------+-----------------+ 3761 | 1.3.6.1.4.1.3029.1.5.1 | 10 | 2B 06 01 04 01 | Curve25519 | 3762 | | | 97 55 01 05 01 | | 3763 +------------------------+-----+-----------------+-----------------+ 3764 | 1.3.101.112 | 3 | 2B 65 70 | Ed25519(1) | 3765 +------------------------+-----+-----------------+-----------------+ 3766 | 1.3.102.110 | 3 | 2B 65 6E | Curve25519(1) | 3767 +------------------------+-----+-----------------+-----------------+ 3768 | 1.3.101.113 | 3 | 2B 65 71 | Ed448 | 3769 +------------------------+-----+-----------------+-----------------+ 3770 | 1.3.101.111 | 3 | 2B 65 6F | X448 | 3771 +------------------------+-----+-----------------+-----------------+ 3773 Table 7 3775 The sequence of octets in the third column is the result of applying 3776 the Distinguished Encoding Rules (DER) to the ASN.1 Object Identifier 3777 with subsequent truncation. The truncation removes the two fields of 3778 encoded Object Identifier. The first omitted field is one octet 3779 representing the Object Identifier tag, and the second omitted field 3780 is the length of the Object Identifier body. For example, the 3781 complete ASN.1 DER encoding for the NIST P-256 curve OID is "06 08 2A 3782 86 48 CE 3D 03 01 07", from which the first entry in the table above 3783 is constructed by omitting the first two octets. Only the truncated 3784 sequence of octets is the valid representation of a curve OID. 3786 The alternative OIDs for Ed25519 and Curve25519 marked with (1) 3787 SHOULD only be used with v5 keys. 3789 9.3. Symmetric-Key Algorithms 3791 +=========+======================================+ 3792 | ID | Algorithm | 3793 +=========+======================================+ 3794 | 0 | Plaintext or unencrypted data | 3795 +---------+--------------------------------------+ 3796 | 1 | IDEA [IDEA] | 3797 +---------+--------------------------------------+ 3798 | 2 | TripleDES (DES-EDE, [SCHNEIER] [HAC] | 3799 | | - 168 bit key derived from 192) | 3800 +---------+--------------------------------------+ 3801 | 3 | CAST5 (128 bit key, as per | 3802 | | [RFC2144]) | 3803 +---------+--------------------------------------+ 3804 | 4 | Blowfish (128 bit key, 16 rounds) | 3805 | | [BLOWFISH] | 3806 +---------+--------------------------------------+ 3807 | 5 | Reserved | 3808 +---------+--------------------------------------+ 3809 | 6 | Reserved | 3810 +---------+--------------------------------------+ 3811 | 7 | AES with 128-bit key [AES] | 3812 +---------+--------------------------------------+ 3813 | 8 | AES with 192-bit key | 3814 +---------+--------------------------------------+ 3815 | 9 | AES with 256-bit key | 3816 +---------+--------------------------------------+ 3817 | 10 | Twofish with 256-bit key [TWOFISH] | 3818 +---------+--------------------------------------+ 3819 | 11 | Camellia with 128-bit key [RFC3713] | 3820 +---------+--------------------------------------+ 3821 | 12 | Camellia with 192-bit key | 3822 +---------+--------------------------------------+ 3823 | 13 | Camellia with 256-bit key | 3824 +---------+--------------------------------------+ 3825 | 100-110 | Private/Experimental algorithm | 3826 +---------+--------------------------------------+ 3828 Table 8 3830 Implementations MUST implement AES-128. Implementations SHOULD 3831 implement AES-256. Implementations that interoperate with RFC-4880 3832 implementations need to support TripleDES and CAST5. Implementations 3833 that interoperate with PGP 2.6 or earlier need to support IDEA, as 3834 that is the only symmetric cipher those versions use. 3835 Implementations MAY implement any other algorithm. 3837 9.4. Compression Algorithms 3839 +=========+================================+ 3840 | ID | Algorithm | 3841 +=========+================================+ 3842 | 0 | Uncompressed | 3843 +---------+--------------------------------+ 3844 | 1 | ZIP [RFC1951] | 3845 +---------+--------------------------------+ 3846 | 2 | ZLIB [RFC1950] | 3847 +---------+--------------------------------+ 3848 | 3 | BZip2 [BZ2] | 3849 +---------+--------------------------------+ 3850 | 100-110 | Private/Experimental algorithm | 3851 +---------+--------------------------------+ 3853 Table 9 3855 Implementations MUST implement uncompressed data. Implementations 3856 SHOULD implement ZLIB. For interoperability reasons implementations 3857 SHOULD be able to decompress using ZIP. Implementations MAY 3858 implement any other algorithm. 3860 9.5. Hash Algorithms 3862 +=========+================================+=============+ 3863 | ID | Algorithm | Text Name | 3864 +=========+================================+=============+ 3865 | 1 | MD5 [HAC] | "MD5" | 3866 +---------+--------------------------------+-------------+ 3867 | 2 | SHA-1 [FIPS180] | "SHA1" | 3868 +---------+--------------------------------+-------------+ 3869 | 3 | RIPE-MD/160 [HAC] | "RIPEMD160" | 3870 +---------+--------------------------------+-------------+ 3871 | 4 | Reserved | | 3872 +---------+--------------------------------+-------------+ 3873 | 5 | Reserved | | 3874 +---------+--------------------------------+-------------+ 3875 | 6 | Reserved | | 3876 +---------+--------------------------------+-------------+ 3877 | 7 | Reserved | | 3878 +---------+--------------------------------+-------------+ 3879 | 8 | SHA2-256 [FIPS180] | "SHA256" | 3880 +---------+--------------------------------+-------------+ 3881 | 9 | SHA2-384 [FIPS180] | "SHA384" | 3882 +---------+--------------------------------+-------------+ 3883 | 10 | SHA2-512 [FIPS180] | "SHA512" | 3884 +---------+--------------------------------+-------------+ 3885 | 11 | SHA2-224 [FIPS180] | "SHA224" | 3886 +---------+--------------------------------+-------------+ 3887 | 12 | SHA3-256 [FIPS202] | "SHA3-256" | 3888 +---------+--------------------------------+-------------+ 3889 | 13 | Reserved | | 3890 +---------+--------------------------------+-------------+ 3891 | 14 | SHA3-512 [FIPS202] | "SHA3-512" | 3892 +---------+--------------------------------+-------------+ 3893 | 100-110 | Private/Experimental algorithm | | 3894 +---------+--------------------------------+-------------+ 3896 Table 10 3898 Implementations MUST implement SHA2-256. Implementations MAY 3899 implement other algorithms. Implementations SHOULD NOT create 3900 messages which require the use of SHA-1 with the exception of 3901 computing version 4 key fingerprints and for purposes of the MDC 3902 packet. Implementations SHOULD NOT use MD5 or RIPE-MD/160. 3904 9.6. Encryption Modes 3906 +====+===============+ 3907 | ID | Mode | 3908 +====+===============+ 3909 | 1 | EAX [EAX] | 3910 +----+---------------+ 3911 | 2 | OCB [RFC7253] | 3912 +----+---------------+ 3914 Table 11 3916 Implementations MUST implement OCB if they support the packet 20 (OCB 3917 Encrypted Data Packet). Implementations MAY implement EAX only for 3918 decryption and only for backward compatibility with former drafts of 3919 this specification. 3921 10. IANA Considerations 3923 OpenPGP is highly parameterized, and consequently there are a number 3924 of considerations for allocating parameters for extensions. This 3925 section describes how IANA should look at extensions to the protocol 3926 as described in this document. 3928 { FIXME: Also add forward references, like "The list of S2K specifier 3929 types is maintained by IANA as described in Section 10." } 3931 10.1. New String-to-Key Specifier Types 3933 OpenPGP S2K specifiers contain a mechanism for new algorithms to turn 3934 a string into a key. This specification creates a registry of S2K 3935 specifier types. The registry includes the S2K type, the name of the 3936 S2K, and a reference to the defining specification. The initial 3937 values for this registry can be found in Section 3.7.1. Adding a new 3938 S2K specifier MUST be done through the SPECIFICATION REQUIRED method, 3939 as described in [RFC8126]. 3941 10.2. New Packets 3943 Major new features of OpenPGP are defined through new packet types. 3944 This specification creates a registry of packet types. The registry 3945 includes the packet type, the name of the packet, and a reference to 3946 the defining specification. The initial values for this registry can 3947 be found in Section 4.3. Adding a new packet type MUST be done 3948 through the RFC REQUIRED method, as described in [RFC8126]. 3950 10.2.1. User Attribute Types 3952 The User Attribute packet permits an extensible mechanism for other 3953 types of certificate identification. This specification creates a 3954 registry of User Attribute types. The registry includes the User 3955 Attribute type, the name of the User Attribute, and a reference to 3956 the defining specification. The initial values for this registry can 3957 be found in Section 5.13. Adding a new User Attribute type MUST be 3958 done through the SPECIFICATION REQUIRED method, as described in 3959 [RFC8126]. 3961 This document requests that IANA register the User ID Attribute Type 3962 found in Section 5.13.2: 3964 +=======+===========+===============+ 3965 | Value | Attribute | Reference | 3966 +=======+===========+===============+ 3967 | 1 | Image | This Document | 3968 +-------+-----------+---------------+ 3970 Table 12 3972 10.2.2. Image Format Subpacket Types 3974 Within User Attribute packets, there is an extensible mechanism for 3975 other types of image-based User Attributes. This specification 3976 creates a registry of Image Attribute subpacket types. The registry 3977 includes the Image Attribute subpacket type, the name of the Image 3978 Attribute subpacket, and a reference to the defining specification. 3979 The initial values for this registry can be found in Section 5.13.1. 3980 Adding a new Image Attribute subpacket type MUST be done through the 3981 SPECIFICATION REQUIRED method, as described in [RFC8126]. 3983 10.2.3. New Signature Subpackets 3985 OpenPGP signatures contain a mechanism for signed (or unsigned) data 3986 to be added to them for a variety of purposes in the Signature 3987 subpackets as discussed in Section 5.2.3.1. This specification 3988 creates a registry of Signature subpacket types. The registry 3989 includes the Signature subpacket type, the name of the subpacket, and 3990 a reference to the defining specification. The initial values for 3991 this registry can be found in Section 5.2.3.1. Adding a new 3992 Signature subpacket MUST be done through the SPECIFICATION REQUIRED 3993 method, as described in [RFC8126]. 3995 10.2.3.1. Signature Notation Data Subpackets 3997 OpenPGP signatures further contain a mechanism for extensions in 3998 signatures. These are the Notation Data subpackets, which contain a 3999 key/value pair. Notations contain a user space that is completely 4000 unmanaged and an IETF space. 4002 This specification creates a registry of Signature Notation Data 4003 types. The registry includes the Signature Notation Data type, the 4004 name of the Signature Notation Data, its allowed values, and a 4005 reference to the defining specification. The initial values for this 4006 registry can be found in Section 5.2.3.18. Adding a new Signature 4007 Notation Data subpacket MUST be done through the SPECIFICATION 4008 REQUIRED method, as described in [RFC8126]. 4010 This document requests IANA register the following Signature Notation 4011 Data types: 4013 +================+=========+====================+==================+ 4014 | Allowed Values | Name | Type | Reference | 4015 +================+=========+====================+==================+ 4016 | A String | charset | Character Set | This Doc Section | 4017 | | | | 5.2.3.18.1 | 4018 +----------------+---------+--------------------+------------------+ 4019 | Any String | manu | Manufacturer Name | This Doc Section | 4020 | | | | 5.2.3.18.2 | 4021 +----------------+---------+--------------------+------------------+ 4022 | Any String | make | Product Make | This Doc Section | 4023 | | | | 5.2.3.18.3 | 4024 +----------------+---------+--------------------+------------------+ 4025 | Any String | model | Product Model | This Doc Section | 4026 | | | | 5.2.3.18.4 | 4027 +----------------+---------+--------------------+------------------+ 4028 | Any String | prodid | Product ID | This Doc Section | 4029 | | | | 5.2.3.18.5 | 4030 +----------------+---------+--------------------+------------------+ 4031 | Any String | pvers | Product Version | This Doc Section | 4032 | | | | 5.2.3.18.6 | 4033 +----------------+---------+--------------------+------------------+ 4034 | Any String | lot | Product Lot Number | This Doc Section | 4035 | | | | 5.2.3.18.7 | 4036 +----------------+---------+--------------------+------------------+ 4037 | Decimal | qty | Package Quantity | This Doc Section | 4038 | Integer String | | | 5.2.3.18.8 | 4039 +----------------+---------+--------------------+------------------+ 4040 | A geo: URI | loc | Current | This Doc Section | 4041 | without the | | Geolocation | 5.2.3.18.9 | 4042 | "geo:" | | Latitude/Longitude | | 4043 +----------------+---------+--------------------+------------------+ 4044 | A geo: URI | dest | Destination | This Doc Section | 4045 | without the | | Geolocation | 5.2.3.18.9 | 4046 | "geo:" | | Latitude/Longitude | | 4047 +----------------+---------+--------------------+------------------+ 4048 | Hash Notation | hash | The Hash of | This Doc Section | 4049 | data | | external data | 5.2.3.18.10 | 4050 +----------------+---------+--------------------+------------------+ 4052 Table 13 4054 10.2.3.2. Signature Notation Data Subpacket Notation Flags 4056 This specification creates a new registry of Signature Notation Data 4057 Subpacket Notation Flags. The registry includes the columns "Flag", 4058 "Description", "Security Recommended", "Interoperability 4059 Recommended", and "Reference". The initial values for this registry 4060 can be found in Section 5.2.3.18. Adding a new item MUST be done 4061 through the SPECIFICATION REQUIRED method, as described in [RFC8126]. 4063 10.2.3.3. Key Server Preference Extensions 4065 OpenPGP signatures contain a mechanism for preferences to be 4066 specified about key servers. This specification creates a registry 4067 of key server preferences. The registry includes the key server 4068 preference, the name of the preference, and a reference to the 4069 defining specification. The initial values for this registry can be 4070 found in Section 5.2.3.19. Adding a new key server preference MUST 4071 be done through the SPECIFICATION REQUIRED method, as described in 4072 [RFC8126]. 4074 10.2.3.4. Key Flags Extensions 4076 OpenPGP signatures contain a mechanism for flags to be specified 4077 about key usage. This specification creates a registry of key usage 4078 flags. The registry includes the key flags value, the name of the 4079 flag, and a reference to the defining specification. The initial 4080 values for this registry can be found in Section 5.2.3.23. Adding a 4081 new key usage flag MUST be done through the SPECIFICATION REQUIRED 4082 method, as described in [RFC8126]. 4084 10.2.3.5. Reason for Revocation Extensions 4086 OpenPGP signatures contain a mechanism for flags to be specified 4087 about why a key was revoked. This specification creates a registry 4088 of "Reason for Revocation" flags. The registry includes the "Reason 4089 for Revocation" flags value, the name of the flag, and a reference to 4090 the defining specification. The initial values for this registry can 4091 be found in Section 5.2.3.25. Adding a new feature flag MUST be done 4092 through the SPECIFICATION REQUIRED method, as described in [RFC8126]. 4094 10.2.3.6. Implementation Features 4096 OpenPGP signatures contain a mechanism for flags to be specified 4097 stating which optional features an implementation supports. This 4098 specification creates a registry of feature-implementation flags. 4099 The registry includes the feature-implementation flags value, the 4100 name of the flag, and a reference to the defining specification. The 4101 initial values for this registry can be found in Section 5.2.3.26. 4103 Adding a new feature-implementation flag MUST be done through the 4104 SPECIFICATION REQUIRED method, as described in [RFC8126]. 4106 Also see Section 14.12 for more information about when feature flags 4107 are needed. 4109 10.2.4. New Packet Versions 4111 The core OpenPGP packets all have version numbers, and can be revised 4112 by introducing a new version of an existing packet. This 4113 specification creates a registry of packet types. The registry 4114 includes the packet type, the number of the version, and a reference 4115 to the defining specification. The initial values for this registry 4116 can be found in Section 5. Adding a new packet version MUST be done 4117 through the RFC REQUIRED method, as described in [RFC8126]. 4119 10.3. New Algorithms 4121 Section 9 lists the core algorithms that OpenPGP uses. Adding in a 4122 new algorithm is usually simple. For example, adding in a new 4123 symmetric cipher usually would not need anything more than allocating 4124 a constant for that cipher. If that cipher had other than a 64-bit 4125 or 128-bit block size, there might need to be additional 4126 documentation describing how OpenPGP-CFB mode would be adjusted. 4127 Similarly, when DSA was expanded from a maximum of 1024-bit public 4128 keys to 3072-bit public keys, the revision of FIPS 186 contained 4129 enough information itself to allow implementation. Changes to this 4130 document were made mainly for emphasis. 4132 10.3.1. Public-Key Algorithms 4134 OpenPGP specifies a number of public-key algorithms. This 4135 specification creates a registry of public-key algorithm identifiers. 4136 The registry includes the algorithm name, its key sizes and 4137 parameters, and a reference to the defining specification. The 4138 initial values for this registry can be found in Section 9.1. Adding 4139 a new public-key algorithm MUST be done through the SPECIFICATION 4140 REQUIRED method, as described in [RFC8126]. 4142 This document requests IANA register the following new public-key 4143 algorithm: 4145 +====+============================+========================+ 4146 | ID | Algorithm | Reference | 4147 +====+============================+========================+ 4148 | 22 | EdDSA public key algorithm | This doc, Section 14.8 | 4149 +----+----------------------------+------------------------+ 4150 | 23 | Reserved for AEDH | This doc | 4151 +----+----------------------------+------------------------+ 4152 | 24 | Reserved for AEDSA | This doc | 4153 +----+----------------------------+------------------------+ 4155 Table 14 4157 [Notes to RFC-Editor: Please remove the table above on publication. 4158 It is desirable not to reuse old or reserved algorithms because some 4159 existing tools might print a wrong description. A higher number is 4160 also an indication for a newer algorithm. As of now 22 is the next 4161 free number.] 4163 10.3.2. Symmetric-Key Algorithms 4165 OpenPGP specifies a number of symmetric-key algorithms. This 4166 specification creates a registry of symmetric-key algorithm 4167 identifiers. The registry includes the algorithm name, its key sizes 4168 and block size, and a reference to the defining specification. The 4169 initial values for this registry can be found in Section 9.3. Adding 4170 a new symmetric-key algorithm MUST be done through the SPECIFICATION 4171 REQUIRED method, as described in [RFC8126]. 4173 10.3.3. Hash Algorithms 4175 OpenPGP specifies a number of hash algorithms. This specification 4176 creates a registry of hash algorithm identifiers. The registry 4177 includes the algorithm name, a text representation of that name, its 4178 block size, an OID hash prefix, and a reference to the defining 4179 specification. The initial values for this registry can be found in 4180 Section 9.5 for the algorithm identifiers and text names, and 4181 Section 9.2 for the OIDs and expanded signature prefixes. Adding a 4182 new hash algorithm MUST be done through the SPECIFICATION REQUIRED 4183 method, as described in [RFC8126]. 4185 This document requests IANA register the following hash algorithms: 4187 +====+===========+===========+ 4188 | ID | Algorithm | Reference | 4189 +====+===========+===========+ 4190 | 12 | SHA3-256 | This doc | 4191 +----+-----------+-----------+ 4192 | 13 | Reserved | | 4193 +----+-----------+-----------+ 4194 | 14 | SHA3-512 | This doc | 4195 +----+-----------+-----------+ 4197 Table 15 4199 [Notes to RFC-Editor: Please remove the table above on publication. 4200 It is desirable not to reuse old or reserved algorithms because some 4201 existing tools might print a wrong description. The ID 13 has been 4202 reserved so that the SHA3 algorithm IDs align nicely with their SHA2 4203 counterparts.] 4205 10.3.4. Compression Algorithms 4207 OpenPGP specifies a number of compression algorithms. This 4208 specification creates a registry of compression algorithm 4209 identifiers. The registry includes the algorithm name and a 4210 reference to the defining specification. The initial values for this 4211 registry can be found in Section 9.4. Adding a new compression key 4212 algorithm MUST be done through the SPECIFICATION REQUIRED method, as 4213 described in [RFC8126]. 4215 11. Packet Composition 4217 OpenPGP packets are assembled into sequences in order to create 4218 messages and to transfer keys. Not all possible packet sequences are 4219 meaningful and correct. This section describes the rules for how 4220 packets should be placed into sequences. 4222 11.1. Transferable Public Keys 4224 OpenPGP users may transfer public keys. The essential elements of a 4225 transferable public key are as follows: 4227 * One Public-Key packet 4229 * Zero or more revocation signatures 4231 * One or more User ID packets 4233 * After each User ID packet, one or more Signature packets 4234 (certifications and attestation key signatures) 4236 * Zero or more User Attribute packets 4238 * After each User Attribute packet, one or more Signature packets 4239 (certifications and attestation key signatures) 4241 * Zero or more Subkey packets 4243 * After each Subkey packet, one Signature packet, plus optionally a 4244 revocation 4246 The Public-Key packet occurs first. Each of the following User ID 4247 packets provides the identity of the owner of this public key. If 4248 there are multiple User ID packets, this corresponds to multiple 4249 means of identifying the same unique individual user; for example, a 4250 user may have more than one email address, and construct a User ID 4251 for each one. 4253 Immediately following each User ID packet, there are one or more 4254 Signature packets. Each Signature packet is calculated on the 4255 immediately preceding User ID packet and the initial Public-Key 4256 packet. The signature serves to certify the corresponding public key 4257 and User ID. In effect, the signer is testifying to his or her 4258 belief that this public key belongs to the user identified by this 4259 User ID. Intermixed with these certifications may be Attestation Key 4260 Signature packets issued by the primary key over the same User ID and 4261 Public Key packet. The most recent of these is used to attest to 4262 third-party certifications over the associated User ID. 4264 Within the same section as the User ID packets, there are zero or 4265 more User Attribute packets. Like the User ID packets, a User 4266 Attribute packet is followed by one or more Signature packets 4267 calculated on the immediately preceding User Attribute packet and the 4268 initial Public-Key packet. 4270 User Attribute packets and User ID packets may be freely intermixed 4271 in this section, so long as the signatures that follow them are 4272 maintained on the proper User Attribute or User ID packet. 4274 After the User ID packet or Attribute packet, there may be zero or 4275 more Subkey packets. In general, subkeys are provided in cases where 4276 the top-level public key is a signature-only key. However, any V4 or 4277 V5 key may have subkeys, and the subkeys may be encryption-only keys, 4278 signature-only keys, or general-purpose keys. V3 keys MUST NOT have 4279 subkeys. 4281 Each Subkey packet MUST be followed by one Signature packet, which 4282 should be a subkey binding signature issued by the top-level key. 4283 For subkeys that can issue signatures, the subkey binding signature 4284 MUST contain an Embedded Signature subpacket with a primary key 4285 binding signature (0x19) issued by the subkey on the top-level key. 4287 Subkey and Key packets may each be followed by a revocation Signature 4288 packet to indicate that the key is revoked. Revocation signatures 4289 are only accepted if they are issued by the key itself, or by a key 4290 that is authorized to issue revocations via a Revocation Key 4291 subpacket in a self-signature by the top-level key. 4293 Transferable public-key packet sequences may be concatenated to allow 4294 transferring multiple public keys in one operation. 4296 11.2. Transferable Secret Keys 4298 OpenPGP users may transfer secret keys. The format of a transferable 4299 secret key is the same as a transferable public key except that 4300 secret-key and secret-subkey packets are used instead of the public 4301 key and public-subkey packets. Implementations SHOULD include self- 4302 signatures on any User IDs and subkeys, as this allows for a complete 4303 public key to be automatically extracted from the transferable secret 4304 key. Implementations MAY choose to omit the self-signatures, 4305 especially if a transferable public key accompanies the transferable 4306 secret key. 4308 11.3. OpenPGP Messages 4310 An OpenPGP message is a packet or sequence of packets that 4311 corresponds to the following grammatical rules (comma represents 4312 sequential composition, and vertical bar separates alternatives): 4314 OpenPGP Message :- Encrypted Message | Signed Message | 4315 Compressed Message | Literal Message. 4317 Compressed Message :- Compressed Data Packet. 4319 Literal Message :- Literal Data Packet. 4321 ESK :- Public-Key Encrypted Session Key Packet | 4322 Symmetric-Key Encrypted Session Key Packet. 4324 ESK Sequence :- ESK | ESK Sequence, ESK. 4326 Encrypted Data :- OCB Encrypted Data Packet | 4327 Symmetrically Encrypted Data Packet | 4328 Symmetrically Encrypted Integrity Protected Data Packet 4330 Encrypted Message :- Encrypted Data | ESK Sequence, Encrypted Data. 4332 One-Pass Signed Message :- One-Pass Signature Packet, 4333 OpenPGP Message, Corresponding Signature Packet. 4335 Signed Message :- Signature Packet, OpenPGP Message | 4336 One-Pass Signed Message. 4338 In addition, decrypting a Symmetrically Encrypted Data packet or a 4339 Symmetrically Encrypted Integrity Protected Data packet as well as 4340 decompressing a Compressed Data packet must yield a valid OpenPGP 4341 Message. 4343 11.4. Detached Signatures 4345 Some OpenPGP applications use so-called "detached signatures". For 4346 example, a program bundle may contain a file, and with it a second 4347 file that is a detached signature of the first file. These detached 4348 signatures are simply a Signature packet stored separately from the 4349 data for which they are a signature. 4351 12. Enhanced Key Formats 4353 12.1. Key Structures 4355 The format of an OpenPGP V3 key is as follows. Entries in square 4356 brackets are optional and ellipses indicate repetition. 4358 RSA Public Key 4359 [Revocation Self Signature] 4360 User ID [Signature ...] 4361 [User ID [Signature ...] ...] 4363 Each signature certifies the RSA public key and the preceding User 4364 ID. The RSA public key can have many User IDs and each User ID can 4365 have many signatures. V3 keys are deprecated. Implementations MUST 4366 NOT generate new V3 keys, but MAY continue to use existing ones. 4368 The format of an OpenPGP V4 key that uses multiple public keys is 4369 similar except that the other keys are added to the end as "subkeys" 4370 of the primary key. 4372 Primary-Key 4373 [Revocation Self Signature] 4374 [Direct Key Signature...] 4375 [User ID [Signature ...] ...] 4376 [User Attribute [Signature ...] ...] 4377 [[Subkey [Binding-Signature-Revocation] 4378 Primary-Key-Binding-Signature] ...] 4380 A subkey always has a single signature after it that is issued using 4381 the primary key to tie the two keys together. This binding signature 4382 may be in either V3 or V4 format, but SHOULD be V4. Subkeys that can 4383 issue signatures MUST have a V4 binding signature due to the REQUIRED 4384 embedded primary key binding signature. 4386 In the above diagram, if the binding signature of a subkey has been 4387 revoked, the revoked key may be removed, leaving only one key. 4389 In a V4 key, the primary key SHOULD be a key capable of 4390 certification. There are cases, such as device certificates, where 4391 the primary key may not be capable of certification. A primary key 4392 capable of making signatures SHOULD be accompanied by either a 4393 certification signature (on a User ID or User Attribute) or a 4394 signature directly on the key. 4396 Implementations SHOULD accept encryption-only primary keys without a 4397 signature. It also SHOULD allow importing any key accompanied either 4398 by a certification signature or a signature on itself. It MAY accept 4399 signature-capable primary keys without an accompanying signature. 4401 The subkeys may be keys of any other type. There may be other 4402 constructions of V4 keys, too. For example, there may be a single- 4403 key RSA key in V4 format, a DSA primary key with an RSA encryption 4404 key, or RSA primary key with an Elgamal subkey, etc. 4406 It is also possible to have a signature-only subkey. This permits a 4407 primary key that collects certifications (key signatures), but is 4408 used only for certifying subkeys that are used for encryption and 4409 signatures. 4411 12.2. Key IDs and Fingerprints 4413 For a V3 key, the eight-octet Key ID consists of the low 64 bits of 4414 the public modulus of the RSA key. 4416 The fingerprint of a V3 key is formed by hashing the body (but not 4417 the two-octet length) of the MPIs that form the key material (public 4418 modulus n, followed by exponent e) with MD5. Note that both V3 keys 4419 and MD5 are deprecated. 4421 A V4 fingerprint is the 160-bit SHA-1 hash of the octet 0x99, 4422 followed by the two-octet packet length, followed by the entire 4423 Public-Key packet starting with the version field. The Key ID is the 4424 low-order 64 bits of the fingerprint. Here are the fields of the 4425 hash material, with the example of a DSA key: 4427 a.1) 0x99 (1 octet) 4429 a.2) two-octet scalar octet count of (b)-(e) 4431 b) version number = 4 (1 octet); 4433 c) timestamp of key creation (4 octets); 4435 d) algorithm (1 octet): 17 = DSA (example); 4437 e) Algorithm-specific fields. 4439 Algorithm-Specific Fields for DSA keys (example): 4441 e.1) MPI of DSA prime p; 4443 e.2) MPI of DSA group order q (q is a prime divisor of p-1); 4445 e.3) MPI of DSA group generator g; 4447 e.4) MPI of DSA public-key value y (= g**x mod p where x is secret). 4449 A V5 fingerprint is the 256-bit SHA2-256 hash of the octet 0x9A, 4450 followed by the four-octet packet length, followed by the entire 4451 Public-Key packet starting with the version field. The Key ID is the 4452 high-order 64 bits of the fingerprint. Here are the fields of the 4453 hash material, with the example of a DSA key: 4455 a.1) 0x9A (1 octet) 4457 a.2) four-octet scalar octet count of (b)-(f) 4459 b) version number = 5 (1 octet); 4461 c) timestamp of key creation (4 octets); 4463 d) algorithm (1 octet): 17 = DSA (example); 4465 e) four-octet scalar octet count for the following key material; 4467 f) algorithm-specific fields. 4469 Algorithm-Specific Fields for DSA keys (example): 4471 f.1) MPI of DSA prime p; 4473 f.2) MPI of DSA group order q (q is a prime divisor of p-1); 4475 f.3) MPI of DSA group generator g; 4477 f.4) MPI of DSA public-key value y (= g**x mod p where x 4478 is secret). 4480 Note that it is possible for there to be collisions of Key IDs -- two 4481 different keys with the same Key ID. Note that there is a much 4482 smaller, but still non-zero, probability that two different keys have 4483 the same fingerprint. 4485 Also note that if V3, V4, and V5 format keys share the same RSA key 4486 material, they will have different Key IDs as well as different 4487 fingerprints. 4489 Finally, the Key ID and fingerprint of a subkey are calculated in the 4490 same way as for a primary key, including the 0x99 (V3 and V4 key) or 4491 0x9A (V5 key) as the first octet (even though this is not a valid 4492 packet ID for a public subkey). 4494 13. Elliptic Curve Cryptography 4496 This section descripes algorithms and parameters used with Elliptic 4497 Curve Cryptography (ECC) keys. A thorough introduction to ECC can be 4498 found in [KOBLITZ]. 4500 13.1. Supported ECC Curves 4502 This document references six named prime field curves, defined in 4503 [FIPS186] as "Curve P-256", "Curve P-384", and "Curve P-521"; and 4504 defined in [RFC5639] as "brainpoolP256r1" "brainpoolP384r1", and 4505 "brainpoolP512r1". Further curves "Curve25519" and "Curve448", 4506 defined in [RFC7748] are referenced for use with Ed25519/Ed448 (EdDSA 4507 signing) and X25519/X448 (ECDH encryption). 4509 The named curves are referenced as a sequence of bytes in this 4510 document, called throughout, curve OID. Section 9.2 describes in 4511 detail how this sequence of bytes is formed. 4513 13.2. ECDSA and ECDH Conversion Primitives 4515 This document defines the uncompressed point format for ECDSA and 4516 ECDH and a custom compression format for certain curves. The point 4517 is encoded in the Multiprecision Integer (MPI) format. 4519 For an uncompressed point the content of the MPI is: 4521 B = 04 || x || y 4523 where x and y are coordinates of the point P = (x, y), each encoded 4524 in the big-endian format and zero-padded to the adjusted underlying 4525 field size. The adjusted underlying field size is the underlying 4526 field size that is rounded up to the nearest 8-bit boundary. This 4527 encoding is compatible with the definition given in [SEC1]. 4529 For a custom compressed point the content of the MPI is: 4531 B = 40 || x 4533 where x is the x coordinate of the point P encoded to the rules 4534 defined for the specified curve. This format is used for ECDH keys 4535 based on curves expressed in Montgomery form. 4537 Therefore, the exact size of the MPI payload is 515 bits for "Curve 4538 P-256", 771 for "Curve P-384", 1059 for "Curve P-521", and 263 for 4539 Curve25519. 4541 Even though the zero point, also called the point at infinity, may 4542 occur as a result of arithmetic operations on points of an elliptic 4543 curve, it SHALL NOT appear in data structures defined in this 4544 document. 4546 If other conversion methods are defined in the future, a compliant 4547 application MUST NOT use a new format when in doubt that any 4548 recipient can support it. Consider, for example, that while both the 4549 public key and the per-recipient ECDH data structure, respectively 4550 defined in Section 5.6.6 and Section 5.1, contain an encoded point 4551 field, the format changes to the field in Section 5.1 only affect a 4552 given recipient of a given message. 4554 13.3. EdDSA Point Format 4556 The EdDSA algorithm defines a specific point compression format. To 4557 indicate the use of this compression format and to make sure that the 4558 key can be represented in the Multiprecision Integer (MPI) format the 4559 octet string specifying the point is prefixed with the octet 0x40. 4560 This encoding is an extension of the encoding given in [SEC1] which 4561 uses 0x04 to indicate an uncompressed point. 4563 For example, the length of a public key for the curve Ed25519 is 263 4564 bit: 7 bit to represent the 0x40 prefix octet and 32 octets for the 4565 native value of the public key. 4567 13.4. Key Derivation Function 4569 A key derivation function (KDF) is necessary to implement the EC 4570 encryption. The Concatenation Key Derivation Function (Approved 4571 Alternative 1) [SP800-56A] with the KDF hash function that is 4572 SHA2-256 [FIPS180] or stronger is REQUIRED. See Section 16 for the 4573 details regarding the choice of the hash function. 4575 For convenience, the synopsis of the encoding method is given below 4576 with significant simplifications attributable to the restricted 4577 choice of hash functions in this document. However, [SP800-56A] is 4578 the normative source of the definition. 4580 // Implements KDF( X, oBits, Param ); 4581 // Input: point X = (x,y) 4582 // oBits - the desired size of output 4583 // hBits - the size of output of hash function Hash 4584 // Param - octets representing the parameters 4585 // Assumes that oBits <= hBits 4586 // Convert the point X to the octet string: 4587 // ZB' = 04 || x || y 4588 // and extract the x portion from ZB' 4589 ZB = x; 4590 MB = Hash ( 00 || 00 || 00 || 01 || ZB || Param ); 4591 return oBits leftmost bits of MB. 4593 Note that ZB in the KDF description above is the compact 4594 representation of X, defined in Section 4.2 of [RFC6090]. 4596 13.5. ECDH Algorithm 4598 The method is a combination of an ECC Diffie-Hellman method to 4599 establish a shared secret, a key derivation method to process the 4600 shared secret into a derived key, and a key wrapping method that uses 4601 the derived key to protect a session key used to encrypt a message. 4603 The One-Pass Diffie-Hellman method C(1, 1, ECC CDH) [SP800-56A] MUST 4604 be implemented with the following restrictions: the ECC CDH primitive 4605 employed by this method is modified to always assume the cofactor as 4606 1, the KDF specified in Section 13.4 is used, and the KDF parameters 4607 specified below are used. 4609 The KDF parameters are encoded as a concatenation of the following 5 4610 variable-length and fixed-length fields, compatible with the 4611 definition of the OtherInfo bitstring [SP800-56A]: 4613 * a variable-length field containing a curve OID, formatted as 4614 follows: 4616 - a one-octet size of the following field 4618 - the octets representing a curve OID, defined in Section 9.2 4620 * a one-octet public key algorithm ID defined in Section 9.1 4622 * a variable-length field containing KDF parameters, identical to 4623 the corresponding field in the ECDH public key, formatted as 4624 follows: 4626 - a one-octet size of the following fields; values 0 and 0xff are 4627 reserved for future extensions 4629 - a one-octet value 01, reserved for future extensions 4631 - a one-octet hash function ID used with the KDF 4633 - a one-octet algorithm ID for the symmetric algorithm used to 4634 wrap the symmetric key for message encryption; see Section 13.5 4635 for details 4637 * 20 octets representing the UTF-8 encoding of the string "Anonymous 4638 Sender ", which is the octet sequence 41 6E 6F 6E 79 6D 6F 75 73 4639 20 53 65 6E 64 65 72 20 20 20 20 4641 * 20 octets representing a recipient encryption subkey or a master 4642 key fingerprint, identifying the key material that is needed for 4643 the decryption. For version 5 keys the 20 leftmost octets of the 4644 fingerprint are used. 4646 The size of the KDF parameters sequence, defined above, is either 54 4647 for the NIST curve P-256, 51 for the curves P-384 and P-521, or 56 4648 for Curve25519. 4650 The key wrapping method is described in [RFC3394]. KDF produces a 4651 symmetric key that is used as a key-encryption key (KEK) as specified 4652 in [RFC3394]. Refer to Section 15 for the details regarding the 4653 choice of the KEK algorithm, which SHOULD be one of three AES 4654 algorithms. Key wrapping and unwrapping is performed with the 4655 default initial value of [RFC3394]. 4657 The input to the key wrapping method is the value "m" derived from 4658 the session key, as described in Section 5.1, "Public-Key Encrypted 4659 Session Key Packets (Tag 1)", except that the PKCS #1.5 padding step 4660 is omitted. The result is padded using the method described in 4661 [PKCS5] to the 8-byte granularity. For example, the following 4662 AES-256 session key, in which 32 octets are denoted from k0 to k31, 4663 is composed to form the following 40 octet sequence: 4665 09 k0 k1 ... k31 c0 c1 05 05 05 05 05 4667 The octets c0 and c1 above denote the checksum. This encoding allows 4668 the sender to obfuscate the size of the symmetric encryption key used 4669 to encrypt the data. For example, assuming that an AES algorithm is 4670 used for the session key, the sender MAY use 21, 13, and 5 bytes of 4671 padding for AES-128, AES-192, and AES-256, respectively, to provide 4672 the same number of octets, 40 total, as an input to the key wrapping 4673 method. 4675 The output of the method consists of two fields. The first field is 4676 the MPI containing the ephemeral key used to establish the shared 4677 secret. The second field is composed of the following two fields: 4679 * a one-octet encoding the size in octets of the result of the key 4680 wrapping method; the value 255 is reserved for future extensions; 4682 * up to 254 octets representing the result of the key wrapping 4683 method, applied to the 8-byte padded session key, as described 4684 above. 4686 Note that for session key sizes 128, 192, and 256 bits, the size of 4687 the result of the key wrapping method is, respectively, 32, 40, and 4688 48 octets, unless the size obfuscation is used. 4690 For convenience, the synopsis of the encoding method is given below; 4691 however, this section, [SP800-56A], and [RFC3394] are the normative 4692 sources of the definition. 4694 Obtain the authenticated recipient public key R 4695 Generate an ephemeral key pair {v, V=vG} 4696 Compute the shared point S = vR; 4697 m = symm_alg_ID || session key || checksum || pkcs5_padding; 4698 curve_OID_len = (byte)len(curve_OID); 4699 Param = curve_OID_len || curve_OID || public_key_alg_ID || 03 4700 || 01 || KDF_hash_ID || KEK_alg_ID for AESKeyWrap || "Anonymous 4701 Sender " || recipient_fingerprint; 4702 Z_len = the key size for the KEK_alg_ID used with AESKeyWrap 4703 Compute Z = KDF( S, Z_len, Param ); 4704 Compute C = AESKeyWrap( Z, m ) as per [RFC3394] 4705 VB = convert point V to the octet string 4706 Output (MPI(VB) || len(C) || C). 4708 The decryption is the inverse of the method given. Note that the 4709 recipient obtains the shared secret by calculating 4711 S = rV = rvG, where (r,R) is the recipient's key pair. 4713 Consistent with Section 5.16, "OCB Encrypted Data Packet (Tag 20)" 4714 and Section 5.14, "Sym. Encrypted Integrity Protected Data Packet 4715 (Tag 18)", OCB encryption or a Modification Detection Code (MDC) MUST 4716 be used anytime the symmetric key is protected by ECDH. 4718 13.5.1. ECDH Parameters 4720 ECDH keys have a hash algorithm parameter for key derivation and a 4721 symmetric algorithm for key encapsulation. 4723 For v4 keys, the following algorithms SHOULD be used depending on the 4724 curve. An implementation SHOULD only use an AES algorithm as a KEK 4725 algorithm. 4727 For v5 keys, the following algorithms MUST be used depending on the 4728 curve. An implementation MUST NOT generate a v5 ECDH key over any 4729 listed curve that uses different KDF or KEK parameters. An 4730 implementation MUST NOT encrypt any message to a v5 ECDH key over a 4731 listed curve that announces a different KDF or KEK parameter. 4733 +=================+================+=====================+ 4734 | Curve | Hash algorithm | Symmetric algorithm | 4735 +=================+================+=====================+ 4736 | NIST P-256 | SHA2-256 | AES-128 | 4737 +-----------------+----------------+---------------------+ 4738 | NIST P-384 | SHA2-384 | AES-192 | 4739 +-----------------+----------------+---------------------+ 4740 | NIST P-521 | SHA2-512 | AES-256 | 4741 +-----------------+----------------+---------------------+ 4742 | brainpoolP256r1 | SHA2-256 | AES-128 | 4743 +-----------------+----------------+---------------------+ 4744 | brainpoolP384r1 | SHA2-384 | AES-192 | 4745 +-----------------+----------------+---------------------+ 4746 | brainpoolP512r1 | SHA2-512 | AES-256 | 4747 +-----------------+----------------+---------------------+ 4748 | Curve25519 | SHA2-256 | AES-128 | 4749 +-----------------+----------------+---------------------+ 4750 | X448 | SHA2-512 | AES-256 | 4751 +-----------------+----------------+---------------------+ 4753 Table 16 4755 14. Notes on Algorithms 4757 14.1. PKCS#1 Encoding in OpenPGP 4759 This standard makes use of the PKCS#1 functions EME-PKCS1-v1_5 and 4760 EMSA-PKCS1-v1_5. However, the calling conventions of these functions 4761 has changed in the past. To avoid potential confusion and 4762 interoperability problems, we are including local copies in this 4763 document, adapted from those in PKCS#1 v2.1 [RFC3447]. RFC 3447 4764 should be treated as the ultimate authority on PKCS#1 for OpenPGP. 4765 Nonetheless, we believe that there is value in having a self- 4766 contained document that avoids problems in the future with needed 4767 changes in the conventions. 4769 14.1.1. EME-PKCS1-v1_5-ENCODE 4770 Input: 4772 k = the length in octets of the key modulus. 4774 M = message to be encoded, an octet string of length mLen, 4775 where mLen <= k - 11. 4777 Output: 4779 EM = encoded message, an octet string of length k. 4781 Error: "message too long". 4783 1. Length checking: If mLen > k - 11, output "message too long" 4784 and stop. 4786 2. Generate an octet string PS of length k - mLen - 3 consisting 4787 of pseudo-randomly generated nonzero octets. The length of PS 4788 will be at least eight octets. 4790 3. Concatenate PS, the message M, and other padding to form an 4791 encoded message EM of length k octets as 4793 EM = 0x00 || 0x02 || PS || 0x00 || M. 4795 4. Output EM. 4797 14.1.2. EME-PKCS1-v1_5-DECODE 4799 Input: 4801 EM = encoded message, an octet string 4803 Output: 4805 M = message, an octet string, 4807 Error: "decryption error", 4809 To decode an EME-PKCS1_v1_5 message, separate the encoded message EM 4810 into an octet string PS consisting of nonzero octets and a message M 4811 as follows 4813 EM = 0x00 || 0x02 || PS || 0x00 || M. 4815 If the first octet of EM does not have hexadecimal value 0x00, if the 4816 second octet of EM does not have hexadecimal value 0x02, if there is 4817 no octet with hexadecimal value 0x00 to separate PS from M, or if the 4818 length of PS is less than 8 octets, output "decryption error" and 4819 stop. See also the security note in Section 15 regarding differences 4820 in reporting between a decryption error and a padding error. 4822 14.1.3. EMSA-PKCS1-v1_5 4824 This encoding method is deterministic and only has an encoding 4825 operation. 4827 Option: 4829 Hash - a hash function in which hLen denotes the length in octets 4830 of the hash function output. 4832 Input: 4834 M = message to be encoded. 4836 emLen = intended length in octets of the encoded message, at least 4837 tLen + 11, where tLen is the octet length of the DER encoding 4838 T of a certain value computed during the encoding operation. 4840 Output: 4842 EM = encoded message, an octet string of length emLen. 4844 Errors: "message too long"; 4845 "intended encoded message length too short". 4847 Steps: 4849 1. Apply the hash function to the message M to produce a hash 4850 value H: 4852 H = Hash(M). 4854 If the hash function outputs "message too long," output 4855 "message too long" and stop. 4857 2. Using the list in Section [](#version-3-signature-packet-format), 4858 "Version 3 Signature Packet Format", produce an ASN.1 DER 4859 value for the hash function used. Let T be the full hash 4860 prefix from the list, and let tLen be the length in octets of 4861 T. 4863 3. If emLen < tLen + 11, output "intended encoded message length 4864 too short" and stop. 4866 4. Generate an octet string PS consisting of emLen - tLen - 3 4867 octets with hexadecimal value 0xFF. The length of PS will be 4868 at least 8 octets. 4870 5. Concatenate PS, the hash prefix T, and other padding to form 4871 the encoded message EM as 4873 EM = 0x00 || 0x01 || PS || 0x00 || T. 4875 6. Output EM. 4877 14.2. Symmetric Algorithm Preferences 4879 The symmetric algorithm preference is an ordered list of algorithms 4880 that the keyholder accepts. Since it is found on a self-signature, 4881 it is possible that a keyholder may have multiple, different 4882 preferences. For example, Alice may have AES-128 only specified for 4883 "alice@work.com" but Camellia-256, Twofish, and AES-128 specified for 4884 "alice@home.org". Note that it is also possible for preferences to 4885 be in a subkey's binding signature. 4887 Since AES-128 is the MUST-implement algorithm, if it is not 4888 explicitly in the list, it is tacitly at the end. However, it is 4889 good form to place it there explicitly. Note also that if an 4890 implementation does not implement the preference, then it is 4891 implicitly an AES-128-only implementation. Note further that 4892 implementations conforming to previous versions of this standard 4893 (RFC-4880) have TripleDES as its only MUST-implement algorithm. 4895 An implementation MUST NOT use a symmetric algorithm that is not in 4896 the recipient's preference list. When encrypting to more than one 4897 recipient, the implementation finds a suitable algorithm by taking 4898 the intersection of the preferences of the recipients. Note that the 4899 MUST-implement algorithm, AES-128, ensures that the intersection is 4900 not null. The implementation may use any mechanism to pick an 4901 algorithm in the intersection. 4903 If an implementation can decrypt a message that a keyholder doesn't 4904 have in their preferences, the implementation SHOULD decrypt the 4905 message anyway, but MUST warn the keyholder that the protocol has 4906 been violated. For example, suppose that Alice, above, has software 4907 that implements all algorithms in this specification. Nonetheless, 4908 she prefers subsets for work or home. If she is sent a message 4909 encrypted with IDEA, which is not in her preferences, the software 4910 warns her that someone sent her an IDEA-encrypted message, but it 4911 would ideally decrypt it anyway. 4913 14.3. Other Algorithm Preferences 4915 Other algorithm preferences work similarly to the symmetric algorithm 4916 preference, in that they specify which algorithms the keyholder 4917 accepts. There are two interesting cases that other comments need to 4918 be made about, though, the compression preferences and the hash 4919 preferences. 4921 14.3.1. Compression Preferences 4923 Compression has been an integral part of PGP since its first days. 4924 OpenPGP and all previous versions of PGP have offered compression. 4925 In this specification, the default is for messages to be compressed, 4926 although an implementation is not required to do so. Consequently, 4927 the compression preference gives a way for a keyholder to request 4928 that messages not be compressed, presumably because they are using a 4929 minimal implementation that does not include compression. 4930 Additionally, this gives a keyholder a way to state that it can 4931 support alternate algorithms. 4933 Like the algorithm preferences, an implementation MUST NOT use an 4934 algorithm that is not in the preference vector. If the preferences 4935 are not present, then they are assumed to be [ZIP(1), 4936 Uncompressed(0)]. 4938 Additionally, an implementation MUST implement this preference to the 4939 degree of recognizing when to send an uncompressed message. A robust 4940 implementation would satisfy this requirement by looking at the 4941 recipient's preference and acting accordingly. A minimal 4942 implementation can satisfy this requirement by never generating a 4943 compressed message, since all implementations can handle messages 4944 that have not been compressed. 4946 14.3.2. Hash Algorithm Preferences 4948 Typically, the choice of a hash algorithm is something the signer 4949 does, rather than the verifier, because a signer rarely knows who is 4950 going to be verifying the signature. This preference, though, allows 4951 a protocol based upon digital signatures ease in negotiation. 4953 Thus, if Alice is authenticating herself to Bob with a signature, it 4954 makes sense for her to use a hash algorithm that Bob's software uses. 4955 This preference allows Bob to state in his key which algorithms Alice 4956 may use. 4958 Since SHA2-256 is the MUST-implement hash algorithm, if it is not 4959 explicitly in the list, it is tacitly at the end. However, it is 4960 good form to place it there explicitly. 4962 14.4. Plaintext 4964 Algorithm 0, "plaintext", may only be used to denote secret keys that 4965 are stored in the clear. Implementations MUST NOT use plaintext in 4966 Symmetrically Encrypted Data packets; they must use Literal Data 4967 packets to encode unencrypted or literal data. 4969 14.5. RSA 4971 There are algorithm types for RSA Sign-Only, and RSA Encrypt-Only 4972 keys. These types are deprecated. The "key flags" subpacket in a 4973 signature is a much better way to express the same idea, and 4974 generalizes it to all algorithms. An implementation SHOULD NOT 4975 create such a key, but MAY interpret it. 4977 An implementation SHOULD NOT implement RSA keys of size less than 4978 1024 bits. 4980 14.6. DSA 4982 An implementation SHOULD NOT implement DSA keys of size less than 4983 1024 bits. It MUST NOT implement a DSA key with a q size of less 4984 than 160 bits. DSA keys MUST also be a multiple of 64 bits, and the 4985 q size MUST be a multiple of 8 bits. The Digital Signature Standard 4986 (DSS) [FIPS186] specifies that DSA be used in one of the following 4987 ways: 4989 * 1024-bit key, 160-bit q, SHA-1, SHA2-224, SHA2-256, SHA2-384, or 4990 SHA2-512 hash 4992 * 2048-bit key, 224-bit q, SHA2-224, SHA2-256, SHA2-384, or SHA2-512 4993 hash 4995 * 2048-bit key, 256-bit q, SHA2-256, SHA2-384, or SHA2-512 hash 4997 * 3072-bit key, 256-bit q, SHA2-256, SHA2-384, or SHA2-512 hash 4999 The above key and q size pairs were chosen to best balance the 5000 strength of the key with the strength of the hash. Implementations 5001 SHOULD use one of the above key and q size pairs when generating DSA 5002 keys. If DSS compliance is desired, one of the specified SHA hashes 5003 must be used as well. [FIPS186] is the ultimate authority on DSS, 5004 and should be consulted for all questions of DSS compliance. 5006 Note that earlier versions of this standard only allowed a 160-bit q 5007 with no truncation allowed, so earlier implementations may not be 5008 able to handle signatures with a different q size or a truncated 5009 hash. 5011 14.7. Elgamal 5013 An implementation SHOULD NOT implement Elgamal keys of size less than 5014 1024 bits. 5016 14.8. EdDSA 5018 Although the EdDSA algorithm allows arbitrary data as input, its use 5019 with OpenPGP requires that a digest of the message is used as input 5020 (pre-hashed). See section Section 5.2.4, "Computing Signatures" for 5021 details. Truncation of the resulting digest is never applied; the 5022 resulting digest value is used verbatim as input to the EdDSA 5023 algorithm. 5025 14.9. Reserved Algorithm Numbers 5027 A number of algorithm IDs have been reserved for algorithms that 5028 would be useful to use in an OpenPGP implementation, yet there are 5029 issues that prevent an implementer from actually implementing the 5030 algorithm. These are marked in Section 9.1, "Public-Key Algorithms", 5031 as "reserved for". 5033 The reserved public-key algorithm X9.42 (21) does not have the 5034 necessary parameters, parameter order, or semantics defined. The 5035 same is currently true for reserved public-key algorithms AEDH (23) 5036 and AEDSA (24). 5038 Previous versions of OpenPGP permitted Elgamal [ELGAMAL] signatures 5039 with a public-key identifier of 20. These are no longer permitted. 5040 An implementation MUST NOT generate such keys. An implementation 5041 MUST NOT generate Elgamal signatures. See [BLEICHENBACHER]. 5043 14.10. OpenPGP CFB Mode 5045 OpenPGP does symmetric encryption using a variant of Cipher Feedback 5046 mode (CFB mode). This section describes the procedure it uses in 5047 detail. This mode is what is used for Symmetrically Encrypted Data 5048 Packets; the mechanism used for encrypting secret-key material is 5049 similar, and is described in the sections above. 5051 In the description below, the value BS is the block size in octets of 5052 the cipher. Most ciphers have a block size of 8 octets. The AES and 5053 Twofish have a block size of 16 octets. Also note that the 5054 description below assumes that the IV and CFB arrays start with an 5055 index of 1 (unlike the C language, which assumes arrays start with a 5056 zero index). 5058 OpenPGP CFB mode uses an initialization vector (IV) of all zeros, and 5059 prefixes the plaintext with BS+2 octets of random data, such that 5060 octets BS+1 and BS+2 match octets BS-1 and BS. It does a CFB 5061 resynchronization after encrypting those BS+2 octets. 5063 Thus, for an algorithm that has a block size of 8 octets (64 bits), 5064 the IV is 10 octets long and octets 7 and 8 of the IV are the same as 5065 octets 9 and 10. For an algorithm with a block size of 16 octets 5066 (128 bits), the IV is 18 octets long, and octets 17 and 18 replicate 5067 octets 15 and 16. Those extra two octets are an easy check for a 5068 correct key. 5070 Step by step, here is the procedure: 5072 1. The feedback register (FR) is set to the IV, which is all zeros. 5074 2. FR is encrypted to produce FRE (FR Encrypted). This is the 5075 encryption of an all-zero value. 5077 3. FRE is xored with the first BS octets of random data prefixed to 5078 the plaintext to produce C[1] through C[BS], the first BS octets 5079 of ciphertext. 5081 4. FR is loaded with C[1] through C[BS]. 5083 5. FR is encrypted to produce FRE, the encryption of the first BS 5084 octets of ciphertext. 5086 6. The left two octets of FRE get xored with the next two octets of 5087 data that were prefixed to the plaintext. This produces C[BS+1] 5088 and C[BS+2], the next two octets of ciphertext. 5090 7. (The resynchronization step) FR is loaded with C[3] through 5091 C[BS+2]. 5093 8. FRE is xored with the first BS octets of the given plaintext, 5094 now that we have finished encrypting the BS+2 octets of prefixed 5095 data. This produces C[BS+3] through C[BS+(BS+2)], the next BS 5096 octets of ciphertext. 5098 9. FR is encrypted to produce FRE. 5100 10. FR is loaded with C[BS+3] to C[BS + (BS+2)] (which is C11-C18 5101 for an 8-octet block). 5103 11. FR is encrypted to produce FRE. 5105 12. FRE is xored with the next BS octets of plaintext, to produce 5106 the next BS octets of ciphertext. These are loaded into FR, and 5107 the process is repeated until the plaintext is used up. 5109 14.11. Private or Experimental Parameters 5111 S2K specifiers, Signature subpacket types, User Attribute types, 5112 image format types, and algorithms described in Section 9 all reserve 5113 the range 100 to 110 for private and experimental use. Packet types 5114 reserve the range 60 to 63 for private and experimental use. These 5115 are intentionally managed with the PRIVATE USE method, as described 5116 in [RFC8126]. 5118 However, implementations need to be careful with these and promote 5119 them to full IANA-managed parameters when they grow beyond the 5120 original, limited system. 5122 14.12. Meta-Considerations for Expansion 5124 If OpenPGP is extended in a way that is not backwards-compatible, 5125 meaning that old implementations will not gracefully handle their 5126 absence of a new feature, the extension proposal can be declared in 5127 the key holder's self-signature as part of the Features signature 5128 subpacket. 5130 We cannot state definitively what extensions will not be upwards- 5131 compatible, but typically new algorithms are upwards-compatible, 5132 whereas new packets are not. 5134 If an extension proposal does not update the Features system, it 5135 SHOULD include an explanation of why this is unnecessary. If the 5136 proposal contains neither an extension to the Features system nor an 5137 explanation of why such an extension is unnecessary, the proposal 5138 SHOULD be rejected. 5140 15. Security Considerations 5142 * As with any technology involving cryptography, you should check 5143 the current literature to determine if any algorithms used here 5144 have been found to be vulnerable to attack or have been found to 5145 be too weak. 5147 * This specification uses Public-Key Cryptography technologies. It 5148 is assumed that the private key portion of a public-private key 5149 pair is controlled and secured by the proper party or parties. 5151 * Certain operations in this specification involve the use of random 5152 numbers. An appropriate entropy source should be used to generate 5153 these numbers (see [RFC4086]). 5155 * The MD5 hash algorithm has been found to have weaknesses, with 5156 collisions found in a number of cases. MD5 is deprecated for use 5157 in OpenPGP. Implementations MUST NOT generate new signatures 5158 using MD5 as a hash function. They MAY continue to consider old 5159 signatures that used MD5 as valid. 5161 * SHA2-224 and SHA2-384 require the same work as SHA2-256 and 5162 SHA2-512, respectively. In general, there are few reasons to use 5163 them outside of DSS compatibility. You need a situation where one 5164 needs more security than smaller hashes, but does not want to have 5165 the full 256-bit or 512-bit data length. 5167 * Many security protocol designers think that it is a bad idea to 5168 use a single key for both privacy (encryption) and integrity 5169 (signatures). In fact, this was one of the motivating forces 5170 behind the V4 key format with separate signature and encryption 5171 keys. If you as an implementer promote dual-use keys, you should 5172 at least be aware of this controversy. 5174 * The DSA algorithm will work with any hash, but is sensitive to the 5175 quality of the hash algorithm. Verifiers should be aware that 5176 even if the signer used a strong hash, an attacker could have 5177 modified the signature to use a weak one. Only signatures using 5178 acceptably strong hash algorithms should be accepted as valid. 5180 * If you are building an authentication system, the recipient may 5181 specify a preferred signing algorithm. However, the signer would 5182 be foolish to use a weak algorithm simply because the recipient 5183 requests it. 5185 * In late summer 2002, Jallad, Katz, and Schneier published an 5186 interesting attack on the OpenPGP protocol and some of its 5187 implementations [JKS02]. In this attack, the attacker modifies a 5188 message and sends it to a user who then returns the erroneously 5189 decrypted message to the attacker. The attacker is thus using the 5190 user as a random oracle, and can often decrypt the message. 5192 Compressing data can ameliorate this attack. The incorrectly 5193 decrypted data nearly always decompresses in ways that defeat the 5194 attack. However, this is not a rigorous fix, and leaves open some 5195 small vulnerabilities. For example, if an implementation does not 5196 compress a message before encryption (perhaps because it knows it 5197 was already compressed), then that message is vulnerable. Because 5198 of this happenstance -- that modification attacks can be thwarted 5199 by decompression errors -- an implementation SHOULD treat a 5200 decompression error as a security problem, not merely a data 5201 problem. 5203 This attack can be defeated by the use of modification detection, 5204 provided that the implementation does not let the user naively 5205 return the data to the attacker. The modification detection is 5206 prefereabble implemented by using the OCB Encrypted Data Packet 5207 and only if the recipients don't supports this by use of the 5208 Symmmetric Encrypted and Integrity Protected Data Packet. An 5209 implementation MUST treat an authentication or MDC failure as a 5210 security problem, not merely a data problem. 5212 In either case, the implementation SHOULD NOT allow the user 5213 access to the erroneous data, and MUST warn the user as to 5214 potential security problems should that data be returned to the 5215 sender. 5217 While this attack is somewhat obscure, requiring a special set of 5218 circumstances to create it, it is nonetheless quite serious as it 5219 permits someone to trick a user to decrypt a message. 5220 Consequently, it is important that: 5222 1. Implementers treat authentication errors, MDC errors, 5223 decompression failures or no use of MDC or AEAD as security 5224 problems. 5226 2. Implementers implement OCB with all due speed and encourage 5227 its spread. 5229 3. Users migrate to implementations that support OCB encryption 5230 with all due speed. 5232 * PKCS#1 has been found to be vulnerable to attacks in which a 5233 system that reports errors in padding differently from errors in 5234 decryption becomes a random oracle that can leak the private key 5235 in mere millions of queries. Implementations must be aware of 5236 this attack and prevent it from happening. The simplest solution 5237 is to report a single error code for all variants of decryption 5238 errors so as not to leak information to an attacker. 5240 * Some technologies mentioned here may be subject to government 5241 control in some countries. 5243 * In winter 2005, Serge Mister and Robert Zuccherato from Entrust 5244 released a paper describing a way that the "quick check" in 5245 OpenPGP CFB mode can be used with a random oracle to decrypt two 5246 octets of every cipher block [MZ05]. They recommend as prevention 5247 not using the quick check at all. 5249 Many implementers have taken this advice to heart for any data 5250 that is symmetrically encrypted and for which the session key is 5251 public-key encrypted. In this case, the quick check is not needed 5252 as the public-key encryption of the session key should guarantee 5253 that it is the right session key. In other cases, the 5254 implementation should use the quick check with care. 5256 On the one hand, there is a danger to using it if there is a 5257 random oracle that can leak information to an attacker. In 5258 plainer language, there is a danger to using the quick check if 5259 timing information about the check can be exposed to an attacker, 5260 particularly via an automated service that allows rapidly repeated 5261 queries. 5263 On the other hand, it is inconvenient to the user to be informed 5264 that they typed in the wrong passphrase only after a petabyte of 5265 data is decrypted. There are many cases in cryptographic 5266 engineering where the implementer must use care and wisdom, and 5267 this is one. 5269 * Refer to [FIPS186], B.4.1, for the method to generate a uniformly 5270 distributed ECC private key. 5272 * This document explicitly discourages the use of algorithms other 5273 than AES as a KEK algorithm because backward compatibility of the 5274 ECDH format is not a concern. The KEK algorithm is only used 5275 within the scope of a Public-Key Encrypted Session Key Packet, 5276 which represents an ECDH key recipient of a message. Compare this 5277 with the algorithm used for the session key of the message, which 5278 MAY be different from a KEK algorithm. 5280 Compliant applications SHOULD implement, advertise through key 5281 preferences, and use the strongest algorithms specified in this 5282 document. 5284 Note that the symmetric algorithm preference list may make it 5285 impossible to use the balanced strength of symmetric key 5286 algorithms for a corresponding public key. For example, the 5287 presence of the symmetric key algorithm IDs and their order in the 5288 key preference list affects the algorithm choices available to the 5289 encoding side, which in turn may make the adherence to the table 5290 above infeasible. Therefore, compliance with this specification 5291 is a concern throughout the life of the key, starting immediately 5292 after the key generation when the key preferences are first added 5293 to a key. It is generally advisable to position a symmetric 5294 algorithm ID of strength matching the public key at the head of 5295 the key preference list. 5297 Encryption to multiple recipients often results in an unordered 5298 intersection subset. For example, if the first recipient's set is 5299 {A, B} and the second's is {B, A}, the intersection is an 5300 unordered set of two algorithms, A and B. In this case, a 5301 compliant application SHOULD choose the stronger encryption 5302 algorithm. 5304 Resource constraints, such as limited computational power, is a 5305 likely reason why an application might prefer to use the weakest 5306 algorithm. On the other side of the spectrum are applications 5307 that can implement every algorithm defined in this document. Most 5308 applications are expected to fall into either of two categories. 5309 A compliant application in the second, or strongest, category 5310 SHOULD prefer AES-256 to AES-192. 5312 SHA-1 MUST NOT be used with the ECDSA or the KDF in the ECDH 5313 method. 5315 MDC MUST be used when a symmetric encryption key is protected by 5316 ECDH. None of the ECC methods described in this document are 5317 allowed with deprecated V3 keys. A compliant application MUST 5318 only use iterated and salted S2K to protect private keys, as 5319 defined in Section 3.7.1.3, "Iterated and Salted S2K". 5321 Side channel attacks are a concern when a compliant application's 5322 use of the OpenPGP format can be modeled by a decryption or 5323 signing oracle model, for example, when an application is a 5324 network service performing decryption to unauthenticated remote 5325 users. ECC scalar multiplication operations used in ECDSA and 5326 ECDH are vulnerable to side channel attacks. Countermeasures can 5327 often be taken at the higher protocol level, such as limiting the 5328 number of allowed failures or time-blinding of the operations 5329 associated with each network interface. Mitigations at the scalar 5330 multiplication level seek to eliminate any measurable distinction 5331 between the ECC point addition and doubling operations. 5333 * Although technically possible, the EdDSA algorithm MUST NOT be 5334 used with a digest algorithms weaker than SHA2-256. 5336 OpenPGP was designed with security in mind, with many smart, 5337 intelligent people spending a lot of time thinking about the 5338 ramifications of their decisions. Removing the requirement for self- 5339 certifying User ID (and User Attribute) packets on a key means that 5340 someone could surreptitiously add an unwanted ID to a key and sign 5341 it. If enough "trusted" people sign that surreptitious identity then 5342 other people might believe it. The attack could wind up sending 5343 encrypted mail destined for alice to some other target, bob, because 5344 someone added "alice" to bob's key without bob's consent. 5346 In the case of device certificates the device itself does not have 5347 any consent. It is given an identity by the device manufacturer and 5348 the manufacturer can insert that ID on the device certificate, 5349 signing it with the manufacturer's key. If another people wants to 5350 label the device by another name, they can do so. There is no harm 5351 in multiple IDs, because the verification is all done based on who 5352 has signed those IDs. 5354 When a key can self-sign, it is still suggested to self-certify IDs, 5355 even if it no longer required by this modification to OpenPGP. This 5356 at least signals to recipients of keys that yes, the owner of this 5357 key asserts that this identity belongs to herself. Note, however, 5358 that mallet could still assert that he is 'alice' and could even 5359 self-certify that. So the attack is not truly different. Moreover, 5360 in the case of device certificates, it's more the manufacturer than 5361 the device that wants to assert an identity (even if the device could 5362 self-certify). 5364 There is no signaling whether a key is using this looser-requirement 5365 key format. An attacker could therefore just remove the self- 5366 signature off a published key. However one would hope that wide 5367 publication would result in another copy still having that signature 5368 and it being returned quickly. However, the lack of signaling also 5369 means that a user with an application following RFC 4880 directly 5370 would see a key following this specification as "broken" and may not 5371 accept it. 5373 On a different note, including the "geo" notation could leak 5374 information about where a signer is located. However it is just an 5375 assertion (albeit a signed assertion) so there is no verifiable truth 5376 to the location information released. Similarly, all the rest of the 5377 signature notations are pure assertions, so they should be taken with 5378 the trustworthiness of the signer. 5380 Combining the User ID with the User Attribute means that an ID and 5381 image would not be separable. For a person this is probably not 5382 good, but for a device it's unlikely the image will change so it 5383 makes sense to combine the ID and image into a single signed packet 5384 with a single signature. 5386 16. Compatibility Profiles 5388 16.1. OpenPGP ECC Profile 5390 A compliant application MUST implement NIST curve P-256, SHOULD 5391 implement NIST curve P-521, SHOULD implement brainpoolP256r1 and 5392 brainpoolP512r1, SHOULD implement Ed25519, SHOULD implement 5393 Curve25519, MAY implement NIST curve P-384, and MAY implement 5394 brainpoolP384r1, as defined in Section 9.2. 5396 A compliant application MUST implement SHA2-256 and SHOULD implement 5397 SHA2-384 and SHA2-512. A compliant application MUST implement 5398 AES-128 and SHOULD implement AES-256. 5400 A compliant application SHOULD follow Section 15 regarding the choice 5401 of the following algorithms for each curve: 5403 * the KDF hash algorithm, 5405 * the KEK algorithm, 5406 * the message digest algorithm and the hash algorithm used in the 5407 key certifications, 5409 * the symmetric algorithm used for message encryption. 5411 It is recommended that the chosen symmetric algorithm for message 5412 encryption be no less secure than the KEK algorithm. 5414 17. Implementation Nits 5416 This section is a collection of comments to help an implementer, 5417 particularly with an eye to backward compatibility. Previous 5418 implementations of PGP are not OpenPGP compliant. Often the 5419 differences are small, but small differences are frequently more 5420 vexing than large differences. Thus, this is a non-comprehensive 5421 list of potential problems and gotchas for a developer who is trying 5422 to be backward-compatible. 5424 * When exporting a private key, PGP 2 generates the header "BEGIN 5425 PGP SECRET KEY BLOCK" instead of "BEGIN PGP PRIVATE KEY BLOCK". 5426 All previous versions ignore the implied data type, and look 5427 directly at the packet data type. 5429 * PGP versions 2.0 through 2.5 generated V2 Public-Key packets. 5430 These are identical to the deprecated V3 keys except for the 5431 version number. An implementation MUST NOT generate them and may 5432 accept or reject them as it sees fit. Some older PGP versions 5433 generated V2 PKESK packets (Tag 1) as well. An implementation may 5434 accept or reject V2 PKESK packets as it sees fit, and MUST NOT 5435 generate them. 5437 * PGP version 2.6 will not accept key-material packets with versions 5438 greater than 3. 5440 * There are many ways possible for two keys to have the same key 5441 material, but different fingerprints (and thus Key IDs). Perhaps 5442 the most interesting is an RSA key that has been "upgraded" to V4 5443 format, but since a V4 fingerprint is constructed by hashing the 5444 key creation time along with other things, two V4 keys created at 5445 different times, yet with the same key material will have 5446 different fingerprints. 5448 * If an implementation is using zlib to interoperate with PGP 2, 5449 then the "windowBits" parameter should be set to -13. 5451 * The 0x19 back signatures were not required for signing subkeys 5452 until relatively recently. Consequently, there may be keys in the 5453 wild that do not have these back signatures. Implementing 5454 software may handle these keys as it sees fit. 5456 * OpenPGP does not put limits on the size of public keys. However, 5457 larger keys are not necessarily better keys. Larger keys take 5458 more computation time to use, and this can quickly become 5459 impractical. Different OpenPGP implementations may also use 5460 different upper bounds for public key sizes, and so care should be 5461 taken when choosing sizes to maintain interoperability. As of 5462 2007 most implementations have an upper bound of 4096 bits for 5463 RSA, DSA, and Elgamal 5465 * ASCII armor is an optional feature of OpenPGP. The OpenPGP 5466 working group strives for a minimal set of mandatory-to-implement 5467 features, and since there could be useful implementations that 5468 only use binary object formats, this is not a "MUST" feature for 5469 an implementation. For example, an implementation that is using 5470 OpenPGP as a mechanism for file signatures may find ASCII armor 5471 unnecessary. OpenPGP permits an implementation to declare what 5472 features it does and does not support, but ASCII armor is not one 5473 of these. Since most implementations allow binary and armored 5474 objects to be used indiscriminately, an implementation that does 5475 not implement ASCII armor may find itself with compatibility 5476 issues with general-purpose implementations. Moreover, 5477 implementations of OpenPGP-MIME [RFC3156] already have a 5478 requirement for ASCII armor so those implementations will 5479 necessarily have support. 5481 18. References 5483 18.1. Normative References 5485 [AES] NIST, "FIPS PUB 197, Advanced Encryption Standard (AES)", 5486 November 2001, 5487 . 5490 [BLOWFISH] Schneier, B., "Description of a New Variable-Length Key, 5491 64-Bit Block Cipher (Blowfish)", Fast Software Encryption, 5492 Cambridge Security Workshop Proceedings Springer-Verlag, 5493 1994, pp191-204, December 1993, 5494 . 5496 [BZ2] Seward, J., "The Bzip2 and libbzip2 home page", 2010, 5497 . 5499 [EAX] Bellare, M., Rogaway, P., and D. Wagner, "A Conventional 5500 Authenticated-Encryption Mode", April 2003. 5502 [ELGAMAL] Elgamal, T., "A Public-Key Cryptosystem and a Signature 5503 Scheme Based on Discrete Logarithms", IEEE Transactions on 5504 Information Theory v. IT-31, n. 4, 1985, pp. 469-472, 5505 1985. 5507 [FIPS180] National Institute of Standards and Technology, U.S. 5508 Department of Commerce, "Secure Hash Standard (SHS), FIPS 5509 180-4", August 2015, 5510 . 5512 [FIPS186] National Institute of Standards and Technology, U.S. 5513 Department of Commerce, "Digital Signature Standard (DSS), 5514 FIPS 186-4", July 2013, 5515 . 5517 [FIPS202] National Institute of Standards and Technology, U.S. 5518 Department of Commerce, "SHA-3 Standard: Permutation-Based 5519 Hash and Extendable-Output Functions, FIPS 202", August 5520 2015, . 5522 [HAC] Menezes, A.J., Oorschot, P.v., and S. Vanstone, "Handbook 5523 of Applied Cryptography", 1996. 5525 [IDEA] Lai, X., "On the design and security of block ciphers", 5526 ETH Series in Information Processing, J.L. Massey 5527 (editor) Vol. 1, Hartung-Gorre Verlag Konstanz, Technische 5528 Hochschule (Zurich), 1992. 5530 [ISO10646] International Organization for Standardization, 5531 "Information Technology - Universal Multiple-octet coded 5532 Character Set (UCS) - Part 1: Architecture and Basic 5533 Multilingual Plane", ISO Standard 10646-1, May 1993. 5535 [JFIF] CA, E.H.M., "JPEG File Interchange Format (Version 5536 1.02).", September 1996. 5538 [PKCS5] RSA Laboratories, "PKCS #5 v2.0: Password-Based 5539 Cryptography Standard", 25 March 1999. 5541 [RFC1950] Deutsch, P. and J. Gailly, "ZLIB Compressed Data Format 5542 Specification version 3.3", RFC 1950, 5543 DOI 10.17487/RFC1950, May 1996, 5544 . 5546 [RFC1951] Deutsch, P., "DEFLATE Compressed Data Format Specification 5547 version 1.3", RFC 1951, DOI 10.17487/RFC1951, May 1996, 5548 . 5550 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 5551 Extensions (MIME) Part One: Format of Internet Message 5552 Bodies", RFC 2045, DOI 10.17487/RFC2045, November 1996, 5553 . 5555 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 5556 Requirement Levels", BCP 14, RFC 2119, 5557 DOI 10.17487/RFC2119, March 1997, 5558 . 5560 [RFC2144] Adams, C., "The CAST-128 Encryption Algorithm", RFC 2144, 5561 DOI 10.17487/RFC2144, May 1997, 5562 . 5564 [RFC2822] Resnick, P., Ed., "Internet Message Format", RFC 2822, 5565 DOI 10.17487/RFC2822, April 2001, 5566 . 5568 [RFC3156] Elkins, M., Del Torto, D., Levien, R., and T. Roessler, 5569 "MIME Security with OpenPGP", RFC 3156, 5570 DOI 10.17487/RFC3156, August 2001, 5571 . 5573 [RFC3394] Schaad, J. and R. Housley, "Advanced Encryption Standard 5574 (AES) Key Wrap Algorithm", RFC 3394, DOI 10.17487/RFC3394, 5575 September 2002, . 5577 [RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography 5578 Standards (PKCS) #1: RSA Cryptography Specifications 5579 Version 2.1", RFC 3447, DOI 10.17487/RFC3447, February 5580 2003, . 5582 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 5583 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 5584 2003, . 5586 [RFC3713] Matsui, M., Nakajima, J., and S. Moriai, "A Description of 5587 the Camellia Encryption Algorithm", RFC 3713, 5588 DOI 10.17487/RFC3713, April 2004, 5589 . 5591 [RFC4086] Eastlake 3rd, D., Schiller, J., and S. Crocker, 5592 "Randomness Requirements for Security", BCP 106, RFC 4086, 5593 DOI 10.17487/RFC4086, June 2005, 5594 . 5596 [RFC5639] Lochter, M. and J. Merkle, "Elliptic Curve Cryptography 5597 (ECC) Brainpool Standard Curves and Curve Generation", 5598 RFC 5639, DOI 10.17487/RFC5639, March 2010, 5599 . 5601 [RFC5870] Mayrhofer, A. and C. Spanring, "A Uniform Resource 5602 Identifier for Geographic Locations ('geo' URI)", 5603 RFC 5870, DOI 10.17487/RFC5870, June 2010, 5604 . 5606 [RFC7253] Krovetz, T. and P. Rogaway, "The OCB Authenticated- 5607 Encryption Algorithm", RFC 7253, DOI 10.17487/RFC7253, May 5608 2014, . 5610 [RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves 5611 for Security", RFC 7748, DOI 10.17487/RFC7748, January 5612 2016, . 5614 [RFC8032] Josefsson, S. and I. Liusvaara, "Edwards-Curve Digital 5615 Signature Algorithm (EdDSA)", RFC 8032, 5616 DOI 10.17487/RFC8032, January 2017, 5617 . 5619 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 5620 Writing an IANA Considerations Section in RFCs", BCP 26, 5621 RFC 8126, DOI 10.17487/RFC8126, June 2017, 5622 . 5624 [SCHNEIER] Schneier, B., "Applied Cryptography Second Edition: 5625 protocols, algorithms, and source code in C", 1996. 5627 [SP800-56A] 5628 Barker, E., Johnson, D., and M. Smid, "Recommendation for 5629 Pair-Wise Key Establishment Schemes Using Discrete 5630 Logarithm Cryptography", NIST Special Publication 800-56A 5631 Revision 1, March 2007. 5633 [TWOFISH] Schneier, B., Kelsey, J., Whiting, D., Wagner, D., Hall, 5634 C., and N. Ferguson, "The Twofish Encryption Algorithm", 5635 1999. 5637 18.2. Informative References 5639 [BLEICHENBACHER] 5640 Bleichenbacher, D., "Generating ElGamal Signatures Without 5641 Knowing the Secret Key", Lecture Notes in Computer 5642 Science Volume 1070, pp. 10-18, 1996. 5644 [JKS02] Jallad, K., Katz, J., and B. Schneier, "Implementation of 5645 Chosen-Ciphertext Attacks against PGP and GnuPG", 2002, 5646 . 5648 [KOBLITZ] Koblitz, N., "A course in number theory and cryptography, 5649 Chapter VI. Elliptic Curves", ISBN 0-387-96576-9, 1997. 5651 [MZ05] Mister, S. and R. Zuccherato, "An Attack on CFB Mode 5652 Encryption As Used By OpenPGP", IACR ePrint Archive Report 5653 2005/033, 8 February 2005, 5654 . 5656 [REGEX] Friedl, J., "Mastering Regular Expressions", 5657 ISBN 0-596-00289-0, August 2002. 5659 [RFC1991] Atkins, D., Stallings, W., and P. Zimmermann, "PGP Message 5660 Exchange Formats", RFC 1991, DOI 10.17487/RFC1991, August 5661 1996, . 5663 [RFC2440] Callas, J., Donnerhacke, L., Finney, H., and R. Thayer, 5664 "OpenPGP Message Format", RFC 2440, DOI 10.17487/RFC2440, 5665 November 1998, . 5667 [RFC4880] Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R. 5668 Thayer, "OpenPGP Message Format", RFC 4880, 5669 DOI 10.17487/RFC4880, November 2007, 5670 . 5672 [RFC6090] McGrew, D., Igoe, K., and M. Salter, "Fundamental Elliptic 5673 Curve Cryptography Algorithms", RFC 6090, 5674 DOI 10.17487/RFC6090, February 2011, 5675 . 5677 [SEC1] Standards for Efficient Cryptography Group, "SEC 1: 5678 Elliptic Curve Cryptography", September 2000. 5680 Appendix A. Test vectors 5682 To help implementing this specification a non-normative example for 5683 the EdDSA algorithm is given. 5685 A.1. Sample EdDSA key 5687 The secret key used for this example is: 5689 D: 1a8b1ff05ded48e18bf50166c664ab023ea70003d78d9e41f5758a91d850f8d2 5691 Note that this is the raw secret key used as input to the EdDSA 5692 signing operation. The key was created on 2014-08-19 14:28:27 and 5693 thus the fingerprint of the OpenPGP key is: 5695 C959 BDBA FA32 A2F8 9A15 3B67 8CFD E121 9796 5A9A 5697 The algorithm specific input parameters without the MPI length 5698 headers are: 5700 oid: 2b06010401da470f01 5702 q: 403f098994bdd916ed4053197934e4a87c80733a1280d62f8010992e43ee3b2406 5704 The entire public key packet is thus: 5706 98 33 04 53 f3 5f 0b 16 09 2b 06 01 04 01 da 47 5707 0f 01 01 07 40 3f 09 89 94 bd d9 16 ed 40 53 19 5708 79 34 e4 a8 7c 80 73 3a 12 80 d6 2f 80 10 99 2e 5709 43 ee 3b 24 06 5711 A.2. Sample EdDSA signature 5713 The signature is created using the sample key over the input data 5714 "OpenPGP" on 2015-09-16 12:24:53 and thus the input to the hash 5715 function is: 5717 m: 4f70656e504750040016080006050255f95f9504ff0000000c 5719 Using the SHA2-256 hash algorithm yields the digest: 5721 d: f6220a3f757814f4c2176ffbb68b00249cd4ccdc059c4b34ad871f30b1740280 5723 Which is fed into the EdDSA signature function and yields this 5724 signature: 5726 r: 56f90cca98e2102637bd983fdb16c131dfd27ed82bf4dde5606e0d756aed3366 5728 s: d09c4fa11527f038e0f57f2201d82f2ea2c9033265fa6ceb489e854bae61b404 5730 The entire signature packet is thus: 5732 88 5e 04 00 16 08 00 06 05 02 55 f9 5f 95 00 0a 5733 09 10 8c fd e1 21 97 96 5a 9a f6 22 01 00 56 f9 5734 0c ca 98 e2 10 26 37 bd 98 3f db 16 c1 31 df d2 5735 7e d8 2b f4 dd e5 60 6e 0d 75 6a ed 33 66 01 00 5736 d0 9c 4f a1 15 27 f0 38 e0 f5 7f 22 01 d8 2f 2e 5737 a2 c9 03 32 65 fa 6c eb 48 9e 85 4b ae 61 b4 04 5739 A.3. Sample OCB encryption and decryption 5741 Encryption is performed with the string 'Hello, world!',LF and 5742 password 'password', using AES-128 with OCB encryption. 5744 A.3.1. Sample Parameters 5746 S2K: 5748 type 3 5750 Iterations: 5752 524288 (144), SHA2-256 5754 Salt: 5756 9f0b7da3e5ea6477 5758 A.3.2. Sample symmetric-key encrypted session key packet (v5) 5760 Packet header: 5762 c3 3d 5764 Version, algorithms, S2K fields: 5766 05 07 02 03 08 9f 0b 7d a3 e5 ea 64 77 90 5768 OCB IV: 5770 99 e3 26 e5 40 0a 90 93 6c ef b4 e8 eb a0 8c 5772 OCB encrypted CEK: 5774 67 73 71 6d 1f 27 14 54 0a 38 fc ac 52 99 49 da 5776 Authentication tag: 5778 c5 29 d3 de 31 e1 5b 4a eb 72 9e 33 00 33 db ed 5780 A.3.3. Starting OCB decryption of CEK 5782 The derived key is: 5784 eb 9d a7 8a 9d 5d f8 0e c7 02 05 96 39 9b 65 08 5786 Authenticated Data: 5788 c3 05 07 02 5790 Nonce: 5792 99 e3 26 e5 40 0a 90 93 6c ef b4 e8 eb a0 8c 5794 Decrypted CEK: 5796 d1 f0 1b a3 0e 13 0a a7 d2 58 2c 16 e0 50 ae 44 5798 A.3.4. Sample OCB Encrypted Data packet 5800 Packet header: 5802 d4 49 5804 Version, AES-128, OCB, Chunk bits (14): 5806 01 07 02 0e 5808 IV: 5810 5e d2 bc 1e 47 0a be 8f 1d 64 4c 7a 6c 8a 56 5812 OCB Encrypted data chunk #0: 5814 7b 0f 77 01 19 66 11 a1 54 ba 9c 25 74 cd 05 62 5815 84 a8 ef 68 03 5c 5817 Chunk #0 authentication tag: 5819 62 3d 93 cc 70 8a 43 21 1b b6 ea f2 b2 7f 7c 18 5821 Final (zero-size chunk #1) authentication tag: 5823 d5 71 bc d8 3b 20 ad d3 a0 8b 73 af 15 b9 a0 98 5825 A.3.5. Decryption of data 5827 Starting OCB decryption of data, using the CEK. 5829 Chunk #0: 5831 Authenticated data: 5833 d4 01 07 02 0e 00 00 00 00 00 00 00 00 5835 Nonce: 5837 5e d2 bc 1e 47 0a be 8f 1d 64 4c 7a 6c 8a 56 5839 Decrypted chunk #0. 5841 Literal data packet with the string contents 'Hello, world!\n'. 5843 cb 14 62 00 00 00 00 00 48 65 6c 6c 6f 2c 20 77 5844 6f 72 6c 64 21 0a 5846 Authenticating final tag: 5848 Authenticated data: 5850 d4 01 07 02 0e 00 00 00 00 00 00 00 01 00 00 00 5851 00 00 00 00 16 5853 Nonce: 5855 5e d2 bc 1e 47 0a be 8f 1d 64 4c 7a 6c 8a 57 5857 A.3.6. Complete OCB encrypted packet sequence 5859 Symmetric-key encrypted session key packet (v5): 5861 c3 3d 05 07 02 03 08 9f 0b 7d a3 e5 ea 64 77 90 5862 99 e3 26 e5 40 0a 90 93 6c ef b4 e8 eb a0 8c 67 5863 73 71 6d 1f 27 14 54 0a 38 fc ac 52 99 49 da c5 5864 29 d3 de 31 e1 5b 4a eb 72 9e 33 00 33 db ed 5866 OCB Encrypted Data packet: 5868 d4 49 01 07 02 0e 5e d2 bc 1e 47 0a be 8f 1d 64 5869 4c 7a 6c 8a 56 7b 0f 77 01 19 66 11 a1 54 ba 9c 5870 25 74 cd 05 62 84 a8 ef 68 03 5c 62 3d 93 cc 70 5871 8a 43 21 1b b6 ea f2 b2 7f 7c 18 d5 71 bc d8 3b 5872 20 ad d3 a0 8b 73 af 15 b9 a0 98 5874 Appendix B. ECC Point compression flag bytes 5876 This specification introduces the new flag byte 0x40 to indicate the 5877 point compression format. The value has been chosen so that the high 5878 bit is not cleared and thus to avoid accidental sign extension. Two 5879 other values might also be interesting for other ECC specifications: 5881 Flag Description 5882 ---- ----------- 5883 0x04 Standard flag for uncompressed format 5884 0x40 Native point format of the curve follows 5885 0x41 Only X coordinate follows. 5886 0x42 Only Y coordinate follows. 5888 Appendix C. Changes since RFC-4880 5890 * Applied errata 2270, 2271, 2242, 3298. 5892 * Added Camellia cipher from RFC 5581. 5894 * Incorporated RFC 6637 (ECC for OpenPGP) 5896 * Added draft-atkins-openpgp-device-certificates 5898 * Added draft-koch-eddsa-for-openpgp-04 5900 * Added Issuer Fingerprint signature subpacket. 5902 * Added a v5 key and fingerprint format. 5904 * Added OIDs for brainpool curves and Curve25519. 5906 * Marked SHA2-256 as MUST implement. 5908 * Marked Curve25519 and Ed25519 as SHOULD implement. 5910 * Marked SHA-1 as SHOULD NOT be used to create messages. 5912 * Marked MD5 as SHOULD NOT implement. 5914 * Changed v5 key fingerprint format to full 32 octets. 5916 * Added Literal Data Packet format octet m. 5918 * Added Feature Flag for v5 key support. 5920 * Added OCB Encrypted Data Packet. 5922 * Removed notes on extending the MDC packet. 5924 * Added v5 Symmetric-Key Encrypted Session Key packet. 5926 * Added OCB encryption of secret keys. 5928 * Added test vectors for OCB. 5930 * Added the Restricted Encryption key flag. 5932 * Deprecated the Symmetrically Encrypted Data Packet. 5934 * Suggest limitation of the OCB chunksize to 128 MiB. 5936 * Specified the V5 signature format. 5938 * Deprectated the creation of V3 signatures. 5940 * Adapted terms from RFC 8126. 5942 * Removed editorial marks and updated cross-references. 5944 * Added the timestamping usage key flag. 5946 * Added Intended Recipient signature subpacket. 5948 * Added Attested Certifications signature subpacket and signature 5949 class. 5951 * Added Key Block signature subpacket. 5953 * Added Literal Data Meta Hash subpacket. 5955 Changes since draft-koch-openpgp-2015-rfc4880bis-01: 5957 * Changed Secret-Key Packet Format for OCB mode to include the 5958 entire public key has additional data. 5960 * Added Trust Alias subpacket. 5962 * Added alternative OIDs for Ed25519 and Curve25519. 5964 Appendix D. The principal authors of RFC-4880 5965 Jon Callas 5966 EMail: jon@callas.org 5968 Lutz Donnerhacke 5969 EMail: lutz@iks-jena.de 5971 Hal Finney 5973 David Shaw 5974 EMail: dshaw@jabberwocky.com 5976 Rodney Thayer 5977 EMail: rodney@canola-jones.com 5979 Authors' Addresses 5981 Werner Koch 5982 GnuPG e.V. 5983 Rochusstr. 44 5984 40479 Duesseldorf 5985 Germany 5986 Email: wk@gnupg.org 5987 URI: https://gnupg.org/verein 5989 brian m. carlson 5990 Email: sandals@crustytoothpaste.net 5992 Ronald Henry Tse 5993 Ribose 5994 Suite 1111, 1 Pedder Street 5995 Central, Hong Kong 5996 Hong Kong 5997 Email: ronald.tse@ribose.com 5998 URI: https://www.ribose.com 6000 Derek Atkins 6001 Email: derek@ihtfp.com 6003 Daniel Kahn Gillmor 6004 Email: dkg@fifthhorseman.net