idnits 2.17.1 draft-ietf-openpgp-rfc2440bis-22.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3978, Section 5.1 on line 22. -- Found old boilerplate from RFC 3978, Section 5.5, updated by RFC 4748 on line 4203. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 4231. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 4238. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 4244. 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 6 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 RFC2440, but the abstract doesn't seem to mention this, which it should. -- The draft header indicates that this document obsoletes RFC1991, but the abstract doesn't seem to mention this, which it should. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust Copyright Line does not match the current year -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (Apr 2007) is 6213 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 398 -- Looks like a reference, but probably isn't: '1' on line 3708 -- Looks like a reference, but probably isn't: '2' on line 398 -- Looks like a reference, but probably isn't: '3' on line 3717 == Missing Reference: 'Optional' is mentioned on line 2025, but not defined == Missing Reference: 'RFC 1951' is mentioned on line 2945, but not defined == Missing Reference: 'RFC 1950' is mentioned on line 2946, but not defined == Missing Reference: 'Binding-Signature-Revocation' is mentioned on line 3316, but not defined == Missing Reference: 'BS' is mentioned on line 3708, but not defined == Unused Reference: 'RFC2119' is defined on line 4108, but no explicit reference was found in the text == Unused Reference: 'RFC2144' is defined on line 4114, but no explicit reference was found in the text == Unused Reference: 'RFC2822' is defined on line 4120, but no explicit reference was found in the text == Unused Reference: 'RFC3156' is defined on line 4122, but no explicit reference was found in the text == Unused Reference: 'RFC4086' is defined on line 4133, but no explicit reference was found in the text == Unused Reference: 'MAURER' is defined on line 4159, but no explicit reference was found in the text == Unused Reference: 'RFC1423' is defined on line 4170, but no explicit reference was found in the text == Unused Reference: 'RFC1951' is defined on line 4174, but no explicit reference was found in the text -- 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. 'ELGAMAL' -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS180' -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS186' -- 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' ** Obsolete normative reference: RFC 1991 (Obsoleted by RFC 4880) ** Downref: Normative reference to an Informational RFC: RFC 2144 ** Obsolete normative reference: RFC 2434 (Obsoleted by RFC 5226) ** Obsolete normative reference: RFC 2822 (Obsoleted by RFC 5322) ** Obsolete normative reference: RFC 3447 (Obsoleted by RFC 8017) -- Possible downref: Non-RFC (?) normative reference: ref. 'SCHNEIER' -- Possible downref: Non-RFC (?) normative reference: ref. 'TWOFISH' -- Obsolete informational reference (is this intentional?): RFC 2440 (Obsoleted by RFC 4880) Summary: 6 errors (**), 0 flaws (~~), 15 warnings (==), 27 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 Network Working Group Jon Callas 2 Internet-Draft PGP Corporation 3 Intended status: Standards Track 4 Expires October 2007 Lutz Donnerhacke 5 Apr 2007 7 Obsoletes: 1991, 2440 Hal Finney 8 PGP Corporation 10 David Shaw 12 Rodney Thayer 14 OpenPGP Message Format 15 draft-ietf-openpgp-rfc2440bis-22 17 Status of this Memo 19 By submitting this Internet-Draft, each author represents that any 20 applicable patent or other IPR claims of which he or she is aware 21 have been or will be disclosed, and any of which he or she becomes 22 aware will be disclosed, in accordance with Section 6 of BCP 79. 24 Internet-Drafts are working documents of the Internet Engineering 25 Task Force (IETF), its areas, and its working groups. Note that 26 other groups may also distribute working documents as 27 Internet-Drafts. 29 Internet-Drafts are draft documents valid for a maximum of six 30 months and may be updated, replaced, or obsoleted by other documents 31 at any time. It is inappropriate to use Internet-Drafts as reference 32 material or to cite them other than as "work in progress." 34 The list of current Internet-Drafts can be accessed at 35 http://www.ietf.org/1id-abstracts.html 37 The list of Internet-Draft Shadow Directories can be accessed at 38 http://www.ietf.org/shadow.html 40 Copyright Notice 42 Copyright (C) The IETF Trust (2007). 44 Abstract 46 This document is maintained in order to publish all necessary 47 information needed to develop interoperable applications based on 48 the OpenPGP format. It is not a step-by-step cookbook for writing an 49 application. It describes only the format and methods needed to 50 read, check, generate, and write conforming packets crossing any 51 network. It does not deal with storage and implementation questions. 52 It does, however, discuss implementation issues necessary to avoid 53 security flaws. 55 OpenPGP software uses a combination of strong public-key and 56 symmetric cryptography to provide security services for electronic 57 communications and data storage. These services include 58 confidentiality, key management, authentication, and digital 59 signatures. This document specifies the message formats used in 60 OpenPGP. 62 Table of Contents 64 Status of this Memo 1 65 Copyright Notice 1 66 Abstract 1 67 Table of Contents 3 68 1. Introduction 7 69 1.1. Terms 7 70 2. General functions 7 71 2.1. Confidentiality via Encryption 8 72 2.2. Authentication via Digital signature 9 73 2.3. Compression 9 74 2.4. Conversion to Radix-64 9 75 2.5. Signature-Only Applications 10 76 3. Data Element Formats 10 77 3.1. Scalar numbers 10 78 3.2. Multiprecision Integers 10 79 3.3. Key IDs 11 80 3.4. Text 11 81 3.5. Time fields 11 82 3.6. Keyrings 11 83 3.7. String-to-key (S2K) specifiers 11 84 3.7.1. String-to-key (S2K) specifier types 11 85 3.7.1.1. Simple S2K 12 86 3.7.1.2. Salted S2K 12 87 3.7.1.3. Iterated and Salted S2K 12 88 3.7.2. String-to-key usage 13 89 3.7.2.1. Secret key encryption 13 90 3.7.2.2. Symmetric-key message encryption 14 91 4. Packet Syntax 14 92 4.1. Overview 14 93 4.2. Packet Headers 14 94 4.2.1. Old-Format Packet Lengths 15 95 4.2.2. New-Format Packet Lengths 15 96 4.2.2.1. One-Octet Lengths 16 97 4.2.2.2. Two-Octet Lengths 16 98 4.2.2.3. Five-Octet Lengths 16 99 4.2.2.4. Partial Body Lengths 16 100 4.2.3. Packet Length Examples 17 101 4.3. Packet Tags 17 102 5. Packet Types 18 103 5.1. Public-Key Encrypted Session Key Packets (Tag 1) 18 104 5.2. Signature Packet (Tag 2) 19 105 5.2.1. Signature Types 20 106 5.2.2. Version 3 Signature Packet Format 22 107 5.2.3. Version 4 Signature Packet Format 24 108 5.2.3.1. Signature Subpacket Specification 25 109 5.2.3.2. Signature Subpacket Types 27 110 5.2.3.3. Notes on Self-Signatures 27 111 5.2.3.4. Signature creation time 28 112 5.2.3.5. Issuer 28 113 5.2.3.6. Key expiration time 28 114 5.2.3.7. Preferred symmetric algorithms 28 115 5.2.3.8. Preferred hash algorithms 29 116 5.2.3.9. Preferred compression algorithms 29 117 5.2.3.10.Signature expiration time 29 118 5.2.3.11.Exportable Certification 29 119 5.2.3.12.Revocable 30 120 5.2.3.13.Trust signature 30 121 5.2.3.14.Regular expression 30 122 5.2.3.15.Revocation key 31 123 5.2.3.16.Notation Data 31 124 5.2.3.17.Key server preferences 32 125 5.2.3.18.Preferred key server 32 126 5.2.3.19.Primary User ID 32 127 5.2.3.20.Policy URI 33 128 5.2.3.21.Key Flags 33 129 5.2.3.22.Signer's User ID 34 130 5.2.3.23.Reason for Revocation 34 131 5.2.3.24.Features 35 132 5.2.3.25.Signature Target 35 133 5.2.3.26.Embedded Signature 36 134 5.2.4. Computing Signatures 36 135 5.2.4.1. Subpacket Hints 37 136 5.3. Symmetric-Key Encrypted Session Key Packets (Tag 3) 37 137 5.4. One-Pass Signature Packets (Tag 4) 38 138 5.5. Key Material Packet 39 139 5.5.1. Key Packet Variants 39 140 5.5.1.1. Public Key Packet (Tag 6) 39 141 5.5.1.2. Public Subkey Packet (Tag 14) 39 142 5.5.1.3. Secret Key Packet (Tag 5) 39 143 5.5.1.4. Secret Subkey Packet (Tag 7) 40 144 5.5.2. Public Key Packet Formats 40 145 5.5.3. Secret Key Packet Formats 41 146 5.6. Compressed Data Packet (Tag 8) 43 147 5.7. Symmetrically Encrypted Data Packet (Tag 9) 44 148 5.8. Marker Packet (Obsolete Literal Packet) (Tag 10) 44 149 5.9. Literal Data Packet (Tag 11) 45 150 5.10. Trust Packet (Tag 12) 46 151 5.11. User ID Packet (Tag 13) 46 152 5.12. User Attribute Packet (Tag 17) 46 153 5.12.1. The Image Attribute Subpacket 47 154 5.13. Sym. Encrypted Integrity Protected Data Packet (Tag 18) 47 155 5.14. Modification Detection Code Packet (Tag 19) 50 156 6. Radix-64 Conversions 51 157 6.1. An Implementation of the CRC-24 in "C" 51 158 6.2. Forming ASCII Armor 52 159 6.3. Encoding Binary in Radix-64 54 160 6.4. Decoding Radix-64 55 161 6.5. Examples of Radix-64 56 162 6.6. Example of an ASCII Armored Message 56 163 7. Cleartext signature framework 56 164 7.1. Dash-Escaped Text 57 165 8. Regular Expressions 58 166 9. Constants 58 167 9.1. Public Key Algorithms 59 168 9.2. Symmetric Key Algorithms 59 169 9.3. Compression Algorithms 60 170 9.4. Hash Algorithms 60 171 10. IANA Considerations 60 172 10.1. New String-to-Key specifier types 60 173 10.2. New Packets 61 174 10.2.1. User Attribute Types 61 175 10.2.1.1.Image Format Subpacket Types 61 176 10.2.2. New Signature Subpackets 61 177 10.2.2.1.Signature Notation Data Subpackets 61 178 10.2.2.2.Key Server Preference Extensions 62 179 10.2.2.3.Key Flags Extensions 62 180 10.2.2.4.Reason For Revocation Extensions 62 181 10.2.2.5.Implementation Features 62 182 10.2.3. New Packet Versions 62 183 10.3. New Algorithms 63 184 10.3.1. Public Key Algorithms 63 185 10.3.2. Symmetric Key Algorithms 63 186 10.3.3. Hash Algorithms 63 187 10.3.4. Compression Algorithms 64 188 11. Packet Composition 64 189 11.1. Transferable Public Keys 64 190 11.2. Transferable Secret Keys 65 191 11.3. OpenPGP Messages 65 192 11.4. Detached Signatures 66 193 12. Enhanced Key Formats 66 194 12.1. Key Structures 66 195 12.2. Key IDs and Fingerprints 67 196 13. Notes on Algorithms 68 197 13.1. PKCS#1 Encoding In OpenPGP 68 198 13.1.1. EME-PKCS1-v1_5-ENCODE 69 199 13.1.2. EME-PKCS1-v1_5-DECODE 69 200 13.1.3. EMSA-PKCS1-v1_5 70 201 13.2. Symmetric Algorithm Preferences 71 202 13.3. Other Algorithm Preferences 71 203 13.3.1. Compression Preferences 71 204 13.3.2. Hash Algorithm Preferences 72 205 13.4. Plaintext 72 206 13.5. RSA 72 207 13.6. DSA 73 208 13.7. Elgamal 73 209 13.8. Reserved Algorithm Numbers 73 210 13.9. OpenPGP CFB mode 74 211 13.10. Private or Experimental Parameters 75 212 13.11. Extension of the MDC System 75 213 13.12. Meta-Considerations for Expansion 76 214 14. Security Considerations 76 215 15. Implementation Nits 79 216 16. Authors' Addresses 80 217 17. References (Normative) 81 218 18. References (Informative) 83 219 19. Full Copyright Statement 84 220 20. Intellectual Property 84 222 1. Introduction 224 This document provides information on the message-exchange packet 225 formats used by OpenPGP to provide encryption, decryption, signing, 226 and key management functions. It is a revision of RFC 2440, "OpenPGP 227 Message Format", which itself replaces RFC 1991, "PGP Message 228 Exchange Formats." [RFC1991] [RFC2440] 230 1.1. Terms 232 * OpenPGP - This is a definition for security software that uses 233 PGP 5.x as a basis, formalized in RFC 2440 and this document. 235 * PGP - Pretty Good Privacy. PGP is a family of software systems 236 developed by Philip R. Zimmermann from which OpenPGP is based. 238 * PGP 2.6.x - This version of PGP has many variants, hence the 239 term PGP 2.6.x. It used only RSA, MD5, and IDEA for its 240 cryptographic transforms. An informational RFC, RFC 1991, was 241 written describing this version of PGP. 243 * PGP 5.x - This version of PGP is formerly known as "PGP 3" in 244 the community and also in the predecessor of this document, RFC 245 1991. It has new formats and corrects a number of problems in 246 the PGP 2.6.x design. It is referred to here as PGP 5.x because 247 that software was the first release of the "PGP 3" code base. 249 * GnuPG - GNU Privacy Guard, also called GPG. GnuPG is an OpenPGP 250 implementation that avoids all encumbered algorithms. 251 Consequently, early versions of GnuPG did not include RSA public 252 keys. GnuPG may or may not have (depending on version) support 253 for IDEA or other encumbered algorithms. 255 "PGP", "Pretty Good", and "Pretty Good Privacy" are trademarks of 256 PGP Corporation and are used with permission. The term "OpenPGP" 257 refers to the protocol described in this and related documents. 259 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 260 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 261 document are to be interpreted as described in RFC 2119. 263 The key words "PRIVATE USE", "HIERARCHICAL ALLOCATION", "FIRST COME 264 FIRST SERVED", "EXPERT REVIEW", "SPECIFICATION REQUIRED", "IESG 265 APPROVAL", "IETF CONSENSUS", and "STANDARDS ACTION" that appear in 266 this document when used to describe namespace allocation are to be 267 interpreted as described in RFC 2434. 269 2. General functions 271 OpenPGP provides data integrity services for messages and data files 272 by using these core technologies: 274 - digital signatures 276 - encryption 278 - compression 280 - radix-64 conversion 282 In addition, OpenPGP provides key management and certificate 283 services, but many of these are beyond the scope of this document. 285 2.1. Confidentiality via Encryption 287 OpenPGP combines symmetric-key encryption and public key encryption 288 to provide confidentiality. When made confidential, first the object 289 is encrypted using a symmetric encryption algorithm. Each symmetric 290 key is used only once, for a single object. A new "session key" is 291 generated as a random number for each object (sometimes referred to 292 as a session). Since it is used only once, the session key is bound 293 to the message and transmitted with it. To protect the key, it is 294 encrypted with the receiver's public key. The sequence is as 295 follows: 297 1. The sender creates a message. 299 2. The sending OpenPGP generates a random number to be used as a 300 session key for this message only. 302 3. The session key is encrypted using each recipient's public key. 303 These "encrypted session keys" start the message. 305 4. The sending OpenPGP encrypts the message using the session key, 306 which forms the remainder of the message. Note that the message 307 is also usually compressed. 309 5. The receiving OpenPGP decrypts the session key using the 310 recipient's private key. 312 6. The receiving OpenPGP decrypts the message using the session 313 key. If the message was compressed, it will be decompressed. 315 With symmetric-key encryption, an object may be encrypted with a 316 symmetric key derived from a passphrase (or other shared secret), or 317 a two-stage mechanism similar to the public-key method described 318 above in which a session key is itself encrypted with a symmetric 319 algorithm keyed from a shared secret. 321 Both digital signature and confidentiality services may be applied 322 to the same message. First, a signature is generated for the message 323 and attached to the message. Then, the message plus signature is 324 encrypted using a symmetric session key. Finally, the session key is 325 encrypted using public-key encryption and prefixed to the encrypted 326 block. 328 2.2. Authentication via Digital signature 330 The digital signature uses a hash code or message digest algorithm, 331 and a public-key signature algorithm. The sequence is as follows: 333 1. The sender creates a message. 335 2. The sending software generates a hash code of the message. 337 3. The sending software generates a signature from the hash code 338 using the sender's private key. 340 4. The binary signature is attached to the message. 342 5. The receiving software keeps a copy of the message signature. 344 6. The receiving software generates a new hash code for the 345 received message and verifies it using the message's signature. 346 If the verification is successful, the message is accepted as 347 authentic. 349 2.3. Compression 351 OpenPGP implementations SHOULD compress the message after applying 352 the signature but before encryption. 354 If an implementation does not implement compression, its authors 355 should be aware that most OpenPGP messages in the world are 356 compressed. Thus, it may even be wise for a space-constrained 357 implementation to implement decompression, but not compression. 359 Furthermore, compression has the added side-effect that some types 360 of attacks can be thwarted by the fact that slightly altered, 361 compressed data rarely uncompresses without severe errors. This is 362 hardly rigorous, but it is operationally useful. These attacks can 363 be rigorously prevented by implementing and using Modification 364 Detection Codes as described in sections following. 366 2.4. Conversion to Radix-64 368 OpenPGP's underlying native representation for encrypted messages, 369 signature certificates, and keys is a stream of arbitrary octets. 370 Some systems only permit the use of blocks consisting of seven-bit, 371 printable text. For transporting OpenPGP's native raw binary octets 372 through channels that are not safe to raw binary data, a printable 373 encoding of these binary octets is needed. OpenPGP provides the 374 service of converting the raw 8-bit binary octet stream to a stream 375 of printable ASCII characters, called Radix-64 encoding or ASCII 376 Armor. 378 Implementations SHOULD provide Radix-64 conversions. 380 2.5. Signature-Only Applications 382 OpenPGP is designed for applications that use both encryption and 383 signatures, but there are a number of problems that are solved by a 384 signature-only implementation. Although this specification requires 385 both encryption and signatures, it is reasonable for there to be 386 subset implementations that are non-conformant only in that they 387 omit encryption. 389 3. Data Element Formats 391 This section describes the data elements used by OpenPGP. 393 3.1. Scalar numbers 395 Scalar numbers are unsigned, and are always stored in big-endian 396 format. Using n[k] to refer to the kth octet being interpreted, the 397 value of a two-octet scalar is ((n[0] << 8) + n[1]). The value of a 398 four-octet scalar is ((n[0] << 24) + (n[1] << 16) + (n[2] << 8) + 399 n[3]). 401 3.2. Multiprecision Integers 403 Multiprecision Integers (also called MPIs) are unsigned integers 404 used to hold large integers such as the ones used in cryptographic 405 calculations. 407 An MPI consists of two pieces: a two-octet scalar that is the length 408 of the MPI in bits followed by a string of octets that contain the 409 actual integer. 411 These octets form a big-endian number; a big-endian number can be 412 made into an MPI by prefixing it with the appropriate length. 414 Examples: 416 (all numbers are in hexadecimal) 418 The string of octets [00 01 01] forms an MPI with the value 1. The 419 string [00 09 01 FF] forms an MPI with the value of 511. 421 Additional rules: 423 The size of an MPI is ((MPI.length + 7) / 8) + 2 octets. 425 The length field of an MPI describes the length starting from its 426 most significant non-zero bit. Thus, the MPI [00 02 01] is not 427 formed correctly. It should be [00 01 01]. 429 Unused bits of an MPI MUST be zero. 431 Also note that when an MPI is encrypted, the length refers to the 432 plaintext MPI. It may be ill-formed in its ciphertext. 434 3.3. Key IDs 436 A Key ID is an eight-octet scalar that identifies a key. 437 Implementations SHOULD NOT assume that Key IDs are unique. The 438 section, "Enhanced Key Formats" below describes how Key IDs are 439 formed. 441 3.4. Text 443 Unless otherwise specified, the character set for text is the UTF-8 444 [RFC3629] encoding of Unicode [ISO10646]. 446 3.5. Time fields 448 A time field is an unsigned four-octet number containing the number 449 of seconds elapsed since midnight, 1 January 1970 UTC. 451 3.6. Keyrings 453 A keyring is a collection of one or more keys in a file or database. 454 Traditionally, a keyring is simply a sequential list of keys, but 455 may be any suitable database. It is beyond the scope of this 456 standard to discuss the details of keyrings or other databases. 458 3.7. String-to-key (S2K) specifiers 460 String-to-key (S2K) specifiers are used to convert passphrase 461 strings into symmetric-key encryption/decryption keys. They are used 462 in two places, currently: to encrypt the secret part of private keys 463 in the private keyring, and to convert passphrases to encryption 464 keys for symmetrically encrypted messages. 466 3.7.1. String-to-key (S2K) specifier types 468 There are three types of S2K specifiers currently supported, and 469 some reserved values: 471 ID S2K Type 472 -- --- ---- 473 0 Simple S2K 474 1 Salted S2K 475 2 Reserved value 476 3 Iterated and Salted S2K 477 100 to 110 Private/Experimental S2K 479 These are described as follows: 481 3.7.1.1. Simple S2K 483 This directly hashes the string to produce the key data. See below 484 for how this hashing is done. 486 Octet 0: 0x00 487 Octet 1: hash algorithm 489 Simple S2K hashes the passphrase to produce the session key. The 490 manner in which this is done depends on the size of the session key 491 (which will depend on the cipher used) and the size of the hash 492 algorithm's output. If the hash size is greater than the session key 493 size, the high-order (leftmost) octets of the hash are used as the 494 key. 496 If the hash size is less than the key size, multiple instances of 497 the hash context are created -- enough to produce the required key 498 data. These instances are preloaded with 0, 1, 2, ... octets of 499 zeros (that is to say, the first instance has no preloading, the 500 second gets preloaded with 1 octet of zero, the third is preloaded 501 with two octets of zeros, and so forth). 503 As the data is hashed, it is given independently to each hash 504 context. Since the contexts have been initialized differently, they 505 will each produce different hash output. Once the passphrase is 506 hashed, the output data from the multiple hashes is concatenated, 507 first hash leftmost, to produce the key data, with any excess octets 508 on the right discarded. 510 3.7.1.2. Salted S2K 512 This includes a "salt" value in the S2K specifier -- some arbitrary 513 data -- that gets hashed along with the passphrase string, to help 514 prevent dictionary attacks. 516 Octet 0: 0x01 517 Octet 1: hash algorithm 518 Octets 2-9: 8-octet salt value 520 Salted S2K is exactly like Simple S2K, except that the input to the 521 hash function(s) consists of the 8 octets of salt from the S2K 522 specifier, followed by the passphrase. 524 3.7.1.3. Iterated and Salted S2K 526 This includes both a salt and an octet count. The salt is combined 527 with the passphrase and the resulting value is hashed repeatedly. 528 This further increases the amount of work an attacker must do to try 529 dictionary attacks. 531 Octet 0: 0x03 532 Octet 1: hash algorithm 533 Octets 2-9: 8-octet salt value 534 Octet 10: count, a one-octet, coded value 536 The count is coded into a one-octet number using the following 537 formula: 539 #define EXPBIAS 6 540 count = ((Int32)16 + (c & 15)) << ((c >> 4) + EXPBIAS); 542 The above formula is in C, where "Int32" is a type for a 32-bit 543 integer, and the variable "c" is the coded count, Octet 10. 545 Iterated-Salted S2K hashes the passphrase and salt data multiple 546 times. The total number of octets to be hashed is specified in the 547 encoded count in the S2K specifier. Note that the resulting count 548 value is an octet count of how many octets will be hashed, not an 549 iteration count. 551 Initially, one or more hash contexts are set up as with the other 552 S2K algorithms, depending on how many octets of key data are needed. 553 Then the salt, followed by the passphrase data is repeatedly hashed 554 until the number of octets specified by the octet count has been 555 hashed. The one exception is that if the octet count is less than 556 the size of the salt plus passphrase, the full salt plus passphrase 557 will be hashed even though that is greater than the octet count. 558 After the hashing is done the data is unloaded from the hash 559 context(s) as with the other S2K algorithms. 561 3.7.2. String-to-key usage 563 Implementations SHOULD use salted or iterated-and-salted S2K 564 specifiers, as simple S2K specifiers are more vulnerable to 565 dictionary attacks. 567 3.7.2.1. Secret key encryption 569 An S2K specifier can be stored in the secret keyring to specify how 570 to convert the passphrase to a key that unlocks the secret data. 571 Older versions of PGP just stored a cipher algorithm octet preceding 572 the secret data or a zero to indicate that the secret data was 573 unencrypted. The MD5 hash function was always used to convert the 574 passphrase to a key for the specified cipher algorithm. 576 For compatibility, when an S2K specifier is used, the special value 577 254 or 255 is stored in the position where the hash algorithm octet 578 would have been in the old data structure. This is then followed 579 immediately by a one-octet algorithm identifier, and then by the S2K 580 specifier as encoded above. 582 Therefore, preceding the secret data there will be one of these 583 possibilities: 585 0: secret data is unencrypted (no passphrase) 586 255 or 254: followed by algorithm octet and S2K specifier 587 Cipher alg: use Simple S2K algorithm using MD5 hash 589 This last possibility, the cipher algorithm number with an implicit 590 use of MD5 and IDEA, is provided for backward compatibility; it MAY 591 be understood, but SHOULD NOT be generated, and is deprecated. 593 These are followed by an Initial Vector of the same length as the 594 block size of the cipher for the decryption of the secret values, if 595 they are encrypted, and then the secret key values themselves. 597 3.7.2.2. Symmetric-key message encryption 599 OpenPGP can create a Symmetric-key Encrypted Session Key (ESK) 600 packet at the front of a message. This is used to allow S2K 601 specifiers to be used for the passphrase conversion or to create 602 messages with a mix of symmetric-key ESKs and public-key ESKs. This 603 allows a message to be decrypted either with a passphrase or a 604 public key pair. 606 PGP 2.X always used IDEA with Simple string-to-key conversion when 607 encrypting a message with a symmetric algorithm. This is deprecated, 608 but MAY be used for backward-compatibility. 610 4. Packet Syntax 612 This section describes the packets used by OpenPGP. 614 4.1. Overview 616 An OpenPGP message is constructed from a number of records that are 617 traditionally called packets. A packet is a chunk of data that has a 618 tag specifying its meaning. An OpenPGP message, keyring, 619 certificate, and so forth consists of a number of packets. Some of 620 those packets may contain other OpenPGP packets (for example, a 621 compressed data packet, when uncompressed, contains OpenPGP 622 packets). 624 Each packet consists of a packet header, followed by the packet 625 body. The packet header is of variable length. 627 4.2. Packet Headers 629 The first octet of the packet header is called the "Packet Tag." It 630 determines the format of the header and denotes the packet contents. 631 The remainder of the packet header is the length of the packet. 633 Note that the most significant bit is the left-most bit, called bit 634 7. A mask for this bit is 0x80 in hexadecimal. 636 +---------------+ 637 PTag |7 6 5 4 3 2 1 0| 638 +---------------+ 639 Bit 7 -- Always one 640 Bit 6 -- New packet format if set 642 PGP 2.6.x only uses old format packets. Thus, software that 643 interoperates with those versions of PGP must only use old format 644 packets. If interoperability is not an issue, the new packet format 645 is RECOMMENDED. Note that old format packets have four bits of 646 packet tags, and new format packets have six; some features cannot 647 be used and still be backward-compatible. 649 Also note that packets with a tag greater than or equal to 16 MUST 650 use new format packets. The old format packets can only express tags 651 less than or equal to 15. 653 Old format packets contain: 655 Bits 5-2 -- packet tag 656 Bits 1-0 - length-type 658 New format packets contain: 660 Bits 5-0 -- packet tag 662 4.2.1. Old-Format Packet Lengths 664 The meaning of the length-type in old-format packets is: 666 0 - The packet has a one-octet length. The header is 2 octets long. 668 1 - The packet has a two-octet length. The header is 3 octets long. 670 2 - The packet has a four-octet length. The header is 5 octets long. 672 3 - The packet is of indeterminate length. The header is 1 octet 673 long, and the implementation must determine how long the packet 674 is. If the packet is in a file, this means that the packet 675 extends until the end of the file. In general, an implementation 676 SHOULD NOT use indeterminate length packets except where the end 677 of the data will be clear from the context, and even then it is 678 better to use a definite length, or a new-format header. The 679 new-format headers described below have a mechanism for 680 precisely encoding data of indeterminate length. 682 4.2.2. New-Format Packet Lengths 684 New format packets have four possible ways of encoding length: 686 1. A one-octet Body Length header encodes packet lengths of up to 687 191 octets. 689 2. A two-octet Body Length header encodes packet lengths of 192 to 690 8383 octets. 692 3. A five-octet Body Length header encodes packet lengths of up to 693 4,294,967,295 (0xFFFFFFFF) octets in length. (This actually 694 encodes a four-octet scalar number.) 696 4. When the length of the packet body is not known in advance by 697 the issuer, Partial Body Length headers encode a packet of 698 indeterminate length, effectively making it a stream. 700 4.2.2.1. One-Octet Lengths 702 A one-octet Body Length header encodes a length of from 0 to 191 703 octets. This type of length header is recognized because the one 704 octet value is less than 192. The body length is equal to: 706 bodyLen = 1st_octet; 708 4.2.2.2. Two-Octet Lengths 710 A two-octet Body Length header encodes a length of from 192 to 8383 711 octets. It is recognized because its first octet is in the range 192 712 to 223. The body length is equal to: 714 bodyLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192 716 4.2.2.3. Five-Octet Lengths 718 A five-octet Body Length header consists of a single octet holding 719 the value 255, followed by a four-octet scalar. The body length is 720 equal to: 722 bodyLen = (2nd_octet << 24) | (3rd_octet << 16) | 723 (4th_octet << 8) | 5th_octet 725 This basic set of one, two, and five-octet lengths is also used 726 internally to some packets. 728 4.2.2.4. Partial Body Lengths 730 A Partial Body Length header is one octet long and encodes the 731 length of only part of the data packet. This length is a power of 2, 732 from 1 to 1,073,741,824 (2 to the 30th power). It is recognized by 733 its one octet value that is greater than or equal to 224, and less 734 than 255. The partial body length is equal to: 736 partialBodyLen = 1 << (1st_octet & 0x1f); 738 Each Partial Body Length header is followed by a portion of the 739 packet body data. The Partial Body Length header specifies this 740 portion's length. Another length header (one octet, two-octet, 741 five-octet, or partial) follows that portion. The last length header 742 in the packet MUST NOT be a partial Body Length header. Partial Body 743 Length headers may only be used for the non-final parts of the 744 packet. 746 Note also that the last Body Length header can be a zero-length 747 header. 749 An implementation MAY use Partial Body Lengths for data packets, be 750 they literal, compressed, or encrypted. The first partial length 751 MUST be at least 512 octets long. Partial Body Lengths MUST NOT be 752 used for any other packet types. 754 4.2.3. Packet Length Examples 756 These examples show ways that new-format packets might encode the 757 packet lengths. 759 A packet with length 100 may have its length encoded in one octet: 760 0x64. This is followed by 100 octets of data. 762 A packet with length 1723 may have its length coded in two octets: 763 0xC5, 0xFB. This header is followed by the 1723 octets of data. 765 A packet with length 100000 may have its length encoded in five 766 octets: 0xFF, 0x00, 0x01, 0x86, 0xA0. 768 It might also be encoded in the following octet stream: 0xEF, first 769 32768 octets of data; 0xE1, next two octets of data; 0xE0, next one 770 octet of data; 0xF0, next 65536 octets of data; 0xC5, 0xDD, last 771 1693 octets of data. This is just one possible encoding, and many 772 variations are possible on the size of the Partial Body Length 773 headers, as long as a regular Body Length header encodes the last 774 portion of the data. 776 Please note that in all of these explanations, the total length of 777 the packet is the length of the header(s) plus the length of the 778 body. 780 4.3. Packet Tags 782 The packet tag denotes what type of packet the body holds. Note that 783 old format headers can only have tags less than 16, whereas new 784 format headers can have tags as great as 63. The defined tags (in 785 decimal) are: 787 0 -- Reserved - a packet tag MUST NOT have this value 788 1 -- Public-Key Encrypted Session Key Packet 789 2 -- Signature Packet 790 3 -- Symmetric-Key Encrypted Session Key Packet 791 4 -- One-Pass Signature Packet 792 5 -- Secret Key Packet 793 6 -- Public Key Packet 794 7 -- Secret Subkey Packet 795 8 -- Compressed Data Packet 796 9 -- Symmetrically Encrypted Data Packet 797 10 -- Marker Packet 798 11 -- Literal Data Packet 799 12 -- Trust Packet 800 13 -- User ID Packet 801 14 -- Public Subkey Packet 802 17 -- User Attribute Packet 803 18 -- Sym. Encrypted and Integrity Protected Data Packet 804 19 -- Modification Detection Code Packet 805 60 to 63 -- Private or Experimental Values 807 5. Packet Types 809 5.1. Public-Key Encrypted Session Key Packets (Tag 1) 811 A Public-Key Encrypted Session Key packet holds the session key used 812 to encrypt a message. Zero or more Public-Key Encrypted Session Key 813 packets and/or Symmetric-Key Encrypted Session Key packets may 814 precede a Symmetrically Encrypted Data Packet, which holds an 815 encrypted message. The message is encrypted with the session key, 816 and the session key is itself encrypted and stored in the Encrypted 817 Session Key packet(s). The Symmetrically Encrypted Data Packet is 818 preceded by one Public-Key Encrypted Session Key packet for each 819 OpenPGP key to which the message is encrypted. The recipient of the 820 message finds a session key that is encrypted to their public key, 821 decrypts the session key, and then uses the session key to decrypt 822 the message. 824 The body of this packet consists of: 826 - A one-octet number giving the version number of the packet type. 827 The currently defined value for packet version is 3. 829 - An eight-octet number that gives the key ID of the public key 830 that the session key is encrypted to. If the session key is 831 encrypted to a subkey then the key ID of this subkey is used 832 here instead of the key ID of the primary key. 834 - A one-octet number giving the public key algorithm used. 836 - A string of octets that is the encrypted session key. This 837 string takes up the remainder of the packet, and its contents 838 are dependent on the public key algorithm used. 840 Algorithm Specific Fields for RSA encryption 842 - multiprecision integer (MPI) of RSA encrypted value m**e mod n. 844 Algorithm Specific Fields for Elgamal encryption: 846 - MPI of Elgamal (Diffie-Hellman) value g**k mod p. 848 - MPI of Elgamal (Diffie-Hellman) value m * y**k mod p. 850 The value "m" in the above formulas is derived from the session key 851 as follows. First the session key is prefixed with a one-octet 852 algorithm identifier that specifies the symmetric encryption 853 algorithm used to encrypt the following Symmetrically Encrypted Data 854 Packet. Then a two-octet checksum is appended which is equal to the 855 sum of the preceding session key octets, not including the algorithm 856 identifier, modulo 65536. This value is then encoded as described in 857 PKCS#1 block encoding EME-PKCS1-v1_5 in Section 12.1 of RFC 3447 to 858 form the "m" value used in the formulas above. See Section 13.1 of 859 this document for notes on OpenPGP's use of PKCS#1. 861 Note that when an implementation forms several PKESKs with one 862 session key, forming a message that can be decrypted by several 863 keys, the implementation MUST make a new PKCS#1 encoding for each 864 key. 866 An implementation MAY accept or use a Key ID of zero as a "wild 867 card" or "speculative" Key ID. In this case, the receiving 868 implementation would try all available private keys, checking for a 869 valid decrypted session key. This format helps reduce traffic 870 analysis of messages. 872 5.2. Signature Packet (Tag 2) 874 A signature packet describes a binding between some public key and 875 some data. The most common signatures are a signature of a file or a 876 block of text, and a signature that is a certification of a User ID. 878 Two versions of signature packets are defined. Version 3 provides 879 basic signature information, while version 4 provides an expandable 880 format with subpackets that can specify more information about the 881 signature. PGP 2.6.x only accepts version 3 signatures. 883 Implementations SHOULD accept V3 signatures. Implementations SHOULD 884 generate V4 signatures. 886 Note that if an implementation is creating an encrypted and signed 887 message that is encrypted to a V3 key, it is reasonable to create a 888 V3 signature. 890 5.2.1. Signature Types 892 There are a number of possible meanings for a signature, which are 893 indicated in a signature type octet in any given signature. Please 894 note that the vagueness of these meanings is not a flaw, but a 895 feature of the system. Because OpenPGP places final authority for 896 validity upon the receiver of a signature, it may be that one 897 signer's casual act might be more rigorous than some other 898 authority's positive act. See section 5.2.4, "Computing Signatures," 899 for detailed information on how to compute and verify signatures of 900 each type. 902 These meanings are: 904 0x00: Signature of a binary document. 905 This means the signer owns it, created it, or certifies that it 906 has not been modified. 908 0x01: Signature of a canonical text document. 909 This means the signer owns it, created it, or certifies that it 910 has not been modified. The signature is calculated over the text 911 data with its line endings converted to . 913 0x02: Standalone signature. 914 This signature is a signature of only its own subpacket 915 contents. It is calculated identically to a signature over a 916 zero-length binary document. Note that it doesn't make sense to 917 have a V3 standalone signature. 919 0x10: Generic certification of a User ID and Public Key packet. 920 The issuer of this certification does not make any particular 921 assertion as to how well the certifier has checked that the 922 owner of the key is in fact the person described by the User ID. 924 0x11: Persona certification of a User ID and Public Key packet. 925 The issuer of this certification has not done any verification 926 of the claim that the owner of this key is the User ID 927 specified. 929 0x12: Casual certification of a User ID and Public Key packet. 930 The issuer of this certification has done some casual 931 verification of the claim of identity. 933 0x13: Positive certification of a User ID and Public Key packet. 934 The issuer of this certification has done substantial 935 verification of the claim of identity. 937 Most OpenPGP implementations make their "key signatures" as 0x10 938 certifications. Some implementations can issue 0x11-0x13 939 certifications, but few differentiate between the types. 941 0x18: Subkey Binding Signature 942 This signature is a statement by the top-level signing key that 943 indicates that it owns the subkey. This signature is calculated 944 directly on the primary key and subkey, and not on any User ID 945 or other packets. A signature that binds a signing subkey MUST 946 have an embedded signature subpacket in this binding signature 947 which contains a 0x19 signature made by the signing subkey on 948 the primary key and subkey. 950 0x19 Primary Key Binding Signature 951 This signature is a statement by a signing subkey, indicating 952 that it is owned by the primary key and subkey. This signature 953 is calculated the same way as a 0x18 signature: directly on the 954 primary key and subkey, and not on any User ID or other packets. 956 0x1F: Signature directly on a key 957 This signature is calculated directly on a key. It binds the 958 information in the signature subpackets to the key, and is 959 appropriate to be used for subpackets that provide information 960 about the key, such as the revocation key subpacket. It is also 961 appropriate for statements that non-self certifiers want to make 962 about the key itself, rather than the binding between a key and 963 a name. 965 0x20: Key revocation signature 966 The signature is calculated directly on the key being revoked. A 967 revoked key is not to be used. Only revocation signatures by the 968 key being revoked, or by an authorized revocation key, should be 969 considered valid revocation signatures. 971 0x28: Subkey revocation signature 972 The signature is calculated directly on the subkey being 973 revoked. A revoked subkey is not to be used. Only revocation 974 signatures by the top-level signature key that is bound to this 975 subkey, or by an authorized revocation key, should be considered 976 valid revocation signatures. 978 0x30: Certification revocation signature 979 This signature revokes an earlier User ID certification 980 signature (signature class 0x10 through 0x13) or direct-key 981 signature (0x1F). It should be issued by the same key that 982 issued the revoked signature or an authorized revocation key. 983 The signature is computed over the same data as the certificate 984 that it revokes, and should have a later creation date than that 985 certificate. 987 0x40: Timestamp signature. 988 This signature is only meaningful for the timestamp contained in 989 it. 991 0x50: Third-Party Confirmation signature. 992 This signature is a signature over some other OpenPGP signature 993 packet(s). It is analogous to a notary seal on the signed data. 994 A third-party signature SHOULD include Signature Target 995 subpacket(s) to give easy identification. Note that we really do 996 mean SHOULD. There are plausible uses for this (such as a blind 997 party that only sees the signature, not the key nor source 998 document) that cannot include a target subpacket. 1000 5.2.2. Version 3 Signature Packet Format 1002 The body of a version 3 Signature Packet contains: 1004 - One-octet version number (3). 1006 - One-octet length of following hashed material. MUST be 5. 1008 - One-octet signature type. 1010 - Four-octet creation time. 1012 - Eight-octet key ID of signer. 1014 - One-octet public key algorithm. 1016 - One-octet hash algorithm. 1018 - Two-octet field holding left 16 bits of signed hash value. 1020 - One or more multiprecision integers comprising the signature. 1021 This portion is algorithm specific, as described below. 1023 The concatenation of the data to be signed, the signature type and 1024 creation time from the signature packet (5 additional octets) is 1025 hashed. The resulting hash value is used in the signature algorithm. 1026 The high 16 bits (first two octets) of the hash are included in the 1027 signature packet to provide a quick test to reject some invalid 1028 signatures. 1030 Algorithm Specific Fields for RSA signatures: 1032 - multiprecision integer (MPI) of RSA signature value m**d mod n. 1034 Algorithm Specific Fields for DSA signatures: 1036 - MPI of DSA value r. 1038 - MPI of DSA value s. 1040 The signature calculation is based on a hash of the signed data, as 1041 described above. The details of the calculation are different for 1042 DSA signatures than for RSA signatures. 1044 With RSA signatures, the hash value is encoded as described in 1045 PKCS#1 section 9.2.1 of RFC 3447 encoded using PKCS#1 encoding type 1046 EMSA-PKCS1-v1_5 as described in section 12.1 of RFC 3447. This 1047 requires inserting the hash value as an octet string into an ASN.1 1048 structure. The object identifier for the type of hash being used is 1049 included in the structure. The hexadecimal representations for the 1050 currently defined hash algorithms are: 1052 - MD5: 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05 1054 - RIPEMD-160: 0x2B, 0x24, 0x03, 0x02, 0x01 1056 - SHA-1: 0x2B, 0x0E, 0x03, 0x02, 0x1A 1058 - SHA224: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04 1060 - SHA256: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01 1062 - SHA384: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02 1064 - SHA512: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03 1066 The ASN.1 OIDs are: 1068 - MD5: 1.2.840.113549.2.5 1070 - RIPEMD-160: 1.3.36.3.2.1 1072 - SHA-1: 1.3.14.3.2.26 1074 - SHA224: 2.16.840.1.101.3.4.2.4 1076 - SHA256: 2.16.840.1.101.3.4.2.1 1078 - SHA384: 2.16.840.1.101.3.4.2.2 1080 - SHA512: 2.16.840.1.101.3.4.2.3 1082 The full hash prefixes for these are: 1084 MD5: 0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 1085 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00, 1086 0x04, 0x10 1088 RIPEMD-160: 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x24, 1089 0x03, 0x02, 0x01, 0x05, 0x00, 0x04, 0x14 1091 SHA-1: 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0E, 1092 0x03, 0x02, 0x1A, 0x05, 0x00, 0x04, 0x14 1094 SHA224: 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1095 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, 0x05, 1096 0x00, 0x04, 0x1C 1098 SHA256: 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1099 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 1100 0x00, 0x04, 0x20 1102 SHA384: 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1103 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 1104 0x00, 0x04, 0x30 1106 SHA512: 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1107 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 1108 0x00, 0x04, 0x40 1110 DSA signatures MUST use hashes that are equal in size to the number 1111 of bits of q, the group generated by the DSA key's generator value. 1112 If the output size of the chosen hash is larger than the number of 1113 bits of q, the hash result is truncated to fit by taking the number 1114 of leftmost bits equal to the number of bits of q. This (possibly 1115 truncated) hash function result is treated as a number and used 1116 directly in the DSA signature algorithm. 1118 5.2.3. Version 4 Signature Packet Format 1120 The body of a version 4 Signature Packet contains: 1122 - One-octet version number (4). 1124 - One-octet signature type. 1126 - One-octet public key algorithm. 1128 - One-octet hash algorithm. 1130 - Two-octet scalar octet count for following hashed subpacket 1131 data. Note that this is the length in octets of all of the 1132 hashed subpackets; a pointer incremented by this number will 1133 skip over the hashed subpackets. 1135 - Hashed subpacket data set. (zero or more subpackets) 1137 - Two-octet scalar octet count for the following unhashed 1138 subpacket data. Note that this is the length in octets of all of 1139 the unhashed subpackets; a pointer incremented by this number 1140 will skip over the unhashed subpackets. 1142 - Unhashed subpacket data set. (zero or more subpackets) 1143 - Two-octet field holding the left 16 bits of the signed hash 1144 value. 1146 - One or more multiprecision integers comprising the signature. 1147 This portion is algorithm specific, as described above. 1149 The concatenation of the data being signed and the signature data 1150 from the version number through the hashed subpacket data 1151 (inclusive) is hashed. The resulting hash value is what is signed. 1152 The left 16 bits of the hash are included in the signature packet to 1153 provide a quick test to reject some invalid signatures. 1155 There are two fields consisting of signature subpackets. The first 1156 field is hashed with the rest of the signature data, while the 1157 second is unhashed. The second set of subpackets is not 1158 cryptographically protected by the signature and should include only 1159 advisory information. 1161 The algorithms for converting the hash function result to a 1162 signature are described in a section below. 1164 5.2.3.1. Signature Subpacket Specification 1166 A subpacket data set consists of zero or more signature subpackets. 1167 In signature packets the subpacket data set is preceded by a 1168 two-octet scalar count of the length in octets of all the 1169 subpackets. A pointer incremented by this number will skip over the 1170 subpacket data set. 1172 Each subpacket consists of a subpacket header and a body. The header 1173 consists of: 1175 - the subpacket length (1, 2, or 5 octets) 1177 - the subpacket type (1 octet) 1179 and is followed by the subpacket specific data. 1181 The length includes the type octet but not this length. Its format 1182 is similar to the "new" format packet header lengths, but cannot 1183 have partial body lengths. That is: 1185 if the 1st octet < 192, then 1186 lengthOfLength = 1 1187 subpacketLen = 1st_octet 1189 if the 1st octet >= 192 and < 255, then 1190 lengthOfLength = 2 1191 subpacketLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192 1193 if the 1st octet = 255, then 1194 lengthOfLength = 5 1195 subpacket length = [four-octet scalar starting at 2nd_octet] 1197 The value of the subpacket type octet may be: 1199 0 = reserved 1200 1 = reserved 1201 2 = signature creation time 1202 3 = signature expiration time 1203 4 = exportable certification 1204 5 = trust signature 1205 6 = regular expression 1206 7 = revocable 1207 8 = reserved 1208 9 = key expiration time 1209 10 = placeholder for backward compatibility 1210 11 = preferred symmetric algorithms 1211 12 = revocation key 1212 13 = reserved 1213 14 = reserved 1214 15 = reserved 1215 16 = issuer key ID 1216 17 = reserved 1217 18 = reserved 1218 19 = reserved 1219 20 = notation data 1220 21 = preferred hash algorithms 1221 22 = preferred compression algorithms 1222 23 = key server preferences 1223 24 = preferred key server 1224 25 = primary User ID 1225 26 = policy URI 1226 27 = key flags 1227 28 = signer's User ID 1228 29 = reason for revocation 1229 30 = features 1230 31 = signature target 1231 32 = embedded signature 1233 100 to 110 = private or experimental 1235 An implementation SHOULD ignore any subpacket of a type that it does 1236 not recognize. 1238 Bit 7 of the subpacket type is the "critical" bit. If set, it 1239 denotes that the subpacket is one that is critical for the evaluator 1240 of the signature to recognize. If a subpacket is encountered that is 1241 marked critical but is unknown to the evaluating software, the 1242 evaluator SHOULD consider the signature to be in error. 1244 An evaluator may "recognize" a subpacket, but not implement it. The 1245 purpose of the critical bit is to allow the signer to tell an 1246 evaluator that it would prefer a new, unknown feature to generate an 1247 error than be ignored. 1249 Implementations SHOULD implement "preferences" and the "reason for 1250 revocation" subpackets. Note, however, that if an implementation 1251 chooses not to implement some of the preferences, it is required to 1252 behave in a polite manner to respect the wishes of those users who 1253 do implement these preferences. 1255 5.2.3.2. Signature Subpacket Types 1257 A number of subpackets are currently defined. Some subpackets apply 1258 to the signature itself and some are attributes of the key. 1259 Subpackets that are found on a self-signature are placed on a 1260 certification made by the key itself. Note that a key may have more 1261 than one User ID, and thus may have more than one self-signature, 1262 and differing subpackets. 1264 A subpacket may be found either in the hashed or unhashed subpacket 1265 sections of a signature. If a subpacket is not hashed, then the 1266 information in it cannot be considered definitive because it is not 1267 part of the signature proper. 1269 5.2.3.3. Notes on Self-Signatures 1271 A self-signature is a binding signature made by the key the 1272 signature refers to. There are three types of self-signatures, the 1273 certification signatures (types 0x10-0x13), the direct-key signature 1274 (type 0x1f), and the subkey binding signature (type 0x18). For 1275 certification self-signatures, each User ID may have a 1276 self-signature, and thus different subpackets in those 1277 self-signatures. For subkey binding signatures, each subkey in fact 1278 has a self-signature. Subpackets that appear in a certification 1279 self-signature apply to the username, and subpackets that appear in 1280 the subkey self-signature apply to the subkey. Lastly, subpackets on 1281 the direct-key signature apply to the entire key. 1283 Implementing software should interpret a self-signature's preference 1284 subpackets as narrowly as possible. For example, suppose a key has 1285 two usernames, Alice and Bob. Suppose that Alice prefers the 1286 symmetric algorithm CAST5, and Bob prefers IDEA or TripleDES. If the 1287 software locates this key via Alice's name, then the preferred 1288 algorithm is CAST5, if software locates the key via Bob's name, then 1289 the preferred algorithm is IDEA. If the key is located by key ID, 1290 the algorithm of the primary User ID of the key provides the 1291 preferred symmetric algorithm. 1293 Revoking a self-signature or allowing it to expire has a semantic 1294 meaning that varies with the signature type. Revoking the 1295 self-signature on a User ID effectively retires that user name. The 1296 self-signature is a statement, "My name X is tied to my signing key 1297 K" and is corroborated by other users' certifications. If another 1298 user revokes their certification, they are effectively saying that 1299 they no longer believe that name and that key are tied together. 1300 Similarly, if the user themselves revokes their self-signature, it 1301 means the user no longer goes by that name, no longer has that email 1302 address, etc. Revoking a binding signature effectively retires that 1303 subkey. Revoking a direct-key signature cancels that signature. 1304 Please see the "Reason for Revocation" subpacket below for more 1305 relevant detail. 1307 Since a self-signature contains important information about the 1308 key's use, an implementation SHOULD allow the user to rewrite the 1309 self-signature, and important information in it, such as preferences 1310 and key expiration. 1312 It is good practice to verify that a self-signature imported into an 1313 implementation doesn't advertise features that the implementation 1314 doesn't support, rewriting the signature as appropriate. 1316 An implementation that encounters multiple self-signatures on the 1317 same object may resolve the ambiguity in any way it sees fit, but it 1318 is RECOMMENDED that priority be given to the most recent 1319 self-signature. 1321 5.2.3.4. Signature creation time 1323 (4 octet time field) 1325 The time the signature was made. 1327 MUST be present in the hashed area. 1329 5.2.3.5. Issuer 1331 (8 octet key ID) 1333 The OpenPGP key ID of the key issuing the signature. 1335 5.2.3.6. Key expiration time 1337 (4 octet time field) 1339 The validity period of the key. This is the number of seconds after 1340 the key creation time that the key expires. If this is not present 1341 or has a value of zero, the key never expires. This is found only on 1342 a self-signature. 1344 5.2.3.7. Preferred symmetric algorithms 1346 (array of one-octet values) 1347 Symmetric algorithm numbers that indicate which algorithms the key 1348 holder prefers to use. The subpacket body is an ordered list of 1349 octets with the most preferred listed first. It is assumed that only 1350 algorithms listed are supported by the recipient's software. 1351 Algorithm numbers are in section 9. This is only found on a 1352 self-signature. 1354 5.2.3.8. Preferred hash algorithms 1356 (array of one-octet values) 1358 Message digest algorithm numbers that indicate which algorithms the 1359 key holder prefers to receive. Like the preferred symmetric 1360 algorithms, the list is ordered. Algorithm numbers are in section 9. 1361 This is only found on a self-signature. 1363 5.2.3.9. Preferred compression algorithms 1365 (array of one-octet values) 1367 Compression algorithm numbers that indicate which algorithms the key 1368 holder prefers to use. Like the preferred symmetric algorithms, the 1369 list is ordered. Algorithm numbers are in section 9. If this 1370 subpacket is not included, ZIP is preferred. A zero denotes that 1371 uncompressed data is preferred; the key holder's software might have 1372 no compression software in that implementation. This is only found 1373 on a self-signature. 1375 5.2.3.10. Signature expiration time 1377 (4 octet time field) 1379 The validity period of the signature. This is the number of seconds 1380 after the signature creation time that the signature expires. If 1381 this is not present or has a value of zero, it never expires. 1383 5.2.3.11. Exportable Certification 1385 (1 octet of exportability, 0 for not, 1 for exportable) 1387 This subpacket denotes whether a certification signature is 1388 "exportable," to be used by other users than the signature's issuer. 1389 The packet body contains a Boolean flag indicating whether the 1390 signature is exportable. If this packet is not present, the 1391 certification is exportable; it is equivalent to a flag containing a 1392 1. 1394 Non-exportable, or "local," certifications are signatures made by a 1395 user to mark a key as valid within that user's implementation only. 1396 Thus, when an implementation prepares a user's copy of a key for 1397 transport to another user (this is the process of "exporting" the 1398 key), any local certification signatures are deleted from the key. 1400 The receiver of a transported key "imports" it, and likewise trims 1401 any local certifications. In normal operation, there won't be any, 1402 assuming the import is performed on an exported key. However, there 1403 are instances where this can reasonably happen. For example, if an 1404 implementation allows keys to be imported from a key database in 1405 addition to an exported key, then this situation can arise. 1407 Some implementations do not represent the interest of a single user 1408 (for example, a key server). Such implementations always trim local 1409 certifications from any key they handle. 1411 5.2.3.12. Revocable 1413 (1 octet of revocability, 0 for not, 1 for revocable) 1415 Signature's revocability status. The packet body contains a Boolean 1416 flag indicating whether the signature is revocable. Signatures that 1417 are not revocable have any later revocation signatures ignored. They 1418 represent a commitment by the signer that he cannot revoke his 1419 signature for the life of his key. If this packet is not present, 1420 the signature is revocable. 1422 5.2.3.13. Trust signature 1424 (1 octet "level" (depth), 1 octet of trust amount) 1426 Signer asserts that the key is not only valid, but also trustworthy, 1427 at the specified level. Level 0 has the same meaning as an ordinary 1428 validity signature. Level 1 means that the signed key is asserted to 1429 be a valid trusted introducer, with the 2nd octet of the body 1430 specifying the degree of trust. Level 2 means that the signed key is 1431 asserted to be trusted to issue level 1 trust signatures, i.e. that 1432 it is a "meta introducer". Generally, a level n trust signature 1433 asserts that a key is trusted to issue level n-1 trust signatures. 1434 The trust amount is in a range from 0-255, interpreted such that 1435 values less than 120 indicate partial trust and values of 120 or 1436 greater indicate complete trust. Implementations SHOULD emit values 1437 of 60 for partial trust and 120 for complete trust. 1439 5.2.3.14. Regular expression 1441 (null-terminated regular expression) 1443 Used in conjunction with trust signature packets (of level > 0) to 1444 limit the scope of trust that is extended. Only signatures by the 1445 target key on User IDs that match the regular expression in the body 1446 of this packet have trust extended by the trust signature subpacket. 1447 The regular expression uses the same syntax as the Henry Spencer's 1448 "almost public domain" regular expression package. A description of 1449 the syntax is found in a section below. 1451 5.2.3.15. Revocation key 1453 (1 octet of class, 1 octet of PK algorithm ID, 20 octets of 1454 fingerprint) 1456 Authorizes the specified key to issue revocation signatures for this 1457 key. Class octet must have bit 0x80 set. If the bit 0x40 is set, 1458 then this means that the revocation information is sensitive. Other 1459 bits are for future expansion to other kinds of authorizations. This 1460 is found on a self-signature. 1462 If the "sensitive" flag is set, the keyholder feels this subpacket 1463 contains private trust information that describes a real-world 1464 sensitive relationship. If this flag is set, implementations SHOULD 1465 NOT export this signature to other users except in cases where the 1466 data needs to be available: when the signature is being sent to the 1467 designated revoker, or when it is accompanied by a revocation 1468 signature from that revoker. Note that it may be appropriate to 1469 isolate this subpacket within a separate signature so that it is not 1470 combined with other subpackets that need to be exported. 1472 5.2.3.16. Notation Data 1474 (4 octets of flags, 2 octets of name length (M), 1475 2 octets of value length (N), 1476 M octets of name data, 1477 N octets of value data) 1479 This subpacket describes a "notation" on the signature that the 1480 issuer wishes to make. The notation has a name and a value, each of 1481 which are strings of octets. There may be more than one notation in 1482 a signature. Notations can be used for any extension the issuer of 1483 the signature cares to make. The "flags" field holds four octets of 1484 flags. 1486 All undefined flags MUST be zero. Defined flags are: 1488 First octet: 0x80 = human-readable. This note value is text. 1489 Other octets: none. 1491 Notation names are arbitrary strings encoded in UTF-8. They reside 1492 two name spaces: The IETF name space and the user name space. 1494 The IETF name space is registered with IANA. These names MUST NOT 1495 contain the "@" character (0x40). This this is a tag for the user 1496 name space. 1498 Names in the user name space consist of a UTF-8 string tag followed 1499 by "@" followed by a DNS domain name. Note that the tag MUST NOT 1500 contain an "@" character. For example, the "sample" tag used by 1501 Example Corporation could be "sample@example.com". 1503 Names in a user space are owned and controlled by the owners of that 1504 domain. Obviously, it's of bad form to create a new name in a DNS 1505 space that you don't own. 1507 Since the user name space is in the form of an email address, 1508 implementers MAY wish to arrange for that address to reach a person 1509 who can be consulted about the use of the named tag. Note that due 1510 to UTF-8 encoding, not all valid user space name tags are valid 1511 email addresses. 1513 If there is a critical notation, the criticality applies to that 1514 specific notation and not to notations in general. 1516 5.2.3.17. Key server preferences 1518 (N octets of flags) 1520 This is a list of one-bit flags that indicate preferences that the 1521 key holder has about how the key is handled on a key server. All 1522 undefined flags MUST be zero. 1524 First octet: 0x80 = No-modify 1525 the key holder requests that this key only be modified or 1526 updated by the key holder or an administrator of the key server. 1528 This is found only on a self-signature. 1530 5.2.3.18. Preferred key server 1532 (String) 1534 This is a URI of a key server that the key holder prefers be used 1535 for updates. Note that keys with multiple User IDs can have a 1536 preferred key server for each User ID. Note also that since this is 1537 a URI, the key server can actually be a copy of the key retrieved by 1538 ftp, http, finger, etc. 1540 5.2.3.19. Primary User ID 1542 (1 octet, Boolean) 1544 This is a flag in a User ID's self signature that states whether 1545 this User ID is the main User ID for this key. It is reasonable for 1546 an implementation to resolve ambiguities in preferences, etc. by 1547 referring to the primary User ID. If this flag is absent, its value 1548 is zero. If more than one User ID in a key is marked as primary, the 1549 implementation may resolve the ambiguity in any way it sees fit, but 1550 it is RECOMMENDED that priority be given to the User ID with the 1551 most recent self-signature. 1553 When appearing on a self-signature on a User ID packet, this 1554 subpacket applies only to User ID packets. When appearing on a 1555 self-signature on a User Attribute packet, this subpacket applies 1556 only to User Attribute packets. That is to say, there are two 1557 different and independent "primaries" - one for User IDs, and one 1558 for User Attributes. 1560 5.2.3.20. Policy URI 1562 (String) 1564 This subpacket contains a URI of a document that describes the 1565 policy that the signature was issued under. 1567 5.2.3.21. Key Flags 1569 (N octets of flags) 1571 This subpacket contains a list of binary flags that hold information 1572 about a key. It is a string of octets, and an implementation MUST 1573 NOT assume a fixed size. This is so it can grow over time. If a list 1574 is shorter than an implementation expects, the unstated flags are 1575 considered to be zero. The defined flags are: 1577 First octet: 1579 0x01 - This key may be used to certify other keys. 1581 0x02 - This key may be used to sign data. 1583 0x04 - This key may be used to encrypt communications. 1585 0x08 - This key may be used to encrypt storage. 1587 0x10 - The private component of this key may have been split by 1588 a secret-sharing mechanism. 1590 0x20 - This key may be used for authentication. 1592 0x80 - The private component of this key may be in the 1593 possession of more than one person. 1595 Usage notes: 1597 The flags in this packet may appear in self-signatures or in 1598 certification signatures. They mean different things depending on 1599 who is making the statement -- for example, a certification 1600 signature that has the "sign data" flag is stating that the 1601 certification is for that use. On the other hand, the 1602 "communications encryption" flag in a self-signature is stating a 1603 preference that a given key be used for communications. Note 1604 however, that it is a thorny issue to determine what is 1605 "communications" and what is "storage." This decision is left wholly 1606 up to the implementation; the authors of this document do not claim 1607 any special wisdom on the issue, and realize that accepted opinion 1608 may change. 1610 The "split key" (0x10) and "group key" (0x80) flags are placed on a 1611 self-signature only; they are meaningless on a certification 1612 signature. They SHOULD be placed only on a direct-key signature 1613 (type 0x1f) or a subkey signature (type 0x18), one that refers to 1614 the key the flag applies to. 1616 5.2.3.22. Signer's User ID 1618 (String) 1620 This subpacket allows a keyholder to state which User ID is 1621 responsible for the signing. Many keyholders use a single key for 1622 different purposes, such as business communications as well as 1623 personal communications. This subpacket allows such a keyholder to 1624 state which of their roles is making a signature. 1626 This subpacket is not appropriate to use to refer to a User 1627 Attribute packet. 1629 5.2.3.23. Reason for Revocation 1631 (1 octet of revocation code, N octets of reason string) 1633 This subpacket is used only in key revocation and certification 1634 revocation signatures. It describes the reason why the key or 1635 certificate was revoked. 1637 The first octet contains a machine-readable code that denotes the 1638 reason for the revocation: 1640 0 - No reason specified (key revocations or cert revocations) 1641 1 - Key is superseded (key revocations) 1642 2 - Key material has been compromised (key revocations) 1643 3 - Key is retired and no longer used (key revocations) 1644 32 - User ID information is no longer valid (cert revocations) 1646 Following the revocation code is a string of octets which gives 1647 information about the reason for revocation in human-readable form 1648 (UTF-8). The string may be null, that is, of zero length. The length 1649 of the subpacket is the length of the reason string plus one. 1651 An implementation SHOULD implement this subpacket, include it in all 1652 revocation signatures, and interpret revocations appropriately. 1653 There are important semantic differences between the reasons, and 1654 there are thus important reasons for revoking signatures. 1656 If a key has been revoked because of a compromise, all signatures 1657 created by that key are suspect. However, if it was merely 1658 superseded or retired, old signatures are still valid. If the 1659 revoked signature is the self-signature for certifying a User ID, a 1660 revocation denotes that that user name is no longer in use. Such a 1661 revocation SHOULD include an 0x20 code. 1663 Note that any signature may be revoked, including a certification on 1664 some other person's key. There are many good reasons for revoking a 1665 certification signature, such as the case where the keyholder leaves 1666 the employ of a business with an email address. A revoked 1667 certification is no longer a part of validity calculations. 1669 5.2.3.24. Features 1671 (N octets of flags) 1673 The features subpacket denotes which advanced OpenPGP features a 1674 user's implementation supports. This is so that as features are 1675 added to OpenPGP that cannot be backwards-compatible, a user can 1676 state that they can use that feature. The flags are single bits that 1677 indicate that a given feature is supported. 1679 This subpacket is similar to a preferences subpacket, and only 1680 appears in a self-signature. 1682 An implementation SHOULD NOT use a feature listed when sending to a 1683 user who does not state that they can use it. 1685 Defined features are: 1687 First octet: 1689 0x01 - Modification Detection (packets 18 and 19) 1691 If an implementation implements any of the defined features, it 1692 SHOULD implement the features subpacket, too. 1694 An implementation may freely infer features from other suitable 1695 implementation-dependent mechanisms. 1697 5.2.3.25. Signature Target 1699 (1 octet PK algorithm, 1 octet hash algorithm, N octets hash) 1701 This subpacket identifies a specific target signature that a 1702 signature refers to. For revocation signatures, this subpacket 1703 provides explicit designation of which signature is being revoked. 1704 For a third-party or timestamp signature, this designates what 1705 signature is signed. All arguments are an identifier of that target 1706 signature. 1708 The N octets of hash data MUST be the size of the hash of the 1709 signature. For example, a target signature with a SHA-1 hash MUST 1710 have 20 octets of hash data. 1712 5.2.3.26. Embedded Signature 1714 (1 signature packet body) 1716 This subpacket contains a complete signature packet body as 1717 specified in section 5.2 above. It is useful when one signature 1718 needs to refer to, or be incorporated in, another signature. 1720 5.2.4. Computing Signatures 1722 All signatures are formed by producing a hash over the signature 1723 data, and then using the resulting hash in the signature algorithm. 1725 For binary document signatures (type 0x00), the document data is 1726 hashed directly. For text document signatures (type 0x01), the 1727 document is canonicalized by converting line endings to , 1728 and the resulting data is hashed. 1730 When a signature is made over a key, the hash data starts with the 1731 octet 0x99, followed by a two-octet length of the key, and then body 1732 of the key packet. (Note that this is an old-style packet header for 1733 a key packet with two-octet length.) A subkey binding signature 1734 (type 0x18) or primary key binding signature (type 0x19) then hashes 1735 the subkey using the same format as the main key (also using 0x99 as 1736 the first octet). Key revocation signatures (types 0x20 and 0x28) 1737 hash only the key being revoked. 1739 A certification signature (type 0x10 through 0x13) hashes the User 1740 ID being bound to the key into the hash context after the above 1741 data. A V3 certification hashes the contents of the User ID or 1742 attribute packet packet, without any header. A V4 certification 1743 hashes the constant 0xb4 for User ID certifications or the constant 1744 0xd1 for User Attribute certifications, followed by a four-octet 1745 number giving the length of the User ID or User Attribute data, and 1746 then the User ID or User Attribute data. 1748 When a signature is made over a signature packet (type 0x50), the 1749 hash data starts with the octet 0x88, followed by the four-octet 1750 length of the signature, and then the body of the signature packet. 1751 (Note that this is an old-style packet header for a signature packet 1752 with the length-of-length set to zero). The unhashed subpacket data 1753 of the signature packet being hashed is not included in the hash and 1754 the unhashed subpacket data length value is set to zero. 1756 Once the data body is hashed, then a trailer is hashed. A V3 1757 signature hashes five octets of the packet body, starting from the 1758 signature type field. This data is the signature type, followed by 1759 the four-octet signature time. A V4 signature hashes the packet body 1760 starting from its first field, the version number, through the end 1761 of the hashed subpacket data. Thus, the fields hashed are the 1762 signature version, the signature type, the public key algorithm, the 1763 hash algorithm, the hashed subpacket length, and the hashed 1764 subpacket body. 1766 V4 signatures also hash in a final trailer of six octets: the 1767 version of the signature packet, i.e. 0x04; 0xFF; a four-octet, 1768 big-endian number that is the length of the hashed data from the 1769 signature packet (note that this number does not include these final 1770 six octets. 1772 After all this has been hashed in a single hash context the 1773 resulting hash field is used in the signature algorithm, and placed 1774 at the end of the signature packet. 1776 5.2.4.1. Subpacket Hints 1778 It is certainly possible for a signature to contain conflicting 1779 information in subpackets. For example, a signature may contain 1780 multiple copies of a preference or multiple expiration times. In 1781 most cases, an implementation SHOULD use the last subpacket in the 1782 signature, but MAY use any conflict resolution scheme that makes 1783 more sense. Please note that we are intentionally leaving conflict 1784 resolution to the implementer; most conflicts are simply syntax 1785 errors, and the wishy-washy language here allows a receiver to be 1786 generous in what they accept, while putting pressure on a creator to 1787 be stingy in what they generate. 1789 Some apparent conflicts may actually make sense -- for example, 1790 suppose a keyholder has an V3 key and a V4 key that share the same 1791 RSA key material. Either of these keys can verify a signature 1792 created by the other, and it may be reasonable for a signature to 1793 contain an issuer subpacket for each key, as a way of explicitly 1794 tying those keys to the signature. 1796 5.3. Symmetric-Key Encrypted Session Key Packets (Tag 3) 1798 The Symmetric-Key Encrypted Session Key packet holds the 1799 symmetric-key encryption of a session key used to encrypt a message. 1800 Zero or more Public-Key Encrypted Session Key packets and/or 1801 Symmetric-Key Encrypted Session Key packets may precede a 1802 Symmetrically Encrypted Data Packet that holds an encrypted message. 1803 The message is encrypted with a session key, and the session key is 1804 itself encrypted and stored in the Encrypted Session Key packet or 1805 the Symmetric-Key Encrypted Session Key packet. 1807 If the Symmetrically Encrypted Data Packet is preceded by one or 1808 more Symmetric-Key Encrypted Session Key packets, each specifies a 1809 passphrase that may be used to decrypt the message. This allows a 1810 message to be encrypted to a number of public keys, and also to one 1811 or more passphrases. This packet type is new, and is not generated 1812 by PGP 2.x or PGP 5.0. 1814 The body of this packet consists of: 1816 - A one-octet version number. The only currently defined version 1817 is 4. 1819 - A one-octet number describing the symmetric algorithm used. 1821 - A string-to-key (S2K) specifier, length as defined above. 1823 - Optionally, the encrypted session key itself, which is decrypted 1824 with the string-to-key object. 1826 If the encrypted session key is not present (which can be detected 1827 on the basis of packet length and S2K specifier size), then the S2K 1828 algorithm applied to the passphrase produces the session key for 1829 decrypting the file, using the symmetric cipher algorithm from the 1830 Symmetric-Key Encrypted Session Key packet. 1832 If the encrypted session key is present, the result of applying the 1833 S2K algorithm to the passphrase is used to decrypt just that 1834 encrypted session key field, using CFB mode with an IV of all zeros. 1835 The decryption result consists of a one-octet algorithm identifier 1836 that specifies the symmetric-key encryption algorithm used to 1837 encrypt the following Symmetrically Encrypted Data Packet, followed 1838 by the session key octets themselves. 1840 Note: because an all-zero IV is used for this decryption, the S2K 1841 specifier MUST use a salt value, either a Salted S2K or an 1842 Iterated-Salted S2K. The salt value will insure that the decryption 1843 key is not repeated even if the passphrase is reused. 1845 5.4. One-Pass Signature Packets (Tag 4) 1847 The One-Pass Signature packet precedes the signed data and contains 1848 enough information to allow the receiver to begin calculating any 1849 hashes needed to verify the signature. It allows the Signature 1850 Packet to be placed at the end of the message, so that the signer 1851 can compute the entire signed message in one pass. 1853 A One-Pass Signature does not interoperate with PGP 2.6.x or 1854 earlier. 1856 The body of this packet consists of: 1858 - A one-octet version number. The current version is 3. 1860 - A one-octet signature type. Signature types are described in 1861 section 5.2.1. 1863 - A one-octet number describing the hash algorithm used. 1865 - A one-octet number describing the public key algorithm used. 1867 - An eight-octet number holding the key ID of the signing key. 1869 - A one-octet number holding a flag showing whether the signature 1870 is nested. A zero value indicates that the next packet is 1871 another One-Pass Signature packet that describes another 1872 signature to be applied to the same message data. 1874 Note that if a message contains more than one one-pass signature, 1875 then the signature packets bracket the message; that is, the first 1876 signature packet after the message corresponds to the last one-pass 1877 packet and the final signature packet corresponds to the first 1878 one-pass packet. 1880 5.5. Key Material Packet 1882 A key material packet contains all the information about a public or 1883 private key. There are four variants of this packet type, and two 1884 major versions. Consequently, this section is complex. 1886 5.5.1. Key Packet Variants 1888 5.5.1.1. Public Key Packet (Tag 6) 1890 A Public Key packet starts a series of packets that forms an OpenPGP 1891 key (sometimes called an OpenPGP certificate). 1893 5.5.1.2. Public Subkey Packet (Tag 14) 1895 A Public Subkey packet (tag 14) has exactly the same format as a 1896 Public Key packet, but denotes a subkey. One or more subkeys may be 1897 associated with a top-level key. By convention, the top-level key 1898 provides signature services, and the subkeys provide encryption 1899 services. 1901 Note: in PGP 2.6.x, tag 14 was intended to indicate a comment 1902 packet. This tag was selected for reuse because no previous version 1903 of PGP ever emitted comment packets but they did properly ignore 1904 them. Public Subkey packets are ignored by PGP 2.6.x and do not 1905 cause it to fail, providing a limited degree of backward 1906 compatibility. 1908 5.5.1.3. Secret Key Packet (Tag 5) 1910 A Secret Key packet contains all the information that is found in a 1911 Public Key packet, including the public key material, but also 1912 includes the secret key material after all the public key fields. 1914 5.5.1.4. Secret Subkey Packet (Tag 7) 1916 A Secret Subkey packet (tag 7) is the subkey analog of the Secret 1917 Key packet, and has exactly the same format. 1919 5.5.2. Public Key Packet Formats 1921 There are two versions of key-material packets. Version 3 packets 1922 were first generated by PGP 2.6. Version 4 keys first appeared in 1923 PGP 5.0, and are the preferred key version for OpenPGP. 1925 OpenPGP implementations MUST create keys with version 4 format. V3 1926 keys are deprecated; an implementation MUST NOT generate a V3 key, 1927 but MAY accept it. 1929 A version 3 public key or public subkey packet contains: 1931 - A one-octet version number (3). 1933 - A four-octet number denoting the time that the key was created. 1935 - A two-octet number denoting the time in days that this key is 1936 valid. If this number is zero, then it does not expire. 1938 - A one-octet number denoting the public key algorithm of this key 1940 - A series of multiprecision integers comprising the key material: 1942 - a multiprecision integer (MPI) of RSA public modulus n; 1944 - an MPI of RSA public encryption exponent e. 1946 V3 keys are deprecated. They contain three weaknesses in them. 1947 First, it is relatively easy to construct a V3 key that has the same 1948 key ID as any other key because the key ID is simply the low 64 bits 1949 of the public modulus. Secondly, because the fingerprint of a V3 key 1950 hashes the key material, but not its length, there is an increased 1951 opportunity for fingerprint collisions. Third, there are weaknesses 1952 in the MD5 hash algorithm that make developers prefer other 1953 algorithms. See below for a fuller discussion of key IDs and 1954 fingerprints. 1956 V2 keys are identical to the deprecated V3 keys except for the 1957 version number. An implementation MUST NOT generate them and MAY 1958 accept or reject them as it sees fit. 1960 The version 4 format is similar to the version 3 format except for 1961 the absence of a validity period. This has been moved to the 1962 signature packet. In addition, fingerprints of version 4 keys are 1963 calculated differently from version 3 keys, as described in section 1964 "Enhanced Key Formats." 1965 A version 4 packet contains: 1967 - A one-octet version number (4). 1969 - A four-octet number denoting the time that the key was created. 1971 - A one-octet number denoting the public key algorithm of this key 1973 - A series of multiprecision integers comprising the key material. 1974 This algorithm-specific portion is: 1976 Algorithm Specific Fields for RSA public keys: 1978 - multiprecision integer (MPI) of RSA public modulus n; 1980 - MPI of RSA public encryption exponent e. 1982 Algorithm Specific Fields for DSA public keys: 1984 - MPI of DSA prime p; 1986 - MPI of DSA group order q (q is a prime divisor of p-1); 1988 - MPI of DSA group generator g; 1990 - MPI of DSA public key value y (= g**x mod p where x is 1991 secret). 1993 Algorithm Specific Fields for Elgamal public keys: 1995 - MPI of Elgamal prime p; 1997 - MPI of Elgamal group generator g; 1999 - MPI of Elgamal public key value y (= g**x mod p where x is 2000 secret). 2002 5.5.3. Secret Key Packet Formats 2004 The Secret Key and Secret Subkey packets contain all the data of the 2005 Public Key and Public Subkey packets, with additional 2006 algorithm-specific secret key data appended, usually in encrypted 2007 form. 2009 The packet contains: 2011 - A Public Key or Public Subkey packet, as described above 2013 - One octet indicating string-to-key usage conventions. Zero 2014 indicates that the secret key data is not encrypted. 255 or 254 2015 indicates that a string-to-key specifier is being given. Any 2016 other value is a symmetric-key encryption algorithm identifier. 2018 - [Optional] If string-to-key usage octet was 255 or 254, a 2019 one-octet symmetric encryption algorithm. 2021 - [Optional] If string-to-key usage octet was 255 or 254, a 2022 string-to-key specifier. The length of the string-to-key 2023 specifier is implied by its type, as described above. 2025 - [Optional] If secret data is encrypted (string-to-key usage 2026 octet not zero), an Initial Vector (IV) of the same length as 2027 the cipher's block size. 2029 - Plain or encrypted multiprecision integers comprising the secret 2030 key data. These algorithm-specific fields are as described 2031 below. 2033 - If the string-to-key usage octet is zero or 255, then a 2034 two-octet checksum of the plaintext of the algorithm-specific 2035 portion (sum of all octets, mod 65536). If the string-to-key 2036 usage octet was 254, then a 20-octet SHA-1 hash of the plaintext 2037 of the algorithm-specific portion. This checksum or hash is 2038 encrypted together with the algorithm-specific fields (if 2039 string-to-key usage octet is not zero). Note that for all other 2040 values, a two-octet checksum is required. 2042 Algorithm Specific Fields for RSA secret keys: 2044 - multiprecision integer (MPI) of RSA secret exponent d. 2046 - MPI of RSA secret prime value p. 2048 - MPI of RSA secret prime value q (p < q). 2050 - MPI of u, the multiplicative inverse of p, mod q. 2052 Algorithm Specific Fields for DSA secret keys: 2054 - MPI of DSA secret exponent x. 2056 Algorithm Specific Fields for Elgamal secret keys: 2058 - MPI of Elgamal secret exponent x. 2060 Secret MPI values can be encrypted using a passphrase. If a 2061 string-to-key specifier is given, that describes the algorithm for 2062 converting the passphrase to a key, else a simple MD5 hash of the 2063 passphrase is used. Implementations MUST use a string-to-key 2064 specifier; the simple hash is for backward compatibility and is 2065 deprecated, though implementations MAY continue to use existing 2066 private keys in the old format. The cipher for encrypting the MPIs 2067 is specified in the secret key packet. 2069 Encryption/decryption of the secret data is done in CFB mode using 2070 the key created from the passphrase and the Initial Vector from the 2071 packet. A different mode is used with V3 keys (which are only RSA) 2072 than with other key formats. With V3 keys, the MPI bit count prefix 2073 (i.e., the first two octets) is not encrypted. Only the MPI 2074 non-prefix data is encrypted. Furthermore, the CFB state is 2075 resynchronized at the beginning of each new MPI value, so that the 2076 CFB block boundary is aligned with the start of the MPI data. 2078 With V4 keys, a simpler method is used. All secret MPI values are 2079 encrypted in CFB mode, including the MPI bitcount prefix. 2081 The two-octet checksum that follows the algorithm-specific portion 2082 is the algebraic sum, mod 65536, of the plaintext of all the 2083 algorithm-specific octets (including MPI prefix and data). With V3 2084 keys, the checksum is stored in the clear. With V4 keys, the 2085 checksum is encrypted like the algorithm-specific data. This value 2086 is used to check that the passphrase was correct. However, this 2087 checksum is deprecated; an implementation SHOULD NOT use it, but 2088 should rather use the SHA-1 hash denoted with a usage octet of 254. 2089 The reason for this is that there are some attacks that involve 2090 undetectably modifying the secret key. 2092 5.6. Compressed Data Packet (Tag 8) 2094 The Compressed Data packet contains compressed data. Typically, this 2095 packet is found as the contents of an encrypted packet, or following 2096 a Signature or One-Pass Signature packet, and contains a literal 2097 data packet. 2099 The body of this packet consists of: 2101 - One octet that gives the algorithm used to compress the packet. 2103 - The remainder of the packet is compressed data. 2105 A Compressed Data Packet's body contains an block that compresses 2106 some set of packets. See section "Packet Composition" for details on 2107 how messages are formed. 2109 ZIP-compressed packets are compressed with raw RFC 1951 DEFLATE 2110 blocks. Note that PGP V2.6 uses 13 bits of compression. If an 2111 implementation uses more bits of compression, PGP V2.6 cannot 2112 decompress it. 2114 ZLIB-compressed packets are compressed with RFC 1950 ZLIB-style 2115 blocks. 2117 BZip2-compressed packets are compressed using the BZip2 [BZ2] 2118 algorithm. 2120 5.7. Symmetrically Encrypted Data Packet (Tag 9) 2122 The Symmetrically Encrypted Data packet contains data encrypted with 2123 a symmetric-key algorithm. When it has been decrypted, it contains 2124 other packets (usually a literal data packet or compressed data 2125 packet, but in theory other Symmetrically Encrypted Data Packets or 2126 sequences of packets that form whole OpenPGP messages). 2128 The body of this packet consists of: 2130 - Encrypted data, the output of the selected symmetric-key cipher 2131 operating in OpenPGP's variant of Cipher Feedback (CFB) mode. 2133 The symmetric cipher used may be specified in an Public-Key or 2134 Symmetric-Key Encrypted Session Key packet that precedes the 2135 Symmetrically Encrypted Data Packet. In that case, the cipher 2136 algorithm octet is prefixed to the session key before it is 2137 encrypted. If no packets of these types precede the encrypted data, 2138 the IDEA algorithm is used with the session key calculated as the 2139 MD5 hash of the passphrase, though this use is deprecated. 2141 The data is encrypted in CFB mode, with a CFB shift size equal to 2142 the cipher's block size. The Initial Vector (IV) is specified as all 2143 zeros. Instead of using an IV, OpenPGP prefixes a string of length 2144 equal to the block size of the cipher plus two to the data before it 2145 is encrypted. The first block-size octets (for example, 8 octets for 2146 a 64-bit block length) are random, and the following two octets are 2147 copies of the last two octets of the IV. For example, in an 8 octet 2148 block, octet 9 is a repeat of octet 7, and octet 10 is a repeat of 2149 octet 8. In a cipher of length 16, octet 17 is a repeat of octet 15 2150 and octet 18 is a repeat of octet 16. As a pedantic clarification, 2151 in both these examples, we consider the first octet to be numbered 2152 1. 2154 After encrypting the first block-size-plus-two octets, the CFB state 2155 is resynchronized. The last block-size octets of ciphertext are 2156 passed through the cipher and the block boundary is reset. 2158 The repetition of 16 bits in the random data prefixed to the message 2159 allows the receiver to immediately check whether the session key is 2160 incorrect. See the Security Considerations section for hints on the 2161 proper use of this "quick check." 2163 5.8. Marker Packet (Obsolete Literal Packet) (Tag 10) 2165 An experimental version of PGP used this packet as the Literal 2166 packet, but no released version of PGP generated Literal packets 2167 with this tag. With PGP 5.x, this packet has been re-assigned and is 2168 reserved for use as the Marker packet. 2170 The body of this packet consists of: 2172 - The three octets 0x50, 0x47, 0x50 (which spell "PGP" in UTF-8). 2174 Such a packet MUST be ignored when received. It may be placed at the 2175 beginning of a message that uses features not available in PGP 2.6.x 2176 in order to cause that version to report that newer software is 2177 necessary to process the message. 2179 5.9. Literal Data Packet (Tag 11) 2181 A Literal Data packet contains the body of a message; data that is 2182 not to be further interpreted. 2184 The body of this packet consists of: 2186 - A one-octet field that describes how the data is formatted. 2188 If it is a 'b' (0x62), then the literal packet contains binary data. 2189 If it is a 't' (0x74), then it contains text data, and thus may need 2190 line ends converted to local form, or other text-mode changes. The 2191 tag 'u' (0x75) means the same as 't', but also indicates that 2192 implementation believes that the literal data contains UTF-8 text. 2194 Early versions of PGP also defined a value of 'l' as a 'local' mode 2195 for machine-local conversions. RFC 1991 incorrectly stated this 2196 local mode flag as '1' (ASCII numeral one). Both of these local 2197 modes are deprecated. 2199 - File name as a string (one-octet length, followed by a file 2200 name). This may be a zero-length string. Commonly, if the source 2201 of the encrypted data is a file, this will be the name of the 2202 encrypted file. An implementation MAY consider the file name in 2203 the literal packet to be a more authoritative name than the 2204 actual file name. 2206 If the special name "_CONSOLE" is used, the message is considered to 2207 be "for your eyes only". This advises that the message data is 2208 unusually sensitive, and the receiving program should process it 2209 more carefully, perhaps avoiding storing the received data to disk, 2210 for example. 2212 - A four-octet number that indicates a date associated with the 2213 literal data. Commonly, the date might be the modification date 2214 of a file, or the time the packet was created, or a zero that 2215 indicates no specific time. 2217 - The remainder of the packet is literal data. 2219 Text data is stored with text endings (i.e. network-normal 2220 line endings). These should be converted to native line endings by 2221 the receiving software. 2223 5.10. Trust Packet (Tag 12) 2225 The Trust packet is used only within keyrings and is not normally 2226 exported. Trust packets contain data that record the user's 2227 specifications of which key holders are trustworthy introducers, 2228 along with other information that implementing software uses for 2229 trust information. The format of trust packets is defined by a given 2230 implementation. 2232 Trust packets SHOULD NOT be emitted to output streams that are 2233 transferred to other users, and they SHOULD be ignored on any input 2234 other than local keyring files. 2236 5.11. User ID Packet (Tag 13) 2238 A User ID packet consists of UTF-8 text that is intended to 2239 represent the name and email address of the key holder. By 2240 convention, it includes an RFC 2822 mail name-addr, but there are no 2241 restrictions on its content. The packet length in the header 2242 specifies the length of the User ID. 2244 5.12. User Attribute Packet (Tag 17) 2246 The User Attribute packet is a variation of the User ID packet. It 2247 is capable of storing more types of data than the User ID packet 2248 which is limited to text. Like the User ID packet, a User Attribute 2249 packet may be certified by the key owner ("self-signed") or any 2250 other key owner who cares to certify it. Except as noted, a User 2251 Attribute packet may be used anywhere that a User ID packet may be 2252 used. 2254 While User Attribute packets are not a required part of the OpenPGP 2255 standard, implementations SHOULD provide at least enough 2256 compatibility to properly handle a certification signature on the 2257 User Attribute packet. A simple way to do this is by treating the 2258 User Attribute packet as a User ID packet with opaque contents, but 2259 an implementation may use any method desired. 2261 The User Attribute packet is made up of one or more attribute 2262 subpackets. Each subpacket consists of a subpacket header and a 2263 body. The header consists of: 2265 - the subpacket length (1, 2, or 5 octets) 2267 - the subpacket type (1 octet) 2269 and is followed by the subpacket specific data. 2271 The only currently defined subpacket type is 1, signifying an image. 2272 An implementation SHOULD ignore any subpacket of a type that it does 2273 not recognize. Subpacket types 100 through 110 are reserved for 2274 private or experimental use. 2276 5.12.1. The Image Attribute Subpacket 2278 The image attribute subpacket is used to encode an image, presumably 2279 (but not required to be) that of the key owner. 2281 The image attribute subpacket begins with an image header. The first 2282 two octets of the image header contain the length of the image 2283 header. Note that unlike other multi-octet numerical values in this 2284 document, due to an historical accident this value is encoded as a 2285 little-endian number. The image header length is followed by a 2286 single octet for the image header version. The only currently 2287 defined version of the image header is 1, which is a 16 octet image 2288 header. The first three octets of a version 1 image header are thus 2289 0x10 0x00 0x01. 2291 The fourth octet of a version 1 image header designates the encoding 2292 format of the image. The only currently defined encoding format is 2293 the value 1 to indicate JPEG. Image format types 100 through 110 are 2294 reserved for private or experimental use. The rest of the version 1 2295 image header is made up of 12 reserved octets, all of which MUST be 2296 set to 0. 2298 The rest of the image subpacket contains the image itself. As the 2299 only currently defined image type is JPEG, the image is encoded in 2300 the JPEG File Interchange Format (JFIF), a standard file format for 2301 JPEG images. [JFIF] 2303 An implementation MAY try and determine the type of an image by 2304 examination of the image data if it is unable to handle a particular 2305 version of the image header or if a specified encoding format value 2306 is not recognized. 2308 5.13. Sym. Encrypted Integrity Protected Data Packet (Tag 18) 2310 The Symmetrically Encrypted Integrity Protected Data Packet is a 2311 variant of the Symmetrically Encrypted Data Packet. It is a new 2312 feature created for OpenPGP that addresses the problem of detecting 2313 a modification to encrypted data. It is used in combination with a 2314 Modification Detection Code Packet. 2316 There is a corresponding feature in the features signature subpacket 2317 that denotes that an implementation can properly use this packet 2318 type. An implementation MUST support decrypting these packets and 2319 SHOULD prefer generating them to the older Symmetrically Encrypted 2320 Data Packet when possible. Since this data packet protects against 2321 modification attacks, this standard encourages its proliferation. 2322 While blanket adoption of this data packet would create 2323 interoperability problems, rapid adoption is nevertheless important. 2324 An implementation SHOULD specifically denote support for this 2325 packet, but it MAY infer it from other mechanisms. 2327 For example, an implementation might infer from the use of a cipher 2328 such as AES or Twofish that a user supports this feature. It might 2329 place in the unhashed portion of another user's key signature a 2330 features subpacket. It might also present a user with an opportunity 2331 to regenerate their own self-signature with a features subpacket. 2333 This packet contains data encrypted with a symmetric-key algorithm 2334 and protected against modification by the SHA-1 hash algorithm. When 2335 it has been decrypted, it will typically contain other packets 2336 (often a literal data packet or compressed data packet). The last 2337 decrypted packet in this packet's payload MUST be a Modification 2338 Detection Code packet. 2340 The body of this packet consists of: 2342 - A one-octet version number. The only currently defined value is 2343 1. 2345 - Encrypted data, the output of the selected symmetric-key cipher 2346 operating in Cipher Feedback mode with shift amount equal to the 2347 block size of the cipher (CFB-n where n is the block size). 2349 The symmetric cipher used MUST be specified in a Public-Key or 2350 Symmetric-Key Encrypted Session Key packet that precedes the 2351 Symmetrically Encrypted Data Packet. In either case, the cipher 2352 algorithm octet is prefixed to the session key before it is 2353 encrypted. 2355 The data is encrypted in CFB mode, with a CFB shift size equal to 2356 the cipher's block size. The Initial Vector (IV) is specified as all 2357 zeros. Instead of using an IV, OpenPGP prefixes an octet string to 2358 the data before it is encrypted. The length of the octet string 2359 equals the block size of the cipher in octets, plus two. The first 2360 octets in the group, of length equal to the block size of the 2361 cipher, are random; the last two octets are each copies of their 2nd 2362 preceding octet. For example, with a cipher whose block size is 128 2363 bits or 16 octets, the prefix data will contain 16 random octets, 2364 then two more octets, which are copies of the 15th and 16th octets, 2365 respectively. Unlike the Symmetrically Encrypted Data Packet, no 2366 special CFB resynchronization is done after encrypting this prefix 2367 data. See OpenPGP CFB Mode below for more details. 2369 The repetition of 16 bits in the random data prefixed to the message 2370 allows the receiver to immediately check whether the session key is 2371 incorrect. 2373 The plaintext of the data to be encrypted is passed through the 2374 SHA-1 hash function, and the result of the hash is appended to the 2375 plaintext in a Modification Detection Code packet. The input to the 2376 hash function includes the prefix data described above; it includes 2377 all of the plaintext, and then also includes two octets of values 2378 0xD3, 0x14. These represent the encoding of a Modification Detection 2379 Code packet tag and length field of 20 octets. 2381 The resulting hash value is stored in a Modification Detection Code 2382 packet which MUST use the two octet encoding just given to represent 2383 its tag and length field. The body of the MDC packet is the 20 octet 2384 output of the SHA-1 hash. 2386 The Modification Detection Code packet is appended to the plaintext 2387 and encrypted along with the plaintext using the same CFB context. 2389 During decryption, the plaintext data should be hashed with SHA-1, 2390 including the prefix data as well as the packet tag and length field 2391 of the Modification Detection Code packet. The body of the MDC 2392 packet, upon decryption, is compared with the result of the SHA-1 2393 hash. 2395 Any failure of the MDC indicates that the message has been modified 2396 and MUST be treated as a security problem. Failures include a 2397 difference in the hash values, but also the absence of an MDC 2398 packet, or an MDC packet in any position other than the end of the 2399 plaintext. Any failure SHOULD be reported to the user. 2401 Note: future designs of new versions of this packet should consider 2402 rollback attacks since it will be possible for an attacker to change 2403 the version back to 1. 2405 NON-NORMATIVE EXPLANATION 2407 The MDC system, as packets 18 and 19 are called, were created to 2408 provide an integrity mechanism that is less strong than a 2409 signature, yet stronger than bare CFB encryption. 2411 It is a limitation of CFB encryption that damage to the 2412 ciphertext will corrupt the affected cipher blocks and the block 2413 following. Additionally, if data is removed from the end of a 2414 CFB-encrypted block, that removal is undetectable. (Note also 2415 that CBC mode has a similar limitation, but data removed from 2416 the front of the block is undetectable.) 2418 The obvious way to protect or authenticate an encrypted block is 2419 to digitally sign it. However, many people do not wish to 2420 habitually sign data, for a large number of reasons beyond the 2421 scope of this document. Suffice it to say that many people 2422 consider properties such as deniability to be as valuable as 2423 integrity. 2425 OpenPGP addresses this desire to have more security than raw 2426 encryption and yet preserve deniability with the MDC system. An 2427 MDC is intentionally not a MAC. Its name was not selected by 2428 accident. It is analogous to a checksum. 2430 Despite the fact that it is a relatively modest system, it has 2431 proved itself in the real world. It is an effective defense to 2432 several attacks that have surfaced since it has been created. It 2433 has met its modest goals admirably. 2435 Consequently, because it is a modest security system, it has 2436 modest requirements on the hash function(s) it employs. It does 2437 not rely on a hash function being collision-free, it relies on a 2438 hash function being one-way. If a forger, Frank, wishes to send 2439 Alice a (digitally) unsigned message that says, "I've always 2440 secretly loved you, signed Bob" it is far easier for him to 2441 construct a new message than it is to modify anything 2442 intercepted from Bob. (Note also that if Bob wishes to 2443 communicate secretly with Alice, but without authentication nor 2444 identification and with a threat model that includes forgers, he 2445 has a problem that transcends mere cryptography.) 2447 Note also that unlike nearly every other OpenPGP subsystem, 2448 there are no parameters in the MDC system. It hard-defines SHA-1 2449 as its hash function. This is not an accident. It is an 2450 intentional choice to avoid downgrade and cross-grade attacks 2451 while making a simple, fast system. (A downgrade attack would be 2452 an attack that replaced SHA-256 with SHA-1, for example. A 2453 cross-grade attack would replace SHA-1 with another 160-bit 2454 hash, such as RIPE-MD/160, for example.) 2456 However, given the present state of hash function cryptanalysis 2457 and cryptography, it may be desirable to upgrade the MDC system 2458 to a new hash function. See section 10.5 in the IANA 2459 considerations for guidance. 2461 5.14. Modification Detection Code Packet (Tag 19) 2463 The Modification Detection Code packet contains a SHA-1 hash of 2464 plaintext data which is used to detect message modification. It is 2465 only used with a Symmetrically Encrypted Integrity Protected Data 2466 packet. The Modification Detection Code packet MUST be the last 2467 packet in the plaintext data which is encrypted in the Symmetrically 2468 Encrypted Integrity Protected Data packet, and MUST appear in no 2469 other place. 2471 A Modification Detection Code packet MUST have a length of 20 2472 octets. 2474 The body of this packet consists of: 2476 - A 20-octet SHA-1 hash of the preceding plaintext data of the 2477 Symmetrically Encrypted Integrity Protected Data packet, 2478 including prefix data, the tag octet, and length octet of the 2479 Modification Detection Code packet. 2481 Note that the Modification Detection Code packet MUST always use a 2482 new-format encoding of the packet tag, and a one-octet encoding of 2483 the packet length. The reason for this is that the hashing rules for 2484 modification detection include a one-octet tag and one-octet length 2485 in the data hash. While this is a bit restrictive, it reduces 2486 complexity. 2488 6. Radix-64 Conversions 2490 As stated in the introduction, OpenPGP's underlying native 2491 representation for objects is a stream of arbitrary octets, and some 2492 systems desire these objects to be immune to damage caused by 2493 character set translation, data conversions, etc. 2495 In principle, any printable encoding scheme that met the 2496 requirements of the unsafe channel would suffice, since it would not 2497 change the underlying binary bit streams of the native OpenPGP data 2498 structures. The OpenPGP standard specifies one such printable 2499 encoding scheme to ensure interoperability. 2501 OpenPGP's Radix-64 encoding is composed of two parts: a base64 2502 encoding of the binary data, and a checksum. The base64 encoding is 2503 identical to the MIME base64 content-transfer-encoding [RFC2045]. 2505 The checksum is a 24-bit CRC converted to four characters of 2506 radix-64 encoding by the same MIME base64 transformation, preceded 2507 by an equals sign (=). The CRC is computed by using the generator 2508 0x864CFB and an initialization of 0xB704CE. The accumulation is done 2509 on the data before it is converted to radix-64, rather than on the 2510 converted data. A sample implementation of this algorithm is in the 2511 next section. 2513 The checksum with its leading equal sign MAY appear on the first 2514 line after the Base64 encoded data. 2516 Rationale for CRC-24: The size of 24 bits fits evenly into printable 2517 base64. The nonzero initialization can detect more errors than a 2518 zero initialization. 2520 6.1. An Implementation of the CRC-24 in "C" 2522 #define CRC24_INIT 0xb704ceL 2523 #define CRC24_POLY 0x1864cfbL 2525 typedef long crc24; 2526 crc24 crc_octets(unsigned char *octets, size_t len) 2527 { 2528 crc24 crc = CRC24_INIT; 2529 int i; 2530 while (len--) { 2531 crc ^= (*octets++) << 16; 2532 for (i = 0; i < 8; i++) { 2533 crc <<= 1; 2534 if (crc & 0x1000000) 2535 crc ^= CRC24_POLY; 2536 } 2537 } 2538 return crc & 0xffffffL; 2539 } 2541 6.2. Forming ASCII Armor 2543 When OpenPGP encodes data into ASCII Armor, it puts specific headers 2544 around the Radix-64 encoded data, so OpenPGP can reconstruct the 2545 data later. An OpenPGP implementation MAY use ASCII armor to protect 2546 raw binary data. OpenPGP informs the user what kind of data is 2547 encoded in the ASCII armor through the use of the headers. 2549 Concatenating the following data creates ASCII Armor: 2551 - An Armor Header Line, appropriate for the type of data 2553 - Armor Headers 2555 - A blank (zero-length, or containing only whitespace) line 2557 - The ASCII-Armored data 2559 - An Armor Checksum 2561 - The Armor Tail, which depends on the Armor Header Line. 2563 An Armor Header Line consists of the appropriate header line text 2564 surrounded by five (5) dashes ('-', 0x2D) on either side of the 2565 header line text. The header line text is chosen based upon the type 2566 of data that is being encoded in Armor, and how it is being encoded. 2567 Header line texts include the following strings: 2569 BEGIN PGP MESSAGE 2570 Used for signed, encrypted, or compressed files. 2572 BEGIN PGP PUBLIC KEY BLOCK 2573 Used for armoring public keys 2575 BEGIN PGP PRIVATE KEY BLOCK 2576 Used for armoring private keys 2578 BEGIN PGP MESSAGE, PART X/Y 2579 Used for multi-part messages, where the armor is split amongst Y 2580 parts, and this is the Xth part out of Y. 2582 BEGIN PGP MESSAGE, PART X 2583 Used for multi-part messages, where this is the Xth part of an 2584 unspecified number of parts. Requires the MESSAGE-ID Armor 2585 Header to be used. 2587 BEGIN PGP SIGNATURE 2588 Used for detached signatures, OpenPGP/MIME signatures, and 2589 cleartext signatures. Note that PGP 2.x uses BEGIN PGP MESSAGE 2590 for detached signatures. 2592 Note that all these Armor Header Lines are to consist of a complete 2593 line. That is to say, there is always a line ending preceding the 2594 starting five dashes, and following the ending five dashes. The 2595 header lines, therefore, MUST start at the beginning of a line, and 2596 MUST NOT have text other than whitespace following them on the same 2597 line. These line endings are considered a part of the Armor Header 2598 Line for the purposes of determining the content they delimit. This 2599 is particularly important when computing a cleartext signature (see 2600 below). 2602 The Armor Headers are pairs of strings that can give the user or the 2603 receiving OpenPGP implementation some information about how to 2604 decode or use the message. The Armor Headers are a part of the 2605 armor, not a part of the message, and hence are not protected by any 2606 signatures applied to the message. 2608 The format of an Armor Header is that of a key-value pair. A colon 2609 (':' 0x38) and a single space (0x20) separate the key and value. 2610 OpenPGP should consider improperly formatted Armor Headers to be 2611 corruption of the ASCII Armor. Unknown keys should be reported to 2612 the user, but OpenPGP should continue to process the message. 2614 Note that some transport methods are sensitive to line length. While 2615 there is a limit of 76 characters for the Radix-64 data (section 2616 6.3), there is no limit to the length of Armor Headers. Care should 2617 be taken that the Armor Headers are short enough to survive 2618 transport. One way to do this is to repeat an Armor Header key 2619 multiple times with different values for each so that no one line is 2620 overly long. 2622 Currently defined Armor Header Keys are: 2624 - "Version", that states the OpenPGP implementation and version 2625 used to encode the message. 2627 - "Comment", a user-defined comment. OpenPGP defines all text to 2628 be in UTF-8. A comment may be any UTF-8 string. However, the 2629 whole point of armoring is to provide seven-bit-clean data. 2630 Consequently, if a comment has characters that are outside the 2631 US-ASCII range of UTF, they may very well not survive transport. 2633 - "MessageID", a 32-character string of printable characters. The 2634 string must be the same for all parts of a multi-part message 2635 that uses the "PART X" Armor Header. MessageID strings should be 2636 unique enough that the recipient of the mail can associate all 2637 the parts of a message with each other. A good checksum or 2638 cryptographic hash function is sufficient. 2640 The MessageID SHOULD NOT appear unless it is in a multi-part 2641 message. If it appears at all, it MUST be computed from the 2642 finished (encrypted, signed, etc.) message in a deterministic 2643 fashion, rather than contain a purely random value. This is to 2644 allow the legitimate recipient to determine that the MessageID 2645 cannot serve as a covert means of leaking cryptographic key 2646 information. 2648 - "Hash", a comma-separated list of hash algorithms used in this 2649 message. This is used only in cleartext signed messages. 2651 - "Charset", a description of the character set that the plaintext 2652 is in. Please note that OpenPGP defines text to be in UTF-8. An 2653 implementation will get best results by translating into and out 2654 of UTF-8. However, there are many instances where this is easier 2655 said than done. Also, there are communities of users who have no 2656 need for UTF-8 because they are all happy with a character set 2657 like ISO Latin-5 or a Japanese character set. In such instances, 2658 an implementation MAY override the UTF-8 default by using this 2659 header key. An implementation MAY implement this key and any 2660 translations it cares to; an implementation MAY ignore it and 2661 assume all text is UTF-8. 2663 The Armor Tail Line is composed in the same manner as the Armor 2664 Header Line, except the string "BEGIN" is replaced by the string 2665 "END". 2667 6.3. Encoding Binary in Radix-64 2669 The encoding process represents 24-bit groups of input bits as 2670 output strings of 4 encoded characters. Proceeding from left to 2671 right, a 24-bit input group is formed by concatenating three 8-bit 2672 input groups. These 24 bits are then treated as four concatenated 2673 6-bit groups, each of which is translated into a single digit in the 2674 Radix-64 alphabet. When encoding a bit stream with the Radix-64 2675 encoding, the bit stream must be presumed to be ordered with the 2676 most-significant-bit first. That is, the first bit in the stream 2677 will be the high-order bit in the first 8-bit octet, and the eighth 2678 bit will be the low-order bit in the first 8-bit octet, and so on. 2680 +--first octet--+-second octet--+--third octet--+ 2681 |7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0| 2682 +-----------+---+-------+-------+---+-----------+ 2683 |5 4 3 2 1 0|5 4 3 2 1 0|5 4 3 2 1 0|5 4 3 2 1 0| 2684 +--1.index--+--2.index--+--3.index--+--4.index--+ 2686 Each 6-bit group is used as an index into an array of 64 printable 2687 characters from the table below. The character referenced by the 2688 index is placed in the output string. 2690 Value Encoding Value Encoding Value Encoding Value Encoding 2691 0 A 17 R 34 i 51 z 2692 1 B 18 S 35 j 52 0 2693 2 C 19 T 36 k 53 1 2694 3 D 20 U 37 l 54 2 2695 4 E 21 V 38 m 55 3 2696 5 F 22 W 39 n 56 4 2697 6 G 23 X 40 o 57 5 2698 7 H 24 Y 41 p 58 6 2699 8 I 25 Z 42 q 59 7 2700 9 J 26 a 43 r 60 8 2701 10 K 27 b 44 s 61 9 2702 11 L 28 c 45 t 62 + 2703 12 M 29 d 46 u 63 / 2704 13 N 30 e 47 v 2705 14 O 31 f 48 w (pad) = 2706 15 P 32 g 49 x 2707 16 Q 33 h 50 y 2709 The encoded output stream must be represented in lines of no more 2710 than 76 characters each. 2712 Special processing is performed if fewer than 24 bits are available 2713 at the end of the data being encoded. There are three possibilities: 2715 1. The last data group has 24 bits (3 octets). No special 2716 processing is needed. 2718 2. The last data group has 16 bits (2 octets). The first two 6-bit 2719 groups are processed as above. The third (incomplete) data group 2720 has two zero-value bits added to it, and is processed as above. 2721 A pad character (=) is added to the output. 2723 3. The last data group has 8 bits (1 octet). The first 6-bit group 2724 is processed as above. The second (incomplete) data group has 2725 four zero-value bits added to it, and is processed as above. Two 2726 pad characters (=) are added to the output. 2728 6.4. Decoding Radix-64 2730 In Radix-64 data, characters other than those in the table, line 2731 breaks, and other white space probably indicate a transmission 2732 error, about which a warning message or even a message rejection 2733 might be appropriate under some circumstances. Decoding software 2734 must ignore all white space. 2736 Because it is used only for padding at the end of the data, the 2737 occurrence of any "=" characters may be taken as evidence that the 2738 end of the data has been reached (without truncation in transit). No 2739 such assurance is possible, however, when the number of octets 2740 transmitted was a multiple of three and no "=" characters are 2741 present. 2743 6.5. Examples of Radix-64 2745 Input data: 0x14fb9c03d97e 2746 Hex: 1 4 f b 9 c | 0 3 d 9 7 e 2747 8-bit: 00010100 11111011 10011100 | 00000011 11011001 11111110 2748 6-bit: 000101 001111 101110 011100 | 000000 111101 100111 111110 2749 Decimal: 5 15 46 28 0 61 37 62 2750 Output: F P u c A 9 l + 2751 Input data: 0x14fb9c03d9 2752 Hex: 1 4 f b 9 c | 0 3 d 9 2753 8-bit: 00010100 11111011 10011100 | 00000011 11011001 2754 pad with 00 2755 6-bit: 000101 001111 101110 011100 | 000000 111101 100100 2756 Decimal: 5 15 46 28 0 61 36 2757 pad with = 2758 Output: F P u c A 9 k = 2759 Input data: 0x14fb9c03 2760 Hex: 1 4 f b 9 c | 0 3 2761 8-bit: 00010100 11111011 10011100 | 00000011 2762 pad with 0000 2763 6-bit: 000101 001111 101110 011100 | 000000 110000 2764 Decimal: 5 15 46 28 0 48 2765 pad with = = 2766 Output: F P u c A w = = 2768 6.6. Example of an ASCII Armored Message 2770 -----BEGIN PGP MESSAGE----- 2771 Version: OpenPrivacy 0.99 2773 yDgBO22WxBHv7O8X7O/jygAEzol56iUKiXmV+XmpCtmpqQUKiQrFqclFqUDBovzS 2774 vBSFjNSiVHsuAA== 2775 =njUN 2776 -----END PGP MESSAGE----- 2778 Note that this example has extra indenting; an actual armored 2779 message would have no leading whitespace. 2781 7. Cleartext signature framework 2783 It is desirable to be able to sign a textual octet stream without 2784 ASCII armoring the stream itself, so the signed text is still 2785 readable without special software. In order to bind a signature to 2786 such a cleartext, this framework is used. (Note that this framework 2787 is not intended to be reversible. RFC 3156 defines another way to 2788 sign cleartext messages for environments that support MIME.) 2790 The cleartext signed message consists of: 2792 - The cleartext header '-----BEGIN PGP SIGNED MESSAGE-----' on a 2793 single line, 2795 - One or more "Hash" Armor Headers, 2797 - Exactly one empty line not included into the message digest, 2799 - The dash-escaped cleartext that is included into the message 2800 digest, 2802 - The ASCII armored signature(s) including the '-----BEGIN PGP 2803 SIGNATURE-----' Armor Header and Armor Tail Lines. 2805 If the "Hash" armor header is given, the specified message digest 2806 algorithm(s) are used for the signature. If there are no such 2807 headers, MD5 is used. If MD5 is the only hash used, then an 2808 implementation MAY omit this header for improved V2.x compatibility. 2809 If more than one message digest is used in the signature, the "Hash" 2810 armor header contains a comma-delimited list of used message 2811 digests. 2813 Current message digest names are described below with the algorithm 2814 IDs. 2816 An implementation SHOULD add a line break after the cleartext, but 2817 MAY omit it if the cleartext ends with a line break. This is for 2818 visual clarity. 2820 7.1. Dash-Escaped Text 2822 The cleartext content of the message must also be dash-escaped. 2824 Dash escaped cleartext is the ordinary cleartext where every line 2825 starting with a dash '-' (0x2D) is prefixed by the sequence dash '-' 2826 (0x2D) and space ' ' (0x20). This prevents the parser from 2827 recognizing armor headers of the cleartext itself. An implementation 2828 MAY dash escape any line, SHOULD dash escape lines commencing "From" 2829 followed by a space, and MUST dash escape any line commencing in a 2830 dash. The message digest is computed using the cleartext itself, not 2831 the dash escaped form. 2833 As with binary signatures on text documents, a cleartext signature 2834 is calculated on the text using canonical line endings. The 2835 line ending (i.e. the ) before the '-----BEGIN PGP 2836 SIGNATURE-----' line that terminates the signed text is not 2837 considered part of the signed text. 2839 When reversing dash-escaping, an implementation MUST strip the 2840 string "- " if it occurs at the beginning of a line, and SHOULD warn 2841 on "-" and any character other than a space at the beginning of a 2842 line. 2844 Also, any trailing whitespace -- spaces (0x20) and tabs (0x09) -- at 2845 the end of any line is removed when the cleartext signature is 2846 generated. 2848 8. Regular Expressions 2850 A regular expression is zero or more branches, separated by '|'. It 2851 matches anything that matches one of the branches. 2853 A branch is zero or more pieces, concatenated. It matches a match 2854 for the first, followed by a match for the second, etc. 2856 A piece is an atom possibly followed by '*', '+', or '?'. An atom 2857 followed by '*' matches a sequence of 0 or more matches of the atom. 2858 An atom followed by '+' matches a sequence of 1 or more matches of 2859 the atom. An atom followed by '?' matches a match of the atom, or 2860 the null string. 2862 An atom is a regular expression in parentheses (matching a match for 2863 the regular expression), a range (see below), '.' (matching any 2864 single character), '^' (matching the null string at the beginning of 2865 the input string), '$' (matching the null string at the end of the 2866 input string), a '\' followed by a single character (matching that 2867 character), or a single character with no other significance 2868 (matching that character). 2870 A range is a sequence of characters enclosed in '[]'. It normally 2871 matches any single character from the sequence. If the sequence 2872 begins with '^', it matches any single character not from the rest 2873 of the sequence. If two characters in the sequence are separated by 2874 '-', this is shorthand for the full list of ASCII characters between 2875 them (e.g. '[0-9]' matches any decimal digit). To include a literal 2876 ']' in the sequence, make it the first character (following a 2877 possible '^'). To include a literal '-', make it the first or last 2878 character. 2880 9. Constants 2882 This section describes the constants used in OpenPGP. 2884 Note that these tables are not exhaustive lists; an implementation 2885 MAY implement an algorithm not on these lists, so long as the 2886 algorithm number(s) are chosen from the private or experimental 2887 algorithm range. 2889 See the section "Notes on Algorithms" below for more discussion of 2890 the algorithms. 2892 9.1. Public Key Algorithms 2894 ID Algorithm 2895 -- --------- 2896 1 - RSA (Encrypt or Sign) [HAC] 2897 2 - RSA Encrypt-Only [HAC] 2898 3 - RSA Sign-Only [HAC] 2899 16 - Elgamal (Encrypt-Only), see [ELGAMAL] [HAC] 2900 17 - DSA (Digital Signature Algorithm) [FIPS186] [HAC] 2901 18 - Reserved for Elliptic Curve 2902 19 - Reserved for ECDSA 2903 20 - Reserved (formerly Elgamal Encrypt or Sign) 2904 21 - Reserved for Diffie-Hellman (X9.42, 2905 as defined for IETF-S/MIME) 2906 100 to 110 - Private/Experimental algorithm. 2908 Implementations MUST implement DSA for signatures, and Elgamal for 2909 encryption. Implementations SHOULD implement RSA keys (1). RSA 2910 Encrypt-Only (2) and RSA Sign-Only are deprecated and SHOULD NOT be 2911 generated, but may be interpreted. See Section 13.5. See Section 2912 13.8 for notes on Elliptic Curve (18), ECDSA (19), Elgamal Encrypt 2913 or Sign (20), and X9.42 (21). Implementations MAY implement any 2914 other algorithm. 2916 9.2. Symmetric Key Algorithms 2918 ID Algorithm 2919 -- --------- 2920 0 - Plaintext or unencrypted data 2921 1 - IDEA [IDEA] 2922 2 - TripleDES (DES-EDE, [SCHNEIER] [HAC] - 2923 168 bit key derived from 192) 2924 3 - CAST5 (128 bit key, as per RFC 2144) 2925 4 - Blowfish (128 bit key, 16 rounds) [BLOWFISH] 2926 5 - Reserved 2927 6 - Reserved 2928 7 - AES with 128-bit key [AES] 2929 8 - AES with 192-bit key 2930 9 - AES with 256-bit key 2931 10 - Twofish with 256-bit key [TWOFISH] 2932 100 to 110 - Private/Experimental algorithm. 2934 Implementations MUST implement TripleDES. Implementations SHOULD 2935 implement AES-128 and CAST5. Implementations that interoperate with 2936 PGP 2.6 or earlier need to support IDEA, as that is the only 2937 symmetric cipher those versions use. Implementations MAY implement 2938 any other algorithm. 2940 9.3. Compression Algorithms 2942 ID Algorithm 2943 -- --------- 2944 0 - Uncompressed 2945 1 - ZIP [RFC 1951] 2946 2 - ZLIB [RFC 1950] 2947 3 - BZip2 [BZ2] 2948 100 to 110 - Private/Experimental algorithm. 2950 Implementations MUST implement uncompressed data. Implementations 2951 SHOULD implement ZIP. Implementations MAY implement any other 2952 algorithm. 2954 9.4. Hash Algorithms 2956 ID Algorithm Text Name 2957 -- --------- ---- ---- 2958 1 - MD5 [HAC] "MD5" 2959 2 - SHA-1 [FIPS180] "SHA1" 2960 3 - RIPE-MD/160 [HAC] "RIPEMD160" 2961 4 - Reserved 2962 5 - Reserved 2963 6 - Reserved 2964 7 - Reserved 2965 8 - SHA256 [FIPS180] "SHA256" 2966 9 - SHA384 [FIPS180] "SHA384" 2967 10 - SHA512 [FIPS180] "SHA512" 2968 11 - SHA224 [FIPS180] "SHA224" 2969 100 to 110 - Private/Experimental algorithm. 2971 Implementations MUST implement SHA-1. Implementations MAY implement 2972 other algorithms. MD5 is deprecated. 2974 10. IANA Considerations 2976 OpenPGP is highly parameterized and consequently there are a number 2977 of considerations for allocating parameters for extensions. This 2978 section describes how IANA should look at extensions to the protocol 2979 as described in this document. 2981 10.1. New String-to-Key specifier types 2983 OpenPGP S2K specifiers contain a mechanism for new algorithms to 2984 turn a string into a key. This specification creates a registry of 2985 S2K specifier types. The registry includes the S2K type, the name of 2986 the S2K and a reference to the defining specification. The initial 2987 values for this registry can be found in 3.7.1. Adding a new S2K 2988 specifier MUST be done through the IETF CONSENSUS method, as 2989 described in [RFC2434]. 2991 10.2. New Packets 2993 Major new features of OpenPGP are defined though new packet types. 2994 This specification creates a registry of packet types. The registry 2995 includes the packet type, the name of the packet and a reference to 2996 the defining specification. The initial values for this registry can 2997 be found in 4.3. Adding a new packet type MUST be done through the 2998 IETF CONSENSUS method, as described in [RFC2434]. 3000 10.2.1. User Attribute Types 3002 The User Attribute packet permits an extensible mechanism for other 3003 types of certificate identification. This specification creates a 3004 registry of User Attribute types. The registry includes the User 3005 Attribute type, the name of the User Attribute and a reference to 3006 the defining specification. The initial values for this registry can 3007 be found in 5.12. Adding a new User Attribute type MUST be done 3008 through the IETF CONSENSUS method, as described in [RFC2434]. 3010 10.2.1.1. Image Format Subpacket Types 3012 Within User Attribute packets, there is an extensible mechanism for 3013 other types of image-based user attributes. This specification 3014 creates a registry of Image Attribute subpacket types. The registry 3015 includes the Image Attribute subpacket type, the name of the Image 3016 Attribute subpacket and a reference to the defining specification. 3017 The initial values for this registry can be found in 5.12.1. Adding 3018 a new Image Attribute subpacket type MUST be done through the IETF 3019 CONSENSUS method, as described in [RFC2434]. 3021 10.2.2. New Signature Subpackets 3023 OpenPGP signatures contain a mechanism for signed (or unsigned) data 3024 to be added to them for a variety of purposes in the signature 3025 subpackets as discussed in section 5.2.3.1. This specification 3026 creates a registry of signature subpacket types. The registry 3027 includes the signature subpacket type, the name of the subpacket and 3028 a reference to the defining specification. The initial values for 3029 this registry can be found in 5.2.3.1. Adding a new signature 3030 subpacket MUST be done through the IETF CONSENSUS method, as 3031 described in [RFC2434]. 3033 10.2.2.1. Signature Notation Data Subpackets 3035 OpenPGP signatures further contain a mechanism for extensions in 3036 signatures. These are the Notation Data subpackets, which contain a 3037 key/value pair. Notations contain a user space which is completely 3038 unmanaged and an IETF space. 3040 This specification creates a registry of Signature Notation Data 3041 types. The registry includes the Signature Notation Data type, the 3042 name of the Signature Notation Data, its allowed values, and a 3043 reference to the defining specification. The initial values for this 3044 registry can be found in 5.2.3.16. Adding a new Signature Notation 3045 Data subpacket MUST be done through the EXPERT REVIEW method, as 3046 described in [RFC2434]. 3048 10.2.2.2. Key Server Preference Extensions 3050 OpenPGP signatures contain a mechanism for preferences to be 3051 specified about key servers. This specification creates a registry 3052 of key server preferences. The registry includes the key server 3053 preference, the name of the preference and a reference to the 3054 defining specification. The initial values for this registry can be 3055 found in 5.2.3.17. Adding a new key server preference MUST be done 3056 through the IETF CONSENSUS method, as described in [RFC2434]. 3058 10.2.2.3. Key Flags Extensions 3060 OpenPGP signatures contain a mechanism for flags to be specified 3061 about key usage. This specification creates a registry of key usage 3062 flags. The registry includes the key flags value, the name of the 3063 flag and a reference to the defining specification. The initial 3064 values for this registry can be found in 5.2.3.21. Adding a new key 3065 usage flag MUST be done through the IETF CONSENSUS method, as 3066 described in [RFC2434]. 3068 10.2.2.4. Reason For Revocation Extensions 3070 OpenPGP signatures contain a mechanism for flags to be specified 3071 about why a key was revoked. This specification creates a registry 3072 of reason-for-revocation flags. The registry includes the 3073 reason-for-revocation flags value, the name of the flag and a 3074 reference to the defining specification. The initial values for this 3075 registry can be found in 5.2.3.23. Adding a new feature flag MUST be 3076 done through the IETF CONSENSUS method, as described in [RFC2434]. 3078 10.2.2.5. Implementation Features 3080 OpenPGP signatures contain a mechanism for flags to be specified 3081 stating which optional features an implementation supports. This 3082 specification creates a registry of feature-implementation flags. 3083 The registry includes the feature-implementation flags value, the 3084 name of the flag and a reference to the defining specification. The 3085 initial values for this registry can be found in 5.2.3.24. Adding a 3086 new feature-implementation flag MUST be done through the IETF 3087 CONSENSUS method, as described in [RFC2434]. 3089 Also see section 10.6 for more information about when feature flags 3090 are needed. 3092 10.2.3. New Packet Versions 3094 The core OpenPGP packets all have version numbers, and can be 3095 revised by introducing a new version of an existing packet. This 3096 specification creates a registry of packet types. The registry 3097 includes the packet type, the number of the version and a reference 3098 to the defining specification. The initial values for this registry 3099 can be found in 5. Adding a new packet version MUST be done through 3100 the IETF CONSENSUS method, as described in [RFC2434]. 3102 10.3. New Algorithms 3104 Chapter 9 lists the core algorithms that OpenPGP uses. Adding in a 3105 new algorithm is usually simple. For example, adding in a new 3106 symmetric cipher usually would not need anything more than 3107 allocating a constant for that cipher. If that cipher had other than 3108 a 64-bit or 128-bit block size, there might need to be additional 3109 documentation describing how OpenPGP-CFB mode would be adjusted. 3110 Similarly, when DSA was expanded from a maximum of 1024-bit public 3111 keys to 3072-bit public keys, the revision of FIPS 186 contained 3112 enough information itself to allow implementation. Changes to this 3113 document were emphasis more than required. 3115 10.3.1. Public Key Algorithms 3117 OpenPGP specifies a number of public key algorithms. This 3118 specification creates a registry of public key algorithm 3119 identifiers. The registry includes the algorithm name, its key sizes 3120 and parameters, and a reference to the defining specification. The 3121 initial values for this registry can be found in section 9. Adding a 3122 new public key algorithm MUST be done through the IETF CONSENSUS 3123 method, as described in [RFC2434]. 3125 10.3.2. Symmetric Key Algorithms 3127 OpenPGP specifies a number of symmetric key algorithms. This 3128 specification creates a registry of symmetric key algorithm 3129 identifiers. The registry includes the algorithm name, its key sizes 3130 and block size, and a reference to the defining specification. The 3131 initial values for this registry can be found in section 9. Adding a 3132 new symmetric key algorithm MUST be done through the IETF CONSENSUS 3133 method, as described in [RFC2434]. 3135 10.3.3. Hash Algorithms 3137 OpenPGP specifies a number of hash algorithms. This specification 3138 creates a registry of hash algorithm identifiers. The registry 3139 includes the algorithm name, a text representation of that name, its 3140 block size, an OID hash prefix, and a reference to the defining 3141 specification. The initial values for this registry can be found in 3142 section 9 for the algorithm identifiers and text names, and section 3143 5.2.2 for the OIDs and expanded signature prefixes. Adding a new 3144 hash algorithm MUST be done through the IETF CONSENSUS method, as 3145 described in [RFC2434]. 3147 10.3.4. Compression Algorithms 3149 OpenPGP specifies a number of compression algorithms. This 3150 specification creates a registry of compression algorithm 3151 identifiers. The registry includes the algorithm name, and a 3152 reference to the defining specification. The initial values for this 3153 registry can be found in section 9.3. Adding a new compression key 3154 algorithm MUST be done through the IETF CONSENSUS method, as 3155 described in [RFC2434]. 3157 11. Packet Composition 3159 OpenPGP packets are assembled into sequences in order to create 3160 messages and to transfer keys. Not all possible packet sequences are 3161 meaningful and correct. This section describes the rules for how 3162 packets should be placed into sequences. 3164 11.1. Transferable Public Keys 3166 OpenPGP users may transfer public keys. The essential elements of a 3167 transferable public key are: 3169 - One Public Key packet 3171 - Zero or more revocation signatures 3173 - One or more User ID packets 3175 - After each User ID packet, zero or more signature packets 3176 (certifications) 3178 - Zero or more User Attribute packets 3180 - After each User Attribute packet, zero or more signature packets 3181 (certifications) 3183 - Zero or more Subkey packets 3185 - After each Subkey packet, one signature packet, plus optionally 3186 a revocation. 3188 The Public Key packet occurs first. Each of the following User ID 3189 packets provides the identity of the owner of this public key. If 3190 there are multiple User ID packets, this corresponds to multiple 3191 means of identifying the same unique individual user; for example, a 3192 user may have more than one email address, and construct a User ID 3193 for each one. 3195 Immediately following each User ID packet, there are zero or more 3196 signature packets. Each signature packet is calculated on the 3197 immediately preceding User ID packet and the initial Public Key 3198 packet. The signature serves to certify the corresponding public key 3199 and User ID. In effect, the signer is testifying to his or her 3200 belief that this public key belongs to the user identified by this 3201 User ID. 3203 Within the same section as the User ID packets, there are zero or 3204 more User Attribute packets. Like the User ID packets, a User 3205 Attribute packet is followed by zero or more signature packets 3206 calculated on the immediately preceding User Attribute packet and 3207 the initial Public Key packet. 3209 User Attribute packets and User ID packets may be freely intermixed 3210 in this section, so long as the signatures that follow them are 3211 maintained on the proper User Attribute or User ID packet. 3213 After the User ID or Attribute packets there may be zero or more 3214 Subkey packets. In general, subkeys are provided in cases where the 3215 top-level public key is a signature-only key. However, any V4 key 3216 may have subkeys, and the subkeys may be encryption-only keys, 3217 signature-only keys, or general-purpose keys. V3 keys MUST NOT have 3218 subkeys. 3220 Each Subkey packet MUST be followed by one Signature packet, which 3221 should be a subkey binding signature issued by the top level key. 3222 For subkeys that can issue signatures, the subkey binding signature 3223 MUST contain an embedded signature subpacket with a primary key 3224 binding signature (0x19) issued by the subkey on the top level key. 3226 Subkey and Key packets may each be followed by a revocation 3227 Signature packet to indicate that the key is revoked. Revocation 3228 signatures are only accepted if they are issued by the key itself, 3229 or by a key that is authorized to issue revocations via a revocation 3230 key subpacket in a self-signature by the top level key. 3232 Transferable public key packet sequences may be concatenated to 3233 allow transferring multiple public keys in one operation. 3235 11.2. Transferable Secret Keys 3237 OpenPGP users may transfer secret keys. The format of a transferable 3238 secret key is the same as a transferable public key except that 3239 secret key and secret subkey packets are used instead of the public 3240 key and public subkey packets. Implementations SHOULD include 3241 self-signatures on any user IDs and subkeys, as this allows for a 3242 complete public key to be automatically extracted from the 3243 transferable secret key. Implementations MAY choose to omit the 3244 self-signatures, especially if a transferable public key accompanies 3245 the transferable secret key. 3247 11.3. OpenPGP Messages 3249 An OpenPGP message is a packet or sequence of packets that 3250 corresponds to the following grammatical rules (comma represents 3251 sequential composition, and vertical bar separates alternatives): 3253 OpenPGP Message :- Encrypted Message | Signed Message | 3254 Compressed Message | Literal Message. 3256 Compressed Message :- Compressed Data Packet. 3258 Literal Message :- Literal Data Packet. 3260 ESK :- Public Key Encrypted Session Key Packet | 3261 Symmetric-Key Encrypted Session Key Packet. 3263 ESK Sequence :- ESK | ESK Sequence, ESK. 3265 Encrypted Data :- Symmetrically Encrypted Data Packet | 3266 Symmetrically Encrypted Integrity Protected Data Packet 3268 Encrypted Message :- Encrypted Data | ESK Sequence, Encrypted Data. 3270 One-Pass Signed Message :- One-Pass Signature Packet, 3271 OpenPGP Message, Corresponding Signature Packet. 3273 Signed Message :- Signature Packet, OpenPGP Message | 3274 One-Pass Signed Message. 3276 In addition, decrypting a Symmetrically Encrypted Data Packet or a 3277 Symmetrically Encrypted Integrity Protected Data Packet as well as 3278 decompressing a Compressed Data packet must yield a valid OpenPGP 3279 Message. 3281 11.4. Detached Signatures 3283 Some OpenPGP applications use so-called "detached signatures." For 3284 example, a program bundle may contain a file, and with it a second 3285 file that is a detached signature of the first file. These detached 3286 signatures are simply a signature packet stored separately from the 3287 data that they are a signature of. 3289 12. Enhanced Key Formats 3291 12.1. Key Structures 3293 The format of an OpenPGP V3 key is as follows. Entries in square 3294 brackets are optional and ellipses indicate repetition. 3296 RSA Public Key 3297 [Revocation Self Signature] 3298 User ID [Signature ...] 3299 [User ID [Signature ...] ...] 3301 Each signature certifies the RSA public key and the preceding User 3302 ID. The RSA public key can have many User IDs and each User ID can 3303 have many signatures. V3 keys are deprecated. Implementations MUST 3304 NOT generate new V3 keys, but MAY continue to use existing ones. 3306 The format of an OpenPGP V4 key that uses multiple public keys is 3307 similar except that the other keys are added to the end as "subkeys" 3308 of the primary key. 3310 Primary-Key 3311 [Revocation Self Signature] 3312 [Direct Key Signature...] 3313 User ID [Signature ...] 3314 [User ID [Signature ...] ...] 3315 [User Attribute [Signature ...] ...] 3316 [[Subkey [Binding-Signature-Revocation] 3317 Primary-Key-Binding-Signature] ...] 3319 A subkey always has a single signature after it that is issued using 3320 the primary key to tie the two keys together. This binding signature 3321 may be in either V3 or V4 format, but SHOULD be V4. Subkeys that can 3322 issue signatures MUST have a V4 binding signature due to the 3323 REQUIRED embedded primary key binding signature. 3325 In the above diagram, if the binding signature of a subkey has been 3326 revoked, the revoked key may be removed, leaving only one key. 3328 In a V4 key, the primary key MUST be a key capable of certification. 3329 The subkeys may be keys of any other type. There may be other 3330 constructions of V4 keys, too. For example, there may be a 3331 single-key RSA key in V4 format, a DSA primary key with an RSA 3332 encryption key, or RSA primary key with an Elgamal subkey, etc. 3334 It is also possible to have a signature-only subkey. This permits a 3335 primary key that collects certifications (key signatures) but is 3336 used only used for certifying subkeys that are used for encryption 3337 and signatures. 3339 12.2. Key IDs and Fingerprints 3341 For a V3 key, the eight-octet key ID consists of the low 64 bits of 3342 the public modulus of the RSA key. 3344 The fingerprint of a V3 key is formed by hashing the body (but not 3345 the two-octet length) of the MPIs that form the key material (public 3346 modulus n, followed by exponent e) with MD5. Note that both V3 keys 3347 and MD5 are deprecated. 3349 A V4 fingerprint is the 160-bit SHA-1 hash of the octet 0x99, 3350 followed by the two-octet packet length, followed by the entire 3351 Public Key packet starting with the version field. The key ID is the 3352 low order 64 bits of the fingerprint. Here are the fields of the 3353 hash material, with the example of a DSA key: 3355 a.1) 0x99 (1 octet) 3357 a.2) high order length octet of (b)-(f) (1 octet) 3359 a.3) low order length octet of (b)-(f) (1 octet) 3361 b) version number = 4 (1 octet); 3363 c) time stamp of key creation (4 octets); 3365 d) algorithm (1 octet): 17 = DSA (example); 3367 e) Algorithm specific fields. 3369 Algorithm Specific Fields for DSA keys (example): 3371 e.1) MPI of DSA prime p; 3373 e.2) MPI of DSA group order q (q is a prime divisor of p-1); 3375 e.3) MPI of DSA group generator g; 3377 e.4) MPI of DSA public key value y (= g**x mod p where x is secret). 3379 Note that it is possible for there to be collisions of key IDs -- 3380 two different keys with the same key ID. Note that there is a much 3381 smaller, but still non-zero probability that two different keys have 3382 the same fingerprint. 3384 Also note that if V3 and V4 format keys share the same RSA key 3385 material, they will have different key IDs as well as different 3386 fingerprints. 3388 Finally, the key ID and fingerprint of a subkey are calculated in 3389 the same way as for a primary key, including the 0x99 as the first 3390 octet (even though this is not a valid packet ID for a public 3391 subkey). 3393 13. Notes on Algorithms 3395 13.1. PKCS#1 Encoding In OpenPGP 3397 This standard makes use of the PKCS#1 functions EME-PKCS1-v1_5 and 3398 EMSA-PKCS1-v1_5. However, the calling conventions of these functions 3399 has changed in the past. To avoid potential confusion and 3400 interoperability problems, we are including local copies in this 3401 document, adapted from those in PKCS#1 v2.1 [RFC3447]. RFC-3447 3402 should be treated as the ultimate authority on PKCS#1 for OpenPGP. 3403 Nonetheless, we believe that there is value in having a 3404 self-contained document that avoids problems in the future with 3405 needed changes in the conventions. 3407 13.1.1. EME-PKCS1-v1_5-ENCODE 3409 Input: 3411 k = the length in octets of the key modulus 3413 M = message to be encoded, an octet string of length mLen, where 3414 mLen <= k - 11 3416 Output: 3418 EM = encoded message, an octet string of length k 3420 Error: "message too long" 3422 1. Length checking: If mLen > k - 11, output "message too long" and 3423 stop. 3425 2. Generate an octet string PS of length k - mLen - 3 consisting of 3426 pseudo-randomly generated nonzero octets. The length of PS will 3427 be at least eight octets. 3429 3. Concatenate PS, the message M, and other padding to form an 3430 encoded message EM of length k octets as 3432 EM = 0x00 || 0x02 || PS || 0x00 || M. 3434 4. Output EM. 3436 13.1.2. EME-PKCS1-v1_5-DECODE 3438 Input: 3440 EM = encoded message, an octet string 3442 Output: 3444 M = message, an octet string 3446 Error: "decryption error" 3448 To decode an EME-PKCS1_v1_5 message, separate the encoded message EM 3449 into an octet string PS consisting of nonzero octets and a message M 3450 as 3452 EM = 0x00 || 0x02 || PS || 0x00 || M. 3454 If the first octet of EM does not have hexadecimal value 0x00, if 3455 the second octet of EM does not have hexadecimal value 0x02, if 3456 there is no octet with hexadecimal value 0x00 to separate PS from M, 3457 or if the length of PS is less than 8 octets, output "decryption 3458 error" and stop. See also the security note in section 13 regarding 3459 differences in reporting between a decryption error and a padding 3460 error. 3462 13.1.3. EMSA-PKCS1-v1_5 3464 This encoding method is deterministic and only has an encoding 3465 operation. 3467 Option: 3469 Hash hash function (hLen denotes the length in octets of the hash 3470 function output) 3472 Input: 3474 M = message to be encoded 3476 mL = intended length in octets of the encoded message, at least tLen 3477 + 11, where tLen is the octet length of the DER encoding T of a 3478 certain value computed during the encoding operation 3480 Output: 3482 EM = encoded message, an octet string of length emLen 3484 Errors: "message too long"; "intended encoded message length too 3485 short" 3487 Steps: 3489 1. Apply the hash function to the message M to produce a hash value 3490 H: 3492 H = Hash(M). 3494 If the hash function outputs "message too long," output "message 3495 too long" and stop. 3497 2. Using the list in section 5.2.2, produce an ASN.1 DER value for 3498 the hash function used. Let T be the full hash prefix from 3499 section 5.2.2, and let tLen be the length in octets of T. 3501 3. If emLen < tLen + 11, output "intended encoded message length 3502 too short" and stop. 3504 4. Generate an octet string PS consisting of emLen - tLen - 3 3505 octets with hexadecimal value 0xff. The length of PS will be at 3506 least 8 octets. 3508 5. Concatenate PS, the hash prefix T, and other padding to form the 3509 encoded message EM as 3511 EM = 0x00 || 0x01 || PS || 0x00 || T. 3513 6. Output EM. 3515 13.2. Symmetric Algorithm Preferences 3517 The symmetric algorithm preference is an ordered list of algorithms 3518 that the keyholder accepts. Since it is found on a self-signature, 3519 it is possible that a keyholder may have multiple, different 3520 preferences. For example, Alice may have TripleDES only specified 3521 for "alice@work.com" but CAST5, Blowfish, and TripleDES specified 3522 for "alice@home.org". Note that it is also possible for preferences 3523 to be in a subkey's binding signature. 3525 Since TripleDES is the MUST-implement algorithm, if it is not 3526 explicitly in the list, it is tacitly at the end. However, it is 3527 good form to place it there explicitly. Note also that if an 3528 implementation does not implement the preference, then it is 3529 implicitly a TripleDES-only implementation. 3531 An implementation MUST NOT use a symmetric algorithm that is not in 3532 the recipient's preference list. When encrypting to more than one 3533 recipient, the implementation finds a suitable algorithm by taking 3534 the intersection of the preferences of the recipients. Note that the 3535 MUST-implement algorithm, TripleDES, ensures that the intersection 3536 is not null. The implementation may use any mechanism to pick an 3537 algorithm in the intersection. 3539 If an implementation can decrypt a message that a keyholder doesn't 3540 have in their preferences, the implementation SHOULD decrypt the 3541 message anyway, but MUST warn the keyholder that the protocol has 3542 been violated. For example, suppose that Alice, above, has software 3543 that implements all algorithms in this specification. Nonetheless, 3544 she prefers subsets for work or home. If she is sent a message 3545 encrypted with IDEA, which is not in her preferences, the software 3546 warns her that someone sent her an IDEA-encrypted message, but it 3547 would ideally decrypt it anyway. 3549 13.3. Other Algorithm Preferences 3551 Other algorithm preferences work similarly to the symmetric 3552 algorithm preference, in that they specify which algorithms the 3553 keyholder accepts. There are two interesting cases that other 3554 comments need to be made about, though, the compression preferences 3555 and the hash preferences. 3557 13.3.1. Compression Preferences 3559 Compression has been an integral part of PGP since its first days. 3561 OpenPGP and all previous versions of PGP have offered compression. 3562 In this specification, the default is for messages to be compressed, 3563 although an implementation is not required to do so. Consequently, 3564 the compression preference gives a way for a keyholder to request 3565 that messages not be compressed, presumably because they are using a 3566 minimal implementation that does not include compression. 3567 Additionally, this gives a keyholder a way to state that it can 3568 support alternate algorithms. 3570 Like the algorithm preferences, an implementation MUST NOT use an 3571 algorithm that is not in the preference vector. If the preferences 3572 are not present, then they are assumed to be [ZIP(1), 3573 UNCOMPRESSED(0)]. 3575 Additionally, an implementation MUST implement this preference to 3576 the degree of recognizing when to send an uncompressed message. A 3577 robust implementation would satisfy this requirement by looking at 3578 the recipient's preference and acting accordingly. A minimal 3579 implementation can satisfy this requirement by never generating a 3580 compressed message, since all implementations can handle messages 3581 that have not been compressed. 3583 13.3.2. Hash Algorithm Preferences 3585 Typically, the choice of a hash algorithm is something the signer 3586 does, rather than the verifier, because a signer rarely knows who is 3587 going to be verifying the signature. This preference, though, allows 3588 a protocol based upon digital signatures ease in negotiation. 3590 Thus, if Alice is authenticating herself to Bob with a signature, it 3591 makes sense for her to use a hash algorithm that Bob's software 3592 uses. This preference allows Bob to state in his key which 3593 algorithms Alice may use. 3595 Since SHA1 is the MUST-implement hash algorithm, if it is not 3596 explicitly in the list, it is tacitly at the end. However, it is 3597 good form to place it there explicitly. 3599 13.4. Plaintext 3601 Algorithm 0, "plaintext," may only be used to denote secret keys 3602 that are stored in the clear. Implementations MUST NOT use plaintext 3603 in Symmetrically Encrypted Data Packets; they must use Literal Data 3604 Packets to encode unencrypted or literal data. 3606 13.5. RSA 3608 There are algorithm types for RSA Sign-Only, and RSA Encrypt-Only 3609 keys. These types are deprecated. The "key flags" subpacket in a 3610 signature is a much better way to express the same idea, and 3611 generalizes it to all algorithms. An implementation SHOULD NOT 3612 create such a key, but MAY interpret it. 3614 An implementation SHOULD NOT implement RSA keys of size less than 3615 1024 bits. 3617 13.6. DSA 3619 An implementation SHOULD NOT implement DSA keys of size less than 3620 1024 bits. It MUST NOT implement a DSA key with a q size of less 3621 than 160 bits. DSA keys MUST also be a multiple of 64 bits, and the 3622 q size MUST be a multiple of 8 bits. The Digital Signature Standard 3623 (DSS) [FIPS186] specifies that DSA be used in one of the following 3624 ways: 3626 * 1024-bit key, 160-bit q, SHA-1, SHA-224, SHA-256, SHA-384 or 3627 SHA-512 hash 3629 * 2048-bit key, 224-bit q, SHA-224, SHA-256, SHA-384 or SHA-512 3630 hash 3632 * 2048-bit key, 256-bit q, SHA-256, SHA-384 or SHA-512 hash 3634 * 3072-bit key, 256-bit q, SHA-256, SHA-384 or SHA-512 hash 3636 The above key and q size pairs were chosen to best balance the 3637 strength of the key with the strength of the hash. Implementations 3638 SHOULD use one of the above key and q size pairs when generating DSA 3639 keys. If DSS compliance is desired, one of the specified SHA hashes 3640 must be used as well. [FIPS186] is the ultimate authority on DSS, 3641 and should be consulted for all questions of DSS compliance. 3643 Note that earlier versions of this standard only allowed a 160-bit q 3644 with no truncation allowed, so earlier implementations may not be 3645 able to handle signatures with a different q size or a truncated 3646 hash. 3648 13.7. Elgamal 3650 An implementation SHOULD NOT implement Elgamal keys of size less 3651 than 1024 bits. 3653 13.8. Reserved Algorithm Numbers 3655 A number of algorithm IDs have been reserved for algorithms that 3656 would be useful to use in an OpenPGP implementation, yet there are 3657 issues that prevent an implementer from actually implementing the 3658 algorithm. These are marked in the Public Algorithms section as 3659 "(reserved for)". 3661 The reserved public key algorithms, Elliptic Curve (18), ECDSA (19), 3662 and X9.42 (21) do not have the necessary parameters, parameter 3663 order, or semantics defined. 3665 Previous versions of OpenPGP permitted Elgamal [ELGAMAL] signatures 3666 with a public key identifier of 20. These are no longer permitted. 3667 An implementation MUST NOT generate such keys. An implementation 3668 MUST NOT generate Elgamal signatures. See [BLEICHENBACHER]. 3670 13.9. OpenPGP CFB mode 3672 OpenPGP does symmetric encryption using a variant of Cipher Feedback 3673 Mode (CFB mode). This section describes the procedure it uses in 3674 detail. This mode is what is used for Symmetrically Encrypted Data 3675 Packets; the mechanism used for encrypting secret key material is 3676 similar, but described in those sections above. 3678 In the description below, the value BS is the block size in octets 3679 of the cipher. Most ciphers have a block size of 8 octets. The AES 3680 and Twofish have a block size of 16 octets. Also note that the 3681 description below assumes that the IV and CFB arrays start with an 3682 index of 1 (unlike the C language, which assumes arrays start with a 3683 zero index). 3685 OpenPGP CFB mode uses an initialization vector (IV) of all zeros, 3686 and prefixes the plaintext with BS+2 octets of random data, such 3687 that octets BS+1 and BS+2 match octets BS-1 and BS. It does a CFB 3688 resynchronization after encrypting those BS+2 octets. 3690 Thus, for an algorithm that has a block size of 8 octets (64 bits), 3691 the IV is 10 octets long and octets 7 and 8 of the IV are the same 3692 as octets 9 and 10. For an algorithm with a block size of 16 octets 3693 (128 bits), the IV is 18 octets long, and octets 17 and 18 replicate 3694 octets 15 and 16. Those extra two octets are an easy check for a 3695 correct key. 3697 Step by step, here is the procedure: 3699 1. The feedback register (FR) is set to the IV, which is all zeros. 3701 2. FR is encrypted to produce FRE (FR Encrypted). This is the 3702 encryption of an all-zero value. 3704 3. FRE is xored with the first BS octets of random data prefixed to 3705 the plaintext to produce C[1] through C[BS], the first BS octets 3706 of ciphertext. 3708 4. FR is loaded with C[1] through C[BS]. 3710 5. FR is encrypted to produce FRE, the encryption of the first BS 3711 octets of ciphertext. 3713 6. The left two octets of FRE get xored with the next two octets of 3714 data that were prefixed to the plaintext. This produces C[BS+1] 3715 and C[BS+2], the next two octets of ciphertext. 3717 7. (The resynchronization step) FR is loaded with C[3] through 3718 C[BS+2]. 3720 8. FR is encrypted to produce FRE. 3722 9. FRE is xored with the first BS octets of the given plaintext, 3723 now that we have finished encrypting the BS+2 octets of prefixed 3724 data. This produces C[BS+3] through C[BS+(BS+2)], the next BS 3725 octets of ciphertext. 3727 10. FR is loaded with C[BS+3] to C[BS + (BS+2)] (which is C11-C18 3728 for an 8-octet block). 3730 11. FR is encrypted to produce FRE. 3732 12. FRE is xored with the next BS octets of plaintext, to produce 3733 the next BS octets of ciphertext. These are loaded into FR and 3734 the process is repeated until the plaintext is used up. 3736 13.10. Private or Experimental Parameters 3738 S2K specifiers, Signature subpacket types, user attribute types, 3739 image format types, and algorithms described in Section 9 all 3740 reserve the range 100 to 110 for private and experimental use. 3741 Packet types reserve the range 60 to 63 for private and experimental 3742 use. These are intentionally managed with the PRIVATE USE method, as 3743 described in [RFC2434]. 3745 However, implementations need to be careful with these and promote 3746 them to full IANA-managed parameters when they grow beyond the 3747 original, limited system. 3749 13.11. Extension of the MDC System 3751 As described in the non-normative explanation in section 5.13, the 3752 MDC system is uniquely unparameterized in OpenPGP, and that this was 3753 an intentional decision to avoid cross-grade attacks. If the MDC 3754 system is extended to a stronger hash function, there must be care 3755 given to avoiding downgrade and cross-grade attacks. 3757 One simple way to do this is to create new packets for a new MDC. 3758 For example, instead of the MDC system using packets 18 and 19, a 3759 new MDC could use 20 and 21. This has obvious drawbacks (it uses two 3760 packet numbers for each new hash function in a space that is limited 3761 to a maximum of 60). 3763 Another simple way to extend the MDC system is to create new 3764 versions of packet 18, and reflect this in packet 19. For example, 3765 suppose that V2 of packet 18 implicitly used SHA-256. This would 3766 require packet 19 to have a length of 32 octets. The change in the 3767 version in packet 18 and the size of packet 19 prevent a downgrade 3768 attack. 3770 There are two drawbacks to this latter approach. The first is that 3771 using the version number of a packet to carry algorithm information 3772 is not tidy from a protocol-design standpoint. it is possible that 3773 there might be several versions of the MDC system in common use, but 3774 this untidiness would reflect untidiness in cryptographic consensus 3775 about hash function security. The second is that different versions 3776 of packet 19 would have to have unique sizes. If there were two 3777 versions each with 256-bit hashes, they could not both have 32-octet 3778 packet 19s without admitting the chance of a cross-grade attack. 3780 Yet another, complex approach to extend the MDC system would be a 3781 hybrid of the two above -- create a new pair of MDC packets that are 3782 fully parameterized, and yet protected from downgrade and 3783 cross-grade. 3785 Any change to the MDC system MUST be done through the IETF CONSENSUS 3786 method, as described in [RFC2434]. 3788 13.12. Meta-Considerations for Expansion 3790 If OpenPGP is extended in a way that is not backwards-compatible, 3791 meaning that old implementations will not gracefully handle their 3792 absence of a new feature, the extension proposal can be declared in 3793 the key holder's self-signature as part of the Features signature 3794 subpacket. 3796 We cannot state definitively what extensions will not be 3797 upwards-compatible, but typically new algorithms are 3798 upwards-compatible, but new packets are not. 3800 If an extension proposal does not update the Features system, it 3801 SHOULD include an explanation of why this is unnecessary. If the 3802 proposal contains neither an extension to the Features system nor an 3803 explanation of why such an extension is unnecessary, the proposal 3804 SHOULD be rejected. 3806 14. Security Considerations 3808 * As with any technology involving cryptography, you should check 3809 the current literature to determine if any algorithms used here 3810 have been found to be vulnerable to attack. 3812 * This specification uses Public Key Cryptography technologies. It 3813 is assumed that the private key portion of a public-private key 3814 pair is controlled and secured by the proper party or parties. 3816 * Certain operations in this specification involve the use of 3817 random numbers. An appropriate entropy source should be used to 3818 generate these numbers. See RFC 4086. 3820 * The MD5 hash algorithm has been found to have weaknesses, with 3821 collisions found in a number of cases. MD5 is deprecated for use 3822 in OpenPGP. Implementations MUST NOT generate new signatures 3823 using MD5 as a hash function. They MAY continue to consider old 3824 signatures that used MD5 as valid. 3826 * SHA-224 and SHA-384 require the same work as SHA-256 and SHA-512 3827 respectively. In general, there are few reasons to use them 3828 outside of DSS compatibility. You need a situation where one 3829 needs more security than smaller hashes, but does not want to 3830 have the full 256-bit or 512-bit data length. 3832 * Many security protocol designers think that it is a bad idea to 3833 use a single key for both privacy (encryption) and integrity 3834 (signatures). In fact, this was one of the motivating forces 3835 behind the V4 key format with separate signature and encryption 3836 keys. If you as an implementer promote dual-use keys, you should 3837 at least be aware of this controversy. 3839 * The DSA algorithm will work with any hash, but is sensitive to 3840 the quality of the hash algorithm. Verifiers should be aware 3841 that even if the signer used a strong hash, an attacker could 3842 have modified the signature to use a weak one. Only signatures 3843 using acceptably strong hash algorithms should be accepted as 3844 valid. 3846 * As OpenPGP combines many different asymmetric, symmetric, and 3847 hash algorithms, each with different measures of strength, care 3848 should be taken that the weakest element of an OpenPGP message 3849 is still sufficiently strong for the purpose at hand. While 3850 consensus about the the strength of a given algorithm may 3851 evolve, NIST Special Publication 800-57 [SP800-57] recommends 3852 the following list of equivalent strengths: 3854 Asymmetric | Hash | Symmetric 3855 key size | size | key size 3856 ------------+--------+----------- 3857 1024 160 80 3858 2048 224 112 3859 3072 256 128 3860 7680 384 192 3861 15360 512 256 3863 * There is a somewhat-related potential security problem in 3864 signatures. If an attacker can find a message that hashes to the 3865 same hash with a different algorithm, a bogus signature 3866 structure can be constructed that evaluates correctly. 3868 For example, suppose Alice DSA signs message M using hash 3869 algorithm H. Suppose that Mallet finds a message M' that has the 3870 same hash value as M with H'. Mallet can then construct a 3871 signature block that verifies as Alice's signature of M' with 3872 H'. However, this would also constitute a weakness in either H 3873 or H' or both. Should this ever occur, a revision will have to 3874 be made to this document to revise the allowed hash algorithms. 3876 * If you are building an authentication system, the recipient may 3877 specify a preferred signing algorithm. However, the signer would 3878 be foolish to use a weak algorithm simply because the recipient 3879 requests it. 3881 * Some of the encryption algorithms mentioned in this document 3882 have been analyzed less than others. For example, although CAST5 3883 is presently considered strong, it has been analyzed less than 3884 TripleDES. Other algorithms may have other controversies 3885 surrounding them. 3887 * In late summer 2002, Jallad, Katz, and Schneier published an 3888 interesting attack on the OpenPGP protocol and some of its 3889 implementations [JKS02]. In this attack, the attacker modifies a 3890 message and sends it to a user who then returns the erroneously 3891 decrypted message to the attacker. The attacker is thus using 3892 the user as a random oracle, and can often decrypt the message. 3894 Compressing data can ameliorate this attack. The incorrectly 3895 decrypted data nearly always decompresses in ways that defeats 3896 the attack. However, this is not a rigorous fix, and leaves open 3897 some small vulnerabilities. For example, if an implementation 3898 does not compress a message before encryption (perhaps because 3899 it knows it was already compressed), then that message is 3900 vulnerable. Because of this happenstance -- that modification 3901 attacks can be thwarted by decompression errors, an 3902 implementation SHOULD treat a decompression error as a security 3903 problem, not merely a data problem. 3905 This attack can be defeated by the use of Modification 3906 Detection, provided that the implementation does not let the 3907 user naively return the data to the attacker. An implementation 3908 MUST treat an MDC failure as a security problem, not merely a 3909 data problem. 3911 In either case, the implementation MAY allow the user access to 3912 the erroneous data, but MUST warn the user as to potential 3913 security problems should that data be returned to the sender. 3915 While this attack is somewhat obscure, requiring a special set 3916 of circumstances to create it, it is nonetheless quite serious 3917 as it permits someone to trick a user to decrypt a message. 3918 Consequently, it is important that: 3920 1. Implementers treat MDC errors and decompression failures as 3921 security problems. 3923 2. Implementers implement Modification Detection with all due 3924 speed and encourage its spread. 3926 3. Users migrate to implementations that support Modification 3927 Detection with all due speed. 3929 * PKCS#1 has been found to be vulnerable to attacks in which a 3930 system that reports errors in padding differently from errors in 3931 decryption becomes a random oracle that can leak the private key 3932 in mere millions of queries. Implementations must be aware of 3933 this attack and prevent it from happening. The simplest solution 3934 is report a single error code for all variants of decryption 3935 errors so as not to leak information to an attacker. 3937 * Some technologies mentioned here may be subject to government 3938 control in some countries. 3940 * In winter 2005, Serge Mister and Robert Zuccherato from Entrust 3941 released a paper describing a way that the "quick check" in 3942 OpenPGP CFB mode can be used with a random oracle to decrypt two 3943 octets of every cipher block [MZ05]. They recommend as 3944 prevention not using the quick check at all. 3946 Many implementers have taken this advice to heart for any data 3947 that is symmetrically encrypted and for which the session key is 3948 public-key encrypted. In this case, the quick check is not 3949 needed as the public key encryption of the session key should 3950 guarantee that it is the right session key. In other cases, the 3951 implementation should use the quick check with care. 3953 On the one hand, there is a danger to using it if there is a 3954 random oracle that can leak information to an attacker. In 3955 plainer language, there is a danger to using the quick check if 3956 timing information about the check can be exposed to an 3957 attacker, particularly via an automated service that allows 3958 rapidly repeated queries. 3960 On the other hand, it is inconvenient to the user to be informed 3961 that they typed in the wrong passphrase only after a petabyte of 3962 data is decrypted. There are many cases in cryptographic 3963 engineering where the implementer must use care and wisdom, and 3964 this is one. 3966 15. Implementation Nits 3968 This section is a collection of comments to help an implementer, 3969 particularly with an eye to backward compatibility. Previous 3970 implementations of PGP are not OpenPGP-compliant. Often the 3971 differences are small, but small differences are frequently more 3972 vexing than large differences. Thus, this is a non-comprehensive 3973 list of potential problems and gotchas for a developer who is trying 3974 to be backward-compatible. 3976 * The IDEA algorithm is patented, and yet it is required for PGP 3977 2.x interoperability. It is also the de-facto preferred 3978 algorithm for a V3 key with a V3 self-signature (or no 3979 self-signature). 3981 * When exporting a private key, PGP 2.x generates the header 3982 "BEGIN PGP SECRET KEY BLOCK" instead of "BEGIN PGP PRIVATE KEY 3983 BLOCK". All previous versions ignore the implied data type, and 3984 look directly at the packet data type. 3986 * PGP 2.0 through 2.5 generated V2 Public Key Packets. These are 3987 identical to the deprecated V3 keys except for the version 3988 number. An implementation MUST NOT generate them and may accept 3989 or reject them as it sees fit. Some older PGP versions generated 3990 V2 PKESK packets (Tag 1) as well. An implementation may accept 3991 or reject V2 PKESK packets as it sees fit, and MUST NOT generate 3992 them. 3994 * PGP 2.6.x will not accept key-material packets with versions 3995 greater than 3. 3997 * There are many ways possible for two keys to have the same key 3998 material, but different fingerprints (and thus key IDs). Perhaps 3999 the most interesting is an RSA key that has been "upgraded" to 4000 V4 format, but since a V4 fingerprint is constructed by hashing 4001 the key creation time along with other things, two V4 keys 4002 created at different times, yet with the same key material will 4003 have different fingerprints. 4005 * If an implementation is using zlib to interoperate with PGP 2.x, 4006 then the "windowBits" parameter should be set to -13. 4008 * The 0x19 back signatures were not required for signing subkeys 4009 until relatively recently. Consquently, there may be keys in the 4010 wild that do not have these back signatures. Implementing 4011 software may handle these keys as it sees fit. 4013 16. Authors' Addresses 4015 The working group can be contacted via the current chair: 4017 Derek Atkins 4018 IHTFP Consulting, Inc. 4019 6 Farragut Ave 4020 Somerville, MA 02144 USA 4021 Email: derek@ihtfp.com 4022 Tel: +1 617 623 3745 4024 The principal authors of this draft are: 4026 Jon Callas 4027 Email: jon@callas.org 4029 Lutz Donnerhacke 4030 IKS GmbH 4031 Wildenbruchstr. 15 4032 07745 Jena, Germany 4034 EMail: lutz@iks-jena.de 4036 Hal Finney 4037 Email: hal@finney.org 4039 David Shaw 4040 Email: dshaw@jabberwocky.com 4042 Rodney Thayer 4043 Email: rodney@canola-jones.com 4045 This memo also draws on much previous work from a number of other 4046 authors who include: Derek Atkins, Charles Breed, Dave Del Torto, 4047 Marc Dyksterhouse, Gail Haspert, Gene Hoffman, Paul Hoffman, Ben 4048 Laurie, Raph Levien, Colin Plumb, Will Price, David Shaw, William 4049 Stallings, Mark Weaver, and Philip R. Zimmermann. 4051 17. References (Normative) 4053 [AES] NIST, FIPS PUB 197, "Advanced Encryption Standard 4054 (AES)," November 2001. 4056 http://csrc.nist.gov/publications/fips/fips197/ 4057 fips-197.{ps,pdf} 4059 [BLOWFISH] Schneier, B. "Description of a New Variable-Length 4060 Key, 64-Bit Block Cipher (Blowfish)" Fast Software 4061 Encryption, Cambridge Security Workshop Proceedings 4062 (December 1993), Springer-Verlag, 1994, pp191-204 4063 4065 [BZ2] J. Seward, jseward@acm.org, "The Bzip2 and libbzip2 4066 home page" 4068 [ELGAMAL] T. Elgamal, "A Public-Key Cryptosystem and a 4069 Signature Scheme Based on Discrete Logarithms," 4070 IEEE Transactions on Information Theory, v. IT-31, 4071 n. 4, 1985, pp. 469-472. 4073 [FIPS180] Secure Hash Signature Standard (SHS) (FIPS PUB 4074 180-2). 4075 4078 [FIPS186] Digital Signature Standard (DSS) (FIPS PUB 186-2). 4079 4081 FIPS 186-3 describes keys greater than 1024 bits. 4082 The latest draft is at: 4083 4086 [HAC] Alfred Menezes, Paul van Oorschot, and Scott 4087 Vanstone, "Handbook of Applied Cryptography," CRC 4088 Press, 1996. 4089 4091 [IDEA] Lai, X, "On the design and security of block 4092 ciphers", ETH Series in Information Processing, 4093 J.L. Massey (editor), Vol. 1, Hartung-Gorre Verlag 4094 Knostanz, Technische Hochschule (Zurich), 1992 4096 [ISO10646] ISO/IEC 10646-1:1993. International Standard -- 4097 Information technology -- Universal Multiple-Octet 4098 Coded Character Set (UCS) -- Part 1: Architecture 4099 and Basic Multilingual Plane. 4101 [JFIF] JPEG File Interchange Format (Version 1.02). 4102 Eric Hamilton, C-Cube Microsystems, Milpitas, CA, 4103 September 1, 1992. 4105 [RFC1991] Atkins, D., Stallings, W. and P. Zimmermann, "PGP 4106 Message Exchange Formats", RFC 1991, August 1996. 4108 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 4109 Requirement Level", BCP 14, RFC 2119, March 1997. 4110 [RFC2045] Borenstein, N. and N. Freed, "Multipurpose Internet 4111 Mail Extensions (MIME) Part One: Format of Internet 4112 Message Bodies.", RFC 2045, November 1996. 4114 [RFC2144] Adams, C., "The CAST-128 Encryption Algorithm", RFC 4115 2144, May 1997. 4117 [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for 4118 Writing an IANA Considerations Section in RFCs", 4119 BCP 26, RFC 2434, October 1998. 4120 [RFC2822] Resnick, P., "Internet Message Format", RFC 2822. 4122 [RFC3156] M. Elkins, D. Del Torto, R. Levien, T. Roessler, 4123 "MIME Security with OpenPGP", RFC 3156, 4124 August 2001. 4126 [RFC3447] B. Kaliski and J. Staddon, "PKCS #1: RSA 4127 Cryptography Specifications Version 2.1", 4128 RFC 3447, February 2003. 4130 [RFC3629] Yergeau., F., "UTF-8, a transformation format of 4131 Unicode and ISO 10646", RFC 3629, November 2003. 4133 [RFC4086] Eastlake, D., Crocker, S. and J. Schiller, 4134 "Randomness Recommendations for Security", RFC 4135 4086, June 2005. 4137 [SCHNEIER] Schneier, B., "Applied Cryptography Second Edition: 4138 protocols, algorithms, and source code in C", 1996. 4140 [TWOFISH] B. Schneier, J. Kelsey, D. Whiting, D. Wagner, C. 4141 Hall, and N. Ferguson, "The Twofish Encryption 4142 Algorithm", John Wiley & Sons, 1999. 4144 18. References (Informative) 4146 [BLEICHENBACHER] Bleichenbacher, Daniel, "Generating Elgamal 4147 signatures without knowing the secret key," 4148 Eurocrypt 96. Note that the version in the 4149 proceedings has an error. A revised version is 4150 available at the time of writing from 4151 4154 [JKS02] Kahil Jallad, Jonathan Katz, Bruce Schneier 4155 "Implementation of Chosen-Ciphertext Attacks 4156 against PGP and GnuPG" 4157 http://www.counterpane.com/pgp-attack.html 4159 [MAURER] Ueli Maurer, "Modelling a Public-Key 4160 Infrastructure", Proc. 1996 European Symposium on 4161 Research in Computer Security (ESORICS' 96), 4162 Lecture Notes in Computer Science, Springer-Verlag, 4163 vol. 1146, pp. 325-350, Sep 1996. 4165 [MZ05] Serge Mister, Robert Zuccherato, "An Attack on 4166 CFB Mode Encryption As Used By OpenPGP," IACR 4167 ePrint Archive: Report 2005/033, 8 Feb 2005 4168 http://eprint.iacr.org/2005/033 4170 [RFC1423] Balenson, D., "Privacy Enhancement for Internet 4171 Electronic Mail: Part III: Algorithms, Modes, and 4172 Identifiers", RFC 1423, October 1993. 4174 [RFC1951] Deutsch, P., "DEFLATE Compressed Data Format 4175 Specification version 1.3.", RFC 1951, May 1996. 4177 [RFC2440] Callas, J., Donnerhacke, L., Finney, H., and 4178 Thayer, R. "OpenPGP Message Format", RFC 2440, 4179 November, 1998. 4181 [SP800-57] NIST Special Publication 800-57, Recommendation on 4182 Key Management 4183 4185 4188 19. Full Copyright Statement 4190 Copyright (C) 2007 by The IETF Trust. 4192 This document is subject to the rights, licenses and restrictions 4193 contained in BCP 78, and except as set forth therein, the authors 4194 retain all their rights. 4196 This document and the information contained herein are provided on 4197 an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE 4198 REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE 4199 IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL 4200 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY 4201 WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE 4202 ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS 4203 FOR A PARTICULAR PURPOSE. 4205 This document and translations of it may be copied and furnished to 4206 others, and derivative works that comment on or otherwise explain it 4207 or assist in its implementation may be prepared, copied, published 4208 and distributed, in whole or in part, without restriction of any 4209 kind, provided that the above copyright notice and this paragraph 4210 are included on all such copies and derivative works. However, this 4211 document itself may not be modified in any way, such as by removing 4212 the copyright notice or references to the Internet Society or other 4213 Internet organizations, except as needed for the purpose of 4214 developing Internet standards in which case the procedures for 4215 copyrights defined in the Internet Standards process must be 4216 followed, or as required to translate it into languages other than 4217 English. 4219 The limited permissions granted above are perpetual and will not be 4220 revoked by the Internet Society or its successors or assigns. 4222 20. Intellectual Property 4224 The IETF takes no position regarding the validity or scope of any 4225 Intellectual Property Rights or other rights that might be claimed 4226 to pertain to the implementation or use of the technology described 4227 in this document or the extent to which any license under such 4228 rights might or might not be available; nor does it represent that 4229 it has made any independent effort to identify any such rights. 4230 Information on the procedures with respect to rights in RFC 4231 documents can be found in BCP 78 and BCP 79. 4233 Copies of IPR disclosures made to the IETF Secretariat and any 4234 assurances of licenses to be made available, or the result of an 4235 attempt made to obtain a general license or permission for the use 4236 of such proprietary rights by implementers or users of this 4237 specification can be obtained from the IETF on-line IPR repository 4238 at http://www.ietf.org/ipr. 4240 The IETF invites any interested party to bring to its attention any 4241 copyrights, patents or patent applications, or other proprietary 4242 rights that may cover technology that may be required to implement 4243 this standard. Please address the information to the IETF at 4244 ietf-ipr@ietf.org.