idnits 2.17.1 draft-koch-openpgp-rfc4880bis-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack a Security Considerations section. ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) -- The draft header indicates that this document updates RFC4880, but the abstract doesn't seem to mention this, which it should. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year (Using the creation date from RFC4880, updated by this document, for RFC5378 checks: 1999-12-21) -- 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 (November 4, 2015) is 3096 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 368 -- Looks like a reference, but probably isn't: '1' on line 3949 -- Looks like a reference, but probably isn't: '2' on line 368 -- Looks like a reference, but probably isn't: '3' on line 3958 == Missing Reference: 'REGEX' is mentioned on line 1421, but not defined == Missing Reference: 'Optional' is mentioned on line 2040, but not defined == Missing Reference: 'Binding-Signature-Revocation' is mentioned on line 3369, but not defined == Missing Reference: 'BLEICHENBACHER' is mentioned on line 3909, but not defined == Missing Reference: 'BS' is mentioned on line 3949, but not defined == Missing Reference: 'JKS02' is mentioned on line 4128, but not defined == Missing Reference: 'MZ05' is mentioned on line 4181, but not defined -- Possible downref: Non-RFC (?) normative reference: ref. 'AES' -- Possible downref: Non-RFC (?) normative reference: ref. 'BLOWFISH' -- Possible downref: Non-RFC (?) normative reference: ref. 'BZ2' -- Possible downref: Non-RFC (?) normative reference: ref. 'ELGAMAL' -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS180' -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS180-3' -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS186' -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS186-3' -- Possible downref: Non-RFC (?) normative reference: ref. 'HAC' -- Possible downref: Non-RFC (?) normative reference: ref. 'IDEA' -- Possible downref: Non-RFC (?) normative reference: ref. 'ISO10646' -- Possible downref: Non-RFC (?) normative reference: ref. 'JFIF' -- Possible downref: Non-RFC (?) normative reference: ref. 'PKCS5' ** Downref: Normative reference to an Informational RFC: RFC 1950 ** Downref: Normative reference to an Informational RFC: RFC 1951 ** Downref: Normative reference to an Informational RFC: RFC 2144 ** Obsolete normative reference: RFC 2434 (Obsoleted by RFC 5226) ** Obsolete normative reference: RFC 2822 (Obsoleted by RFC 5322) ** Downref: Normative reference to an Informational RFC: RFC 3394 ** Obsolete normative reference: RFC 3447 (Obsoleted by RFC 8017) ** Downref: Normative reference to an Informational RFC: RFC 3713 -- Possible downref: Non-RFC (?) normative reference: ref. 'SCHNEIER' -- Possible downref: Non-RFC (?) normative reference: ref. 'SP800-56A' -- Possible downref: Non-RFC (?) normative reference: ref. 'SuiteB' -- Possible downref: Non-RFC (?) normative reference: ref. 'TWOFISH' -- Obsolete informational reference (is this intentional?): RFC 1991 (Obsoleted by RFC 4880) -- Obsolete informational reference (is this intentional?): RFC 2440 (Obsoleted by RFC 4880) Summary: 10 errors (**), 0 flaws (~~), 8 warnings (==), 27 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group W. Koch 3 Internet-Draft 4 Updates: 4880 (if approved) November 4, 2015 5 Intended status: Standards Track 6 Expires: May 7, 2016 8 OpenPGP Message Format 9 draft-koch-openpgp-rfc4880bis-01 11 Abstract 13 { Work in progress to update OpenPGP } 15 This document is maintained in order to publish all necessary 16 information needed to develop interoperable applications based on the 17 OpenPGP format. It is not a step-by-step cookbook for writing an 18 application. It describes only the format and methods needed to 19 read, check, generate, and write conforming packets crossing any 20 network. It does not deal with storage and implementation questions. 21 It does, however, discuss implementation issues necessary to avoid 22 security flaws. 24 OpenPGP software uses a combination of strong public-key and 25 symmetric cryptography to provide security services for electronic 26 communications and data storage. These services include 27 confidentiality, key management, authentication, and digital 28 signatures. This document specifies the message formats used in 29 OpenPGP. 31 Status of This Memo 33 This Internet-Draft is submitted in full conformance with the 34 provisions of BCP 78 and BCP 79. 36 Internet-Drafts are working documents of the Internet Engineering 37 Task Force (IETF). Note that other groups may also distribute 38 working documents as Internet-Drafts. The list of current Internet- 39 Drafts is at http://datatracker.ietf.org/drafts/current/. 41 Internet-Drafts are draft documents valid for a maximum of six months 42 and may be updated, replaced, or obsoleted by other documents at any 43 time. It is inappropriate to use Internet-Drafts as reference 44 material or to cite them other than as "work in progress." 46 This Internet-Draft will expire on May 7, 2016. 48 Copyright Notice 50 Copyright (c) 2015 IETF Trust and the persons identified as the 51 document authors. All rights reserved. 53 This document is subject to BCP 78 and the IETF Trust's Legal 54 Provisions Relating to IETF Documents 55 (http://trustee.ietf.org/license-info) in effect on the date of 56 publication of this document. Please review these documents 57 carefully, as they describe your rights and restrictions with respect 58 to this document. Code Components extracted from this document must 59 include Simplified BSD License text as described in Section 4.e of 60 the Trust Legal Provisions and are provided without warranty as 61 described in the Simplified BSD License. 63 Table of Contents 65 1. {1} Introduction . . . . . . . . . . . . . . . . . . . . . . 4 66 1.1. {1.1} Terms . . . . . . . . . . . . . . . . . . . . . . . 5 67 2. {2} General functions . . . . . . . . . . . . . . . . . . . . 6 68 2.1. {2.1} Confidentiality via Encryption . . . . . . . . . . 6 69 2.2. {2.2} Authentication via Digital Signature . . . . . . . 7 70 2.3. {2.3} Compression . . . . . . . . . . . . . . . . . . . . 7 71 2.4. {2.4} Conversion to Radix-64 . . . . . . . . . . . . . . 8 72 2.5. {2.5} Signature-Only Applications . . . . . . . . . . . . 8 73 3. {3} Data Element Formats . . . . . . . . . . . . . . . . . . 8 74 3.1. {3.1} Scalar Numbers . . . . . . . . . . . . . . . . . . 8 75 3.2. {3.2} Multiprecision Integers . . . . . . . . . . . . . . 8 76 3.3. {3.3} Key IDs . . . . . . . . . . . . . . . . . . . . . . 9 77 3.4. {3.4} Text . . . . . . . . . . . . . . . . . . . . . . . 9 78 3.5. {3.5} Time Fields . . . . . . . . . . . . . . . . . . . . 9 79 3.6. {3.6} Keyrings . . . . . . . . . . . . . . . . . . . . . 9 80 3.7. {3.7} String-to-Key (S2K) Specifiers . . . . . . . . . . 10 81 3.7.1. {3.7.1} String-to-Key (S2K) Specifier Types . . . . . 10 82 3.7.2. {3.7.2} String-to-Key Usage . . . . . . . . . . . . . 12 83 4. {4} Packet Syntax . . . . . . . . . . . . . . . . . . . . . . 13 84 4.1. {4.1} Overview . . . . . . . . . . . . . . . . . . . . . 13 85 4.2. {4.2} Packet Headers . . . . . . . . . . . . . . . . . . 13 86 4.2.1. {4.2.1} Old Format Packet Lengths . . . . . . . . . . 14 87 4.2.2. {4.2.2} New Format Packet Lengths . . . . . . . . . . 14 88 4.2.3. {4.2.3} Packet Length Examples . . . . . . . . . . . 16 89 4.3. {4.3} Packet Tags . . . . . . . . . . . . . . . . . . . . 16 90 5. {5} Packet Types . . . . . . . . . . . . . . . . . . . . . . 17 91 5.1. {5.1} Public-Key Encrypted Session Key Packets (Tag 1) . 17 92 5.2. {5.2} Signature Packet (Tag 2) . . . . . . . . . . . . . 19 93 5.2.1. {5.2.1} Signature Types . . . . . . . . . . . . . . . 19 94 5.2.2. {5.2.2} Version 3 Signature Packet Format . . . . . . 21 95 5.2.3. {5.2.3} Version 4 Signature Packet Format . . . . . . 24 96 5.2.4. {5.2.4} Computing Signatures . . . . . . . . . . . . 37 97 5.3. {5.3} Symmetric-Key Encrypted Session Key Packets (Tag 3) 38 98 5.4. {5.4} One-Pass Signature Packets (Tag 4) . . . . . . . . 39 99 5.5. {5.5} Key Material Packet . . . . . . . . . . . . . . . . 40 100 5.5.1. {5.5.1} Key Packet Variants . . . . . . . . . . . . . 40 101 5.5.2. {5.5.2} Public-Key Packet Formats . . . . . . . . . . 41 102 5.5.3. {5.5.3} Secret-Key Packet Formats . . . . . . . . . . 43 103 5.6. {5.6} Compressed Data Packet (Tag 8) . . . . . . . . . . 45 104 5.7. {5.7} Symmetrically Encrypted Data Packet (Tag 9) . . . . 46 105 5.8. {5.8} Marker Packet (Obsolete Literal Packet) (Tag 10) . 47 106 5.9. {5.9} Literal Data Packet (Tag 11) . . . . . . . . . . . 47 107 5.10. {5.10} Trust Packet (Tag 12) . . . . . . . . . . . . . . 48 108 5.11. {5.11} User ID Packet (Tag 13) . . . . . . . . . . . . . 48 109 5.12. {5.12} User Attribute Packet (Tag 17) . . . . . . . . . . 49 110 5.12.1. {5.12.1} The Image Attribute Subpacket . . . . . . . 49 111 5.13. {5.13} Sym. Encrypted Integrity Protected Data Packet 112 (Tag 18) . . . . . . . . . . . . . . . . . . . . . . . . 50 113 5.14. {5.14} Modification Detection Code Packet (Tag 19) . . . 53 114 6. {6} Radix-64 Conversions . . . . . . . . . . . . . . . . . . 54 115 6.1. {6.1} An Implementation of the CRC-24 in "C" . . . . . . 54 116 6.2. {6.2} Forming ASCII Armor . . . . . . . . . . . . . . . . 55 117 6.3. {6.3} Encoding Binary in Radix-64 . . . . . . . . . . . . 57 118 6.4. {6.4} Decoding Radix-64 . . . . . . . . . . . . . . . . . 59 119 6.5. {6.5} Examples of Radix-64 . . . . . . . . . . . . . . . 59 120 6.6. {6.6} Example of an ASCII Armored Message . . . . . . . . 60 121 7. {7} Cleartext Signature Framework . . . . . . . . . . . . . . 60 122 7.1. {7.1} Dash-Escaped Text . . . . . . . . . . . . . . . . . 61 123 8. {8} Regular Expressions . . . . . . . . . . . . . . . . . . . 62 124 9. {9} Constants . . . . . . . . . . . . . . . . . . . . . . . . 62 125 9.1. {9.1} Public-Key Algorithms . . . . . . . . . . . . . . . 63 126 9.2. ECC Curve OID . . . . . . . . . . . . . . . . . . . . . . 63 127 9.3. {9.2} Symmetric-Key Algorithms . . . . . . . . . . . . . 64 128 9.4. {9.3} Compression Algorithms . . . . . . . . . . . . . . 65 129 9.5. {9.4} Hash Algorithms . . . . . . . . . . . . . . . . . . 65 130 10. {10} IANA Considerations . . . . . . . . . . . . . . . . . . 66 131 10.1. {10.1} New String-to-Key Specifier Types . . . . . . . . 66 132 10.2. {10.2} New Packets . . . . . . . . . . . . . . . . . . . 66 133 10.2.1. {10.2.1} User Attribute Types . . . . . . . . . . . 66 134 10.2.2. {10.2.1.1} Image Format Subpacket Types . . . . . . 66 135 10.2.3. {10.2.2} New Signature Subpackets . . . . . . . . . 67 136 10.2.4. {10.2.3} New Packet Versions . . . . . . . . . . . . 68 137 10.3. {10.3} New Algorithms . . . . . . . . . . . . . . . . . 68 138 10.3.1. {10.3.1} Public-Key Algorithms . . . . . . . . . . . 69 139 10.3.2. {10.3.2} Symmetric-Key Algorithms . . . . . . . . . 69 140 10.3.3. {10.3.3} Hash Algorithms . . . . . . . . . . . . . . 69 141 10.3.4. {10.3.4} Compression Algorithms . . . . . . . . . . 69 142 11. {11} Packet Composition . . . . . . . . . . . . . . . . . . . 69 143 11.1. {11.1} Transferable Public Keys . . . . . . . . . . . . 70 144 11.2. {11.2} Transferable Secret Keys . . . . . . . . . . . . 71 145 11.3. {11.3} OpenPGP Messages . . . . . . . . . . . . . . . . 71 146 11.4. {11.4} Detached Signatures . . . . . . . . . . . . . . . 72 147 12. {12} Enhanced Key Formats . . . . . . . . . . . . . . . . . . 72 148 12.1. {12.1} Key Structures . . . . . . . . . . . . . . . . . 72 149 12.2. {12.2} Key IDs and Fingerprints . . . . . . . . . . . . 73 150 13. Elliptic Curve Cryptography . . . . . . . . . . . . . . . . . 74 151 13.1. Supported ECC Curves . . . . . . . . . . . . . . . . . . 75 152 13.2. ECC Conversion Primitives . . . . . . . . . . . . . . . 75 153 13.3. Key Derivation Function . . . . . . . . . . . . . . . . 75 154 13.4. EC DH Algorithm (ECDH) . . . . . . . . . . . . . . . . . 76 155 14. {13} Notes on Algorithms . . . . . . . . . . . . . . . . . . 79 156 14.1. {13.1} PKCS#1 Encoding in OpenPGP . . . . . . . . . . . 79 157 14.1.1. {13.1.1} EME-PKCS1-v1_5-ENCODE . . . . . . . . . . . 79 158 14.1.2. {13.1.2} EME-PKCS1-v1_5-DECODE . . . . . . . . . . . 79 159 14.1.3. {13.1.3} EMSA-PKCS1-v1_5 . . . . . . . . . . . . . . 80 160 14.2. {13.2} Symmetric Algorithm Preferences . . . . . . . . . 81 161 14.3. {13.3} Other Algorithm Preferences . . . . . . . . . . . 82 162 14.3.1. {13.3.1} Compression Preferences . . . . . . . . . . 82 163 14.3.2. {13.3.2} Hash Algorithm Preferences . . . . . . . . 83 164 14.4. {13.4} Plaintext . . . . . . . . . . . . . . . . . . . . 83 165 14.5. {13.5} RSA . . . . . . . . . . . . . . . . . . . . . . . 83 166 14.6. {13.6} DSA . . . . . . . . . . . . . . . . . . . . . . . 83 167 14.7. {13.7} Elgamal . . . . . . . . . . . . . . . . . . . . . 84 168 14.8. {13.8} Reserved Algorithm Numbers . . . . . . . . . . . 84 169 14.9. {13.9} OpenPGP CFB Mode . . . . . . . . . . . . . . . . 84 170 14.10. {13.10} Private or Experimental Parameters . . . . . . . 86 171 14.11. {13.11} Extension of the MDC System . . . . . . . . . . 86 172 14.12. {13.12} Meta-Considerations for Expansion . . . . . . . 87 173 15. {14} Security Considerations . . . . . . . . . . . . . . . . 87 174 16. Compatibility Profiles . . . . . . . . . . . . . . . . . . . 93 175 16.1. OpenPGP ECC Profile . . . . . . . . . . . . . . . . . . 93 176 16.2. Suite-B Profile . . . . . . . . . . . . . . . . . . . . 93 177 16.3. Security Strength at 192 Bits . . . . . . . . . . . . . 93 178 16.4. Security Strength at 128 Bits . . . . . . . . . . . . . 94 179 17. {15} Implementation Nits . . . . . . . . . . . . . . . . . . 94 180 18. References . . . . . . . . . . . . . . . . . . . . . . . . . 95 181 18.1. Normative References . . . . . . . . . . . . . . . . . . 95 182 18.2. Informative References . . . . . . . . . . . . . . . . . 98 183 Appendix A. Changes since RFC-4880 . . . . . . . . . . . . . . . 98 184 Appendix B. The principal authors of RFC-4880 are as follows: . 99 185 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 99 187 1. {1} Introduction 189 { This is work in progress to update OpenPGP. Editorial notes are 190 enclosed in curly braces. The section numbers from RFC4880 are also 191 indicated in curly braces. } 192 This document provides information on the message-exchange packet 193 formats used by OpenPGP to provide encryption, decryption, signing, 194 and key management functions. It is a revision of RFC 2440, "OpenPGP 195 Message Format", which itself replaces RFC 1991, "PGP Message 196 Exchange Formats" [RFC1991] [RFC2440]. 198 This document obsoletes: RFC 5581 (Camellia cipher) and RFC 6637 (ECC 199 for OpenPGP) 201 1.1. {1.1} Terms 203 o OpenPGP - This is a term for security software that uses PGP 5.x 204 as a basis, formalized in RFC 2440 and this document. 206 o PGP - Pretty Good Privacy. PGP is a family of software systems 207 developed by Philip R. Zimmermann from which OpenPGP is based. 209 o PGP 2.6.x - This version of PGP has many variants, hence the term 210 PGP 2.6.x. It used only RSA, MD5, and IDEA for its cryptographic 211 transforms. An informational RFC, RFC 1991, was written 212 describing this version of PGP. 214 o PGP 5.x - This version of PGP is formerly known as "PGP 3" in the 215 community and also in the predecessor of this document, RFC 1991. 216 It has new formats and corrects a number of problems in the PGP 217 2.6.x design. It is referred to here as PGP 5.x because that 218 software was the first release of the "PGP 3" code base. 220 o GnuPG - GNU Privacy Guard, also called GPG. GnuPG is an OpenPGP 221 implementation that avoids all encumbered algorithms. 222 Consequently, early versions of GnuPG did not include RSA public 223 keys. GnuPG may or may not have (depending on version) support 224 for IDEA or other encumbered algorithms. 226 "PGP", "Pretty Good", and "Pretty Good Privacy" are trademarks of PGP 227 Corporation and are used with permission. The term "OpenPGP" refers 228 to the protocol described in this and related documents. 230 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 231 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 232 document are to be interpreted as described in [RFC2119]. 234 The key words "PRIVATE USE", "HIERARCHICAL ALLOCATION", "FIRST COME 235 FIRST SERVED", "EXPERT REVIEW", "SPECIFICATION REQUIRED", "IESG 236 APPROVAL", "IETF CONSENSUS", and "STANDARDS ACTION" that appear in 237 this document when used to describe namespace allocation are to be 238 interpreted as described in [RFC2434]. 240 2. {2} General functions 242 OpenPGP provides data integrity services for messages and data files 243 by using these core technologies: 245 o digital signatures 247 o encryption 249 o compression 251 o Radix-64 conversion 253 In addition, OpenPGP provides key management and certificate 254 services, but many of these are beyond the scope of this document. 256 2.1. {2.1} Confidentiality via Encryption 258 OpenPGP combines symmetric-key encryption and public-key encryption 259 to provide confidentiality. When made confidential, first the object 260 is encrypted using a symmetric encryption algorithm. Each symmetric 261 key is used only once, for a single object. A new "session key" is 262 generated as a random number for each object (sometimes referred to 263 as a session). Since it is used only once, the session key is bound 264 to the message and transmitted with it. To protect the key, it is 265 encrypted with the receiver's public key. The sequence is as 266 follows: 268 1. The sender creates a message. 270 2. The sending OpenPGP generates a random number to be used as a 271 session key for this message only. 273 3. The session key is encrypted using each recipient's public key. 274 These "encrypted session keys" start the message. 276 4. The sending OpenPGP encrypts the message using the session key, 277 which forms the remainder of the message. Note that the message 278 is also usually compressed. 280 5. The receiving OpenPGP decrypts the session key using the 281 recipient's private key. 283 6. The receiving OpenPGP decrypts the message using the session key. 284 If the message was compressed, it will be decompressed. 286 With symmetric-key encryption, an object may be encrypted with a 287 symmetric key derived from a passphrase (or other shared secret), or 288 a two-stage mechanism similar to the public-key method described 289 above in which a session key is itself encrypted with a symmetric 290 algorithm keyed from a shared secret. 292 Both digital signature and confidentiality services may be applied to 293 the same message. First, a signature is generated for the message 294 and attached to the message. Then the message plus signature is 295 encrypted using a symmetric session key. Finally, the session key is 296 encrypted using public-key encryption and prefixed to the encrypted 297 block. 299 2.2. {2.2} Authentication via Digital Signature 301 The digital signature uses a hash code or message digest algorithm, 302 and a public-key signature algorithm. The sequence is as follows: 304 1. The sender creates a message. 306 2. The sending software generates a hash code of the message. 308 3. The sending software generates a signature from the hash code 309 using the sender's private key. 311 4. The binary signature is attached to the message. 313 5. The receiving software keeps a copy of the message signature. 315 6. The receiving software generates a new hash code for the received 316 message and verifies it using the message's signature. If the 317 verification is successful, the message is accepted as authentic. 319 2.3. {2.3} Compression 321 OpenPGP implementations SHOULD compress the message after applying 322 the signature but before encryption. 324 If an implementation does not implement compression, its authors 325 should be aware that most OpenPGP messages in the world are 326 compressed. Thus, it may even be wise for a space-constrained 327 implementation to implement decompression, but not compression. 329 Furthermore, compression has the added side effect that some types of 330 attacks can be thwarted by the fact that slightly altered, compressed 331 data rarely uncompresses without severe errors. This is hardly 332 rigorous, but it is operationally useful. These attacks can be 333 rigorously prevented by implementing and using Modification Detection 334 Codes as described in sections following. 336 2.4. {2.4} Conversion to Radix-64 338 OpenPGP's underlying native representation for encrypted messages, 339 signature certificates, and keys is a stream of arbitrary octets. 340 Some systems only permit the use of blocks consisting of seven-bit, 341 printable text. For transporting OpenPGP's native raw binary octets 342 through channels that are not safe to raw binary data, a printable 343 encoding of these binary octets is needed. OpenPGP provides the 344 service of converting the raw 8-bit binary octet stream to a stream 345 of printable ASCII characters, called Radix-64 encoding or ASCII 346 Armor. 348 Implementations SHOULD provide Radix-64 conversions. 350 2.5. {2.5} Signature-Only Applications 352 OpenPGP is designed for applications that use both encryption and 353 signatures, but there are a number of problems that are solved by a 354 signature-only implementation. Although this specification requires 355 both encryption and signatures, it is reasonable for there to be 356 subset implementations that are non-conformant only in that they omit 357 encryption. 359 3. {3} Data Element Formats 361 This section describes the data elements used by OpenPGP. 363 3.1. {3.1} Scalar Numbers 365 Scalar numbers are unsigned and are always stored in big-endian 366 format. Using n[k] to refer to the kth octet being interpreted, the 367 value of a two-octet scalar is ((n[0] << 8) + n[1]). The value of a 368 four-octet scalar is ((n[0] << 24) + (n[1] << 16) + (n[2] << 8) + 369 n[3]). 371 3.2. {3.2} Multiprecision Integers 373 Multiprecision integers (also called MPIs) are unsigned integers used 374 to hold large integers such as the ones used in cryptographic 375 calculations. 377 An MPI consists of two pieces: a two-octet scalar that is the length 378 of the MPI in bits followed by a string of octets that contain the 379 actual integer. 381 These octets form a big-endian number; a big-endian number can be 382 made into an MPI by prefixing it with the appropriate length. 384 Examples: 386 (all numbers are in hexadecimal) 388 The string of octets [00 01 01] forms an MPI with the value 1. The 389 string [00 09 01 FF] forms an MPI with the value of 511. 391 Additional rules: 393 The size of an MPI is ((MPI.length + 7) / 8) + 2 octets. 395 The length field of an MPI describes the length starting from its 396 most significant non-zero bit. Thus, the MPI [00 02 01] is not 397 formed correctly. It should be [00 01 01]. 399 Unused bits of an MPI MUST be zero. 401 Also note that when an MPI is encrypted, the length refers to the 402 plaintext MPI. It may be ill-formed in its ciphertext. 404 3.3. {3.3} Key IDs 406 A Key ID is an eight-octet scalar that identifies a key. 407 Implementations SHOULD NOT assume that Key IDs are unique. The 408 section "Enhanced Key Formats" below describes how Key IDs are 409 formed. 411 3.4. {3.4} Text 413 Unless otherwise specified, the character set for text is the UTF-8 414 [RFC3629] encoding of Unicode [ISO10646]. 416 3.5. {3.5} Time Fields 418 A time field is an unsigned four-octet number containing the number 419 of seconds elapsed since midnight, 1 January 1970 UTC. 421 3.6. {3.6} Keyrings 423 A keyring is a collection of one or more keys in a file or database. 424 Traditionally, a keyring is simply a sequential list of keys, but may 425 be any suitable database. It is beyond the scope of this standard to 426 discuss the details of keyrings or other databases. 428 3.7. {3.7} String-to-Key (S2K) Specifiers 430 String-to-key (S2K) specifiers are used to convert passphrase strings 431 into symmetric-key encryption/decryption keys. They are used in two 432 places, currently: to encrypt the secret part of private keys in the 433 private keyring, and to convert passphrases to encryption keys for 434 symmetrically encrypted messages. 436 3.7.1. {3.7.1} String-to-Key (S2K) Specifier Types 438 There are three types of S2K specifiers currently supported, and some 439 reserved values: 441 +-------------+---------------------------+ 442 | ID | S2K Type | 443 +-------------+---------------------------+ 444 | 0 | Simple S2K | 445 | 1 | Salted S2K | 446 | 2 | Reserved value | 447 | 3 | Iterated and Salted S2K | 448 | 100 to 110 | Private/Experimental S2K | 449 +-------------+---------------------------+ 451 These are described in the following Sections. 453 3.7.1.1. {3.7.1.1} Simple S2K 455 This directly hashes the string to produce the key data. See below 456 for how this hashing is done. 458 Octet 0: 0x00 459 Octet 1: hash algorithm 461 Simple S2K hashes the passphrase to produce the session key. The 462 manner in which this is done depends on the size of the session key 463 (which will depend on the cipher used) and the size of the hash 464 algorithm's output. If the hash size is greater than the session key 465 size, the high-order (leftmost) octets of the hash are used as the 466 key. 468 If the hash size is less than the key size, multiple instances of the 469 hash context are created -- enough to produce the required key data. 470 These instances are preloaded with 0, 1, 2, ... octets of zeros (that 471 is to say, the first instance has no preloading, the second gets 472 preloaded with 1 octet of zero, the third is preloaded with two 473 octets of zeros, and so forth). 475 As the data is hashed, it is given independently to each hash 476 context. Since the contexts have been initialized differently, they 477 will each produce different hash output. Once the passphrase is 478 hashed, the output data from the multiple hashes is concatenated, 479 first hash leftmost, to produce the key data, with any excess octets 480 on the right discarded. 482 3.7.1.2. {3.7.1.2} Salted S2K 484 This includes a "salt" value in the S2K specifier -- some arbitrary 485 data -- that gets hashed along with the passphrase string, to help 486 prevent dictionary attacks. 488 Octet 0: 0x01 489 Octet 1: hash algorithm 490 Octets 2-9: 8-octet salt value 492 Salted S2K is exactly like Simple S2K, except that the input to the 493 hash function(s) consists of the 8 octets of salt from the S2K 494 specifier, followed by the passphrase. 496 3.7.1.3. {3.7.1.3} Iterated and Salted S2K 498 This includes both a salt and an octet count. The salt is combined 499 with the passphrase and the resulting value is hashed repeatedly. 500 This further increases the amount of work an attacker must do to try 501 dictionary attacks. 503 Octet 0: 0x03 504 Octet 1: hash algorithm 505 Octets 2-9: 8-octet salt value 506 Octet 10: count, a one-octet, coded value 508 The count is coded into a one-octet number using the following 509 formula: 511 #define EXPBIAS 6 512 count = ((Int32)16 + (c & 15)) << ((c >> 4) + EXPBIAS); 514 The above formula is in C, where "Int32" is a type for a 32-bit 515 integer, and the variable "c" is the coded count, Octet 10. 517 Iterated-Salted S2K hashes the passphrase and salt data multiple 518 times. The total number of octets to be hashed is specified in the 519 encoded count in the S2K specifier. Note that the resulting count 520 value is an octet count of how many octets will be hashed, not an 521 iteration count. 523 Initially, one or more hash contexts are set up as with the other S2K 524 algorithms, depending on how many octets of key data are needed. 525 Then the salt, followed by the passphrase data, is repeatedly hashed 526 until the number of octets specified by the octet count has been 527 hashed. The one exception is that if the octet count is less than 528 the size of the salt plus passphrase, the full salt plus passphrase 529 will be hashed even though that is greater than the octet count. 530 After the hashing is done, the data is unloaded from the hash 531 context(s) as with the other S2K algorithms. 533 3.7.2. {3.7.2} String-to-Key Usage 535 Implementations SHOULD use salted or iterated-and-salted S2K 536 specifiers, as simple S2K specifiers are more vulnerable to 537 dictionary attacks. 539 3.7.2.1. {3.7.2.1} Secret-Key Encryption 541 An S2K specifier can be stored in the secret keyring to specify how 542 to convert the passphrase to a key that unlocks the secret data. 543 Older versions of PGP just stored a cipher algorithm octet preceding 544 the secret data or a zero to indicate that the secret data was 545 unencrypted. The MD5 hash function was always used to convert the 546 passphrase to a key for the specified cipher algorithm. 548 For compatibility, when an S2K specifier is used, the special value 549 254 or 255 is stored in the position where the hash algorithm octet 550 would have been in the old data structure. This is then followed 551 immediately by a one-octet algorithm identifier, and then by the S2K 552 specifier as encoded above. 554 Therefore, preceding the secret data there will be one of these 555 possibilities: 557 0: secret data is unencrypted (no passphrase) 558 255 or 254: followed by algorithm octet and S2K specifier 559 Cipher alg: use Simple S2K algorithm using MD5 hash 561 This last possibility, the cipher algorithm number with an implicit 562 use of MD5 and IDEA, is provided for backward compatibility; it MAY 563 be understood, but SHOULD NOT be generated, and is deprecated. 565 These are followed by an Initial Vector of the same length as the 566 block size of the cipher for the decryption of the secret values, if 567 they are encrypted, and then the secret-key values themselves. 569 3.7.2.2. {3.7.2.2} Symmetric-Key Message Encryption 571 OpenPGP can create a Symmetric-key Encrypted Session Key (ESK) packet 572 at the front of a message. This is used to allow S2K specifiers to 573 be used for the passphrase conversion or to create messages with a 574 mix of symmetric-key ESKs and public-key ESKs. This allows a message 575 to be decrypted either with a passphrase or a public-key pair. 577 PGP 2.X always used IDEA with Simple string-to-key conversion when 578 encrypting a message with a symmetric algorithm. This is deprecated, 579 but MAY be used for backward-compatibility. 581 4. {4} Packet Syntax 583 This section describes the packets used by OpenPGP. 585 4.1. {4.1} Overview 587 An OpenPGP message is constructed from a number of records that are 588 traditionally called packets. A packet is a chunk of data that has a 589 tag specifying its meaning. An OpenPGP message, keyring, 590 certificate, and so forth consists of a number of packets. Some of 591 those packets may contain other OpenPGP packets (for example, a 592 compressed data packet, when uncompressed, contains OpenPGP packets). 594 Each packet consists of a packet header, followed by the packet body. 595 The packet header is of variable length. 597 4.2. {4.2} Packet Headers 599 The first octet of the packet header is called the "Packet Tag". It 600 determines the format of the header and denotes the packet contents. 601 The remainder of the packet header is the length of the packet. 603 Note that the most significant bit is the leftmost bit, called bit 7. 604 A mask for this bit is 0x80 in hexadecimal. 606 +---------------+ 607 PTag |7 6 5 4 3 2 1 0| 608 +---------------+ 609 Bit 7 -- Always one 610 Bit 6 -- New packet format if set 612 PGP 2.6.x only uses old format packets. Thus, software that 613 interoperates with those versions of PGP must only use old format 614 packets. If interoperability is not an issue, the new packet format 615 is RECOMMENDED. Note that old format packets have four bits of 616 packet tags, and new format packets have six; some features cannot be 617 used and still be backward-compatible. 619 Also note that packets with a tag greater than or equal to 16 MUST 620 use new format packets. The old format packets can only express tags 621 less than or equal to 15. 623 Old format packets contain: 625 Bits 5-2 -- packet tag 626 Bits 1-0 -- length-type 628 New format packets contain: 630 Bits 5-0 -- packet tag 632 4.2.1. {4.2.1} Old Format Packet Lengths 634 The meaning of the length-type in old format packets is: 636 0 The packet has a one-octet length. The header is 2 octets long. 638 1 The packet has a two-octet length. The header is 3 octets long. 640 2 The packet has a four-octet length. The header is 5 octets long. 642 3 The packet is of indeterminate length. The header is 1 octet 643 long, and the implementation must determine how long the packet 644 is. If the packet is in a file, this means that the packet 645 extends until the end of the file. In general, an implementation 646 SHOULD NOT use indeterminate-length packets except where the end 647 of the data will be clear from the context, and even then it is 648 better to use a definite length, or a new format header. The new 649 format headers described below have a mechanism for precisely 650 encoding data of indeterminate length. 652 4.2.2. {4.2.2} New Format Packet Lengths 654 New format packets have four possible ways of encoding length: 656 1. A one-octet Body Length header encodes packet lengths of up to 657 191 octets. 659 2. A two-octet Body Length header encodes packet lengths of 192 to 660 8383 octets. 662 3. A five-octet Body Length header encodes packet lengths of up to 663 4,294,967,295 (0xFFFFFFFF) octets in length. (This actually 664 encodes a four-octet scalar number.) 666 4. When the length of the packet body is not known in advance by the 667 issuer, Partial Body Length headers encode a packet of 668 indeterminate length, effectively making it a stream. 670 4.2.2.1. {4.2.2.1} One-Octet Lengths 672 A one-octet Body Length header encodes a length of 0 to 191 octets. 673 This type of length header is recognized because the one octet value 674 is less than 192. The body length is equal to: 676 bodyLen = 1st_octet; 678 4.2.2.2. {4.2.2.2} Two-Octet Lengths 680 A two-octet Body Length header encodes a length of 192 to 8383 681 octets. It is recognized because its first octet is in the range 192 682 to 223. The body length is equal to: 684 bodyLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192 686 4.2.2.3. {4.2.2.3} Five-Octet Lengths 688 A five-octet Body Length header consists of a single octet holding 689 the value 255, followed by a four-octet scalar. The body length is 690 equal to: 692 bodyLen = (2nd_octet << 24) | (3rd_octet << 16) | 693 (4th_octet << 8) | 5th_octet 695 This basic set of one, two, and five-octet lengths is also used 696 internally to some packets. 698 4.2.2.4. {4.2.2.4} Partial Body Lengths 700 A Partial Body Length header is one octet long and encodes the length 701 of only part of the data packet. This length is a power of 2, from 1 702 to 1,073,741,824 (2 to the 30th power). It is recognized by its one 703 octet value that is greater than or equal to 224, and less than 255. 704 The Partial Body Length is equal to: 706 partialBodyLen = 1 << (1st_octet & 0x1F); 708 Each Partial Body Length header is followed by a portion of the 709 packet body data. The Partial Body Length header specifies this 710 portion's length. Another length header (one octet, two-octet, five- 711 octet, or partial) follows that portion. The last length header in 712 the packet MUST NOT be a Partial Body Length header. Partial Body 713 Length headers may only be used for the non-final parts of the 714 packet. 716 Note also that the last Body Length header can be a zero-length 717 header. 719 An implementation MAY use Partial Body Lengths for data packets, be 720 they literal, compressed, or encrypted. The first partial length 721 MUST be at least 512 octets long. Partial Body Lengths MUST NOT be 722 used for any other packet types. 724 4.2.3. {4.2.3} Packet Length Examples 726 These examples show ways that new format packets might encode the 727 packet lengths. 729 A packet with length 100 may have its length encoded in one octet: 730 0x64. This is followed by 100 octets of data. 732 A packet with length 1723 may have its length encoded in two octets: 733 0xC5, 0xFB. This header is followed by the 1723 octets of data. 735 A packet with length 100000 may have its length encoded in five 736 octets: 0xFF, 0x00, 0x01, 0x86, 0xA0. 738 It might also be encoded in the following octet stream: 0xEF, first 739 32768 octets of data; 0xE1, next two octets of data; 0xE0, next one 740 octet of data; 0xF0, next 65536 octets of data; 0xC5, 0xDD, last 1693 741 octets of data. This is just one possible encoding, and many 742 variations are possible on the size of the Partial Body Length 743 headers, as long as a regular Body Length header encodes the last 744 portion of the data. 746 Please note that in all of these explanations, the total length of 747 the packet is the length of the header(s) plus the length of the 748 body. 750 4.3. {4.3} Packet Tags 752 The packet tag denotes what type of packet the body holds. Note that 753 old format headers can only have tags less than 16, whereas new 754 format headers can have tags as great as 63. The defined tags (in 755 decimal) are as follows: 757 +-----------+-----------------------------------------------------+ 758 | Tag | Packet Type | 759 +-----------+-----------------------------------------------------+ 760 | 0 | Reserved - a packet tag MUST NOT have this value | 761 | 1 | Public-Key Encrypted Session Key Packet | 762 | 2 | Signature Packet | 763 | 3 | Symmetric-Key Encrypted Session Key Packet | 764 | 4 | One-Pass Signature Packet | 765 | 5 | Secret-Key Packet | 766 | 6 | Public-Key Packet | 767 | 7 | Secret-Subkey Packet | 768 | 8 | Compressed Data Packet | 769 | 9 | Symmetrically Encrypted Data Packet | 770 | 10 | Marker Packet | 771 | 11 | Literal Data Packet | 772 | 12 | Trust Packet | 773 | 13 | User ID Packet | 774 | 14 | Public-Subkey Packet | 775 | 17 | User Attribute Packet | 776 | 18 | Sym. Encrypted and Integrity Protected Data Packet | 777 | 19 | Modification Detection Code Packet | 778 | 60 to 63 | Private or Experimental Values | 779 +-----------+-----------------------------------------------------+ 781 5. {5} Packet Types 783 5.1. {5.1} Public-Key Encrypted Session Key Packets (Tag 1) 785 A Public-Key Encrypted Session Key packet holds the session key used 786 to encrypt a message. Zero or more Public-Key Encrypted Session Key 787 packets and/or Symmetric-Key Encrypted Session Key packets may 788 precede a Symmetrically Encrypted Data Packet, which holds an 789 encrypted message. The message is encrypted with the session key, 790 and the session key is itself encrypted and stored in the Encrypted 791 Session Key packet(s). The Symmetrically Encrypted Data Packet is 792 preceded by one Public-Key Encrypted Session Key packet for each 793 OpenPGP key to which the message is encrypted. The recipient of the 794 message finds a session key that is encrypted to their public key, 795 decrypts the session key, and then uses the session key to decrypt 796 the message. 798 The body of this packet consists of: 800 o A one-octet number giving the version number of the packet type. 801 The currently defined value for packet version is 3. 803 o An eight-octet number that gives the Key ID of the public key to 804 which the session key is encrypted. If the session key is 805 encrypted to a subkey, then the Key ID of this subkey is used here 806 instead of the Key ID of the primary key. 808 o A one-octet number giving the public-key algorithm used. 810 o A string of octets that is the encrypted session key. This string 811 takes up the remainder of the packet, and its contents are 812 dependent on the public-key algorithm used. 814 Algorithm Specific Fields for RSA encryption: 816 * Multiprecision integer (MPI) of RSA encrypted value m**e mod n. 818 Algorithm Specific Fields for Elgamal encryption: 820 * MPI of Elgamal (Diffie-Hellman) value g**k mod p. 822 * MPI of Elgamal (Diffie-Hellman) value m * y**k mod p. 824 Algorithm-Specific Fields for ECDH encryption: 826 * MPI of an EC point representing an ephemeral public key. 828 * a one-octet size, followed by a symmetric key encoded using the 829 method described in Section 13.4. 831 The value "m" in the above formulas is derived from the session key 832 as follows. First, the session key is prefixed with a one-octet 833 algorithm identifier that specifies the symmetric encryption 834 algorithm used to encrypt the following Symmetrically Encrypted Data 835 Packet. Then a two-octet checksum is appended, which is equal to the 836 sum of the preceding session key octets, not including the algorithm 837 identifier, modulo 65536. This value is then encoded as described in 838 PKCS#1 block encoding EME-PKCS1-v1_5 in Section 7.2.1 of [RFC3447] to 839 form the "m" value used in the formulas above. See Section 13.1 of 840 this document for notes on OpenPGP's use of PKCS#1. 842 Note that when an implementation forms several PKESKs with one 843 session key, forming a message that can be decrypted by several keys, 844 the implementation MUST make a new PKCS#1 encoding for each key. 846 An implementation MAY accept or use a Key ID of zero as a "wild card" 847 or "speculative" Key ID. In this case, the receiving implementation 848 would try all available private keys, checking for a valid decrypted 849 session key. This format helps reduce traffic analysis of messages. 851 5.2. {5.2} Signature Packet (Tag 2) 853 A Signature packet describes a binding between some public key and 854 some data. The most common signatures are a signature of a file or a 855 block of text, and a signature that is a certification of a User ID. 857 Two versions of Signature packets are defined. Version 3 provides 858 basic signature information, while version 4 provides an expandable 859 format with subpackets that can specify more information about the 860 signature. PGP 2.6.x only accepts version 3 signatures. 862 Implementations SHOULD accept V3 signatures. Implementations SHOULD 863 generate V4 signatures. 865 Note that if an implementation is creating an encrypted and signed 866 message that is encrypted to a V3 key, it is reasonable to create a 867 V3 signature. 869 5.2.1. {5.2.1} Signature Types 871 There are a number of possible meanings for a signature, which are 872 indicated in a signature type octet in any given signature. Please 873 note that the vagueness of these meanings is not a flaw, but a 874 feature of the system. Because OpenPGP places final authority for 875 validity upon the receiver of a signature, it may be that one 876 signer's casual act might be more rigorous than some other 877 authority's positive act. See Section 5.2.4, "Computing Signatures", 878 for detailed information on how to compute and verify signatures of 879 each type. 881 These meanings are as follows: 883 0x00 Signature of a binary document. This means the signer owns it, 884 created it, or certifies that it has not been modified. 886 0x01 Signature of a canonical text document. This means the signer 887 owns it, created it, or certifies that it has not been modified. 888 The signature is calculated over the text data with its line 889 endings converted to . 891 0x02 Standalone signature. This signature is a signature of only 892 its own subpacket contents. It is calculated identically to a 893 signature over a zero-length binary document. Note that it 894 doesn't make sense to have a V3 standalone signature. 896 0x10 Generic certification of a User ID and Public-Key packet. The 897 issuer of this certification does not make any particular 898 assertion as to how well the certifier has checked that the owner 899 of the key is in fact the person described by the User ID. 901 0x11 Persona certification of a User ID and Public-Key packet. The 902 issuer of this certification has not done any verification of the 903 claim that the owner of this key is the User ID specified. 905 0x12 Casual certification of a User ID and Public-Key packet. The 906 issuer of this certification has done some casual verification of 907 the claim of identity. 909 0x13 Positive certification of a User ID and Public-Key packet. The 910 issuer of this certification has done substantial verification of 911 the claim of identity. 913 Most OpenPGP implementations make their "key signatures" as 0x10 914 certifications. Some implementations can issue 0x11-0x13 915 certifications, but few differentiate between the types. 917 0x18 Subkey Binding Signature This signature is a statement by the 918 top-level signing key that indicates that it owns the subkey. 919 This signature is calculated directly on the primary key and 920 subkey, and not on any User ID or other packets. A signature that 921 binds a signing subkey MUST have an Embedded Signature subpacket 922 in this binding signature that contains a 0x19 signature made by 923 the signing subkey on the primary key and subkey. 925 0x19 Primary Key Binding Signature This signature is a statement by 926 a signing subkey, indicating that it is owned by the primary key 927 and subkey. This signature is calculated the same way as a 0x18 928 signature: directly on the primary key and subkey, and not on any 929 User ID or other packets. 931 0x1F Signature directly on a key This signature is calculated 932 directly on a key. It binds the information in the Signature 933 subpackets to the key, and is appropriate to be used for 934 subpackets that provide information about the key, such as the 935 Revocation Key subpacket. It is also appropriate for statements 936 that non-self certifiers want to make about the key itself, rather 937 than the binding between a key and a name. 939 0x20 Key revocation signature The signature is calculated directly 940 on the key being revoked. A revoked key is not to be used. Only 941 revocation signatures by the key being revoked, or by an 942 authorized revocation key, should be considered valid revocation 943 signatures. 945 0x28 Subkey revocation signature The signature is calculated 946 directly on the subkey being revoked. A revoked subkey is not to 947 be used. Only revocation signatures by the top-level signature 948 key that is bound to this subkey, or by an authorized revocation 949 key, should be considered valid revocation signatures. 951 0x30 Certification revocation signature This signature revokes an 952 earlier User ID certification signature (signature class 0x10 953 through 0x13) or direct-key signature (0x1F). It should be issued 954 by the same key that issued the revoked signature or an authorized 955 revocation key. The signature is computed over the same data as 956 the certificate that it revokes, and should have a later creation 957 date than that certificate. 959 0x40 Timestamp signature. This signature is only meaningful for the 960 timestamp contained in it. 962 0x50 Third-Party Confirmation signature. This signature is a 963 signature over some other OpenPGP Signature packet(s). It is 964 analogous to a notary seal on the signed data. A third-party 965 signature SHOULD include Signature Target subpacket(s) to give 966 easy identification. Note that we really do mean SHOULD. There 967 are plausible uses for this (such as a blind party that only sees 968 the signature, not the key or source document) that cannot include 969 a target subpacket. 971 5.2.2. {5.2.2} Version 3 Signature Packet Format 973 The body of a version 3 Signature Packet contains: 975 o One-octet version number (3). 977 o One-octet length of following hashed material. MUST be 5. 979 o One-octet signature type. 981 o Four-octet creation time. 983 o Eight-octet Key ID of signer. 985 o One-octet public-key algorithm. 987 o One-octet hash algorithm. 989 o Two-octet field holding left 16 bits of signed hash value. 991 o One or more multiprecision integers comprising the signature. 992 This portion is algorithm specific, as described below. 994 The concatenation of the data to be signed, the signature type, 995 and creation time from the Signature packet (5 additional octets) 996 is hashed. The resulting hash value is used in the signature 997 algorithm. The high 16 bits (first two octets) of the hash are 998 included in the Signature packet to provide a quick test to reject 999 some invalid signatures. 1001 Algorithm-Specific Fields for RSA signatures: 1003 * Multiprecision integer (MPI) of RSA signature value m**d mod n. 1005 Algorithm-Specific Fields for DSA and ECDSA signatures: 1007 * MPI of DSA or ECDSA value r. 1009 * MPI of DSA or ECDSA value s. 1011 The signature calculation is based on a hash of the signed data, as 1012 described above. The details of the calculation are different for 1013 DSA signatures than for RSA signatures. 1015 With RSA signatures, the hash value is encoded using PKCS#1 encoding 1016 type EMSA-PKCS1-v1_5 as described in Section 9.2 of RFC 3447. This 1017 requires inserting the hash value as an octet string into an ASN.1 1018 structure. The object identifier for the type of hash being used is 1019 included in the structure. The hexadecimal representations for the 1020 currently defined hash algorithms are as follows: 1022 - MD5: 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05 1024 - RIPEMD-160: 0x2B, 0x24, 0x03, 0x02, 0x01 1026 - SHA-1: 0x2B, 0x0E, 0x03, 0x02, 0x1A 1028 - SHA224: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04 1030 - SHA256: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01 1032 - SHA384: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02 1034 - SHA512: 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03 1036 The ASN.1 Object Identifiers (OIDs) are as follows: 1038 - MD5: 1.2.840.113549.2.5 1040 - RIPEMD-160: 1.3.36.3.2.1 1042 - SHA-1: 1.3.14.3.2.26 1044 - SHA224: 2.16.840.1.101.3.4.2.4 1046 - SHA256: 2.16.840.1.101.3.4.2.1 1048 - SHA384: 2.16.840.1.101.3.4.2.2 1050 - SHA512: 2.16.840.1.101.3.4.2.3 1052 The full hash prefixes for these are as follows: 1054 - MD5: 0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 1055 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00, 1056 0x04, 0x10 1058 - RIPEMD-160: 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x24, 1059 0x03, 0x02, 0x01, 0x05, 0x00, 0x04, 0x14 1061 - SHA-1: 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0E, 1062 0x03, 0x02, 0x1A, 0x05, 0x00, 0x04, 0x14 1064 - SHA224: 0x30, 0x2D, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1065 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, 0x05, 1066 0x00, 0x04, 0x1C 1068 - SHA256: 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1069 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 1070 0x00, 0x04, 0x20 1072 - SHA384: 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1073 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 1074 0x00, 0x04, 0x30 1076 - SHA512: 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 1077 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 1078 0x00, 0x04, 0x40 1080 DSA signatures MUST use hashes that are equal in size to the number 1081 of bits of q, the group generated by the DSA key's generator value. 1083 If the output size of the chosen hash is larger than the number of 1084 bits of q, the hash result is truncated to fit by taking the number 1085 of leftmost bits equal to the number of bits of q. This (possibly 1086 truncated) hash function result is treated as a number and used 1087 directly in the DSA signature algorithm. 1089 5.2.3. {5.2.3} Version 4 Signature Packet Format 1091 The body of a version 4 Signature packet contains: 1093 o One-octet version number (4). 1095 o One-octet signature type. 1097 o One-octet public-key algorithm. 1099 o One-octet hash algorithm. 1101 o Two-octet scalar octet count for following hashed subpacket data. 1102 Note that this is the length in octets of all of the hashed 1103 subpackets; a pointer incremented by this number will skip over 1104 the hashed subpackets. 1106 o Hashed subpacket data set (zero or more subpackets). 1108 o Two-octet scalar octet count for the following unhashed subpacket 1109 data. Note that this is the length in octets of all of the 1110 unhashed subpackets; a pointer incremented by this number will 1111 skip over the unhashed subpackets. 1113 o Unhashed subpacket data set (zero or more subpackets). 1115 o Two-octet field holding the left 16 bits of the signed hash value. 1117 o One or more multiprecision integers comprising the signature. 1118 This portion is algorithm specific, as described above. 1120 The concatenation of the data being signed and the signature data 1121 from the version number through the hashed subpacket data (inclusive) 1122 is hashed. The resulting hash value is what is signed. The left 16 1123 bits of the hash are included in the Signature packet to provide a 1124 quick test to reject some invalid signatures. 1126 There are two fields consisting of Signature subpackets. The first 1127 field is hashed with the rest of the signature data, while the second 1128 is unhashed. The second set of subpackets is not cryptographically 1129 protected by the signature and should include only advisory 1130 information. 1132 The algorithms for converting the hash function result to a signature 1133 are described in a section below. 1135 5.2.3.1. {5.2.3.1} Signature Subpacket Specification 1137 A subpacket data set consists of zero or more Signature subpackets. 1138 In Signature packets, the subpacket data set is preceded by a two- 1139 octet scalar count of the length in octets of all the subpackets. A 1140 pointer incremented by this number will skip over the subpacket data 1141 set. 1143 Each subpacket consists of a subpacket header and a body. The header 1144 consists of: 1146 o the subpacket length (1, 2, or 5 octets), 1148 o the subpacket type (1 octet), 1150 and is followed by the subpacket-specific data. 1152 The length includes the type octet but not this length. Its format 1153 is similar to the "new" format packet header lengths, but cannot have 1154 Partial Body Lengths. That is: 1156 if the 1st octet < 192, then 1157 lengthOfLength = 1 1158 subpacketLen = 1st_octet 1160 if the 1st octet >= 192 and < 255, then 1161 lengthOfLength = 2 1162 subpacketLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192 1164 if the 1st octet = 255, then 1165 lengthOfLength = 5 1166 subpacket length = [four-octet scalar starting at 2nd_octet] 1168 The value of the subpacket type octet may be: 1170 +-------------+-----------------------------------------+ 1171 | Type | Description | 1172 +-------------+-----------------------------------------+ 1173 | 0 | Reserved | 1174 | 1 | Reserved | 1175 | 2 | Signature Creation Time | 1176 | 3 | Signature Expiration Time | 1177 | 4 | Exportable Certification | 1178 | 5 | Trust Signature | 1179 | 6 | Regular Expression | 1180 | 7 | Revocable | 1181 | 8 | Reserved | 1182 | 9 | Key Expiration Time | 1183 | 10 | Placeholder for backward compatibility | 1184 | 11 | Preferred Symmetric Algorithms | 1185 | 12 | Revocation Key | 1186 | 13 to 15 | Reserved | 1187 | 16 | Issuer | 1188 | 17 to 19 | Reserved | 1189 | 20 | Notation Data | 1190 | 21 | Preferred Hash Algorithms | 1191 | 22 | Preferred Compression Algorithms | 1192 | 23 | Key Server Preferences | 1193 | 24 | Preferred Key Server | 1194 | 25 | Primary User ID | 1195 | 26 | Policy URI | 1196 | 27 | Key Flags | 1197 | 28 | Signer's User ID | 1198 | 29 | Reason for Revocation | 1199 | 30 | Features | 1200 | 31 | Signature Target | 1201 | 32 | Embedded Signature | 1202 | 100 to 110 | Private or experimental | 1203 +-------------+-----------------------------------------+ 1205 An implementation SHOULD ignore any subpacket of a type that it does 1206 not recognize. 1208 Bit 7 of the subpacket type is the "critical" bit. If set, it 1209 denotes that the subpacket is one that is critical for the evaluator 1210 of the signature to recognize. If a subpacket is encountered that is 1211 marked critical but is unknown to the evaluating software, the 1212 evaluator SHOULD consider the signature to be in error. 1214 An evaluator may "recognize" a subpacket, but not implement it. The 1215 purpose of the critical bit is to allow the signer to tell an 1216 evaluator that it would prefer a new, unknown feature to generate an 1217 error than be ignored. 1219 Implementations SHOULD implement the three preferred algorithm 1220 subpackets (11, 21, and 22), as well as the "Reason for Revocation" 1221 subpacket. Note, however, that if an implementation chooses not to 1222 implement some of the preferences, it is required to behave in a 1223 polite manner to respect the wishes of those users who do implement 1224 these preferences. 1226 5.2.3.2. {5.2.3.2} Signature Subpacket Types 1228 A number of subpackets are currently defined. Some subpackets apply 1229 to the signature itself and some are attributes of the key. 1230 Subpackets that are found on a self-signature are placed on a 1231 certification made by the key itself. Note that a key may have more 1232 than one User ID, and thus may have more than one self-signature, and 1233 differing subpackets. 1235 A subpacket may be found either in the hashed or unhashed subpacket 1236 sections of a signature. If a subpacket is not hashed, then the 1237 information in it cannot be considered definitive because it is not 1238 part of the signature proper. 1240 5.2.3.3. {5.2.3.3} Notes on Self-Signatures 1242 A self-signature is a binding signature made by the key to which the 1243 signature refers. There are three types of self-signatures, the 1244 certification signatures (types 0x10-0x13), the direct-key signature 1245 (type 0x1F), and the subkey binding signature (type 0x18). For 1246 certification self-signatures, each User ID may have a self- 1247 signature, and thus different subpackets in those self-signatures. 1248 For subkey binding signatures, each subkey in fact has a self- 1249 signature. Subpackets that appear in a certification self-signature 1250 apply to the user name, and subpackets that appear in the subkey 1251 self-signature apply to the subkey. Lastly, subpackets on the 1252 direct-key signature apply to the entire key. 1254 Implementing software should interpret a self-signature's preference 1255 subpackets as narrowly as possible. For example, suppose a key has 1256 two user names, Alice and Bob. Suppose that Alice prefers the 1257 symmetric algorithm CAST5, and Bob prefers IDEA or TripleDES. If the 1258 software locates this key via Alice's name, then the preferred 1259 algorithm is CAST5; if software locates the key via Bob's name, then 1260 the preferred algorithm is IDEA. If the key is located by Key ID, 1261 the algorithm of the primary User ID of the key provides the 1262 preferred symmetric algorithm. 1264 Revoking a self-signature or allowing it to expire has a semantic 1265 meaning that varies with the signature type. Revoking the self- 1266 signature on a User ID effectively retires that user name. The self- 1267 signature is a statement, "My name X is tied to my signing key K" and 1268 is corroborated by other users' certifications. If another user 1269 revokes their certification, they are effectively saying that they no 1270 longer believe that name and that key are tied together. Similarly, 1271 if the users themselves revoke their self-signature, then the users 1272 no longer go by that name, no longer have that email address, etc. 1273 Revoking a binding signature effectively retires that subkey. 1274 Revoking a direct-key signature cancels that signature. Please see 1275 the "Reason for Revocation" subpacket (Section 5.2.3.23) for more 1276 relevant detail. 1278 Since a self-signature contains important information about the key's 1279 use, an implementation SHOULD allow the user to rewrite the self- 1280 signature, and important information in it, such as preferences and 1281 key expiration. 1283 It is good practice to verify that a self-signature imported into an 1284 implementation doesn't advertise features that the implementation 1285 doesn't support, rewriting the signature as appropriate. 1287 An implementation that encounters multiple self-signatures on the 1288 same object may resolve the ambiguity in any way it sees fit, but it 1289 is RECOMMENDED that priority be given to the most recent self- 1290 signature. 1292 5.2.3.4. {5.2.3.4} Signature Creation Time 1294 (4-octet time field) 1296 The time the signature was made. 1298 MUST be present in the hashed area. 1300 5.2.3.5. {5.2.3.5} Issuer 1302 (8-octet Key ID) 1304 The OpenPGP Key ID of the key issuing the signature. 1306 5.2.3.6. {5.2.3.6} Key Expiration Time 1308 (4-octet time field) 1310 The validity period of the key. This is the number of seconds after 1311 the key creation time that the key expires. If this is not present 1312 or has a value of zero, the key never expires. This is found only on 1313 a self-signature. 1315 5.2.3.7. {5.2.3.7} Preferred Symmetric Algorithms 1317 (array of one-octet values) 1319 Symmetric algorithm numbers that indicate which algorithms the key 1320 holder prefers to use. The subpacket body is an ordered list of 1321 octets with the most preferred listed first. It is assumed that only 1322 algorithms listed are supported by the recipient's software. 1323 Algorithm numbers are in Section 9. This is only found on a self- 1324 signature. 1326 5.2.3.8. {5.2.3.8} Preferred Hash Algorithms 1328 (array of one-octet values) 1330 Message digest algorithm numbers that indicate which algorithms the 1331 key holder prefers to receive. Like the preferred symmetric 1332 algorithms, the list is ordered. Algorithm numbers are in Section 9. 1333 This is only found on a self-signature. 1335 5.2.3.9. {5.2.3.9} Preferred Compression Algorithms 1337 (array of one-octet values) 1339 Compression algorithm numbers that indicate which algorithms the key 1340 holder prefers to use. Like the preferred symmetric algorithms, the 1341 list is ordered. Algorithm numbers are in Section 9. If this 1342 subpacket is not included, ZIP is preferred. A zero denotes that 1343 uncompressed data is preferred; the key holder's software might have 1344 no compression software in that implementation. This is only found 1345 on a self-signature. 1347 5.2.3.10. {5.2.3.10} Signature Expiration Time 1349 (4-octet time field) 1351 The validity period of the signature. This is the number of seconds 1352 after the signature creation time that the signature expires. If 1353 this is not present or has a value of zero, it never expires. 1355 5.2.3.11. {5.2.3.11} Exportable Certification 1357 (1 octet of exportability, 0 for not, 1 for exportable) 1359 This subpacket denotes whether a certification signature is 1360 "exportable", to be used by other users than the signature's issuer. 1361 The packet body contains a Boolean flag indicating whether the 1362 signature is exportable. If this packet is not present, the 1363 certification is exportable; it is equivalent to a flag containing a 1364 1. 1366 Non-exportable, or "local", certifications are signatures made by a 1367 user to mark a key as valid within that user's implementation only. 1369 Thus, when an implementation prepares a user's copy of a key for 1370 transport to another user (this is the process of "exporting" the 1371 key), any local certification signatures are deleted from the key. 1373 The receiver of a transported key "imports" it, and likewise trims 1374 any local certifications. In normal operation, there won't be any, 1375 assuming the import is performed on an exported key. However, there 1376 are instances where this can reasonably happen. For example, if an 1377 implementation allows keys to be imported from a key database in 1378 addition to an exported key, then this situation can arise. 1380 Some implementations do not represent the interest of a single user 1381 (for example, a key server). Such implementations always trim local 1382 certifications from any key they handle. 1384 5.2.3.12. {5.2.3.12} Revocable 1386 (1 octet of revocability, 0 for not, 1 for revocable) 1388 Signature's revocability status. The packet body contains a Boolean 1389 flag indicating whether the signature is revocable. Signatures that 1390 are not revocable have any later revocation signatures ignored. They 1391 represent a commitment by the signer that he cannot revoke his 1392 signature for the life of his key. If this packet is not present, 1393 the signature is revocable. 1395 5.2.3.13. {5.2.3.13} Trust Signature 1397 (1 octet "level" (depth), 1 octet of trust amount) 1399 Signer asserts that the key is not only valid but also trustworthy at 1400 the specified level. Level 0 has the same meaning as an ordinary 1401 validity signature. Level 1 means that the signed key is asserted to 1402 be a valid trusted introducer, with the 2nd octet of the body 1403 specifying the degree of trust. Level 2 means that the signed key is 1404 asserted to be trusted to issue level 1 trust signatures, i.e., that 1405 it is a "meta introducer". Generally, a level n trust signature 1406 asserts that a key is trusted to issue level n-1 trust signatures. 1407 The trust amount is in a range from 0-255, interpreted such that 1408 values less than 120 indicate partial trust and values of 120 or 1409 greater indicate complete trust. Implementations SHOULD emit values 1410 of 60 for partial trust and 120 for complete trust. 1412 5.2.3.14. {5.2.3.14} Regular Expression 1414 (null-terminated regular expression) 1416 Used in conjunction with trust Signature packets (of level > 0) to 1417 limit the scope of trust that is extended. Only signatures by the 1418 target key on User IDs that match the regular expression in the body 1419 of this packet have trust extended by the trust Signature subpacket. 1420 The regular expression uses the same syntax as the Henry Spencer's 1421 "almost public domain" regular expression [REGEX] package. A 1422 description of the syntax is found in Section 8 below. 1424 5.2.3.15. {5.2.3.15} Revocation Key 1426 (1 octet of class, 1 octet of public-key algorithm ID, 20 octets of 1427 fingerprint) 1429 Authorizes the specified key to issue revocation signatures for this 1430 key. Class octet must have bit 0x80 set. If the bit 0x40 is set, 1431 then this means that the revocation information is sensitive. Other 1432 bits are for future expansion to other kinds of authorizations. This 1433 is found on a self-signature. 1435 If the "sensitive" flag is set, the keyholder feels this subpacket 1436 contains private trust information that describes a real-world 1437 sensitive relationship. If this flag is set, implementations SHOULD 1438 NOT export this signature to other users except in cases where the 1439 data needs to be available: when the signature is being sent to the 1440 designated revoker, or when it is accompanied by a revocation 1441 signature from that revoker. Note that it may be appropriate to 1442 isolate this subpacket within a separate signature so that it is not 1443 combined with other subpackets that need to be exported. 1445 5.2.3.16. {5.2.3.16} Notation Data 1447 (4 octets of flags, 2 octets of name length (M), 1448 2 octets of value length (N), 1449 M octets of name data, 1450 N octets of value data) 1452 This subpacket describes a "notation" on the signature that the 1453 issuer wishes to make. The notation has a name and a value, each of 1454 which are strings of octets. There may be more than one notation in 1455 a signature. Notations can be used for any extension the issuer of 1456 the signature cares to make. The "flags" field holds four octets of 1457 flags. 1459 All undefined flags MUST be zero. Defined flags are as follows: 1461 First octet: 0x80 = human-readable. This note value is text. 1462 Other octets: none. 1464 Notation names are arbitrary strings encoded in UTF-8. They reside 1465 in two namespaces: The IETF namespace and the user namespace. 1467 The IETF namespace is registered with IANA. These names MUST NOT 1468 contain the "@" character (0x40). This is a tag for the user 1469 namespace. 1471 Names in the user namespace consist of a UTF-8 string tag followed by 1472 "@" followed by a DNS domain name. Note that the tag MUST NOT 1473 contain an "@" character. For example, the "sample" tag used by 1474 Example Corporation could be "sample@example.com". 1476 Names in a user space are owned and controlled by the owners of that 1477 domain. Obviously, it's bad form to create a new name in a DNS space 1478 that you don't own. 1480 Since the user namespace is in the form of an email address, 1481 implementers MAY wish to arrange for that address to reach a person 1482 who can be consulted about the use of the named tag. Note that due 1483 to UTF-8 encoding, not all valid user space name tags are valid email 1484 addresses. 1486 If there is a critical notation, the criticality applies to that 1487 specific notation and not to notations in general. 1489 5.2.3.17. {5.2.3.17} Key Server Preferences 1491 (N octets of flags) 1493 This is a list of one-bit flags that indicate preferences that the 1494 key holder has about how the key is handled on a key server. All 1495 undefined flags MUST be zero. 1497 First octet: 0x80 = No-modify the key holder requests that this key 1498 only be modified or updated by the key holder or an administrator of 1499 the key server. 1501 This is found only on a self-signature. 1503 5.2.3.18. {5.2.3.18} Preferred Key Server 1505 (String) 1507 This is a URI of a key server that the key holder prefers be used for 1508 updates. Note that keys with multiple User IDs can have a preferred 1509 key server for each User ID. Note also that since this is a URI, the 1510 key server can actually be a copy of the key retrieved by ftp, http, 1511 finger, etc. 1513 5.2.3.19. {5.2.3.19} Primary User ID 1515 (1 octet, Boolean) 1517 This is a flag in a User ID's self-signature that states whether this 1518 User ID is the main User ID for this key. It is reasonable for an 1519 implementation to resolve ambiguities in preferences, etc. by 1520 referring to the primary User ID. If this flag is absent, its value 1521 is zero. If more than one User ID in a key is marked as primary, the 1522 implementation may resolve the ambiguity in any way it sees fit, but 1523 it is RECOMMENDED that priority be given to the User ID with the most 1524 recent self-signature. 1526 When appearing on a self-signature on a User ID packet, this 1527 subpacket applies only to User ID packets. When appearing on a self- 1528 signature on a User Attribute packet, this subpacket applies only to 1529 User Attribute packets. That is to say, there are two different and 1530 independent "primaries" -- one for User IDs, and one for User 1531 Attributes. 1533 5.2.3.20. {5.2.3.20} Policy URI 1535 (String) 1537 This subpacket contains a URI of a document that describes the policy 1538 under which the signature was issued. 1540 5.2.3.21. {5.2.3.21} Key Flags 1542 (N octets of flags) 1544 This subpacket contains a list of binary flags that hold information 1545 about a key. It is a string of octets, and an implementation MUST 1546 NOT assume a fixed size. This is so it can grow over time. If a 1547 list is shorter than an implementation expects, the unstated flags 1548 are considered to be zero. The defined flags are as follows: 1550 0x01 This key may be used to certify other keys. 1552 0x02 This key may be used to sign data. 1554 0x04 This key may be used to encrypt communications. 1556 0x08 This key may be used to encrypt storage. 1558 0x10 The private component of this key may have been split by a 1559 secret-sharing mechanism. 1561 0x20 This key may be used for authentication. 1563 0x80 The private component of this key may be in the possession of 1564 more than one person. 1566 Usage notes: 1568 The flags in this packet may appear in self-signatures or in 1569 certification signatures. They mean different things depending on 1570 who is making the statement --- for example, a certification 1571 signature that has the "sign data" flag is stating that the 1572 certification is for that use. On the other hand, the 1573 "communications encryption" flag in a self-signature is stating a 1574 preference that a given key be used for communications. Note 1575 however, that it is a thorny issue to determine what is 1576 "communications" and what is "storage". This decision is left wholly 1577 up to the implementation; the authors of this document do not claim 1578 any special wisdom on the issue and realize that accepted opinion may 1579 change. 1581 The "split key" (0x10) and "group key" (0x80) flags are placed on a 1582 self-signature only; they are meaningless on a certification 1583 signature. They SHOULD be placed only on a direct-key signature 1584 (type 0x1F) or a subkey signature (type 0x18), one that refers to the 1585 key the flag applies to. 1587 5.2.3.22. {5.2.3.22} Signer's User ID 1589 (String) 1591 This subpacket allows a keyholder to state which User ID is 1592 responsible for the signing. Many keyholders use a single key for 1593 different purposes, such as business communications as well as 1594 personal communications. This subpacket allows such a keyholder to 1595 state which of their roles is making a signature. 1597 This subpacket is not appropriate to use to refer to a User Attribute 1598 packet. 1600 5.2.3.23. {5.2.3.23} Reason for Revocation 1602 (1 octet of revocation code, N octets of reason string) 1603 This subpacket is used only in key revocation and certification 1604 revocation signatures. It describes the reason why the key or 1605 certificate was revoked. 1607 The first octet contains a machine-readable code that denotes the 1608 reason for the revocation: 1610 +----------+--------------------------------------------------------+ 1611 | Code | Reason | 1612 +----------+--------------------------------------------------------+ 1613 | 0 | No reason specified (key revocations or cert | 1614 | | revocations) | 1615 | 1 | Key is superseded (key revocations) | 1616 | 2 | Key material has been compromised (key revocations) | 1617 | 3 | Key is retired and no longer used (key revocations) | 1618 | 32 | User ID information is no longer valid (cert | 1619 | | revocations) | 1620 | 100-110 | Private Use | 1621 +----------+--------------------------------------------------------+ 1623 Following the revocation code is a string of octets that gives 1624 information about the Reason for Revocation in human-readable form 1625 (UTF-8). The string may be null, that is, of zero length. The 1626 length of the subpacket is the length of the reason string plus one. 1627 An implementation SHOULD implement this subpacket, include it in all 1628 revocation signatures, and interpret revocations appropriately. 1629 There are important semantic differences between the reasons, and 1630 there are thus important reasons for revoking signatures. 1632 If a key has been revoked because of a compromise, all signatures 1633 created by that key are suspect. However, if it was merely 1634 superseded or retired, old signatures are still valid. If the 1635 revoked signature is the self-signature for certifying a User ID, a 1636 revocation denotes that that user name is no longer in use. Such a 1637 revocation SHOULD include a 0x20 code. 1639 Note that any signature may be revoked, including a certification on 1640 some other person's key. There are many good reasons for revoking a 1641 certification signature, such as the case where the keyholder leaves 1642 the employ of a business with an email address. A revoked 1643 certification is no longer a part of validity calculations. 1645 5.2.3.24. {5.2.3.24} Features 1647 (N octets of flags) 1649 The Features subpacket denotes which advanced OpenPGP features a 1650 user's implementation supports. This is so that as features are 1651 added to OpenPGP that cannot be backwards-compatible, a user can 1652 state that they can use that feature. The flags are single bits that 1653 indicate that a given feature is supported. 1655 This subpacket is similar to a preferences subpacket, and only 1656 appears in a self-signature. 1658 An implementation SHOULD NOT use a feature listed when sending to a 1659 user who does not state that they can use it. 1661 Defined features are as follows: 1663 First octet: 1665 0x01 - Modification Detection (packets 18 and 19) 1667 If an implementation implements any of the defined features, it 1668 SHOULD implement the Features subpacket, too. 1670 An implementation may freely infer features from other suitable 1671 implementation-dependent mechanisms. 1673 5.2.3.25. {5.2.3.25} Signature Target 1675 (1 octet public-key algorithm, 1 octet hash algorithm, N octets hash) 1677 This subpacket identifies a specific target signature to which a 1678 signature refers. For revocation signatures, this subpacket provides 1679 explicit designation of which signature is being revoked. For a 1680 third-party or timestamp signature, this designates what signature is 1681 signed. All arguments are an identifier of that target signature. 1683 The N octets of hash data MUST be the size of the hash of the 1684 signature. For example, a target signature with a SHA-1 hash MUST 1685 have 20 octets of hash data. 1687 5.2.3.26. {5.2.3.26} Embedded Signature 1689 (1 signature packet body) 1691 This subpacket contains a complete Signature packet body as specified 1692 in Section 5.2 above. It is useful when one signature needs to refer 1693 to, or be incorporated in, another signature. 1695 5.2.4. {5.2.4} Computing Signatures 1697 All signatures are formed by producing a hash over the signature 1698 data, and then using the resulting hash in the signature algorithm. 1700 For binary document signatures (type 0x00), the document data is 1701 hashed directly. For text document signatures (type 0x01), the 1702 document is canonicalized by converting line endings to , and 1703 the resulting data is hashed. 1705 When a signature is made over a key, the hash data starts with the 1706 octet 0x99, followed by a two-octet length of the key, and then body 1707 of the key packet. (Note that this is an old-style packet header for 1708 a key packet with two-octet length.) A subkey binding signature 1709 (type 0x18) or primary key binding signature (type 0x19) then hashes 1710 the subkey using the same format as the main key (also using 0x99 as 1711 the first octet). Primary key revocation signatures (type 0x20) hash 1712 only the key being revoked. Subkey revocation signature (type 0x28) 1713 hash first the primary key and then the subkey being revoked. 1715 A certification signature (type 0x10 through 0x13) hashes the User ID 1716 being bound to the key into the hash context after the above data. A 1717 V3 certification hashes the contents of the User ID or attribute 1718 packet packet, without any header. A V4 certification hashes the 1719 constant 0xB4 for User ID certifications or the constant 0xD1 for 1720 User Attribute certifications, followed by a four-octet number giving 1721 the length of the User ID or User Attribute data, and then the User 1722 ID or User Attribute data. 1724 When a signature is made over a Signature packet (type 0x50), the 1725 hash data starts with the octet 0x88, followed by the four-octet 1726 length of the signature, and then the body of the Signature packet. 1727 (Note that this is an old-style packet header for a Signature packet 1728 with the length-of-length set to zero.) The unhashed subpacket data 1729 of the Signature packet being hashed is not included in the hash, and 1730 the unhashed subpacket data length value is set to zero. 1732 Once the data body is hashed, then a trailer is hashed. A V3 1733 signature hashes five octets of the packet body, starting from the 1734 signature type field. This data is the signature type, followed by 1735 the four-octet signature time. A V4 signature hashes the packet body 1736 starting from its first field, the version number, through the end of 1737 the hashed subpacket data. Thus, the fields hashed are the signature 1738 version, the signature type, the public-key algorithm, the hash 1739 algorithm, the hashed subpacket length, and the hashed subpacket 1740 body. 1742 V4 signatures also hash in a final trailer of six octets: the version 1743 of the Signature packet, i.e., 0x04; 0xFF; and a four-octet, big- 1744 endian number that is the length of the hashed data from the 1745 Signature packet (note that this number does not include these final 1746 six octets). 1748 After all this has been hashed in a single hash context, the 1749 resulting hash field is used in the signature algorithm and placed at 1750 the end of the Signature packet. 1752 5.2.4.1. {5.2.4.1} Subpacket Hints 1754 It is certainly possible for a signature to contain conflicting 1755 information in subpackets. For example, a signature may contain 1756 multiple copies of a preference or multiple expiration times. In 1757 most cases, an implementation SHOULD use the last subpacket in the 1758 signature, but MAY use any conflict resolution scheme that makes more 1759 sense. Please note that we are intentionally leaving conflict 1760 resolution to the implementer; most conflicts are simply syntax 1761 errors, and the wishy-washy language here allows a receiver to be 1762 generous in what they accept, while putting pressure on a creator to 1763 be stingy in what they generate. 1765 Some apparent conflicts may actually make sense -- for example, 1766 suppose a keyholder has a V3 key and a V4 key that share the same RSA 1767 key material. Either of these keys can verify a signature created by 1768 the other, and it may be reasonable for a signature to contain an 1769 issuer subpacket for each key, as a way of explicitly tying those 1770 keys to the signature. 1772 5.3. {5.3} Symmetric-Key Encrypted Session Key Packets (Tag 3) 1774 The Symmetric-Key Encrypted Session Key packet holds the symmetric- 1775 key encryption of a session key used to encrypt a message. Zero or 1776 more Public-Key Encrypted Session Key packets and/or Symmetric-Key 1777 Encrypted Session Key packets may precede a Symmetrically Encrypted 1778 Data packet that holds an encrypted message. The message is 1779 encrypted with a session key, and the session key is itself encrypted 1780 and stored in the Encrypted Session Key packet or the Symmetric-Key 1781 Encrypted Session Key packet. 1783 If the Symmetrically Encrypted Data packet is preceded by one or more 1784 Symmetric-Key Encrypted Session Key packets, each specifies a 1785 passphrase that may be used to decrypt the message. This allows a 1786 message to be encrypted to a number of public keys, and also to one 1787 or more passphrases. This packet type is new and is not generated by 1788 PGP 2.x or PGP 5.0. 1790 The body of this packet consists of: 1792 o A one-octet version number. The only currently defined version is 1793 4. 1795 o A one-octet number describing the symmetric algorithm used. 1797 o A string-to-key (S2K) specifier, length as defined above. 1799 o Optionally, the encrypted session key itself, which is decrypted 1800 with the string-to-key object. 1802 If the encrypted session key is not present (which can be detected on 1803 the basis of packet length and S2K specifier size), then the S2K 1804 algorithm applied to the passphrase produces the session key for 1805 decrypting the file, using the symmetric cipher algorithm from the 1806 Symmetric-Key Encrypted Session Key packet. 1808 If the encrypted session key is present, the result of applying the 1809 S2K algorithm to the passphrase is used to decrypt just that 1810 encrypted session key field, using CFB mode with an IV of all zeros. 1811 The decryption result consists of a one-octet algorithm identifier 1812 that specifies the symmetric-key encryption algorithm used to encrypt 1813 the following Symmetrically Encrypted Data packet, followed by the 1814 session key octets themselves. 1816 Note: because an all-zero IV is used for this decryption, the S2K 1817 specifier MUST use a salt value, either a Salted S2K or an Iterated- 1818 Salted S2K. The salt value will ensure that the decryption key is 1819 not repeated even if the passphrase is reused. 1821 5.4. {5.4} One-Pass Signature Packets (Tag 4) 1823 The One-Pass Signature packet precedes the signed data and contains 1824 enough information to allow the receiver to begin calculating any 1825 hashes needed to verify the signature. It allows the Signature 1826 packet to be placed at the end of the message, so that the signer can 1827 compute the entire signed message in one pass. 1829 A One-Pass Signature does not interoperate with PGP 2.6.x or earlier. 1831 The body of this packet consists of: 1833 o A one-octet version number. The current version is 3. 1835 o A one-octet signature type. Signature types are described in 1836 Section 5.2.1. 1838 o A one-octet number describing the hash algorithm used. 1840 o A one-octet number describing the public-key algorithm used. 1842 o An eight-octet number holding the Key ID of the signing key. 1844 o A one-octet number holding a flag showing whether the signature is 1845 nested. A zero value indicates that the next packet is another 1846 One-Pass Signature packet that describes another signature to be 1847 applied to the same message data. 1849 Note that if a message contains more than one one-pass signature, 1850 then the Signature packets bracket the message; that is, the first 1851 Signature packet after the message corresponds to the last one-pass 1852 packet and the final Signature packet corresponds to the first one- 1853 pass packet. 1855 5.5. {5.5} Key Material Packet 1857 A key material packet contains all the information about a public or 1858 private key. There are four variants of this packet type, and two 1859 major versions. Consequently, this section is complex. 1861 5.5.1. {5.5.1} Key Packet Variants 1863 5.5.1.1. {5.5.1.1} Public-Key Packet (Tag 6) 1865 A Public-Key packet starts a series of packets that forms an OpenPGP 1866 key (sometimes called an OpenPGP certificate). 1868 5.5.1.2. {5.5.1.2} Public-Subkey Packet (Tag 14) 1870 A Public-Subkey packet (tag 14) has exactly the same format as a 1871 Public-Key packet, but denotes a subkey. One or more subkeys may be 1872 associated with a top-level key. By convention, the top-level key 1873 provides signature services, and the subkeys provide encryption 1874 services. 1876 Note: in PGP 2.6.x, tag 14 was intended to indicate a comment packet. 1877 This tag was selected for reuse because no previous version of PGP 1878 ever emitted comment packets but they did properly ignore them. 1879 Public-Subkey packets are ignored by PGP 2.6.x and do not cause it to 1880 fail, providing a limited degree of backward compatibility. 1882 5.5.1.3. {5.5.1.3} Secret-Key Packet (Tag 5) 1884 A Secret-Key packet contains all the information that is found in a 1885 Public-Key packet, including the public-key material, but also 1886 includes the secret-key material after all the public-key fields. 1888 5.5.1.4. {5.5.1.4} Secret-Subkey Packet (Tag 7) 1890 A Secret-Subkey packet (tag 7) is the subkey analog of the Secret Key 1891 packet and has exactly the same format. 1893 5.5.2. {5.5.2} Public-Key Packet Formats 1895 There are two versions of key-material packets. Version 3 packets 1896 were first generated by PGP 2.6. Version 4 keys first appeared in 1897 PGP 5.0 and are the preferred key version for OpenPGP. 1899 OpenPGP implementations MUST create keys with version 4 format. V3 1900 keys are deprecated; an implementation MUST NOT generate a V3 key, 1901 but MAY accept it. 1903 A version 3 public key or public-subkey packet contains: 1905 o A one-octet version number (3). 1907 o A four-octet number denoting the time that the key was created. 1909 o A two-octet number denoting the time in days that this key is 1910 valid. If this number is zero, then it does not expire. 1912 o A one-octet number denoting the public-key algorithm of this key. 1914 o A series of multiprecision integers comprising the key material: 1916 * a multiprecision integer (MPI) of RSA public modulus n; 1918 * an MPI of RSA public encryption exponent e. 1920 V3 keys are deprecated. They contain three weaknesses. First, it is 1921 relatively easy to construct a V3 key that has the same Key ID as any 1922 other key because the Key ID is simply the low 64 bits of the public 1923 modulus. Secondly, because the fingerprint of a V3 key hashes the 1924 key material, but not its length, there is an increased opportunity 1925 for fingerprint collisions. Third, there are weaknesses in the MD5 1926 hash algorithm that make developers prefer other algorithms. See 1927 below for a fuller discussion of Key IDs and fingerprints. 1929 V2 keys are identical to the deprecated V3 keys except for the 1930 version number. An implementation MUST NOT generate them and MAY 1931 accept or reject them as it sees fit. 1933 The version 4 format is similar to the version 3 format except for 1934 the absence of a validity period. This has been moved to the 1935 Signature packet. In addition, fingerprints of version 4 keys are 1936 calculated differently from version 3 keys, as described in the 1937 section "Enhanced Key Formats". 1939 A version 4 packet contains: 1941 o A one-octet version number (4). 1943 o A four-octet number denoting the time that the key was created. 1945 o A one-octet number denoting the public-key algorithm of this key. 1947 o A series of multiprecision integers comprising the key material. 1948 This algorithm-specific portion is: 1950 Algorithm-Specific Fields for RSA public keys: 1952 * multiprecision integer (MPI) of RSA public modulus n; 1954 * MPI of RSA public encryption exponent e. 1956 Algorithm-Specific Fields for DSA public keys: 1958 * MPI of DSA prime p; 1960 * MPI of DSA group order q (q is a prime divisor of p-1); 1962 * MPI of DSA group generator g; 1964 * MPI of DSA public-key value y (= g**x mod p where x is secret). 1966 Algorithm-Specific Fields for Elgamal public keys: 1968 * MPI of Elgamal prime p; 1970 * MPI of Elgamal group generator g; 1972 * MPI of Elgamal public key value y (= g**x mod p where x is 1973 secret). 1975 Algorithm-Specific Fields for ECDSA keys: 1977 * a variable-length field containing a curve OID, formatted as 1978 follows: 1980 + a one-octet size of the following field; values 0 and 0xFF 1981 are reserved for future extensions, 1983 + the octets representing a curve OID, defined in section 1984 11{FIXME}; 1986 * a MPI of an EC point representing a public key. 1988 Algorithm-Specific Fields for ECDH keys: 1990 * a variable-length field containing a curve OID, formatted as 1991 follows: 1993 + a one-octet size of the following field; values 0 and 0xFF 1994 are reserved for future extensions, 1996 + the octets representing a curve OID, defined in 1997 Section 11{FIXME}; 1999 * a MPI of an EC point representing a public key; 2001 * a variable-length field containing KDF parameters, formatted as 2002 follows: 2004 + a one-octet size of the following fields; values 0 and 0xff 2005 are reserved for future extensions; 2007 + a one-octet value 1, reserved for future extensions; 2009 + a one-octet hash function ID used with a KDF; 2011 + a one-octet algorithm ID for the symmetric algorithm used to 2012 wrap the symmetric key used for the message encryption; see 2013 Section 8 for details. 2015 Observe that an ECDH public key is composed of the same sequence of 2016 fields that define an ECDSA key, plus the KDF parameters field. 2018 5.5.3. {5.5.3} Secret-Key Packet Formats 2020 The Secret-Key and Secret-Subkey packets contain all the data of the 2021 Public-Key and Public-Subkey packets, with additional algorithm- 2022 specific secret-key data appended, usually in encrypted form. 2024 The packet contains: 2026 o A Public-Key or Public-Subkey packet, as described above. 2028 o One octet indicating string-to-key usage conventions. Zero 2029 indicates that the secret-key data is not encrypted. 255 or 254 2030 indicates that a string-to-key specifier is being given. Any 2031 other value is a symmetric-key encryption algorithm identifier. 2033 o [Optional] If string-to-key usage octet was 255 or 254, a one- 2034 octet symmetric encryption algorithm. 2036 o [Optional] If string-to-key usage octet was 255 or 254, a string- 2037 to-key specifier. The length of the string-to-key specifier is 2038 implied by its type, as described above. 2040 o [Optional] If secret data is encrypted (string-to-key usage octet 2041 not zero), an Initial Vector (IV) of the same length as the 2042 cipher's block size. 2044 o Plain or encrypted multiprecision integers comprising the secret 2045 key data. These algorithm-specific fields are as described below. 2047 o If the string-to-key usage octet is zero or 255, then a two-octet 2048 checksum of the plaintext of the algorithm-specific portion (sum 2049 of all octets, mod 65536). If the string-to-key usage octet was 2050 254, then a 20-octet SHA-1 hash of the plaintext of the algorithm- 2051 specific portion. This checksum or hash is encrypted together 2052 with the algorithm-specific fields (if string-to-key usage octet 2053 is not zero). Note that for all other values, a two-octet 2054 checksum is required. 2056 Algorithm-Specific Fields for RSA secret keys: 2058 * multiprecision integer (MPI) of RSA secret exponent d. 2060 * MPI of RSA secret prime value p. 2062 * MPI of RSA secret prime value q (p < q). 2064 * MPI of u, the multiplicative inverse of p, mod q. 2066 Algorithm-Specific Fields for DSA secret keys: 2068 * MPI of DSA secret exponent x. 2070 Algorithm-Specific Fields for Elgamal secret keys: 2072 * MPI of Elgamal secret exponent x. 2074 Algorithm-Specific Fields for ECDH or ECDSA secret keys: 2076 * MPI of an integer representing the secret key, which is a 2077 scalar of the public EC point. 2079 Secret MPI values can be encrypted using a passphrase. If a string- 2080 to-key specifier is given, that describes the algorithm for 2081 converting the passphrase to a key, else a simple MD5 hash of the 2082 passphrase is used. Implementations MUST use a string-to-key 2083 specifier; the simple hash is for backward compatibility and is 2084 deprecated, though implementations MAY continue to use existing 2085 private keys in the old format. The cipher for encrypting the MPIs 2086 is specified in the Secret-Key packet. 2088 Encryption/decryption of the secret data is done in CFB mode using 2089 the key created from the passphrase and the Initial Vector from the 2090 packet. A different mode is used with V3 keys (which are only RSA) 2091 than with other key formats. With V3 keys, the MPI bit count prefix 2092 (i.e., the first two octets) is not encrypted. Only the MPI non- 2093 prefix data is encrypted. Furthermore, the CFB state is 2094 resynchronized at the beginning of each new MPI value, so that the 2095 CFB block boundary is aligned with the start of the MPI data. 2097 With V4 keys, a simpler method is used. All secret MPI values are 2098 encrypted in CFB mode, including the MPI bitcount prefix. 2100 The two-octet checksum that follows the algorithm-specific portion is 2101 the algebraic sum, mod 65536, of the plaintext of all the algorithm- 2102 specific octets (including MPI prefix and data). With V3 keys, the 2103 checksum is stored in the clear. With V4 keys, the checksum is 2104 encrypted like the algorithm-specific data. This value is used to 2105 check that the passphrase was correct. However, this checksum is 2106 deprecated; an implementation SHOULD NOT use it, but should rather 2107 use the SHA-1 hash denoted with a usage octet of 254. The reason for 2108 this is that there are some attacks that involve undetectably 2109 modifying the secret key. 2111 5.6. {5.6} Compressed Data Packet (Tag 8) 2113 The Compressed Data packet contains compressed data. Typically, this 2114 packet is found as the contents of an encrypted packet, or following 2115 a Signature or One-Pass Signature packet, and contains a literal data 2116 packet. 2118 The body of this packet consists of: 2120 o One octet that gives the algorithm used to compress the packet. 2122 o Compressed data, which makes up the remainder of the packet. 2124 A Compressed Data Packet's body contains an block that compresses 2125 some set of packets. See section "Packet Composition" for details on 2126 how messages are formed. 2128 ZIP-compressed packets are compressed with raw RFC 1951 [RFC1951] 2129 DEFLATE blocks. Note that PGP V2.6 uses 13 bits of compression. If 2130 an implementation uses more bits of compression, PGP V2.6 cannot 2131 decompress it. 2133 ZLIB-compressed packets are compressed with RFC 1950 [RFC1950] ZLIB- 2134 style blocks. 2136 BZip2-compressed packets are compressed using the BZip2 [BZ2] 2137 algorithm. 2139 5.7. {5.7} Symmetrically Encrypted Data Packet (Tag 9) 2141 The Symmetrically Encrypted Data packet contains data encrypted with 2142 a symmetric-key algorithm. When it has been decrypted, it contains 2143 other packets (usually a literal data packet or compressed data 2144 packet, but in theory other Symmetrically Encrypted Data packets or 2145 sequences of packets that form whole OpenPGP messages). 2147 The body of this packet consists of: 2149 o Encrypted data, the output of the selected symmetric-key cipher 2150 operating in OpenPGP's variant of Cipher Feedback (CFB) mode. 2152 The symmetric cipher used may be specified in a Public-Key or 2153 Symmetric-Key Encrypted Session Key packet that precedes the 2154 Symmetrically Encrypted Data packet. In that case, the cipher 2155 algorithm octet is prefixed to the session key before it is 2156 encrypted. If no packets of these types precede the encrypted data, 2157 the IDEA algorithm is used with the session key calculated as the MD5 2158 hash of the passphrase, though this use is deprecated. 2160 The data is encrypted in CFB mode, with a CFB shift size equal to the 2161 cipher's block size. The Initial Vector (IV) is specified as all 2162 zeros. Instead of using an IV, OpenPGP prefixes a string of length 2163 equal to the block size of the cipher plus two to the data before it 2164 is encrypted. The first block-size octets (for example, 8 octets for 2165 a 64-bit block length) are random, and the following two octets are 2166 copies of the last two octets of the IV. For example, in an 8-octet 2167 block, octet 9 is a repeat of octet 7, and octet 10 is a repeat of 2168 octet 8. In a cipher of length 16, octet 17 is a repeat of octet 15 2169 and octet 18 is a repeat of octet 16. As a pedantic clarification, 2170 in both these examples, we consider the first octet to be numbered 1. 2172 After encrypting the first block-size-plus-two octets, the CFB state 2173 is resynchronized. The last block-size octets of ciphertext are 2174 passed through the cipher and the block boundary is reset. 2176 The repetition of 16 bits in the random data prefixed to the message 2177 allows the receiver to immediately check whether the session key is 2178 incorrect. See the "Security Considerations" section for hints on 2179 the proper use of this "quick check". 2181 5.8. {5.8} Marker Packet (Obsolete Literal Packet) (Tag 10) 2183 An experimental version of PGP used this packet as the Literal 2184 packet, but no released version of PGP generated Literal packets with 2185 this tag. With PGP 5.x, this packet has been reassigned and is 2186 reserved for use as the Marker packet. 2188 The body of this packet consists of: 2190 o The three octets 0x50, 0x47, 0x50 (which spell "PGP" in UTF-8). 2192 Such a packet MUST be ignored when received. It may be placed at the 2193 beginning of a message that uses features not available in PGP 2.6.x 2194 in order to cause that version to report that newer software is 2195 necessary to process the message. 2197 5.9. {5.9} Literal Data Packet (Tag 11) 2199 A Literal Data packet contains the body of a message; data that is 2200 not to be further interpreted. 2202 The body of this packet consists of: 2204 o A one-octet field that describes how the data is formatted. 2206 If it is a 'b' (0x62), then the Literal packet contains binary 2207 data. If it is a 't' (0x74), then it contains text data, and thus 2208 may need line ends converted to local form, or other text-mode 2209 changes. The tag 'u' (0x75) means the same as 't', but also 2210 indicates that implementation believes that the literal data 2211 contains UTF-8 text. 2213 Early versions of PGP also defined a value of 'l' as a 'local' 2214 mode for machine-local conversions. RFC 1991 [RFC1991] 2215 incorrectly stated this local mode flag as '1' (ASCII numeral 2216 one). Both of these local modes are deprecated. 2218 o File name as a string (one-octet length, followed by a file name). 2219 This may be a zero-length string. Commonly, if the source of the 2220 encrypted data is a file, this will be the name of the encrypted 2221 file. An implementation MAY consider the file name in the Literal 2222 packet to be a more authoritative name than the actual file name. 2224 If the special name "_CONSOLE" is used, the message is considered 2225 to be "for your eyes only". This advises that the message data is 2226 unusually sensitive, and the receiving program should process it 2227 more carefully, perhaps avoiding storing the received data to 2228 disk, for example. 2230 o A four-octet number that indicates a date associated with the 2231 literal data. Commonly, the date might be the modification date 2232 of a file, or the time the packet was created, or a zero that 2233 indicates no specific time. 2235 o The remainder of the packet is literal data. 2237 Text data is stored with text endings (i.e., network- 2238 normal line endings). These should be converted to native line 2239 endings by the receiving software. 2241 5.10. {5.10} Trust Packet (Tag 12) 2243 The Trust packet is used only within keyrings and is not normally 2244 exported. Trust packets contain data that record the user's 2245 specifications of which key holders are trustworthy introducers, 2246 along with other information that implementing software uses for 2247 trust information. The format of Trust packets is defined by a given 2248 implementation. 2250 Trust packets SHOULD NOT be emitted to output streams that are 2251 transferred to other users, and they SHOULD be ignored on any input 2252 other than local keyring files. 2254 5.11. {5.11} User ID Packet (Tag 13) 2256 A User ID packet consists of UTF-8 text that is intended to represent 2257 the name and email address of the key holder. By convention, it 2258 includes an RFC 2822 [RFC2822] mail name-addr, but there are no 2259 restrictions on its content. The packet length in the header 2260 specifies the length of the User ID. 2262 5.12. {5.12} User Attribute Packet (Tag 17) 2264 The User Attribute packet is a variation of the User ID packet. It 2265 is capable of storing more types of data than the User ID packet, 2266 which is limited to text. Like the User ID packet, a User Attribute 2267 packet may be certified by the key owner ("self-signed") or any other 2268 key owner who cares to certify it. Except as noted, a User Attribute 2269 packet may be used anywhere that a User ID packet may be used. 2271 While User Attribute packets are not a required part of the OpenPGP 2272 standard, implementations SHOULD provide at least enough 2273 compatibility to properly handle a certification signature on the 2274 User Attribute packet. A simple way to do this is by treating the 2275 User Attribute packet as a User ID packet with opaque contents, but 2276 an implementation may use any method desired. 2278 The User Attribute packet is made up of one or more attribute 2279 subpackets. Each subpacket consists of a subpacket header and a 2280 body. The header consists of: 2282 o the subpacket length (1, 2, or 5 octets) 2284 o the subpacket type (1 octet) 2286 and is followed by the subpacket specific data. 2288 The only currently defined subpacket type is 1, signifying an image. 2289 An implementation SHOULD ignore any subpacket of a type that it does 2290 not recognize. Subpacket types 100 through 110 are reserved for 2291 private or experimental use. 2293 5.12.1. {5.12.1} The Image Attribute Subpacket 2295 The Image Attribute subpacket is used to encode an image, presumably 2296 (but not required to be) that of the key owner. 2298 The Image Attribute subpacket begins with an image header. The first 2299 two octets of the image header contain the length of the image 2300 header. Note that unlike other multi-octet numerical values in this 2301 document, due to a historical accident this value is encoded as a 2302 little-endian number. The image header length is followed by a 2303 single octet for the image header version. The only currently 2304 defined version of the image header is 1, which is a 16-octet image 2305 header. The first three octets of a version 1 image header are thus 2306 0x10, 0x00, 0x01. 2308 The fourth octet of a version 1 image header designates the encoding 2309 format of the image. The only currently defined encoding format is 2310 the value 1 to indicate JPEG. Image format types 100 through 110 are 2311 reserved for private or experimental use. The rest of the version 1 2312 image header is made up of 12 reserved octets, all of which MUST be 2313 set to 0. 2315 The rest of the image subpacket contains the image itself. As the 2316 only currently defined image type is JPEG, the image is encoded in 2317 the JPEG File Interchange Format (JFIF), a standard file format for 2318 JPEG images [JFIF]. 2320 An implementation MAY try to determine the type of an image by 2321 examination of the image data if it is unable to handle a particular 2322 version of the image header or if a specified encoding format value 2323 is not recognized. 2325 5.13. {5.13} Sym. Encrypted Integrity Protected Data Packet (Tag 18) 2327 The Symmetrically Encrypted Integrity Protected Data packet is a 2328 variant of the Symmetrically Encrypted Data packet. It is a new 2329 feature created for OpenPGP that addresses the problem of detecting a 2330 modification to encrypted data. It is used in combination with a 2331 Modification Detection Code packet. 2333 There is a corresponding feature in the features Signature subpacket 2334 that denotes that an implementation can properly use this packet 2335 type. An implementation MUST support decrypting these packets and 2336 SHOULD prefer generating them to the older Symmetrically Encrypted 2337 Data packet when possible. Since this data packet protects against 2338 modification attacks, this standard encourages its proliferation. 2339 While blanket adoption of this data packet would create 2340 interoperability problems, rapid adoption is nevertheless important. 2341 An implementation SHOULD specifically denote support for this packet, 2342 but it MAY infer it from other mechanisms. 2344 For example, an implementation might infer from the use of a cipher 2345 such as Advanced Encryption Standard (AES) or Twofish that a user 2346 supports this feature. It might place in the unhashed portion of 2347 another user's key signature a Features subpacket. It might also 2348 present a user with an opportunity to regenerate their own self- 2349 signature with a Features subpacket. 2351 This packet contains data encrypted with a symmetric-key algorithm 2352 and protected against modification by the SHA-1 hash algorithm. When 2353 it has been decrypted, it will typically contain other packets (often 2354 a Literal Data packet or Compressed Data packet). The last decrypted 2355 packet in this packet's payload MUST be a Modification Detection Code 2356 packet. 2358 The body of this packet consists of: 2360 o A one-octet version number. The only currently defined value is 2361 1. 2363 o Encrypted data, the output of the selected symmetric-key cipher 2364 operating in Cipher Feedback mode with shift amount equal to the 2365 block size of the cipher (CFB-n where n is the block size). 2367 The symmetric cipher used MUST be specified in a Public-Key or 2368 Symmetric-Key Encrypted Session Key packet that precedes the 2369 Symmetrically Encrypted Data packet. In either case, the cipher 2370 algorithm octet is prefixed to the session key before it is 2371 encrypted. 2373 The data is encrypted in CFB mode, with a CFB shift size equal to the 2374 cipher's block size. The Initial Vector (IV) is specified as all 2375 zeros. Instead of using an IV, OpenPGP prefixes an octet string to 2376 the data before it is encrypted. The length of the octet string 2377 equals the block size of the cipher in octets, plus two. The first 2378 octets in the group, of length equal to the block size of the cipher, 2379 are random; the last two octets are each copies of their 2nd 2380 preceding octet. For example, with a cipher whose block size is 128 2381 bits or 16 octets, the prefix data will contain 16 random octets, 2382 then two more octets, which are copies of the 15th and 16th octets, 2383 respectively. Unlike the Symmetrically Encrypted Data Packet, no 2384 special CFB resynchronization is done after encrypting this prefix 2385 data. See "OpenPGP CFB Mode" below for more details. 2387 The repetition of 16 bits in the random data prefixed to the message 2388 allows the receiver to immediately check whether the session key is 2389 incorrect. 2391 The plaintext of the data to be encrypted is passed through the SHA-1 2392 hash function, and the result of the hash is appended to the 2393 plaintext in a Modification Detection Code packet. The input to the 2394 hash function includes the prefix data described above; it includes 2395 all of the plaintext, and then also includes two octets of values 2396 0xD3, 0x14. These represent the encoding of a Modification Detection 2397 Code packet tag and length field of 20 octets. 2399 The resulting hash value is stored in a Modification Detection Code 2400 (MDC) packet, which MUST use the two octet encoding just given to 2401 represent its tag and length field. The body of the MDC packet is 2402 the 20-octet output of the SHA-1 hash. 2404 The Modification Detection Code packet is appended to the plaintext 2405 and encrypted along with the plaintext using the same CFB context. 2407 During decryption, the plaintext data should be hashed with SHA-1, 2408 including the prefix data as well as the packet tag and length field 2409 of the Modification Detection Code packet. The body of the MDC 2410 packet, upon decryption, is compared with the result of the SHA-1 2411 hash. 2413 Any failure of the MDC indicates that the message has been modified 2414 and MUST be treated as a security problem. Failures include a 2415 difference in the hash values, but also the absence of an MDC packet, 2416 or an MDC packet in any position other than the end of the plaintext. 2417 Any failure SHOULD be reported to the user. 2419 Note: future designs of new versions of this packet should consider 2420 rollback attacks since it will be possible for an attacker to change 2421 the version back to 1. 2423 NON-NORMATIVE EXPLANATION 2425 The MDC system, as packets 18 and 19 are called, were created to 2426 provide an integrity mechanism that is less strong than a 2427 signature, yet stronger than bare CFB encryption. 2429 It is a limitation of CFB encryption that damage to the 2430 ciphertext will corrupt the affected cipher blocks and the block 2431 following. Additionally, if data is removed from the end of a 2432 CFB-encrypted block, that removal is undetectable. (Note also 2433 that CBC mode has a similar limitation, but data removed from 2434 the front of the block is undetectable.) 2436 The obvious way to protect or authenticate an encrypted block is 2437 to digitally sign it. However, many people do not wish to 2438 habitually sign data, for a large number of reasons beyond the 2439 scope of this document. Suffice it to say that many people 2440 consider properties such as deniability to be as valuable as 2441 integrity. 2443 OpenPGP addresses this desire to have more security than raw 2444 encryption and yet preserve deniability with the MDC system. An 2445 MDC is intentionally not a MAC. Its name was not selected by 2446 accident. It is analogous to a checksum. 2448 Despite the fact that it is a relatively modest system, it has 2449 proved itself in the real world. It is an effective defense to 2450 several attacks that have surfaced since it has been created. 2451 It has met its modest goals admirably. 2453 Consequently, because it is a modest security system, it has 2454 modest requirements on the hash function(s) it employs. It does 2455 not rely on a hash function being collision-free, it relies on a 2456 hash function being one-way. If a forger, Frank, wishes to send 2457 Alice a (digitally) unsigned message that says, "I've always 2458 secretly loved you, signed Bob", it is far easier for him to 2459 construct a new message than it is to modify anything 2460 intercepted from Bob. (Note also that if Bob wishes to 2461 communicate secretly with Alice, but without authentication or 2462 identification and with a threat model that includes forgers, he 2463 has a problem that transcends mere cryptography.) 2465 Note also that unlike nearly every other OpenPGP subsystem, 2466 there are no parameters in the MDC system. It hard-defines 2467 SHA-1 as its hash function. This is not an accident. It is an 2468 intentional choice to avoid downgrade and cross-grade attacks 2469 while making a simple, fast system. (A downgrade attack would 2470 be an attack that replaced SHA-256 with SHA-1, for example. A 2471 cross-grade attack would replace SHA-1 with another 160-bit 2472 hash, such as RIPE-MD/160, for example.) 2474 However, given the present state of hash function cryptanalysis 2475 and cryptography, it may be desirable to upgrade the MDC system 2476 to a new hash function. See Section 13.11 in the "IANA 2477 Considerations" for guidance. 2479 5.14. {5.14} Modification Detection Code Packet (Tag 19) 2481 The Modification Detection Code packet contains a SHA-1 hash of 2482 plaintext data, which is used to detect message modification. It is 2483 only used with a Symmetrically Encrypted Integrity Protected Data 2484 packet. The Modification Detection Code packet MUST be the last 2485 packet in the plaintext data that is encrypted in the Symmetrically 2486 Encrypted Integrity Protected Data packet, and MUST appear in no 2487 other place. 2489 A Modification Detection Code packet MUST have a length of 20 octets. 2491 The body of this packet consists of: 2493 o A 20-octet SHA-1 hash of the preceding plaintext data of the 2494 Symmetrically Encrypted Integrity Protected Data packet, including 2495 prefix data, the tag octet, and length octet of the Modification 2496 Detection Code packet. 2498 Note that the Modification Detection Code packet MUST always use a 2499 new format encoding of the packet tag, and a one-octet encoding of 2500 the packet length. The reason for this is that the hashing rules for 2501 modification detection include a one-octet tag and one-octet length 2502 in the data hash. While this is a bit restrictive, it reduces 2503 complexity. 2505 6. {6} Radix-64 Conversions 2507 As stated in the introduction, OpenPGP's underlying native 2508 representation for objects is a stream of arbitrary octets, and some 2509 systems desire these objects to be immune to damage caused by 2510 character set translation, data conversions, etc. 2512 In principle, any printable encoding scheme that met the requirements 2513 of the unsafe channel would suffice, since it would not change the 2514 underlying binary bit streams of the native OpenPGP data structures. 2515 The OpenPGP standard specifies one such printable encoding scheme to 2516 ensure interoperability. 2518 OpenPGP's Radix-64 encoding is composed of two parts: a base64 2519 encoding of the binary data and a checksum. The base64 encoding is 2520 identical to the MIME base64 content-transfer-encoding [RFC2045]. 2522 The checksum is a 24-bit Cyclic Redundancy Check (CRC) converted to 2523 four characters of radix-64 encoding by the same MIME base64 2524 transformation, preceded by an equal sign (=). The CRC is computed 2525 by using the generator 0x864CFB and an initialization of 0xB704CE. 2526 The accumulation is done on the data before it is converted to radix- 2527 64, rather than on the converted data. A sample implementation of 2528 this algorithm is in the next section. 2530 The checksum with its leading equal sign MAY appear on the first line 2531 after the base64 encoded data. 2533 Rationale for CRC-24: The size of 24 bits fits evenly into printable 2534 base64. The nonzero initialization can detect more errors than a 2535 zero initialization. 2537 6.1. {6.1} An Implementation of the CRC-24 in "C" 2538 #define CRC24_INIT 0xB704CEL 2539 #define CRC24_POLY 0x1864CFBL 2541 typedef long crc24; 2542 crc24 crc_octets(unsigned char *octets, size_t len) 2543 { 2544 crc24 crc = CRC24_INIT; 2545 int i; 2546 while (len--) { 2547 crc ^= (*octets++) << 16; 2548 for (i = 0; i < 8; i++) { 2549 crc <<= 1; 2550 if (crc & 0x1000000) 2551 crc ^= CRC24_POLY; 2552 } 2553 } 2554 return crc & 0xFFFFFFL; 2555 } 2557 6.2. {6.2} Forming ASCII Armor 2559 When OpenPGP encodes data into ASCII Armor, it puts specific headers 2560 around the Radix-64 encoded data, so OpenPGP can reconstruct the data 2561 later. An OpenPGP implementation MAY use ASCII armor to protect raw 2562 binary data. OpenPGP informs the user what kind of data is encoded 2563 in the ASCII armor through the use of the headers. 2565 Concatenating the following data creates ASCII Armor: 2567 o An Armor Header Line, appropriate for the type of data 2569 o Armor Headers 2571 o A blank (zero-length, or containing only whitespace) line 2573 o The ASCII-Armored data 2575 o An Armor Checksum 2577 o The Armor Tail, which depends on the Armor Header Line 2579 An Armor Header Line consists of the appropriate header line text 2580 surrounded by five (5) dashes ('-', 0x2D) on either side of the 2581 header line text. The header line text is chosen based upon the type 2582 of data that is being encoded in Armor, and how it is being encoded. 2583 Header line texts include the following strings: 2585 BEGIN PGP MESSAGE Used for signed, encrypted, or compressed files. 2587 BEGIN PGP PUBLIC KEY BLOCK Used for armoring public keys. 2589 BEGIN PGP PRIVATE KEY BLOCK Used for armoring private keys. 2591 BEGIN PGP MESSAGE, PART X/Y Used for multi-part messages, where the 2592 armor is split amongst Y parts, and this is the Xth part out of Y. 2594 BEGIN PGP MESSAGE, PART X Used for multi-part messages, where this 2595 is the Xth part of an unspecified number of parts. Requires the 2596 MESSAGE-ID Armor Header to be used. 2598 BEGIN PGP SIGNATURE Used for detached signatures, OpenPGP/MIME 2599 signatures, and cleartext signatures. Note that PGP 2.x uses 2600 BEGIN PGP MESSAGE for detached signatures. 2602 Note that all these Armor Header Lines are to consist of a complete 2603 line. That is to say, there is always a line ending preceding the 2604 starting five dashes, and following the ending five dashes. The 2605 header lines, therefore, MUST start at the beginning of a line, and 2606 MUST NOT have text other than whitespace following them on the same 2607 line. These line endings are considered a part of the Armor Header 2608 Line for the purposes of determining the content they delimit. This 2609 is particularly important when computing a cleartext signature (see 2610 below). 2612 The Armor Headers are pairs of strings that can give the user or the 2613 receiving OpenPGP implementation some information about how to decode 2614 or use the message. The Armor Headers are a part of the armor, not a 2615 part of the message, and hence are not protected by any signatures 2616 applied to the message. 2618 The format of an Armor Header is that of a key-value pair. A colon 2619 (':' 0x38) and a single space (0x20) separate the key and value. 2620 OpenPGP should consider improperly formatted Armor Headers to be 2621 corruption of the ASCII Armor. Unknown keys should be reported to 2622 the user, but OpenPGP should continue to process the message. 2624 Note that some transport methods are sensitive to line length. While 2625 there is a limit of 76 characters for the Radix-64 data 2626 (Section 6.3), there is no limit to the length of Armor Headers. 2627 Care should be taken that the Armor Headers are short enough to 2628 survive transport. One way to do this is to repeat an Armor Header 2629 key multiple times with different values for each so that no one line 2630 is overly long. 2632 Currently defined Armor Header Keys are as follows: 2634 o "Version", which states the OpenPGP implementation and version 2635 used to encode the message. 2637 o "Comment", a user-defined comment. OpenPGP defines all text to be 2638 in UTF-8. A comment may be any UTF-8 string. However, the whole 2639 point of armoring is to provide seven-bit-clean data. 2640 Consequently, if a comment has characters that are outside the US- 2641 ASCII range of UTF, they may very well not survive transport. 2643 o "Hash", a comma-separated list of hash algorithms used in this 2644 message. This is used only in cleartext signed messages. 2646 o "MessageID", a 32-character string of printable characters. The 2647 string must be the same for all parts of a multi-part message that 2648 uses the "PART X" Armor Header. MessageID strings should be 2649 unique enough that the recipient of the mail can associate all the 2650 parts of a message with each other. A good checksum or 2651 cryptographic hash function is sufficient. 2653 The MessageID SHOULD NOT appear unless it is in a multi-part 2654 message. If it appears at all, it MUST be computed from the 2655 finished (encrypted, signed, etc.) message in a deterministic 2656 fashion, rather than contain a purely random value. This is to 2657 allow the legitimate recipient to determine that the MessageID 2658 cannot serve as a covert means of leaking cryptographic key 2659 information. 2661 o "Charset", a description of the character set that the plaintext 2662 is in. Please note that OpenPGP defines text to be in UTF-8. An 2663 implementation will get best results by translating into and out 2664 of UTF-8. However, there are many instances where this is easier 2665 said than done. Also, there are communities of users who have no 2666 need for UTF-8 because they are all happy with a character set 2667 like ISO Latin-5 or a Japanese character set. In such instances, 2668 an implementation MAY override the UTF-8 default by using this 2669 header key. An implementation MAY implement this key and any 2670 translations it cares to; an implementation MAY ignore it and 2671 assume all text is UTF-8. 2673 The Armor Tail Line is composed in the same manner as the Armor 2674 Header Line, except the string "BEGIN" is replaced by the string 2675 "END". 2677 6.3. {6.3} Encoding Binary in Radix-64 2679 The encoding process represents 24-bit groups of input bits as output 2680 strings of 4 encoded characters. Proceeding from left to right, a 2681 24-bit input group is formed by concatenating three 8-bit input 2682 groups. These 24 bits are then treated as four concatenated 6-bit 2683 groups, each of which is translated into a single digit in the 2684 Radix-64 alphabet. When encoding a bit stream with the Radix-64 2685 encoding, the bit stream must be presumed to be ordered with the most 2686 significant bit first. That is, the first bit in the stream will be 2687 the high-order bit in the first 8-bit octet, and the eighth bit will 2688 be the low-order bit in the first 8-bit octet, and so on. 2690 +--first octet--+-second octet--+--third octet--+ 2691 |7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0| 2692 +-----------+---+-------+-------+---+-----------+ 2693 |5 4 3 2 1 0|5 4 3 2 1 0|5 4 3 2 1 0|5 4 3 2 1 0| 2694 +--1.index--+--2.index--+--3.index--+--4.index--+ 2696 Each 6-bit group is used as an index into an array of 64 printable 2697 characters from the table below. The character referenced by the 2698 index is placed in the output string. 2700 Value Encoding Value Encoding Value Encoding Value Encoding 2701 0 A 17 R 34 i 51 z 2702 1 B 18 S 35 j 52 0 2703 2 C 19 T 36 k 53 1 2704 3 D 20 U 37 l 54 2 2705 4 E 21 V 38 m 55 3 2706 5 F 22 W 39 n 56 4 2707 6 G 23 X 40 o 57 5 2708 7 H 24 Y 41 p 58 6 2709 8 I 25 Z 42 q 59 7 2710 9 J 26 a 43 r 60 8 2711 10 K 27 b 44 s 61 9 2712 11 L 28 c 45 t 62 + 2713 12 M 29 d 46 u 63 / 2714 13 N 30 e 47 v 2715 14 O 31 f 48 w (pad) = 2716 15 P 32 g 49 x 2717 16 Q 33 h 50 y 2719 The encoded output stream must be represented in lines of no more 2720 than 76 characters each. 2722 Special processing is performed if fewer than 24 bits are available 2723 at the end of the data being encoded. There are three possibilities: 2725 1. The last data group has 24 bits (3 octets). No special 2726 processing is needed. 2728 2. The last data group has 16 bits (2 octets). The first two 2729 6-bit groups are processed as above. The third (incomplete) 2730 data group has two zero-value bits added to it, and is 2731 processed as above. A pad character (=) is added to the 2732 output. 2734 3. The last data group has 8 bits (1 octet). The first 6-bit 2735 group is processed as above. The second (incomplete) data 2736 group has four zero-value bits added to it, and is processed 2737 as above. Two pad characters (=) are added to the output. 2739 6.4. {6.4} Decoding Radix-64 2741 In Radix-64 data, characters other than those in the table, line 2742 breaks, and other white space probably indicate a transmission error, 2743 about which a warning message or even a message rejection might be 2744 appropriate under some circumstances. Decoding software must ignore 2745 all white space. 2747 Because it is used only for padding at the end of the data, the 2748 occurrence of any "=" characters may be taken as evidence that the 2749 end of the data has been reached (without truncation in transit). No 2750 such assurance is possible, however, when the number of octets 2751 transmitted was a multiple of three and no "=" characters are 2752 present. 2754 6.5. {6.5} Examples of Radix-64 2755 Input data: 0x14FB9C03D97E 2756 Hex: 1 4 F B 9 C | 0 3 D 9 7 E 2757 8-bit: 00010100 11111011 10011100 | 00000011 11011001 01111110 2758 6-bit: 000101 001111 101110 011100 | 000000 111101 100101 111110 2759 Decimal: 5 15 46 28 0 61 37 62 2760 Output: F P u c A 9 l + 2761 Input data: 0x14FB9C03D9 2762 Hex: 1 4 F B 9 C | 0 3 D 9 2763 8-bit: 00010100 11111011 10011100 | 00000011 11011001 2764 pad with 00 2765 6-bit: 000101 001111 101110 011100 | 000000 111101 100100 2766 Decimal: 5 15 46 28 0 61 36 2767 pad with = 2768 Output: F P u c A 9 k = 2769 Input data: 0x14FB9C03 2770 Hex: 1 4 F B 9 C | 0 3 2771 8-bit: 00010100 11111011 10011100 | 00000011 2772 pad with 0000 2773 6-bit: 000101 001111 101110 011100 | 000000 110000 2774 Decimal: 5 15 46 28 0 48 2775 pad with = = 2776 Output: F P u c A w = = 2778 6.6. {6.6} Example of an ASCII Armored Message 2780 -----BEGIN PGP MESSAGE----- 2781 Version: OpenPrivacy 0.99 2783 yDgBO22WxBHv7O8X7O/jygAEzol56iUKiXmV+XmpCtmpqQUKiQrFqclFqUDBovzS 2784 vBSFjNSiVHsuAA== 2785 =njUN 2786 -----END PGP MESSAGE----- 2788 Note that this example has extra indenting; an actual armored message 2789 would have no leading whitespace. 2791 7. {7} Cleartext Signature Framework 2793 It is desirable to be able to sign a textual octet stream without 2794 ASCII armoring the stream itself, so the signed text is still 2795 readable without special software. In order to bind a signature to 2796 such a cleartext, this framework is used. (Note that this framework 2797 is not intended to be reversible. RFC 3156 [RFC3156] defines another 2798 way to sign cleartext messages for environments that support MIME.) 2800 The cleartext signed message consists of: 2802 o The cleartext header '-----BEGIN PGP SIGNED MESSAGE-----' on a 2803 single line, 2805 o One or more "Hash" Armor Headers, 2807 o Exactly one empty line not included into the message digest, 2809 o The dash-escaped cleartext that is included into the message 2810 digest, 2812 o The ASCII armored signature(s) including the '-----BEGIN PGP 2813 SIGNATURE-----' Armor Header and Armor Tail Lines. 2815 If the "Hash" Armor Header is given, the specified message digest 2816 algorithm(s) are used for the signature. If there are no such 2817 headers, MD5 is used. If MD5 is the only hash used, then an 2818 implementation MAY omit this header for improved V2.x compatibility. 2819 If more than one message digest is used in the signature, the "Hash" 2820 armor header contains a comma-delimited list of used message digests. 2822 Current message digest names are described below with the algorithm 2823 IDs. 2825 An implementation SHOULD add a line break after the cleartext, but 2826 MAY omit it if the cleartext ends with a line break. This is for 2827 visual clarity. 2829 7.1. {7.1} Dash-Escaped Text 2831 The cleartext content of the message must also be dash-escaped. 2833 Dash-escaped cleartext is the ordinary cleartext where every line 2834 starting with a dash '-' (0x2D) is prefixed by the sequence dash '-' 2835 (0x2D) and space ' ' (0x20). This prevents the parser from 2836 recognizing armor headers of the cleartext itself. An implementation 2837 MAY dash-escape any line, SHOULD dash-escape lines commencing "From" 2838 followed by a space, and MUST dash-escape any line commencing in a 2839 dash. The message digest is computed using the cleartext itself, not 2840 the dash-escaped form. 2842 As with binary signatures on text documents, a cleartext signature is 2843 calculated on the text using canonical line endings. The 2844 line ending (i.e., the ) before the '-----BEGIN PGP 2845 SIGNATURE-----' line that terminates the signed text is not 2846 considered part of the signed text. 2848 When reversing dash-escaping, an implementation MUST strip the string 2849 "- " if it occurs at the beginning of a line, and SHOULD warn on "-" 2850 and any character other than a space at the beginning of a line. 2852 Also, any trailing whitespace -- spaces (0x20) and tabs (0x09) -- at 2853 the end of any line is removed when the cleartext signature is 2854 generated. 2856 8. {8} Regular Expressions 2858 A regular expression is zero or more branches, separated by '|'. It 2859 matches anything that matches one of the branches. 2861 A branch is zero or more pieces, concatenated. It matches a match 2862 for the first, followed by a match for the second, etc. 2864 A piece is an atom possibly followed by '_', '+', or '?'. An atom 2865 followed by '_' matches a sequence of 0 or more matches of the atom. 2866 An atom followed by '+' matches a sequence of 1 or more matches of 2867 the atom. An atom followed by '?' matches a match of the atom, or 2868 the null string. 2870 An atom is a regular expression in parentheses (matching a match for 2871 the regular expression), a range (see below), '.' (matching any 2872 single character), '^' (matching the null string at the beginning of 2873 the input string), '$' (matching the null string at the end of the 2874 input string), a '' followed by a single character (matching that 2875 character), or a single character with no other significance 2876 (matching that character). 2878 A range is a sequence of characters enclosed in '[]'. It normally 2879 matches any single character from the sequence. If the sequence 2880 begins with '^', it matches any single character not from the rest of 2881 the sequence. If two characters in the sequence are separated by 2882 '-', this is shorthand for the full list of ASCII characters between 2883 them (e.g., '[0-9]' matches any decimal digit). To include a literal 2884 ']' in the sequence, make it the first character (following a 2885 possible '^'). To include a literal '-', make it the first or last 2886 character. 2888 9. {9} Constants 2890 This section describes the constants used in OpenPGP. 2892 Note that these tables are not exhaustive lists; an implementation 2893 MAY implement an algorithm not on these lists, so long as the 2894 algorithm numbers are chosen from the private or experimental 2895 algorithm range. 2897 See the section "Notes on Algorithms" below for more discussion of 2898 the algorithms. 2900 9.1. {9.1} Public-Key Algorithms 2902 +-----------+----------------------------------------------------+ 2903 | ID | Algorithm | 2904 +-----------+----------------------------------------------------+ 2905 | 1 | RSA (Encrypt or Sign) [HAC] | 2906 | 2 | RSA Encrypt-Only [HAC] | 2907 | 3 | RSA Sign-Only [HAC] | 2908 | 16 | Elgamal (Encrypt-Only) [ELGAMAL] [HAC] | 2909 | 17 | DSA (Digital Signature Algorithm) [FIPS186] [HAC] | 2910 | 18 | ECDH public key algorithm | 2911 | 19 | ECDSA public key algorithm [FIPS186-3] | 2912 | 20 | Reserved (formerly Elgamal Encrypt or Sign) | 2913 | 21 | Reserved for Diffie-Hellman | 2914 | | (X9.42, as defined for IETF-S/MIME) | 2915 | 100--110 | Private/Experimental algorithm | 2916 +-----------+----------------------------------------------------+ 2918 Implementations MUST implement DSA and ECDSA for signatures, and 2919 Elgamal and ECDH for encryption. Implementations SHOULD implement 2920 RSA keys (1). RSA Encrypt-Only (2) and RSA Sign-Only are deprecated 2921 and SHOULD NOT be generated, but may be interpreted. See 2922 Section 13.5. See Section 13.8 for notes Elgamal Encrypt or Sign 2923 (20), and X9.42 (21). Implementations MAY implement any other 2924 algorithm. 2926 A compatible specification of ECDSA is given in [RFC6090] as "KT-I 2927 Signatures" and in [SEC1]; ECDH is defined in Section 13.4 this 2928 document. 2930 9.2. ECC Curve OID 2932 The parameter curve OID is an array of octets that define a named 2933 curve. The table below specifies the exact sequence of bytes for 2934 each named curve referenced in this document: 2936 +---------------------+------+-----------------------+--------------+ 2937 | ASN.1 Object | OID | Curve OID bytes in | Curve name | 2938 | Identifier | len | hexadecimal | in | 2939 | | | representation | [FIPS186-3] | 2940 +---------------------+------+-----------------------+--------------+ 2941 | 1.2.840.10045.3.1.7 | 8 | 2A 86 48 CE 3D 03 01 | NIST curve | 2942 | | | 07 | P-256 | 2943 | 1.3.132.0.34 | 5 | 2B 81 04 00 22 | NIST curve | 2944 | | | | P-384 | 2945 | 1.3.132.0.35 | 5 | 2B 81 04 00 23 | NIST curve | 2946 | | | | P-521 | 2947 +---------------------+------+-----------------------+--------------+ 2949 The sequence of octets in the third column is the result of applying 2950 the Distinguished Encoding Rules (DER) to the ASN.1 Object Identifier 2951 with subsequent truncation. The truncation removes the two fields of 2952 encoded Object Identifier. The first omitted field is one octet 2953 representing the Object Identifier tag, and the second omitted field 2954 is the length of the Object Identifier body. For example, the 2955 complete ASN.1 DER encoding for the NIST P-256 curve OID is "06 08 2A 2956 86 48 CE 3D 03 01 07", from which the first entry in the table above 2957 is constructed by omitting the first two octets. Only the truncated 2958 sequence of octets is the valid representation of a curve OID. 2960 9.3. {9.2} Symmetric-Key Algorithms 2962 +-----------+-----------------------------------------------+ 2963 | ID | Algorithm | 2964 +-----------+-----------------------------------------------+ 2965 | 0 | Plaintext or unencrypted data | 2966 | 1 | IDEA [IDEA] | 2967 | 2 | TripleDES (DES-EDE, [SCHNEIER] [HAC] | 2968 | | - 168 bit key derived from 192) | 2969 | 3 | CAST5 (128 bit key, as per [RFC2144]) | 2970 | 4 | Blowfish (128 bit key, 16 rounds) [BLOWFISH] | 2971 | 5 | Reserved | 2972 | 6 | Reserved | 2973 | 7 | AES with 128-bit key [AES] | 2974 | 8 | AES with 192-bit key | 2975 | 9 | AES with 256-bit key | 2976 | 10 | Twofish with 256-bit key [TWOFISH] | 2977 | 11 | Camellia with 128-bit key [RFC3713] | 2978 | 12 | Camellia with 192-bit key | 2979 | 13 | Camellia with 256-bit key | 2980 | 100--110 | Private/Experimental algorithm | 2981 +-----------+-----------------------------------------------+ 2983 Implementations MUST implement TripleDES. Implementations SHOULD 2984 implement AES-128 and CAST5. Implementations that interoperate with 2985 PGP 2.6 or earlier need to support IDEA, as that is the only 2986 symmetric cipher those versions use. Implementations MAY implement 2987 any other algorithm. 2989 9.4. {9.3} Compression Algorithms 2991 +-----------+---------------------------------+ 2992 | ID | Algorithm | 2993 +-----------+---------------------------------+ 2994 | 0 | Uncompressed | 2995 | 1 | ZIP [RFC1951] | 2996 | 2 | ZLIB [RFC1950] | 2997 | 3 | BZip2 [BZ2] | 2998 | 100--110 | Private/Experimental algorithm | 2999 +-----------+---------------------------------+ 3001 Implementations MUST implement uncompressed data. Implementations 3002 SHOULD implement ZIP. Implementations MAY implement any other 3003 algorithm. 3005 9.5. {9.4} Hash Algorithms 3007 +-----------+---------------------------------+--------------+ 3008 | ID | Algorithm | Text Name | 3009 +-----------+---------------------------------+--------------+ 3010 | 1 | MD5 [HAC] | "MD5" | 3011 | 2 | SHA-1 [FIPS180] | "SHA1" | 3012 | 3 | RIPE-MD/160 [HAC] | "RIPEMD160" | 3013 | 4 | Reserved | | 3014 | 5 | Reserved | | 3015 | 6 | Reserved | | 3016 | 7 | Reserved | | 3017 | 8 | SHA256 [FIPS180] | "SHA256" | 3018 | 9 | SHA384 [FIPS180] | "SHA384" | 3019 | 10 | SHA512 [FIPS180] | "SHA512" | 3020 | 11 | SHA224 [FIPS180] | "SHA224" | 3021 | 100--110 | Private/Experimental algorithm | | 3022 +-----------+---------------------------------+--------------+ 3024 Implementations MUST implement SHA-1. Implementations MAY implement 3025 other algorithms. MD5 is deprecated. 3027 10. {10} IANA Considerations 3029 OpenPGP is highly parameterized, and consequently there are a number 3030 of considerations for allocating parameters for extensions. This 3031 section describes how IANA should look at extensions to the protocol 3032 as described in this document. 3034 10.1. {10.1} New String-to-Key Specifier Types 3036 OpenPGP S2K specifiers contain a mechanism for new algorithms to turn 3037 a string into a key. This specification creates a registry of S2K 3038 specifier types. The registry includes the S2K type, the name of the 3039 S2K, and a reference to the defining specification. The initial 3040 values for this registry can be found in Section 3.7.1. Adding a new 3041 S2K specifier MUST be done through the IETF CONSENSUS method, as 3042 described in [RFC2434]. 3044 10.2. {10.2} New Packets 3046 Major new features of OpenPGP are defined through new packet types. 3047 This specification creates a registry of packet types. The registry 3048 includes the packet type, the name of the packet, and a reference to 3049 the defining specification. The initial values for this registry can 3050 be found in Section 4.3. Adding a new packet type MUST be done 3051 through the IETF CONSENSUS method, as described in [RFC2434]. 3053 10.2.1. {10.2.1} User Attribute Types 3055 The User Attribute packet permits an extensible mechanism for other 3056 types of certificate identification. This specification creates a 3057 registry of User Attribute types. The registry includes the User 3058 Attribute type, the name of the User Attribute, and a reference to 3059 the defining specification. The initial values for this registry can 3060 be found in Section 5.12. Adding a new User Attribute type MUST be 3061 done through the IETF CONSENSUS method, as described in [RFC2434]. 3063 10.2.2. {10.2.1.1} Image Format Subpacket Types 3065 Within User Attribute packets, there is an extensible mechanism for 3066 other types of image-based user attributes. This specification 3067 creates a registry of Image Attribute subpacket types. The registry 3068 includes the Image Attribute subpacket type, the name of the Image 3069 Attribute subpacket, and a reference to the defining specification. 3070 The initial values for this registry can be found in Section 5.12.1. 3071 Adding a new Image Attribute subpacket type MUST be done through the 3072 IETF CONSENSUS method, as described in [RFC2434]. 3074 10.2.3. {10.2.2} New Signature Subpackets 3076 OpenPGP signatures contain a mechanism for signed (or unsigned) data 3077 to be added to them for a variety of purposes in the Signature 3078 subpackets as discussed in Section 5.2.3.1. This specification 3079 creates a registry of Signature subpacket types. The registry 3080 includes the Signature subpacket type, the name of the subpacket, and 3081 a reference to the defining specification. The initial values for 3082 this registry can be found in Section 5.2.3.1. Adding a new 3083 Signature subpacket MUST be done through the IETF CONSENSUS method, 3084 as described in [RFC2434]. 3086 10.2.3.1. {10.2.2.1} Signature Notation Data Subpackets 3088 OpenPGP signatures further contain a mechanism for extensions in 3089 signatures. These are the Notation Data subpackets, which contain a 3090 key/value pair. Notations contain a user space that is completely 3091 unmanaged and an IETF space. 3093 This specification creates a registry of Signature Notation Data 3094 types. The registry includes the Signature Notation Data type, the 3095 name of the Signature Notation Data, its allowed values, and a 3096 reference to the defining specification. The initial values for this 3097 registry can be found in Section 5.2.3.16. Adding a new Signature 3098 Notation Data subpacket MUST be done through the EXPERT REVIEW 3099 method, as described in [RFC2434]. 3101 10.2.3.2. {10.2.2.2} Key Server Preference Extensions 3103 OpenPGP signatures contain a mechanism for preferences to be 3104 specified about key servers. This specification creates a registry 3105 of key server preferences. The registry includes the key server 3106 preference, the name of the preference, and a reference to the 3107 defining specification. The initial values for this registry can be 3108 found in Section 5.2.3.17. Adding a new key server preference MUST 3109 be done through the IETF CONSENSUS method, as described in [RFC2434]. 3111 10.2.3.3. {10.2.2.3} Key Flags Extensions 3113 OpenPGP signatures contain a mechanism for flags to be specified 3114 about key usage. This specification creates a registry of key usage 3115 flags. The registry includes the key flags value, the name of the 3116 flag, and a reference to the defining specification. The initial 3117 values for this registry can be found in Section 5.2.3.21. Adding a 3118 new key usage flag MUST be done through the IETF CONSENSUS method, as 3119 described in [RFC2434]. 3121 10.2.3.4. {10.2.2.4} Reason for Revocation Extensions 3123 OpenPGP signatures contain a mechanism for flags to be specified 3124 about why a key was revoked. This specification creates a registry 3125 of "Reason for Revocation" flags. The registry includes the "Reason 3126 for Revocation" flags value, the name of the flag, and a reference to 3127 the defining specification. The initial values for this registry can 3128 be found in Section 5.2.3.23. Adding a new feature flag MUST be done 3129 through the IETF CONSENSUS method, as described in [RFC2434]. 3131 10.2.3.5. {10.2.2.5} Implementation Features 3133 OpenPGP signatures contain a mechanism for flags to be specified 3134 stating which optional features an implementation supports. This 3135 specification creates a registry of feature-implementation flags. 3136 The registry includes the feature-implementation flags value, the 3137 name of the flag, and a reference to the defining specification. The 3138 initial values for this registry can be found in Section 5.2.3.24. 3139 Adding a new feature-implementation flag MUST be done through the 3140 IETF CONSENSUS method, as described in [RFC2434]. 3142 Also see Section 13.12 for more information about when feature flags 3143 are needed. 3145 10.2.4. {10.2.3} New Packet Versions 3147 The core OpenPGP packets all have version numbers, and can be revised 3148 by introducing a new version of an existing packet. This 3149 specification creates a registry of packet types. The registry 3150 includes the packet type, the number of the version, and a reference 3151 to the defining specification. The initial values for this registry 3152 can be found in Section 5. Adding a new packet version MUST be done 3153 through the IETF CONSENSUS method, as described in [RFC2434]. 3155 10.3. {10.3} New Algorithms 3157 Section 9 lists the core algorithms that OpenPGP uses. Adding in a 3158 new algorithm is usually simple. For example, adding in a new 3159 symmetric cipher usually would not need anything more than allocating 3160 a constant for that cipher. If that cipher had other than a 64-bit 3161 or 128-bit block size, there might need to be additional 3162 documentation describing how OpenPGP-CFB mode would be adjusted. 3163 Similarly, when DSA was expanded from a maximum of 1024-bit public 3164 keys to 3072-bit public keys, the revision of FIPS 186 contained 3165 enough information itself to allow implementation. Changes to this 3166 document were made mainly for emphasis. 3168 10.3.1. {10.3.1} Public-Key Algorithms 3170 OpenPGP specifies a number of public-key algorithms. This 3171 specification creates a registry of public-key algorithm identifiers. 3172 The registry includes the algorithm name, its key sizes and 3173 parameters, and a reference to the defining specification. The 3174 initial values for this registry can be found in Section 9. Adding a 3175 new public-key algorithm MUST be done through the IETF CONSENSUS 3176 method, as described in [RFC2434]. 3178 10.3.2. {10.3.2} Symmetric-Key Algorithms 3180 OpenPGP specifies a number of symmetric-key algorithms. This 3181 specification creates a registry of symmetric-key algorithm 3182 identifiers. The registry includes the algorithm name, its key sizes 3183 and block size, and a reference to the defining specification. The 3184 initial values for this registry can be found in Section 9. Adding a 3185 new symmetric-key algorithm MUST be done through the IETF CONSENSUS 3186 method, as described in [RFC2434]. 3188 10.3.3. {10.3.3} Hash Algorithms 3190 OpenPGP specifies a number of hash algorithms. This specification 3191 creates a registry of hash algorithm identifiers. The registry 3192 includes the algorithm name, a text representation of that name, its 3193 block size, an OID hash prefix, and a reference to the defining 3194 specification. The initial values for this registry can be found in 3195 Section 9 for the algorithm identifiers and text names, and 3196 Section 5.2.2 for the OIDs and expanded signature prefixes. Adding a 3197 new hash algorithm MUST be done through the IETF CONSENSUS method, as 3198 described in [RFC2434]. 3200 10.3.4. {10.3.4} Compression Algorithms 3202 OpenPGP specifies a number of compression algorithms. This 3203 specification creates a registry of compression algorithm 3204 identifiers. The registry includes the algorithm name and a 3205 reference to the defining specification. The initial values for this 3206 registry can be found in Section 9.3. Adding a new compression key 3207 algorithm MUST be done through the IETF CONSENSUS method, as 3208 described in [RFC2434]. 3210 11. {11} Packet Composition 3212 OpenPGP packets are assembled into sequences in order to create 3213 messages and to transfer keys. Not all possible packet sequences are 3214 meaningful and correct. This section describes the rules for how 3215 packets should be placed into sequences. 3217 11.1. {11.1} Transferable Public Keys 3219 OpenPGP users may transfer public keys. The essential elements of a 3220 transferable public key are as follows: 3222 o One Public-Key packet 3224 o Zero or more revocation signatures 3226 o One or more User ID packets 3228 o After each User ID packet, zero or more Signature packets 3229 (certifications) 3231 o Zero or more User Attribute packets 3233 o After each User Attribute packet, zero or more Signature packets 3234 (certifications) 3236 o Zero or more Subkey packets 3238 o After each Subkey packet, one Signature packet, plus optionally a 3239 revocation 3241 The Public-Key packet occurs first. Each of the following User ID 3242 packets provides the identity of the owner of this public key. If 3243 there are multiple User ID packets, this corresponds to multiple 3244 means of identifying the same unique individual user; for example, a 3245 user may have more than one email address, and construct a User ID 3246 for each one. 3248 Immediately following each User ID packet, there are zero or more 3249 Signature packets. Each Signature packet is calculated on the 3250 immediately preceding User ID packet and the initial Public-Key 3251 packet. The signature serves to certify the corresponding public key 3252 and User ID. In effect, the signer is testifying to his or her 3253 belief that this public key belongs to the user identified by this 3254 User ID. 3256 Within the same section as the User ID packets, there are zero or 3257 more User Attribute packets. Like the User ID packets, a User 3258 Attribute packet is followed by zero or more Signature packets 3259 calculated on the immediately preceding User Attribute packet and the 3260 initial Public-Key packet. 3262 User Attribute packets and User ID packets may be freely intermixed 3263 in this section, so long as the signatures that follow them are 3264 maintained on the proper User Attribute or User ID packet. 3266 After the User ID packet or Attribute packet, there may be zero or 3267 more Subkey packets. In general, subkeys are provided in cases where 3268 the top-level public key is a signature-only key. However, any V4 3269 key may have subkeys, and the subkeys may be encryption-only keys, 3270 signature-only keys, or general-purpose keys. V3 keys MUST NOT have 3271 subkeys. 3273 Each Subkey packet MUST be followed by one Signature packet, which 3274 should be a subkey binding signature issued by the top-level key. 3275 For subkeys that can issue signatures, the subkey binding signature 3276 MUST contain an Embedded Signature subpacket with a primary key 3277 binding signature (0x19) issued by the subkey on the top-level key. 3279 Subkey and Key packets may each be followed by a revocation Signature 3280 packet to indicate that the key is revoked. Revocation signatures 3281 are only accepted if they are issued by the key itself, or by a key 3282 that is authorized to issue revocations via a Revocation Key 3283 subpacket in a self-signature by the top-level key. 3285 Transferable public-key packet sequences may be concatenated to allow 3286 transferring multiple public keys in one operation. 3288 11.2. {11.2} Transferable Secret Keys 3290 OpenPGP users may transfer secret keys. The format of a transferable 3291 secret key is the same as a transferable public key except that 3292 secret-key and secret-subkey packets are used instead of the public 3293 key and public-subkey packets. Implementations SHOULD include self- 3294 signatures on any user IDs and subkeys, as this allows for a complete 3295 public key to be automatically extracted from the transferable secret 3296 key. Implementations MAY choose to omit the self-signatures, 3297 especially if a transferable public key accompanies the transferable 3298 secret key. 3300 11.3. {11.3} OpenPGP Messages 3302 An OpenPGP message is a packet or sequence of packets that 3303 corresponds to the following grammatical rules (comma represents 3304 sequential composition, and vertical bar separates alternatives): 3306 OpenPGP Message :- Encrypted Message | Signed Message | 3307 Compressed Message | Literal Message. 3309 Compressed Message :- Compressed Data Packet. 3311 Literal Message :- Literal Data Packet. 3313 ESK :- Public-Key Encrypted Session Key Packet | 3314 Symmetric-Key Encrypted Session Key Packet. 3316 ESK Sequence :- ESK | ESK Sequence, ESK. 3318 Encrypted Data :- Symmetrically Encrypted Data Packet | 3319 Symmetrically Encrypted Integrity Protected Data Packet 3321 Encrypted Message :- Encrypted Data | ESK Sequence, Encrypted Data. 3323 One-Pass Signed Message :- One-Pass Signature Packet, 3324 OpenPGP Message, Corresponding Signature Packet. 3326 Signed Message :- Signature Packet, OpenPGP Message | 3327 One-Pass Signed Message. 3329 In addition, decrypting a Symmetrically Encrypted Data packet or a 3330 Symmetrically Encrypted Integrity Protected Data packet as well as 3331 decompressing a Compressed Data packet must yield a valid OpenPGP 3332 Message. 3334 11.4. {11.4} Detached Signatures 3336 Some OpenPGP applications use so-called "detached signatures". For 3337 example, a program bundle may contain a file, and with it a second 3338 file that is a detached signature of the first file. These detached 3339 signatures are simply a Signature packet stored separately from the 3340 data for which they are a signature. 3342 12. {12} Enhanced Key Formats 3344 12.1. {12.1} Key Structures 3346 The format of an OpenPGP V3 key is as follows. Entries in square 3347 brackets are optional and ellipses indicate repetition. 3349 RSA Public Key 3350 [Revocation Self Signature] 3351 User ID [Signature ...] 3352 [User ID [Signature ...] ...] 3354 Each signature certifies the RSA public key and the preceding User 3355 ID. The RSA public key can have many User IDs and each User ID can 3356 have many signatures. V3 keys are deprecated. Implementations MUST 3357 NOT generate new V3 keys, but MAY continue to use existing ones. 3359 The format of an OpenPGP V4 key that uses multiple public keys is 3360 similar except that the other keys are added to the end as "subkeys" 3361 of the primary key. 3363 Primary-Key 3364 [Revocation Self Signature] 3365 [Direct Key Signature...] 3366 User ID [Signature ...] 3367 [User ID [Signature ...] ...] 3368 [User Attribute [Signature ...] ...] 3369 [[Subkey [Binding-Signature-Revocation] 3370 Primary-Key-Binding-Signature] ...] 3372 A subkey always has a single signature after it that is issued using 3373 the primary key to tie the two keys together. This binding signature 3374 may be in either V3 or V4 format, but SHOULD be V4. Subkeys that can 3375 issue signatures MUST have a V4 binding signature due to the REQUIRED 3376 embedded primary key binding signature. 3378 In the above diagram, if the binding signature of a subkey has been 3379 revoked, the revoked key may be removed, leaving only one key. 3381 In a V4 key, the primary key MUST be a key capable of certification. 3382 The subkeys may be keys of any other type. There may be other 3383 constructions of V4 keys, too. For example, there may be a single- 3384 key RSA key in V4 format, a DSA primary key with an RSA encryption 3385 key, or RSA primary key with an Elgamal subkey, etc. 3387 It is also possible to have a signature-only subkey. This permits a 3388 primary key that collects certifications (key signatures), but is 3389 used only for certifying subkeys that are used for encryption and 3390 signatures. 3392 12.2. {12.2} Key IDs and Fingerprints 3394 For a V3 key, the eight-octet Key ID consists of the low 64 bits of 3395 the public modulus of the RSA key. 3397 The fingerprint of a V3 key is formed by hashing the body (but not 3398 the two-octet length) of the MPIs that form the key material (public 3399 modulus n, followed by exponent e) with MD5. Note that both V3 keys 3400 and MD5 are deprecated. 3402 A V4 fingerprint is the 160-bit SHA-1 hash of the octet 0x99, 3403 followed by the two-octet packet length, followed by the entire 3404 Public-Key packet starting with the version field. The Key ID is the 3405 low-order 64 bits of the fingerprint. Here are the fields of the 3406 hash material, with the example of a DSA key: 3408 a.1) 0x99 (1 octet) 3410 a.2) high-order length octet of (b)-(e) (1 octet) 3412 a.3) low-order length octet of (b)-(e) (1 octet) 3414 b) version number = 4 (1 octet); 3416 c) timestamp of key creation (4 octets); 3418 d) algorithm (1 octet): 17 = DSA (example); 3420 e) Algorithm-specific fields. 3422 Algorithm-Specific Fields for DSA keys (example): 3424 e.1) MPI of DSA prime p; 3426 e.2) MPI of DSA group order q (q is a prime divisor of p-1); 3428 e.3) MPI of DSA group generator g; 3430 e.4) MPI of DSA public-key value y (= g\*\*x mod p where x is secret). 3432 Note that it is possible for there to be collisions of Key IDs -- two 3433 different keys with the same Key ID. Note that there is a much 3434 smaller, but still non-zero, probability that two different keys have 3435 the same fingerprint. 3437 Also note that if V3 and V4 format keys share the same RSA key 3438 material, they will have different Key IDs as well as different 3439 fingerprints. 3441 Finally, the Key ID and fingerprint of a subkey are calculated in the 3442 same way as for a primary key, including the 0x99 as the first octet 3443 (even though this is not a valid packet ID for a public subkey). 3445 13. Elliptic Curve Cryptography 3447 This section descripes algorithms and parameters used with Elliptic 3448 Curve Cryptography (ECC) keys. A thorough introduction to ECC can be 3449 found in [KOBLITZ]. 3451 13.1. Supported ECC Curves 3453 This document references three named prime field curves, defined in 3454 [FIPS186-3] as "Curve P-256", "Curve P-384", and "Curve P-521". 3456 The named curves are referenced as a sequence of bytes in this 3457 document, called throughout, curve OID. Section 9.2 describes in 3458 detail how this sequence of bytes is formed. 3460 13.2. ECC Conversion Primitives 3462 This document only defines the uncompressed point format. The point 3463 is encoded in the Multiprecision Integer (MPI) format. The content 3464 of the MPI is the following: 3466 B = 04 || x || y 3468 where x and y are coordinates of the point P = (x, y), each encoded 3469 in the big-endian format and zero-padded to the adjusted underlying 3470 field size. The adjusted underlying field size is the underlying 3471 field size that is rounded up to the nearest 8-bit boundary. 3473 Therefore, the exact size of the MPI payload is 515 bits for "Curve 3474 P-256", 771 for "Curve P-384", and 1059 for "Curve P-521". 3476 Even though the zero point, also called the point at infinity, may 3477 occur as a result of arithmetic operations on points of an elliptic 3478 curve, it SHALL NOT appear in data structures defined in this 3479 document. 3481 This encoding is compatible with the definition given in [SEC1]. 3483 If other conversion methods are defined in the future, a compliant 3484 application MUST NOT use a new format when in doubt that any 3485 recipient can support it. Consider, for example, that while both the 3486 public key and the per-recipient ECDH data structure, respectively 3487 defined in Sections 9{FIXME} and 10{FIXME}, contain an encoded point 3488 field, the format changes to the field in Section 10{FIXME} only 3489 affect a given recipient of a given message. 3491 13.3. Key Derivation Function 3493 A key derivation function (KDF) is necessary to implement the EC 3494 encryption. The Concatenation Key Derivation Function (Approved 3495 Alternative 1) [SP800-56A] with the KDF hash function that is 3496 SHA2-256 [FIPS180-3] or stronger is REQUIRED. See Section 12{FIXME} 3497 for the details regarding the choice of the hash function. 3499 For convenience, the synopsis of the encoding method is given below 3500 with significant simplifications attributable to the restricted 3501 choice of hash functions in this document. However, [SP800-56A] is 3502 the normative source of the definition. 3504 // Implements KDF( X, oBits, Param ); 3505 // Input: point X = (x,y) 3506 // oBits - the desired size of output 3507 // hBits - the size of output of hash function Hash 3508 // Param - octets representing the parameters 3509 // Assumes that oBits <= hBits 3510 // Convert the point X to the octet string, see section 6{FIXME}: 3511 // ZB' = 04 || x || y 3512 // and extract the x portion from ZB' 3513 ZB = x; 3514 MB = Hash ( 00 || 00 || 00 || 01 || ZB || Param ); 3515 return oBits leftmost bits of MB. 3517 Note that ZB in the KDF description above is the compact 3518 representation of X, defined in Section 4.2 of [RFC6090]. 3520 13.4. EC DH Algorithm (ECDH) 3522 The method is a combination of an ECC Diffie-Hellman method to 3523 establish a shared secret, a key derivation method to process the 3524 shared secret into a derived key, and a key wrapping method that uses 3525 the derived key to protect a session key used to encrypt a message. 3527 The One-Pass Diffie-Hellman method C(1, 1, ECC CDH) [SP800-56A] MUST 3528 be implemented with the following restrictions: the ECC CDH primitive 3529 employed by this method is modified to always assume the cofactor as 3530 1, the KDF specified in Section 7 is used, and the KDF parameters 3531 specified below are used. 3533 The KDF parameters are encoded as a concatenation of the following 5 3534 variable-length and fixed-length fields, compatible with the 3535 definition of the OtherInfo bitstring [SP800-56A]: 3537 o a variable-length field containing a curve OID, formatted as 3538 follows: 3540 * a one-octet size of the following field 3542 * the octets representing a curve OID, defined in Section 11 3544 o a one-octet public key algorithm ID defined in Section 5 3545 o a variable-length field containing KDF parameters, identical to 3546 the corresponding field in the ECDH public key, formatted as 3547 follows: 3549 * a one-octet size of the following fields; values 0 and 0xff are 3550 reserved for future extensions 3552 * a one-octet value 01, reserved for future extensions 3554 * a one-octet hash function ID used with the KDF 3556 * a one-octet algorithm ID for the symmetric algorithm used to 3557 wrap the symmetric key for message encryption; see Section 8 3558 for details 3560 o 20 octets representing the UTF-8 encoding of the string "Anonymous 3561 Sender ", which is the octet sequence 41 6E 6F 6E 79 6D 6F 75 73 3562 20 53 65 6E 64 65 72 20 20 20 20 3564 o 20 octets representing a recipient encryption subkey or a master 3565 key fingerprint, identifying the key material that is needed for 3566 the decryption. 3568 The size of the KDF parameters sequence, defined above, is either 54 3569 for the NIST curve P-256 or 51 for the curves P-384 and P-521. 3571 The key wrapping method is described in [RFC3394]. KDF produces a 3572 symmetric key that is used as a key-encryption key (KEK) as specified 3573 in [RFC3394]. Refer to Section 13{FIXME} for the details regarding 3574 the choice of the KEK algorithm, which SHOULD be one of three AES 3575 algorithms. Key wrapping and unwrapping is performed with the 3576 default initial value of [RFC3394]. 3578 The input to the key wrapping method is the value "m" derived from 3579 the session key, as described in Section 5.1{FIXME}, "Public-Key 3580 Encrypted Session Key Packets (Tag 1)", except that the PKCS #1.5 3581 padding step is omitted. The result is padded using the method 3582 described in [PKCS5] to the 8-byte granularity. For example, the 3583 following AES-256 session key, in which 32 octets are denoted from k0 3584 to k31, is composed to form the following 40 octet sequence: 3586 09 k0 k1 ... k31 c0 c1 05 05 05 05 05 3588 The octets c0 and c1 above denote the checksum. This encoding allows 3589 the sender to obfuscate the size of the symmetric encryption key used 3590 to encrypt the data. For example, assuming that an AES algorithm is 3591 used for the session key, the sender MAY use 21, 13, and 5 bytes of 3592 padding for AES-128, AES-192, and AES-256, respectively, to provide 3593 the same number of octets, 40 total, as an input to the key wrapping 3594 method. 3596 The output of the method consists of two fields. The first field is 3597 the MPI containing the ephemeral key used to establish the shared 3598 secret. The second field is composed of the following two fields: 3600 o a one-octet encoding the size in octets of the result of the key 3601 wrapping method; the value 255 is reserved for future extensions; 3603 o up to 254 octets representing the result of the key wrapping 3604 method, applied to the 8-byte padded session key, as described 3605 above. 3607 Note that for session key sizes 128, 192, and 256 bits, the size of 3608 the result of the key wrapping method is, respectively, 32, 40, and 3609 48 octets, unless the size obfuscation is used. 3611 For convenience, the synopsis of the encoding method is given below; 3612 however, this section, [SP800-56A], and [RFC3394] are the normative 3613 sources of the definition. 3615 Obtain the authenticated recipient public key R 3616 Generate an ephemeral key pair {v, V=vG} 3617 Compute the shared point S = vR; 3618 m = symm_alg_ID || session key || checksum || pkcs5_padding; 3619 curve_OID_len = (byte)len(curve_OID); 3620 Param = curve_OID_len || curve_OID || public_key_alg_ID || 03 3621 || 01 || KDF_hash_ID || KEK_alg_ID for AESKeyWrap || "Anonymous 3622 Sender " || recipient_fingerprint; 3623 Z_len = the key size for the KEK_alg_ID used with AESKeyWrap 3624 Compute Z = KDF( S, Z_len, Param ); 3625 Compute C = AESKeyWrap( Z, m ) as per [RFC3394] 3626 VB = convert point V to the octet string 3627 Output (MPI(VB) || len(C) || C). 3629 The decryption is the inverse of the method given. Note that the 3630 recipient obtains the shared secret by calculating 3632 S = rV = rvG, where (r,R) is the recipient's key pair. 3634 Consistent with Section 5.13{FIXME}, "Sym. Encrypted Integrity 3635 Protected Data Packet (Tag 18)", a Modification Detection Code (MDC) 3636 MUST be used anytime the symmetric key is protected by ECDH. 3638 14. {13} Notes on Algorithms 3640 14.1. {13.1} PKCS#1 Encoding in OpenPGP 3642 This standard makes use of the PKCS#1 functions EME-PKCS1-v1_5 and 3643 EMSA-PKCS1-v1_5. However, the calling conventions of these functions 3644 has changed in the past. To avoid potential confusion and 3645 interoperability problems, we are including local copies in this 3646 document, adapted from those in PKCS#1 v2.1 [RFC3447]. RFC 3447 3647 should be treated as the ultimate authority on PKCS#1 for OpenPGP. 3648 Nonetheless, we believe that there is value in having a self- 3649 contained document that avoids problems in the future with needed 3650 changes in the conventions. 3652 14.1.1. {13.1.1} EME-PKCS1-v1_5-ENCODE 3654 Input: 3656 k = the length in octets of the key modulus 3658 M = message to be encoded, an octet string of length mLen, where mLen 3659 \<= k - 11 3661 Output: 3663 EM = encoded message, an octet string of length k 3665 Error: "message too long" 3667 1. Length checking: If mLen > k - 11, output "message too long" 3668 and stop. 3670 2. Generate an octet string PS of length k - mLen - 3 consisting 3671 of pseudo-randomly generated nonzero octets. The length of PS 3672 will be at least eight octets. 3674 3. Concatenate PS, the message M, and other padding to form an 3675 encoded message EM of length k octets as 3677 EM = 0x00 || 0x02 || PS || 0x00 || M. 3679 4. Output EM. 3681 14.1.2. {13.1.2} EME-PKCS1-v1_5-DECODE 3682 Input: 3684 EM = encoded message, an octet string 3686 Output: 3688 M = message, an octet string 3690 Error: "decryption error" 3692 To decode an EME-PKCS1_v1_5 message, separate the encoded message EM 3693 into an octet string PS consisting of nonzero octets and a message M 3694 as follows 3696 EM = 0x00 || 0x02 || PS || 0x00 || M. 3698 If the first octet of EM does not have hexadecimal value 0x00, if the 3699 second octet of EM does not have hexadecimal value 0x02, if there is 3700 no octet with hexadecimal value 0x00 to separate PS from M, or if the 3701 length of PS is less than 8 octets, output "decryption error" and 3702 stop. See also the security note in Section 14 regarding differences 3703 in reporting between a decryption error and a padding error. 3705 14.1.3. {13.1.3} EMSA-PKCS1-v1_5 3707 This encoding method is deterministic and only has an encoding 3708 operation. 3710 Option: 3712 Hash - a hash function in which hLen denotes the length in octets 3713 of the hash function output 3715 Input: 3717 M = message to be encoded 3719 emLen = intended length in octets of the encoded message, at least 3720 tLen + 11, where tLen is the octet length of the DER encoding 3721 T of a certain value computed during the encoding operation 3723 Output: 3725 EM = encoded message, an octet string of length emLen 3727 Errors: "message too long"; 3728 "intended encoded message length too short" 3730 Steps: 3732 1. Apply the hash function to the message M to produce a hash 3733 value H: 3735 H = Hash(M). 3737 If the hash function outputs "message too long," output 3738 "message too long" and stop. 3740 2. Using the list in Section 5.2.2, produce an ASN.1 DER value 3741 for the hash function used. Let T be the full hash prefix 3742 from Section 5.2.2, and let tLen be the length in octets of T. 3744 3. If emLen < tLen + 11, output "intended encoded message length 3745 too short" and stop. 3747 4. Generate an octet string PS consisting of emLen - tLen - 3 3748 octets with hexadecimal value 0xFF. The length of PS will be 3749 at least 8 octets. 3751 5. Concatenate PS, the hash prefix T, and other padding to form 3752 the encoded message EM as 3754 EM = 0x00 || 0x01 || PS || 0x00 || T. 3756 6. Output EM. 3758 14.2. {13.2} Symmetric Algorithm Preferences 3760 The symmetric algorithm preference is an ordered list of algorithms 3761 that the keyholder accepts. Since it is found on a self-signature, 3762 it is possible that a keyholder may have multiple, different 3763 preferences. For example, Alice may have TripleDES only specified 3764 for "alice@work.com" but CAST5, Blowfish, and TripleDES specified for 3765 "alice@home.org". Note that it is also possible for preferences to 3766 be in a subkey's binding signature. 3768 Since TripleDES is the MUST-implement algorithm, if it is not 3769 explicitly in the list, it is tacitly at the end. However, it is 3770 good form to place it there explicitly. Note also that if an 3771 implementation does not implement the preference, then it is 3772 implicitly a TripleDES-only implementation. 3774 An implementation MUST NOT use a symmetric algorithm that is not in 3775 the recipient's preference list. When encrypting to more than one 3776 recipient, the implementation finds a suitable algorithm by taking 3777 the intersection of the preferences of the recipients. Note that the 3778 MUST-implement algorithm, TripleDES, ensures that the intersection is 3779 not null. The implementation may use any mechanism to pick an 3780 algorithm in the intersection. 3782 If an implementation can decrypt a message that a keyholder doesn't 3783 have in their preferences, the implementation SHOULD decrypt the 3784 message anyway, but MUST warn the keyholder that the protocol has 3785 been violated. For example, suppose that Alice, above, has software 3786 that implements all algorithms in this specification. Nonetheless, 3787 she prefers subsets for work or home. If she is sent a message 3788 encrypted with IDEA, which is not in her preferences, the software 3789 warns her that someone sent her an IDEA-encrypted message, but it 3790 would ideally decrypt it anyway. 3792 14.3. {13.3} Other Algorithm Preferences 3794 Other algorithm preferences work similarly to the symmetric algorithm 3795 preference, in that they specify which algorithms the keyholder 3796 accepts. There are two interesting cases that other comments need to 3797 be made about, though, the compression preferences and the hash 3798 preferences. 3800 14.3.1. {13.3.1} Compression Preferences 3802 Compression has been an integral part of PGP since its first days. 3803 OpenPGP and all previous versions of PGP have offered compression. 3804 In this specification, the default is for messages to be compressed, 3805 although an implementation is not required to do so. Consequently, 3806 the compression preference gives a way for a keyholder to request 3807 that messages not be compressed, presumably because they are using a 3808 minimal implementation that does not include compression. 3809 Additionally, this gives a keyholder a way to state that it can 3810 support alternate algorithms. 3812 Like the algorithm preferences, an implementation MUST NOT use an 3813 algorithm that is not in the preference vector. If the preferences 3814 are not present, then they are assumed to be [ZIP(1), 3815 Uncompressed(0)]. 3817 Additionally, an implementation MUST implement this preference to the 3818 degree of recognizing when to send an uncompressed message. A robust 3819 implementation would satisfy this requirement by looking at the 3820 recipient's preference and acting accordingly. A minimal 3821 implementation can satisfy this requirement by never generating a 3822 compressed message, since all implementations can handle messages 3823 that have not been compressed. 3825 14.3.2. {13.3.2} Hash Algorithm Preferences 3827 Typically, the choice of a hash algorithm is something the signer 3828 does, rather than the verifier, because a signer rarely knows who is 3829 going to be verifying the signature. This preference, though, allows 3830 a protocol based upon digital signatures ease in negotiation. 3832 Thus, if Alice is authenticating herself to Bob with a signature, it 3833 makes sense for her to use a hash algorithm that Bob's software uses. 3834 This preference allows Bob to state in his key which algorithms Alice 3835 may use. 3837 Since SHA1 is the MUST-implement hash algorithm, if it is not 3838 explicitly in the list, it is tacitly at the end. However, it is 3839 good form to place it there explicitly. 3841 14.4. {13.4} Plaintext 3843 Algorithm 0, "plaintext", may only be used to denote secret keys that 3844 are stored in the clear. Implementations MUST NOT use plaintext in 3845 Symmetrically Encrypted Data packets; they must use Literal Data 3846 packets to encode unencrypted or literal data. 3848 14.5. {13.5} RSA 3850 There are algorithm types for RSA Sign-Only, and RSA Encrypt-Only 3851 keys. These types are deprecated. The "key flags" subpacket in a 3852 signature is a much better way to express the same idea, and 3853 generalizes it to all algorithms. An implementation SHOULD NOT 3854 create such a key, but MAY interpret it. 3856 An implementation SHOULD NOT implement RSA keys of size less than 3857 1024 bits. 3859 14.6. {13.6} DSA 3861 An implementation SHOULD NOT implement DSA keys of size less than 3862 1024 bits. It MUST NOT implement a DSA key with a q size of less 3863 than 160 bits. DSA keys MUST also be a multiple of 64 bits, and the 3864 q size MUST be a multiple of 8 bits. The Digital Signature Standard 3865 (DSS) [FIPS186] specifies that DSA be used in one of the following 3866 ways: 3868 o 1024-bit key, 160-bit q, SHA-1, SHA-224, SHA-256, SHA-384, or 3869 SHA-512 hash 3871 o 2048-bit key, 224-bit q, SHA-224, SHA-256, SHA-384, or SHA-512 3872 hash 3874 o 2048-bit key, 256-bit q, SHA-256, SHA-384, or SHA-512 hash 3876 o 3072-bit key, 256-bit q, SHA-256, SHA-384, or SHA-512 hash 3878 The above key and q size pairs were chosen to best balance the 3879 strength of the key with the strength of the hash. Implementations 3880 SHOULD use one of the above key and q size pairs when generating DSA 3881 keys. If DSS compliance is desired, one of the specified SHA hashes 3882 must be used as well. [FIPS186] is the ultimate authority on DSS, 3883 and should be consulted for all questions of DSS compliance. 3885 Note that earlier versions of this standard only allowed a 160-bit q 3886 with no truncation allowed, so earlier implementations may not be 3887 able to handle signatures with a different q size or a truncated 3888 hash. 3890 14.7. {13.7} Elgamal 3892 An implementation SHOULD NOT implement Elgamal keys of size less than 3893 1024 bits. 3895 14.8. {13.8} Reserved Algorithm Numbers 3897 A number of algorithm IDs have been reserved for algorithms that 3898 would be useful to use in an OpenPGP implementation, yet there are 3899 issues that prevent an implementer from actually implementing the 3900 algorithm. These are marked in Section 9.1, "Public-Key Algorithms", 3901 as "reserved for". 3903 The reserved public-key algorithm X9.42 (21) does not have the 3904 necessary parameters, parameter order, or semantics defined. 3906 Previous versions of OpenPGP permitted Elgamal [ELGAMAL] signatures 3907 with a public-key identifier of 20. These are no longer permitted. 3908 An implementation MUST NOT generate such keys. An implementation 3909 MUST NOT generate Elgamal signatures. See [BLEICHENBACHER]. 3911 14.9. {13.9} OpenPGP CFB Mode 3913 OpenPGP does symmetric encryption using a variant of Cipher Feedback 3914 mode (CFB mode). This section describes the procedure it uses in 3915 detail. This mode is what is used for Symmetrically Encrypted Data 3916 Packets; the mechanism used for encrypting secret-key material is 3917 similar, and is described in the sections above. 3919 In the description below, the value BS is the block size in octets of 3920 the cipher. Most ciphers have a block size of 8 octets. The AES and 3921 Twofish have a block size of 16 octets. Also note that the 3922 description below assumes that the IV and CFB arrays start with an 3923 index of 1 (unlike the C language, which assumes arrays start with a 3924 zero index). 3926 OpenPGP CFB mode uses an initialization vector (IV) of all zeros, and 3927 prefixes the plaintext with BS+2 octets of random data, such that 3928 octets BS+1 and BS+2 match octets BS-1 and BS. It does a CFB 3929 resynchronization after encrypting those BS+2 octets. 3931 Thus, for an algorithm that has a block size of 8 octets (64 bits), 3932 the IV is 10 octets long and octets 7 and 8 of the IV are the same as 3933 octets 9 and 10. For an algorithm with a block size of 16 octets 3934 (128 bits), the IV is 18 octets long, and octets 17 and 18 replicate 3935 octets 15 and 16. Those extra two octets are an easy check for a 3936 correct key. 3938 Step by step, here is the procedure: 3940 1. The feedback register (FR) is set to the IV, which is all zeros. 3942 2. FR is encrypted to produce FRE (FR Encrypted). This is the 3943 encryption of an all-zero value. 3945 3. FRE is xored with the first BS octets of random data prefixed to 3946 the plaintext to produce C[1] through C[BS], the first BS octets 3947 of ciphertext. 3949 4. FR is loaded with C[1] through C[BS]. 3951 5. FR is encrypted to produce FRE, the encryption of the first BS 3952 octets of ciphertext. 3954 6. The left two octets of FRE get xored with the next two octets of 3955 data that were prefixed to the plaintext. This produces C[BS+1] 3956 and C[BS+2], the next two octets of ciphertext. 3958 7. (The resynchronization step) FR is loaded with C[3] through 3959 C[BS+2]. 3961 8. FRE is xored with the first BS octets of the given plaintext, 3962 now that we have finished encrypting the BS+2 octets of prefixed 3963 data. This produces C[BS+3] through C[BS+(BS+2)], the next BS 3964 octets of ciphertext. 3966 9. FR is encrypted to produce FRE. 3968 10. FR is loaded with C[BS+3] to C[BS + (BS+2)] (which is C11-C18 3969 for an 8-octet block). 3971 11. FR is encrypted to produce FRE. 3973 12. FRE is xored with the next BS octets of plaintext, to produce 3974 the next BS octets of ciphertext. These are loaded into FR, and 3975 the process is repeated until the plaintext is used up. 3977 14.10. {13.10} Private or Experimental Parameters 3979 S2K specifiers, Signature subpacket types, user attribute types, 3980 image format types, and algorithms described in Section 9 all reserve 3981 the range 100 to 110 for private and experimental use. Packet types 3982 reserve the range 60 to 63 for private and experimental use. These 3983 are intentionally managed with the PRIVATE USE method, as described 3984 in [RFC2434]. 3986 However, implementations need to be careful with these and promote 3987 them to full IANA-managed parameters when they grow beyond the 3988 original, limited system. 3990 14.11. {13.11} Extension of the MDC System 3992 As described in the non-normative explanation in Section 5.13, the 3993 MDC system is uniquely unparameterized in OpenPGP. This was an 3994 intentional decision to avoid cross-grade attacks. If the MDC system 3995 is extended to a stronger hash function, care must be taken to avoid 3996 downgrade and cross-grade attacks. 3998 One simple way to do this is to create new packets for a new MDC. 3999 For example, instead of the MDC system using packets 18 and 19, a new 4000 MDC could use 20 and 21. This has obvious drawbacks (it uses two 4001 packet numbers for each new hash function in a space that is limited 4002 to a maximum of 60). 4004 Another simple way to extend the MDC system is to create new versions 4005 of packet 18, and reflect this in packet 19. For example, suppose 4006 that V2 of packet 18 implicitly used SHA-256. This would require 4007 packet 19 to have a length of 32 octets. The change in the version 4008 in packet 18 and the size of packet 19 prevent a downgrade attack. 4010 There are two drawbacks to this latter approach. The first is that 4011 using the version number of a packet to carry algorithm information 4012 is not tidy from a protocol-design standpoint. It is possible that 4013 there might be several versions of the MDC system in common use, but 4014 this untidiness would reflect untidiness in cryptographic consensus 4015 about hash function security. The second is that different versions 4016 of packet 19 would have to have unique sizes. If there were two 4017 versions each with 256-bit hashes, they could not both have 32-octet 4018 packet 19s without admitting the chance of a cross-grade attack. 4020 Yet another, complex approach to extend the MDC system would be a 4021 hybrid of the two above -- create a new pair of MDC packets that are 4022 fully parameterized, and yet protected from downgrade and cross- 4023 grade. 4025 Any change to the MDC system MUST be done through the IETF CONSENSUS 4026 method, as described in [RFC2434]. 4028 14.12. {13.12} Meta-Considerations for Expansion 4030 If OpenPGP is extended in a way that is not backwards-compatible, 4031 meaning that old implementations will not gracefully handle their 4032 absence of a new feature, the extension proposal can be declared in 4033 the key holder's self-signature as part of the Features signature 4034 subpacket. 4036 We cannot state definitively what extensions will not be upwards- 4037 compatible, but typically new algorithms are upwards-compatible, 4038 whereas new packets are not. 4040 If an extension proposal does not update the Features system, it 4041 SHOULD include an explanation of why this is unnecessary. If the 4042 proposal contains neither an extension to the Features system nor an 4043 explanation of why such an extension is unnecessary, the proposal 4044 SHOULD be rejected. 4046 15. {14} Security Considerations 4048 o As with any technology involving cryptography, you should check 4049 the current literature to determine if any algorithms used here 4050 have been found to be vulnerable to attack. 4052 o This specification uses Public-Key Cryptography technologies. It 4053 is assumed that the private key portion of a public-private key 4054 pair is controlled and secured by the proper party or parties. 4056 o Certain operations in this specification involve the use of random 4057 numbers. An appropriate entropy source should be used to generate 4058 these numbers (see [RFC4086]). 4060 o The MD5 hash algorithm has been found to have weaknesses, with 4061 collisions found in a number of cases. MD5 is deprecated for use 4062 in OpenPGP. Implementations MUST NOT generate new signatures 4063 using MD5 as a hash function. They MAY continue to consider old 4064 signatures that used MD5 as valid. 4066 o SHA-224 and SHA-384 require the same work as SHA-256 and SHA-512, 4067 respectively. In general, there are few reasons to use them 4068 outside of DSS compatibility. You need a situation where one 4069 needs more security than smaller hashes, but does not want to have 4070 the full 256-bit or 512-bit data length. 4072 o Many security protocol designers think that it is a bad idea to 4073 use a single key for both privacy (encryption) and integrity 4074 (signatures). In fact, this was one of the motivating forces 4075 behind the V4 key format with separate signature and encryption 4076 keys. If you as an implementer promote dual-use keys, you should 4077 at least be aware of this controversy. 4079 o The DSA algorithm will work with any hash, but is sensitive to the 4080 quality of the hash algorithm. Verifiers should be aware that 4081 even if the signer used a strong hash, an attacker could have 4082 modified the signature to use a weak one. Only signatures using 4083 acceptably strong hash algorithms should be accepted as valid. 4085 o As OpenPGP combines many different asymmetric, symmetric, and hash 4086 algorithms, each with different measures of strength, care should 4087 be taken that the weakest element of an OpenPGP message is still 4088 sufficiently strong for the purpose at hand. While consensus 4089 about the strength of a given algorithm may evolve, NIST Special 4090 Publication 800-57 [SP800-57] recommends the following list of 4091 equivalent strengths: 4093 Asymmetric | Hash | Symmetric 4094 key size | size | key size 4095 ------------+--------+----------- 4096 1024 160 80 4097 2048 224 112 4098 3072 256 128 4099 7680 384 192 4100 15360 512 256 4102 o There is a somewhat-related potential security problem in 4103 signatures. If an attacker can find a message that hashes to the 4104 same hash with a different algorithm, a bogus signature structure 4105 can be constructed that evaluates correctly. 4107 For example, suppose Alice DSA signs message M using hash 4108 algorithm H. Suppose that Mallet finds a message M' that has the 4109 same hash value as M with H'. Mallet can then construct a 4110 signature block that verifies as Alice's signature of M' with H'. 4111 However, this would also constitute a weakness in either H or H' 4112 or both. Should this ever occur, a revision will have to be made 4113 to this document to revise the allowed hash algorithms. 4115 o If you are building an authentication system, the recipient may 4116 specify a preferred signing algorithm. However, the signer would 4117 be foolish to use a weak algorithm simply because the recipient 4118 requests it. 4120 o Some of the encryption algorithms mentioned in this document have 4121 been analyzed less than others. For example, although CAST5 is 4122 presently considered strong, it has been analyzed less than 4123 TripleDES. Other algorithms may have other controversies 4124 surrounding them. 4126 o In late summer 2002, Jallad, Katz, and Schneier published an 4127 interesting attack on the OpenPGP protocol and some of its 4128 implementations [JKS02]. In this attack, the attacker modifies a 4129 message and sends it to a user who then returns the erroneously 4130 decrypted message to the attacker. The attacker is thus using the 4131 user as a random oracle, and can often decrypt the message. 4133 Compressing data can ameliorate this attack. The incorrectly 4134 decrypted data nearly always decompresses in ways that defeat the 4135 attack. However, this is not a rigorous fix, and leaves open some 4136 small vulnerabilities. For example, if an implementation does not 4137 compress a message before encryption (perhaps because it knows it 4138 was already compressed), then that message is vulnerable. Because 4139 of this happenstance -- that modification attacks can be thwarted 4140 by decompression errors -- an implementation SHOULD treat a 4141 decompression error as a security problem, not merely a data 4142 problem. 4144 This attack can be defeated by the use of Modification Detection, 4145 provided that the implementation does not let the user naively 4146 return the data to the attacker. An implementation MUST treat an 4147 MDC failure as a security problem, not merely a data problem. 4149 In either case, the implementation MAY allow the user access to 4150 the erroneous data, but MUST warn the user as to potential 4151 security problems should that data be returned to the sender. 4153 While this attack is somewhat obscure, requiring a special set of 4154 circumstances to create it, it is nonetheless quite serious as it 4155 permits someone to trick a user to decrypt a message. 4156 Consequently, it is important that: 4158 1. Implementers treat MDC errors and decompression failures as 4159 security problems. 4161 2. Implementers implement Modification Detection with all due 4162 speed and encourage its spread. 4164 3. Users migrate to implementations that support Modification 4165 Detection with all due speed. 4167 o PKCS#1 has been found to be vulnerable to attacks in which a 4168 system that reports errors in padding differently from errors in 4169 decryption becomes a random oracle that can leak the private key 4170 in mere millions of queries. Implementations must be aware of 4171 this attack and prevent it from happening. The simplest solution 4172 is to report a single error code for all variants of decryption 4173 errors so as not to leak information to an attacker. 4175 o Some technologies mentioned here may be subject to government 4176 control in some countries. 4178 o In winter 2005, Serge Mister and Robert Zuccherato from Entrust 4179 released a paper describing a way that the "quick check" in 4180 OpenPGP CFB mode can be used with a random oracle to decrypt two 4181 octets of every cipher block [MZ05]. They recommend as prevention 4182 not using the quick check at all. 4184 Many implementers have taken this advice to heart for any data 4185 that is symmetrically encrypted and for which the session key is 4186 public-key encrypted. In this case, the quick check is not needed 4187 as the public-key encryption of the session key should guarantee 4188 that it is the right session key. In other cases, the 4189 implementation should use the quick check with care. 4191 On the one hand, there is a danger to using it if there is a 4192 random oracle that can leak information to an attacker. In 4193 plainer language, there is a danger to using the quick check if 4194 timing information about the check can be exposed to an attacker, 4195 particularly via an automated service that allows rapidly repeated 4196 queries. 4198 On the other hand, it is inconvenient to the user to be informed 4199 that they typed in the wrong passphrase only after a petabyte of 4200 data is decrypted. There are many cases in cryptographic 4201 engineering where the implementer must use care and wisdom, and 4202 this is one. 4204 o Refer to [FIPS186-3], B.4.1, for the method to generate a 4205 uniformly distributed ECC private key. 4207 o The curves proposed in this document correspond to the symmetric 4208 key sizes 128 bits, 192 bits, and 256 bits, as described in the 4209 table below. This allows a compliant application to offer 4210 balanced public key security, which is compatible with the 4211 symmetric key strength for each AES algorithm defined here. 4213 The following table defines the hash and the symmetric encryption 4214 algorithm that SHOULD be used with a given curve for ECDSA or 4215 ECDH. A stronger hash algorithm or a symmetric key algorithm MAY 4216 be used for a given ECC curve. However, note that the increase in 4217 the strength of the hash algorithm or the symmetric key algorithm 4218 may not increase the overall security offered by the given ECC 4219 key. 4221 Curve name | ECC | RSA | Hash size | Symmetric 4222 | strength | strength, | | key size 4223 | | informative | | 4224 -----------+----------+-------------+-----------+----------- 4225 NIST P-256 256 3072 256 128 4226 NIST P-384 384 7680 384 192 4227 NIST P-521 521 15360 512 256 4229 Requirement levels indicated elsewhere in this document lead to 4230 the following combinations of algorithms in the OpenPGP profile: 4231 MUST implement NIST curve P-256 / SHA2-256 / AES-128, SHOULD 4232 implement NIST curve P-521 / SHA2-512 / AES-256, MAY implement 4233 NIST curve P-384 / SHA2-384 / AES-256, among other allowed 4234 combinations. 4236 Consistent with the table above, the following table defines the 4237 KDF hash algorithm and the AES KEK encryption algorithm that 4238 SHOULD be used with a given curve for ECDH. A stronger KDF hash 4239 algorithm or AES KEK algorithm MAY be used for a given ECC curve. 4241 Curve name | Recommended KDF | Recommended KEK 4242 | hash algorithm | encryption algorithm 4243 -----------+-----------------+----------------------- 4244 NIST P-256 SHA2-256 AES-128 4245 NIST P-384 SHA2-384 AES-192 4246 NIST P-521 SHA2-512 AES-256 4248 This document explicitly discourages the use of algorithms other 4249 than AES as a KEK algorithm because backward compatibility of the 4250 ECDH format is not a concern. The KEK algorithm is only used 4251 within the scope of a Public-Key Encrypted Session Key Packet, 4252 which represents an ECDH key recipient of a message. Compare this 4253 with the algorithm used for the session key of the message, which 4254 MAY be different from a KEK algorithm. 4256 Compliant applications SHOULD implement, advertise through key 4257 preferences, and use the strongest algorithms specified in this 4258 document. 4260 Note that the symmetric algorithm preference list may make it 4261 impossible to use the balanced strength of symmetric key 4262 algorithms for a corresponding public key. For example, the 4263 presence of the symmetric key algorithm IDs and their order in the 4264 key preference list affects the algorithm choices available to the 4265 encoding side, which in turn may make the adherence to the table 4266 above infeasible. Therefore, compliance with this specification 4267 is a concern throughout the life of the key, starting immediately 4268 after the key generation when the key preferences are first added 4269 to a key. It is generally advisable to position a symmetric 4270 algorithm ID of strength matching the public key at the head of 4271 the key preference list. 4273 Encryption to multiple recipients often results in an unordered 4274 intersection subset. For example, if the first recipient's set is 4275 {A, B} and the second's is {B, A}, the intersection is an 4276 unordered set of two algorithms, A and B. In this case, a 4277 compliant application SHOULD choose the stronger encryption 4278 algorithm. 4280 Resource constraints, such as limited computational power, is a 4281 likely reason why an application might prefer to use the weakest 4282 algorithm. On the other side of the spectrum are applications 4283 that can implement every algorithm defined in this document. Most 4284 applications are expected to fall into either of two categories. 4285 A compliant application in the second, or strongest, category 4286 SHOULD prefer AES-256 to AES-192. 4288 SHA-1 MUST NOT be used with the ECDSA or the KDF in the ECDH 4289 method. 4291 MDC MUST be used when a symmetric encryption key is protected by 4292 ECDH. None of the ECC methods described in this document are 4293 allowed with deprecated V3 keys. A compliant application MUST 4294 only use iterated and salted S2K to protect private keys, as 4295 defined in Section 3.7.1.3{FIXME}, "Iterated and Salted S2K". 4297 Side channel attacks are a concern when a compliant application's 4298 use of the OpenPGP format can be modeled by a decryption or 4299 signing oracle model, for example, when an application is a 4300 network service performing decryption to unauthenticated remote 4301 users. ECC scalar multiplication operations used in ECDSA and 4302 ECDH are vulnerable to side channel attacks. Countermeasures can 4303 often be taken at the higher protocol level, such as limiting the 4304 number of allowed failures or time-blinding of the operations 4305 associated with each network interface. Mitigations at the scalar 4306 multiplication level seek to eliminate any measurable distinction 4307 between the ECC point addition and doubling operations. 4309 16. Compatibility Profiles 4311 16.1. OpenPGP ECC Profile 4313 A compliant application MUST implement NIST curve P-256, MAY 4314 implement NIST curve P-384, and SHOULD implement NIST curve P-521, as 4315 defined in Section 11. A compliant application MUST implement 4316 SHA2-256 and SHOULD implement SHA2-384 and SHA2-512. A compliant 4317 application MUST implement AES-128 and SHOULD implement AES-256. 4319 A compliant application SHOULD follow Section 13{FIXME} regarding the 4320 choice of the following algorithms for each curve: 4322 o the KDF hash algorithm, 4324 o the KEK algorithm, 4326 o the message digest algorithm and the hash algorithm used in the 4327 key certifications, 4329 o the symmetric algorithm used for message encryption. 4331 It is recommended that the chosen symmetric algorithm for message 4332 encryption be no less secure than the KEK algorithm. 4334 16.2. Suite-B Profile 4336 A subset of algorithms allowed by this document can be used to 4337 achieve [SuiteB] compatibility. The references to [SuiteB] in this 4338 document are informative. This document is primarily concerned with 4339 format specification, leaving additional security restrictions 4340 unspecified, such as matching the assigned security level of 4341 information to authorized recipients or interoperability concerns 4342 arising from fewer allowed algorithms in [SuiteB] than allowed by 4343 this document. 4345 16.3. Security Strength at 192 Bits 4347 To achieve the security strength of 192 bits, [SuiteB] requires NIST 4348 curve P-384, AES-256, and SHA2-384. The symmetric algorithm 4349 restriction means that the algorithm of KEK used for key wrapping in 4350 Section 8 and an OpenPGP session key used for message encryption must 4351 be AES-256. The hash algorithm restriction means that the hash 4352 algorithms of KDF and the OpenPGP message digest calculation must be 4353 SHA-384. 4355 16.4. Security Strength at 128 Bits 4357 The set of algorithms in Section 12.2.1{FIXME} is extended to allow 4358 NIST curve P-256, AES-128, and SHA2-256. 4360 17. {15} Implementation Nits 4362 This section is a collection of comments to help an implementer, 4363 particularly with an eye to backward compatibility. Previous 4364 implementations of PGP are not OpenPGP compliant. Often the 4365 differences are small, but small differences are frequently more 4366 vexing than large differences. Thus, this is a non-comprehensive 4367 list of potential problems and gotchas for a developer who is trying 4368 to be backward-compatible. 4370 o The IDEA algorithm is patented, and yet it is required for PGP 2.x 4371 interoperability. It is also the de-facto preferred algorithm for 4372 a V3 key with a V3 self-signature (or no self- signature). 4374 o When exporting a private key, PGP 2.x generates the header "BEGIN 4375 PGP SECRET KEY BLOCK" instead of "BEGIN PGP PRIVATE KEY BLOCK". 4376 All previous versions ignore the implied data type, and look 4377 directly at the packet data type. 4379 o PGP 2.0 through 2.5 generated V2 Public-Key packets. These are 4380 identical to the deprecated V3 keys except for the version number. 4381 An implementation MUST NOT generate them and may accept or reject 4382 them as it sees fit. Some older PGP versions generated V2 PKESK 4383 packets (Tag 1) as well. An implementation may accept or reject 4384 V2 PKESK packets as it sees fit, and MUST NOT generate them. 4386 o PGP 2.6.x will not accept key-material packets with versions 4387 greater than 3. 4389 o There are many ways possible for two keys to have the same key 4390 material, but different fingerprints (and thus Key IDs). Perhaps 4391 the most interesting is an RSA key that has been "upgraded" to V4 4392 format, but since a V4 fingerprint is constructed by hashing the 4393 key creation time along with other things, two V4 keys created at 4394 different times, yet with the same key material will have 4395 different fingerprints. 4397 o If an implementation is using zlib to interoperate with PGP 2.x, 4398 then the "windowBits" parameter should be set to -13. 4400 o The 0x19 back signatures were not required for signing subkeys 4401 until relatively recently. Consequently, there may be keys in the 4402 wild that do not have these back signatures. Implementing 4403 software may handle these keys as it sees fit. 4405 o OpenPGP does not put limits on the size of public keys. However, 4406 larger keys are not necessarily better keys. Larger keys take 4407 more computation time to use, and this can quickly become 4408 impractical. Different OpenPGP implementations may also use 4409 different upper bounds for public key sizes, and so care should be 4410 taken when choosing sizes to maintain interoperability. As of 4411 2007 most implementations have an upper bound of 4096 bits. 4413 o ASCII armor is an optional feature of OpenPGP. The OpenPGP 4414 working group strives for a minimal set of mandatory-to-implement 4415 features, and since there could be useful implementations that 4416 only use binary object formats, this is not a "MUST" feature for 4417 an implementation. For example, an implementation that is using 4418 OpenPGP as a mechanism for file signatures may find ASCII armor 4419 unnecessary. OpenPGP permits an implementation to declare what 4420 features it does and does not support, but ASCII armor is not one 4421 of these. Since most implementations allow binary and armored 4422 objects to be used indiscriminately, an implementation that does 4423 not implement ASCII armor may find itself with compatibility 4424 issues with general-purpose implementations. Moreover, 4425 implementations of OpenPGP-MIME [RFC3156] already have a 4426 requirement for ASCII armor so those implementations will 4427 necessarily have support. 4429 18. References 4431 18.1. Normative References 4433 [AES] NIST, "FIPS PUB 197, Advanced Encryption Standard (AES)", 4434 November 2001, 4435 . 4438 [BLOWFISH] 4439 Schneier, B., "Description of a New Variable-Length Key, 4440 64-Bit Block Cipher (Blowfish)", Fast Software Encryption, 4441 Cambridge Security Workshop Proceedings, Springer-Verlag, 4442 1994, pp191-204, December 1993, 4443 . 4445 [BZ2] Seward, J., "The Bzip2 and libbzip2 home page", 4446 . 4448 [ELGAMAL] Elgamal, T., "A Public-Key Cryptosystem and a Signature 4449 Scheme Based on Discrete Logarithms,", IEEE Transactions 4450 on Information Theory v. IT-31, n. 4, 1985, pp. 469-472, . 4452 [FIPS180] NIST, "Secure Hash Signature Standard (SHS) (FIPS PUB 4453 180-2)", . 4456 [FIPS180-3] 4457 National Institute of Standards and Technology, U.S. 4458 Department of Commerce, "Secure Hash Standard (SHS), FIPS 4459 180-3", October 2008. 4461 [FIPS186] NIST, "Digital Signature Standard (DSS) (FIPS PUB 186-2)", 4462 . 4465 [FIPS186-3] 4466 National Institute of Standards and Technology, U.S. 4467 Department of Commerce, "Digital Signature Standard, FIPS 4468 186-3", June 2009. 4470 [HAC] Menezes, A., Oorschot, P., and S. Vanstone, "Handbook of 4471 Applied Cryptography", 1996. 4473 [IDEA] Lai, X., "On the design and security of block ciphers", 4474 ETH Series in Information Processing, J.L. Massey 4475 (editor), Vol. 1, Hartung-Gorre Verlag Konstanz, 4476 Technische Hochschule (Zurich), 1992. 4478 [ISO10646] 4479 International Organization for Standardization, 4480 "Information Technology - Universal Multiple-octet coded 4481 Character Set (UCS) - Part 1: Architecture and Basic 4482 Multilingual Plane", ISO Standard 10646-1, May 1993. 4484 [JFIF] Eric Hamilton, C-Cube Microsystems, Milpitas, CA, "JPEG 4485 File Interchange Format (Version 1.02).", September 1996. 4487 [PKCS5] RSA Laboratories, "PKCS #5 v2.0: Password-Based 4488 Cryptography Standard", March 1999. 4490 [RFC1950] Deutsch, L. and J-L. Gailly, "ZLIB Compressed Data Format 4491 Specification version 3.3", RFC 1950, May 1996. 4493 [RFC1951] Deutsch, P., "DEFLATE Compressed Data Format Specification 4494 version 1.3", RFC 1951, May 1996. 4496 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 4497 Extensions (MIME) Part One: Format of Internet Message 4498 Bodies", RFC 2045, November 1996. 4500 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 4501 Requirement Levels", BCP 14, RFC 2119, March 1997. 4503 [RFC2144] Adams, C., "The CAST-128 Encryption Algorithm", RFC 2144, 4504 May 1997. 4506 [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for Writing an 4507 IANA Considerations Section in RFCs", BCP 26, RFC 2434, 4508 October 1998. 4510 [RFC2822] Resnick, P., "Internet Message Format", RFC 2822, April 4511 2001. 4513 [RFC3156] Elkins, M., Del Torto, D., Levien, R., and T. Roessler, 4514 "MIME Security with OpenPGP", RFC 3156, August 2001. 4516 [RFC3394] Schaad, J. and R. Housley, "Advanced Encryption Standard 4517 (AES) Key Wrap Algorithm", RFC 3394, September 2002. 4519 [RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography 4520 Standards (PKCS) #1: RSA Cryptography Specifications 4521 Version 2.1", RFC 3447, February 2003. 4523 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 4524 10646", STD 63, RFC 3629, November 2003. 4526 [RFC3713] Matsui, M., Nakajima, J., and S. Moriai, "A Description of 4527 the Camellia Encryption Algorithm", RFC 3713, April 2004. 4529 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 4530 Requirements for Security", BCP 106, RFC 4086, June 2005. 4532 [SCHNEIER] 4533 Schneier, B., "Applied Cryptography Second Edition: 4534 protocols, algorithms, and source code in C", 1996. 4536 [SP800-56A] 4537 Barker, E., Johnson, D., and M. Smid, "Recommendation for 4538 Pair-Wise Key Establishment Schemes Using Discrete 4539 Logarithm Cryptography", NIST Special Publication 800-56A 4540 Revision 1, March 2007. 4542 [SuiteB] National Security Agency, "NSA Suite B Cryptography", 4543 March 2010, 4544 . 4546 [TWOFISH] Schneier, B., Kelsey, J., Whiting, D., Wagner, D., Hall, 4547 C., and N. Ferguson, "The Twofish Encryption Algorithm", 4548 1999. 4550 18.2. Informative References 4552 [KOBLITZ] Koblitz, N., "A course in number theory and cryptography, 4553 Chapter VI. Elliptic Curves, ISBN: 0-387-96576-9, 4554 Springer-Verlag", 1997. 4556 [RFC1423] Balenson, D., "Privacy Enhancement for Internet Electronic 4557 Mail: Part III: Algorithms, Modes, and Identifiers", RFC 4558 1423, February 1993. 4560 [RFC1991] Atkins, D., Stallings, W., and P. Zimmermann, "PGP Message 4561 Exchange Formats", RFC 1991, August 1996. 4563 [RFC2440] Callas, J., Donnerhacke, L., Finney, H., and R. Thayer, 4564 "OpenPGP Message Format", RFC 2440, November 1998. 4566 [RFC6090] McGrew, D., Igoe, K., and M. Salter, "Fundamental Elliptic 4567 Curve Cryptography Algorithms", RFC 6090, February 2011. 4569 [SEC1] Standards for Efficient Cryptography Group, "SEC 1: 4570 Elliptic Curve Cryptography", September 2000. 4572 [SP800-57] 4573 NIST, "Recommendation on Key Management", NIST Special 4574 Publication 800-57, March 2007, 4575 . 4578 Appendix A. Changes since RFC-4880 4580 o Applied errata 2270, 2271, 2242, 3298. 4582 o Added Camellia cipher from RFC 5581. 4584 o Incorporated RFC 6637 (ECC for OpenPGP) 4586 { Informational rfcs: [RFC1423] } 4588 Appendix B. The principal authors of RFC-4880 are as follows: 4590 Jon Callas 4591 EMail: jon@callas.org 4593 Lutz Donnerhacke 4594 EMail: lutz@iks-jena.de 4596 Hal Finney 4598 David Shaw 4599 EMail: dshaw@jabberwocky.com 4601 Rodney Thayer 4602 EMail: rodney@canola-jones.com 4604 Author's Address 4606 Werner Koch 4608 Email: wk@gnupg.org