idnits 2.17.1 draft-ietf-dkim-rfc4871bis-13.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 draft header indicates that this document obsoletes RFC5672, but the abstract doesn't seem to directly say this. It does mention RFC5672 though, so this could be OK. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 1350 has weird spacing: '... email elec...' == The document seems to contain a disclaimer for pre-RFC5378 work, but was first submitted on or after 10 November 2008. The disclaimer is usually necessary only for documents that revise or obsolete older RFCs, and that take significant amounts of text from those RFCs. If you can contact all authors of the source material and they are willing to grant the BCP78 rights to the IETF Trust, you can and should remove the disclaimer. Otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (June 24, 2011) is 4683 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Unused Reference: 'ITU-X660-1997' is defined on line 2884, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS-180-3-2008' -- Possible downref: Non-RFC (?) normative reference: ref. 'ITU-X660-1997' ** Obsolete normative reference: RFC 3447 (Obsoleted by RFC 8017) ** Downref: Normative reference to an Informational RFC: RFC 5598 -- Obsolete informational reference (is this intentional?): RFC 4409 (Obsoleted by RFC 6409) -- Obsolete informational reference (is this intentional?): RFC 4870 (Obsoleted by RFC 4871) -- Obsolete informational reference (is this intentional?): RFC 4871 (Obsoleted by RFC 6376) -- Obsolete informational reference (is this intentional?): RFC 5226 (Obsoleted by RFC 8126) -- Obsolete informational reference (is this intentional?): RFC 5451 (Obsoleted by RFC 7001) -- Obsolete informational reference (is this intentional?): RFC 5672 (Obsoleted by RFC 6376) -- Obsolete informational reference (is this intentional?): RFC 5751 (Obsoleted by RFC 8551) Summary: 2 errors (**), 0 flaws (~~), 4 warnings (==), 11 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group D. Crocker, Ed. 3 Internet-Draft Brandenburg InternetWorking 4 Obsoletes: 4871, 5672 T. Hansen, Ed. 5 (if approved) AT&T Laboratories 6 Intended status: Standards Track M. Kucherawy, Ed. 7 Expires: December 26, 2011 Cloudmark 8 June 24, 2011 10 DomainKeys Identified Mail (DKIM) Signatures 11 draft-ietf-dkim-rfc4871bis-13 13 Abstract 15 DomainKeys Identified Mail (DKIM) permits a person, role, or 16 organization that owns the signing domain to claim some 17 responsibility for a message by associating the domain with the 18 message. This can be an author's organization, an operational relay 19 or one of their agents. DKIM separates the question of the identity 20 of the signer of the message from the purported author of the 21 message. Assertion of responsibility is validated through a 22 cryptographic signature and querying the signer's domain directly to 23 retrieve the appropriate public key. Message transit from author to 24 recipient is through relays that typically make no substantive change 25 to the message content and thus preserve the DKIM signature. 27 This memo obsoletes RFC4871 and RFC5672. 29 Status of this Memo 31 This Internet-Draft is submitted in full conformance with the 32 provisions of BCP 78 and BCP 79. 34 Internet-Drafts are working documents of the Internet Engineering 35 Task Force (IETF). Note that other groups may also distribute 36 working documents as Internet-Drafts. The list of current Internet- 37 Drafts is at http://datatracker.ietf.org/drafts/current/. 39 Internet-Drafts are draft documents valid for a maximum of six months 40 and may be updated, replaced, or obsoleted by other documents at any 41 time. It is inappropriate to use Internet-Drafts as reference 42 material or to cite them other than as "work in progress." 44 This Internet-Draft will expire on December 26, 2011. 46 Copyright Notice 48 Copyright (c) 2011 IETF Trust and the persons identified as the 49 document authors. All rights reserved. 51 This document is subject to BCP 78 and the IETF Trust's Legal 52 Provisions Relating to IETF Documents 53 (http://trustee.ietf.org/license-info) in effect on the date of 54 publication of this document. Please review these documents 55 carefully, as they describe your rights and restrictions with respect 56 to this document. Code Components extracted from this document must 57 include Simplified BSD License text as described in Section 4.e of 58 the Trust Legal Provisions and are provided without warranty as 59 described in the Simplified BSD License. 61 This document may contain material from IETF Documents or IETF 62 Contributions published or made publicly available before November 63 10, 2008. The person(s) controlling the copyright in some of this 64 material may not have granted the IETF Trust the right to allow 65 modifications of such material outside the IETF Standards Process. 66 Without obtaining an adequate license from the person(s) controlling 67 the copyright in such materials, this document may not be modified 68 outside the IETF Standards Process, and derivative works of it may 69 not be created outside the IETF Standards Process, except to format 70 it for publication as an RFC or to translate it into languages other 71 than English. 73 Table of Contents 75 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5 76 1.1. DKIM Architecture Documents . . . . . . . . . . . . . . . 6 77 1.2. Signing Identity . . . . . . . . . . . . . . . . . . . . . 6 78 1.3. Scalability . . . . . . . . . . . . . . . . . . . . . . . 6 79 1.4. Simple Key Management . . . . . . . . . . . . . . . . . . 6 80 1.5. Data Integrity . . . . . . . . . . . . . . . . . . . . . . 7 81 2. Terminology and Definitions . . . . . . . . . . . . . . . . . 7 82 2.1. Signers . . . . . . . . . . . . . . . . . . . . . . . . . 7 83 2.2. Verifiers . . . . . . . . . . . . . . . . . . . . . . . . 7 84 2.3. Identity . . . . . . . . . . . . . . . . . . . . . . . . . 7 85 2.4. Identifier . . . . . . . . . . . . . . . . . . . . . . . . 8 86 2.5. Signing Domain Identifier (SDID) . . . . . . . . . . . . . 8 87 2.6. Agent or User Identifier (AUID) . . . . . . . . . . . . . 8 88 2.7. Identity Assessor . . . . . . . . . . . . . . . . . . . . 8 89 2.8. Whitespace . . . . . . . . . . . . . . . . . . . . . . . . 8 90 2.9. Imported ABNF Tokens . . . . . . . . . . . . . . . . . . . 9 91 2.10. Common ABNF Tokens . . . . . . . . . . . . . . . . . . . . 9 92 2.11. DKIM-Quoted-Printable . . . . . . . . . . . . . . . . . . 10 93 3. Protocol Elements . . . . . . . . . . . . . . . . . . . . . . 11 94 3.1. Selectors . . . . . . . . . . . . . . . . . . . . . . . . 11 95 3.2. Tag=Value Lists . . . . . . . . . . . . . . . . . . . . . 13 96 3.3. Signing and Verification Algorithms . . . . . . . . . . . 14 97 3.4. Canonicalization . . . . . . . . . . . . . . . . . . . . . 15 98 3.5. The DKIM-Signature Header Field . . . . . . . . . . . . . 19 99 3.6. Key Management and Representation . . . . . . . . . . . . 29 100 3.7. Computing the Message Hashes . . . . . . . . . . . . . . . 33 101 3.8. Input Requirements . . . . . . . . . . . . . . . . . . . . 36 102 3.9. Output Requirements . . . . . . . . . . . . . . . . . . . 36 103 3.10. Signing by Parent Domains . . . . . . . . . . . . . . . . 36 104 3.11. Relationship between SDID and AUID . . . . . . . . . . . . 36 105 4. Semantics of Multiple Signatures . . . . . . . . . . . . . . . 37 106 4.1. Example Scenarios . . . . . . . . . . . . . . . . . . . . 37 107 4.2. Interpretation . . . . . . . . . . . . . . . . . . . . . . 39 108 5. Signer Actions . . . . . . . . . . . . . . . . . . . . . . . . 40 109 5.1. Determine Whether the Email Should Be Signed and by 110 Whom . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 111 5.2. Select a Private Key and Corresponding Selector 112 Information . . . . . . . . . . . . . . . . . . . . . . . 40 113 5.3. Normalize the Message to Prevent Transport Conversions . . 41 114 5.4. Determine the Header Fields to Sign . . . . . . . . . . . 42 115 5.5. Recommended Signature Content . . . . . . . . . . . . . . 44 116 5.6. Compute the Message Hash and Signature . . . . . . . . . . 45 117 5.7. Insert the DKIM-Signature Header Field . . . . . . . . . . 46 118 6. Verifier Actions . . . . . . . . . . . . . . . . . . . . . . . 46 119 6.1. Extract Signatures from the Message . . . . . . . . . . . 47 120 6.2. Communicate Verification Results . . . . . . . . . . . . . 52 121 6.3. Interpret Results/Apply Local Policy . . . . . . . . . . . 52 122 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 54 123 7.1. DKIM-Signature Tag Specifications . . . . . . . . . . . . 54 124 7.2. DKIM-Signature Query Method Registry . . . . . . . . . . . 55 125 7.3. DKIM-Signature Canonicalization Registry . . . . . . . . . 55 126 7.4. _domainkey DNS TXT Resource Record Tag Specifications . . 56 127 7.5. DKIM Key Type Registry . . . . . . . . . . . . . . . . . . 56 128 7.6. DKIM Hash Algorithms Registry . . . . . . . . . . . . . . 57 129 7.7. DKIM Service Types Registry . . . . . . . . . . . . . . . 57 130 7.8. DKIM Selector Flags Registry . . . . . . . . . . . . . . . 57 131 7.9. DKIM-Signature Header Field . . . . . . . . . . . . . . . 58 132 8. Security Considerations . . . . . . . . . . . . . . . . . . . 58 133 8.1. Misuse of Body Length Limits ("l=" Tag) . . . . . . . . . 58 134 8.2. Misappropriated Private Key . . . . . . . . . . . . . . . 58 135 8.3. Key Server Denial-of-Service Attacks . . . . . . . . . . . 59 136 8.4. Attacks Against the DNS . . . . . . . . . . . . . . . . . 59 137 8.5. Replay Attacks . . . . . . . . . . . . . . . . . . . . . . 60 138 8.6. Limits on Revoking Keys . . . . . . . . . . . . . . . . . 60 139 8.7. Intentionally Malformed Key Records . . . . . . . . . . . 61 140 8.8. Intentionally Malformed DKIM-Signature Header Fields . . . 61 141 8.9. Information Leakage . . . . . . . . . . . . . . . . . . . 61 142 8.10. Remote Timing Attacks . . . . . . . . . . . . . . . . . . 61 143 8.11. Reordered Header Fields . . . . . . . . . . . . . . . . . 61 144 8.12. RSA Attacks . . . . . . . . . . . . . . . . . . . . . . . 62 145 8.13. Inappropriate Signing by Parent Domains . . . . . . . . . 62 146 8.14. Attacks Involving Addition of Header Fields . . . . . . . 62 147 8.15. Malformed Inputs . . . . . . . . . . . . . . . . . . . . . 63 148 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 64 149 9.1. Normative References . . . . . . . . . . . . . . . . . . . 64 150 9.2. Informative References . . . . . . . . . . . . . . . . . . 65 151 Appendix A. Example of Use (INFORMATIVE) . . . . . . . . . . . . 66 152 A.1. The User Composes an Email . . . . . . . . . . . . . . . . 66 153 A.2. The Email is Signed . . . . . . . . . . . . . . . . . . . 67 154 A.3. The Email Signature is Verified . . . . . . . . . . . . . 68 155 Appendix B. Usage Examples (INFORMATIVE) . . . . . . . . . . . . 69 156 B.1. Alternate Submission Scenarios . . . . . . . . . . . . . . 69 157 B.2. Alternate Delivery Scenarios . . . . . . . . . . . . . . . 71 158 Appendix C. Creating a Public Key (INFORMATIVE) . . . . . . . . . 73 159 C.1. Compatibility with DomainKeys Key Records . . . . . . . . 74 160 C.2. RFC4871 Compatibility . . . . . . . . . . . . . . . . . . 74 161 Appendix D. MUA Considerations (INFORMATIVE) . . . . . . . . . . 74 162 Appendix E. Changes since RFC4871 . . . . . . . . . . . . . . . . 75 163 Appendix F. Acknowledgements . . . . . . . . . . . . . . . . . . 77 164 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 77 166 1. Introduction 168 DomainKeys Identified Mail (DKIM) permits a person, role, or 169 organization to claim some responsibility for a message by 170 associating a domain name [RFC1034] with the message [RFC5322], which 171 they are authorized to use. This can be an author's organization, an 172 operational relay or one of their agents. Assertion of 173 responsibility is validated through a cryptographic signature and 174 querying the signer's domain directly to retrieve the appropriate 175 public key. Message transit from author to recipient is through 176 relays that typically make no substantive change to the message 177 content and thus preserve the DKIM signature. A message can contain 178 multiple signatures, from the same or different organizations 179 involved with the message. 181 The approach taken by DKIM differs from previous approaches to 182 message signing (e.g., Secure/Multipurpose Internet Mail Extensions 183 (S/MIME) [RFC5751], OpenPGP [RFC4880]) in that: 185 o the message signature is written as a message header field so that 186 neither human recipients nor existing MUA (Mail User Agent) 187 software is confused by signature-related content appearing in the 188 message body; 190 o there is no dependency on public and private key pairs being 191 issued by well-known, trusted certificate authorities; 193 o there is no dependency on the deployment of any new Internet 194 protocols or services for public key distribution or revocation; 196 o signature verification failure does not force rejection of the 197 message; 199 o no attempt is made to include encryption as part of the mechanism; 201 o message archiving is not a design goal. 203 DKIM: 205 o is compatible with the existing email infrastructure and 206 transparent to the fullest extent possible; 208 o requires minimal new infrastructure; 210 o can be implemented independently of clients in order to reduce 211 deployment time; 213 o can be deployed incrementally; 215 o allows delegation of signing to third parties. 217 1.1. DKIM Architecture Documents 219 Readers are advised to be familiar with the material in [RFC4686], 220 [RFC5585] and [RFC5863], which respectively provide the background 221 for the development of DKIM, an overview of the service, and 222 deployment and operations guidance and advice. 224 1.2. Signing Identity 226 DKIM separates the question of the identity of the signer of the 227 message from the purported author of the message. In particular, a 228 signature includes the identity of the signer. Verifiers can use the 229 signing information to decide how they want to process the message. 230 The signing identity is included as part of the signature header 231 field. 233 INFORMATIVE RATIONALE: The signing identity specified by a DKIM 234 signature is not required to match an address in any particular 235 header field because of the broad methods of interpretation by 236 recipient mail systems, including MUAs. 238 1.3. Scalability 240 DKIM is designed to support the extreme scalability requirements that 241 characterize the email identification problem. There are currently 242 over 70 million domains and a much larger number of individual 243 addresses. DKIM seeks to preserve the positive aspects of the 244 current email infrastructure, such as the ability for anyone to 245 communicate with anyone else without introduction. 247 1.4. Simple Key Management 249 DKIM differs from traditional hierarchical public-key systems in that 250 no Certificate Authority infrastructure is required; the verifier 251 requests the public key from a repository in the domain of the 252 claimed signer directly rather than from a third party. 254 The DNS is proposed as the initial mechanism for the public keys. 255 Thus, DKIM currently depends on DNS administration and the security 256 of the DNS system. DKIM is designed to be extensible to other key 257 fetching services as they become available. 259 1.5. Data Integrity 261 A DKIM signature associates the d= name with the computed hash of 262 some or all of the message (see Section 3.7) in order to prevent the 263 re-use of the signature with different messages. Verifying the 264 signature asserts that the hashed content has not changed since it 265 was signed, and asserts nothing else about "protecting" the end-to- 266 end integrity of the message. 268 2. Terminology and Definitions 270 This section defines terms used in the rest of the document. 272 DKIM is designed to operate within the Internet Mail service, as 273 defined in [RFC5598]. Basic email terminology is taken from that 274 specification. 276 Syntax descriptions use Augmented BNF (ABNF) [RFC5234]. 278 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 279 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 280 "OPTIONAL" in this document are to be interpreted as described in 281 [RFC2119]. These words take their normative meanings only when they 282 are presented in ALL UPPER CASE. 284 2.1. Signers 286 Elements in the mail system that sign messages on behalf of a domain 287 are referred to as signers. These may be MUAs (Mail User Agents), 288 MSAs (Mail Submission Agents), MTAs (Mail Transfer Agents), or other 289 agents such as mailing list exploders. In general, any signer will 290 be involved in the injection of a message into the message system in 291 some way. The key issue is that a message must be signed before it 292 leaves the administrative domain of the signer. 294 2.2. Verifiers 296 Elements in the mail system that verify signatures are referred to as 297 verifiers. These may be MTAs, Mail Delivery Agents (MDAs), or MUAs. 298 In most cases it is expected that verifiers will be close to an end 299 user (reader) of the message or some consuming agent such as a 300 mailing list exploder. 302 2.3. Identity 304 A person, role, or organization. In the context of DKIM, examples 305 include the author, the author's organization, an ISP along the 306 handling path, an independent trust assessment service, and a mailing 307 list operator. 309 2.4. Identifier 311 A label that refers to an identity. 313 2.5. Signing Domain Identifier (SDID) 315 A single domain name that is the mandatory payload output of DKIM and 316 that refers to the identity claiming some responsibility for the 317 message by signing it. It is specified in Section 3.5. 319 2.6. Agent or User Identifier (AUID) 321 A single identifier that refers to the agent or user on behalf of 322 whom the Signing Domain Identifier (SDID) has taken responsibility. 323 The AUID comprises a domain name and an optional . The 324 domain name is the same as that used for the SDID or is a sub-domain 325 of it. For DKIM processing, the domain name portion of the AUID has 326 only basic domain name semantics; any possible owner-specific 327 semantics are outside the scope of DKIM. It is specified in 328 Section 3.5. 330 Note that acceptable values for the AUID may be constrained via a 331 flag in the public key record. (See Section 3.6.1.) 333 2.7. Identity Assessor 335 A module that consumes DKIM's mandatory payload, which is the 336 responsible Signing Domain Identifier (SDID). The module is 337 dedicated to the assessment of the delivered identifier. Other DKIM 338 (and non-DKIM) values can also be delivered to this module as well as 339 to a more general message evaluation filtering engine. However, this 340 additional activity is outside the scope of the DKIM signature 341 specification. 343 2.8. Whitespace 345 There are three forms of whitespace: 347 o WSP represents simple whitespace, i.e., a space or a tab character 348 (formal definition in [RFC5234]). 350 o LWSP is linear whitespace, defined as WSP plus CRLF (formal 351 definition in [RFC5234]). 353 o FWS is folding whitespace. It allows multiple lines separated by 354 CRLF followed by at least one whitespace, to be joined. 356 The formal ABNF for these are (WSP and LWSP are given for information 357 only): 358 WSP = SP / HTAB 359 LWSP = *(WSP / CRLF WSP) 360 FWS = [*WSP CRLF] 1*WSP 362 The definition of FWS is identical to that in [RFC5322] except for 363 the exclusion of obs-FWS. 365 2.9. Imported ABNF Tokens 367 The following tokens are imported from other RFCs as noted. Those 368 RFCs should be considered definitive. 370 The following tokens are imported from [RFC5321]: 372 o "Local-part" (implementation warning: this permits quoted strings) 374 o "sub-domain" 376 The following tokens are imported from [RFC5322]: 378 o "field-name" (name of a header field) 380 o "dot-atom-text" (in the Local-part of an email address) 382 The following tokens are imported from [RFC2045]: 384 o "qp-section" (a single line of quoted-printable-encoded text) 386 o "hex-octet" (a quoted-printable encoded octet) 388 INFORMATIVE NOTE: Be aware that the ABNF in [RFC2045] does not 389 obey the rules of [RFC5234] and must be interpreted accordingly, 390 particularly as regards case folding. 392 Other tokens not defined herein are imported from [RFC5234]. These 393 are intuitive primitives such as SP, HTAB, WSP, ALPHA, DIGIT, CRLF, 394 etc. 396 2.10. Common ABNF Tokens 397 The following ABNF tokens are used elsewhere in this document: 398 hyphenated-word = ALPHA [ *(ALPHA / DIGIT / "-") (ALPHA / DIGIT) ] 399 ALPHADIGITPS = (ALPHA / DIGIT / "+" / "/") 400 base64string = ALPHADIGITPS *([FWS] ALPHADIGITPS) 401 [ [FWS] "=" [ [FWS] "=" ] ] 402 hdr-name = field-name 403 qp-hdr-value = dkim-quoted-printable ; with "|" encoded 405 2.11. DKIM-Quoted-Printable 407 The DKIM-Quoted-Printable encoding syntax resembles that described in 408 Quoted-Printable [RFC2045], Section 6.7: any character MAY be encoded 409 as an "=" followed by two hexadecimal digits from the alphabet 410 "0123456789ABCDEF" (no lowercase characters permitted) representing 411 the hexadecimal-encoded integer value of that character. All control 412 characters (those with values < %x20), 8-bit characters (values > 413 %x7F), and the characters DEL (%x7F), SPACE (%x20), and semicolon 414 (";", %x3B) MUST be encoded. Note that all whitespace, including 415 SPACE, CR, and LF characters, MUST be encoded. After encoding, FWS 416 MAY be added at arbitrary locations in order to avoid excessively 417 long lines; such whitespace is NOT part of the value, and MUST be 418 removed before decoding. Use of characters not listed as "mail-safe" 419 in [RFC2049] is NOT RECOMMENDED. 421 ABNF: 423 dkim-quoted-printable = *(FWS / hex-octet / dkim-safe-char) 424 ; hex-octet is from RFC2045 425 dkim-safe-char = %x21-3A / %x3C / %x3E-7E 426 ; '!' - ':', '<', '>' - '~' 427 ; Characters not listed as "mail-safe" in 428 ; [RFC2049] are also NOT RECOMMENDED. 430 INFORMATIVE NOTE: DKIM-Quoted-Printable differs from Quoted- 431 Printable as defined in [RFC2045] in several important ways: 433 1. Whitespace in the input text, including CR and LF, must be 434 encoded. [RFC2045] does not require such encoding, and does 435 not permit encoding of CR or LF characters that are part of a 436 CRLF line break. 438 2. Whitespace in the encoded text is ignored. This is to allow 439 tags encoded using DKIM-Quoted-Printable to be wrapped as 440 needed. In particular, [RFC2045] requires that line breaks in 441 the input be represented as physical line breaks; that is not 442 the case here. 444 3. The "soft line break" syntax ("=" as the last non-whitespace 445 character on the line) does not apply. 447 4. DKIM-Quoted-Printable does not require that encoded lines be 448 no more than 76 characters long (although there may be other 449 requirements depending on the context in which the encoded 450 text is being used). 452 3. Protocol Elements 454 Protocol Elements are conceptual parts of the protocol that are not 455 specific to either signers or verifiers. The protocol descriptions 456 for signers and verifiers are described in later sections (Signer 457 Actions (Section 5) and Verifier Actions (Section 6)). NOTE: This 458 section must be read in the context of those sections. 460 3.1. Selectors 462 To support multiple concurrent public keys per signing domain, the 463 key namespace is subdivided using "selectors". For example, 464 selectors might indicate the names of office locations (e.g., 465 "sanfrancisco", "coolumbeach", and "reykjavik"), the signing date 466 (e.g., "january2005", "february2005", etc.), or even an individual 467 user. 469 Selectors are needed to support some important use cases. For 470 example: 472 o Domains that want to delegate signing capability for a specific 473 address for a given duration to a partner, such as an advertising 474 provider or other outsourced function. 476 o Domains that want to allow frequent travelers to send messages 477 locally without the need to connect with a particular MSA. 479 o "Affinity" domains (e.g., college alumni associations) that 480 provide forwarding of incoming mail, but that do not operate a 481 mail submission agent for outgoing mail. 483 Periods are allowed in selectors and are component separators. When 484 keys are retrieved from the DNS, periods in selectors define DNS 485 label boundaries in a manner similar to the conventional use in 486 domain names. Selector components might be used to combine dates 487 with locations, for example, "march2005.reykjavik". In a DNS 488 implementation, this can be used to allow delegation of a portion of 489 the selector namespace. 491 ABNF: 493 selector = sub-domain *( "." sub-domain ) 495 The number of public keys and corresponding selectors for each domain 496 is determined by the domain owner. Many domain owners will be 497 satisfied with just one selector, whereas administratively 498 distributed organizations may choose to manage disparate selectors 499 and key pairs in different regions or on different email servers. 501 Beyond administrative convenience, selectors make it possible to 502 seamlessly replace public keys on a routine basis. If a domain 503 wishes to change from using a public key associated with selector 504 "january2005" to a public key associated with selector 505 "february2005", it merely makes sure that both public keys are 506 advertised in the public-key repository concurrently for the 507 transition period during which email may be in transit prior to 508 verification. At the start of the transition period, the outbound 509 email servers are configured to sign with the "february2005" private 510 key. At the end of the transition period, the "january2005" public 511 key is removed from the public-key repository. 513 INFORMATIVE NOTE: A key may also be revoked as described below. 514 The distinction between revoking and removing a key selector 515 record is subtle. When phasing out keys as described above, a 516 signing domain would probably simply remove the key record after 517 the transition period. However, a signing domain could elect to 518 revoke the key (but maintain the key record) for a further period. 519 There is no defined semantic difference between a revoked key and 520 a removed key. 522 While some domains may wish to make selector values well known, 523 others will want to take care not to allocate selector names in a way 524 that allows harvesting of data by outside parties. For example, if 525 per-user keys are issued, the domain owner will need to make the 526 decision as to whether to associate this selector directly with the 527 name of a registered end-user, or make it some unassociated random 528 value, such as a fingerprint of the public key. 530 INFORMATIVE OPERATIONS NOTE: Reusing a selector with a new key 531 (for example, changing the key associated with a user's name) 532 makes it impossible to tell the difference between a message that 533 didn't verify because the key is no longer valid versus a message 534 that is actually forged. For this reason, signers are ill-advised 535 to reuse selectors for new keys. A better strategy is to assign 536 new keys to new selectors. 538 3.2. Tag=Value Lists 540 DKIM uses a simple "tag=value" syntax in several contexts, including 541 in messages and domain signature records. 543 Values are a series of strings containing either plain text, "base64" 544 text (as defined in [RFC2045], Section 6.8), "qp-section" (ibid, 545 Section 6.7), or "dkim-quoted-printable" (as defined in 546 Section 2.11). The name of the tag will determine the encoding of 547 each value. Unencoded semicolon (";") characters MUST NOT occur in 548 the tag value, since that separates tag-specs. 550 INFORMATIVE IMPLEMENTATION NOTE: Although the "plain text" defined 551 below (as "tag-value") only includes 7-bit characters, an 552 implementation that wished to anticipate future standards would be 553 advised not to preclude the use of UTF8-encoded text in tag=value 554 lists. 556 Formally, the ABNF syntax rules are as follows: 557 tag-list = tag-spec 0*( ";" tag-spec ) [ ";" ] 558 tag-spec = [FWS] tag-name [FWS] "=" [FWS] tag-value [FWS] 559 tag-name = ALPHA 0*ALNUMPUNC 560 tag-value = [ tval 0*( 1*(WSP / FWS) tval ) ] 561 ; Prohibits WSP and FWS at beginning and end 562 tval = 1*VALCHAR 563 VALCHAR = %x21-3A / %x3C-7E 564 ; EXCLAMATION to TILDE except SEMICOLON 565 ALNUMPUNC = ALPHA / DIGIT / "_" 567 Note that WSP is allowed anywhere around tags. In particular, any 568 WSP after the "=" and any WSP before the terminating ";" is not part 569 of the value; however, WSP inside the value is significant. 571 Tags MUST be interpreted in a case-sensitive manner. Values MUST be 572 processed as case sensitive unless the specific tag description of 573 semantics specifies case insensitivity. 575 Tags with duplicate names MUST NOT occur within a single tag-list; if 576 a tag name does occur more than once, the entire tag-list is invalid. 578 Whitespace within a value MUST be retained unless explicitly excluded 579 by the specific tag description. 581 Tag=value pairs that represent the default value MAY be included to 582 aid legibility. 584 Unrecognized tags MUST be ignored. 586 Tags that have an empty value are not the same as omitted tags. An 587 omitted tag is treated as having the default value; a tag with an 588 empty value explicitly designates the empty string as the value. 590 3.3. Signing and Verification Algorithms 592 DKIM supports multiple digital signature algorithms. Two algorithms 593 are defined by this specification at this time: rsa-sha1 and rsa- 594 sha256. Signers MUST implement and SHOULD sign using rsa-sha256. 595 Verifiers MUST implement both rsa-sha1 and rsa-sha256. 597 INFORMATIVE NOTE: Although rsa-sha256 is strongly encouraged, some 598 senders might prefer to use rsa-sha1 when balancing security 599 strength against performance, complexity, or other needs. In 600 general, however, rsa-sha256 should always be used whenever 601 possible. 603 3.3.1. The rsa-sha1 Signing Algorithm 605 The rsa-sha1 Signing Algorithm computes a message hash as described 606 in Section 3.7 below using SHA-1 [FIPS-180-3-2008] as the hash-alg. 607 That hash is then signed by the signer using the RSA algorithm 608 (defined in PKCS#1 version 1.5 [RFC3447]) as the crypt-alg and the 609 signer's private key. The hash MUST NOT be truncated or converted 610 into any form other than the native binary form before being signed. 611 The signing algorithm SHOULD use a public exponent of 65537. 613 3.3.2. The rsa-sha256 Signing Algorithm 615 The rsa-sha256 Signing Algorithm computes a message hash as described 616 in Section 3.7 below using SHA-256 [FIPS-180-3-2008] as the hash-alg. 617 That hash is then signed by the signer using the RSA algorithm 618 (defined in PKCS#1 version 1.5 [RFC3447]) as the crypt-alg and the 619 signer's private key. The hash MUST NOT be truncated or converted 620 into any form other than the native binary form before being signed. 621 The signing algorithm SHOULD use a public exponent of 65537. 623 3.3.3. Key Sizes 625 Selecting appropriate key sizes is a trade-off between cost, 626 performance, and risk. Since short RSA keys more easily succumb to 627 off-line attacks, signers MUST use RSA keys of at least 1024 bits for 628 long-lived keys. Verifiers MUST be able to validate signatures with 629 keys ranging from 512 bits to 2048 bits, and they MAY be able to 630 validate signatures with larger keys. Verifier policies may use the 631 length of the signing key as one metric for determining whether a 632 signature is acceptable. 634 Factors that should influence the key size choice include the 635 following: 637 o The practical constraint that large (e.g., 4096 bit) keys may not 638 fit within a 512-byte DNS UDP response packet 640 o The security constraint that keys smaller than 1024 bits are 641 subject to off-line attacks 643 o Larger keys impose higher CPU costs to verify and sign email 645 o Keys can be replaced on a regular basis, thus their lifetime can 646 be relatively short 648 o The security goals of this specification are modest compared to 649 typical goals of other systems that employ digital signatures 651 See [RFC3766] for further discussion on selecting key sizes. 653 3.3.4. Other Algorithms 655 Other algorithms MAY be defined in the future. Verifiers MUST ignore 656 any signatures using algorithms that they do not implement. 658 3.4. Canonicalization 660 Some mail systems modify email in transit, potentially invalidating a 661 signature. For most signers, mild modification of email is 662 immaterial to validation of the DKIM domain name's use. For such 663 signers, a canonicalization algorithm that survives modest in-transit 664 modification is preferred. 666 Other signers demand that any modification of the email, however 667 minor, result in a signature verification failure. These signers 668 prefer a canonicalization algorithm that does not tolerate in-transit 669 modification of the signed email. 671 Some signers may be willing to accept modifications to header fields 672 that are within the bounds of email standards such as [RFC5322], but 673 are unwilling to accept any modification to the body of messages. 675 To satisfy all requirements, two canonicalization algorithms are 676 defined for each of the header and the body: a "simple" algorithm 677 that tolerates almost no modification and a "relaxed" algorithm that 678 tolerates common modifications such as whitespace replacement and 679 header field line rewrapping. A signer MAY specify either algorithm 680 for header or body when signing an email. If no canonicalization 681 algorithm is specified by the signer, the "simple" algorithm defaults 682 for both header and body. Verifiers MUST implement both 683 canonicalization algorithms. Note that the header and body may use 684 different canonicalization algorithms. Further canonicalization 685 algorithms MAY be defined in the future; verifiers MUST ignore any 686 signatures that use unrecognized canonicalization algorithms. 688 Canonicalization simply prepares the email for presentation to the 689 signing or verification algorithm. It MUST NOT change the 690 transmitted data in any way. Canonicalization of header fields and 691 body are described below. 693 NOTE: This section assumes that the message is already in "network 694 normal" format (text is ASCII encoded, lines are separated with CRLF 695 characters, etc.). See also Section 5.3 for information about 696 normalizing the message. 698 3.4.1. The "simple" Header Canonicalization Algorithm 700 The "simple" header canonicalization algorithm does not change header 701 fields in any way. Header fields MUST be presented to the signing or 702 verification algorithm exactly as they are in the message being 703 signed or verified. In particular, header field names MUST NOT be 704 case folded and whitespace MUST NOT be changed. 706 3.4.2. The "relaxed" Header Canonicalization Algorithm 708 The "relaxed" header canonicalization algorithm MUST apply the 709 following steps in order: 711 o Convert all header field names (not the header field values) to 712 lowercase. For example, convert "SUBJect: AbC" to "subject: AbC". 714 o Unfold all header field continuation lines as described in 715 [RFC5322]; in particular, lines with terminators embedded in 716 continued header field values (that is, CRLF sequences followed by 717 WSP) MUST be interpreted without the CRLF. Implementations MUST 718 NOT remove the CRLF at the end of the header field value. 720 o Convert all sequences of one or more WSP characters to a single SP 721 character. WSP characters here include those before and after a 722 line folding boundary. 724 o Delete all WSP characters at the end of each unfolded header field 725 value. 727 o Delete any WSP characters remaining before and after the colon 728 separating the header field name from the header field value. The 729 colon separator MUST be retained. 731 3.4.3. The "simple" Body Canonicalization Algorithm 733 The "simple" body canonicalization algorithm ignores all empty lines 734 at the end of the message body. An empty line is a line of zero 735 length after removal of the line terminator. If there is no body or 736 no trailing CRLF on the message body, a CRLF is added. It makes no 737 other changes to the message body. In more formal terms, the 738 "simple" body canonicalization algorithm converts "0*CRLF" at the end 739 of the body to a single "CRLF". 741 Note that a completely empty or missing body is canonicalized as a 742 single "CRLF"; that is, the canonicalized length will be 2 octets. 744 The SHA-1 value (in base64) for an empty body (canonicalized to a 745 "CRLF") is: 746 uoq1oCgLlTqpdDX/iUbLy7J1Wic= 747 The SHA-256 value is: 748 frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN/XKdLCPjaYaY= 750 3.4.4. The "relaxed" Body Canonicalization Algorithm 752 The "relaxed" body canonicalization algorithm MUST apply the 753 following steps (a) and (b) in order: 755 a. Reduce whitespace: 757 * Ignore all whitespace at the end of lines. Implementations 758 MUST NOT remove the CRLF at the end of the line. 760 * Reduce all sequences of WSP within a line to a single SP 761 character. 763 b. Ignore all empty lines at the end of the message body. "Empty 764 line" is defined in Section 3.4.3. If the body is non-empty, but 765 does not end with a CRLF, a CRLF is added. (For email, this is 766 only possible when using extensions to SMTP or non-SMTP transport 767 mechanisms.) 769 The SHA-1 value (in base64) for an empty body (canonicalized to a 770 null input) is: 771 2jmj7l5rSw0yVb/vlWAYkK/YBwk= 772 The SHA-256 value is: 773 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= 774 INFORMATIVE NOTE: It should be noted that the relaxed body 775 canonicalization algorithm may enable certain types of extremely 776 crude "ASCII Art" attacks where a message may be conveyed by 777 adjusting the spacing between words. If this is a concern, the 778 "simple" body canonicalization algorithm should be used instead. 780 3.4.5. Body Length Limits 782 A body length count MAY be specified to limit the signature 783 calculation to an initial prefix of the body text, measured in 784 octets. If the body length count is not specified, the entire 785 message body is signed. 787 INFORMATIVE RATIONALE: This capability is provided because it is 788 very common for mailing lists to add trailers to messages (e.g., 789 instructions how to get off the list). Until those messages are 790 also signed, the body length count is a useful tool for the 791 verifier since it may as a matter of policy accept messages having 792 valid signatures with extraneous data. 794 INFORMATIVE IMPLEMENTATION NOTE: Using body length limits enables 795 an attack in which an attacker modifies a message to include 796 content that solely benefits the attacker. It is possible for the 797 appended content to completely replace the original content in the 798 end recipient's eyes, such as via alterations to the MIME 799 structure or exploiting lax HTML parsing in the MUA, and to defeat 800 duplicate message detection algorithms. To avoid this attack, 801 signers should be wary of using this tag, and verifiers might wish 802 to ignore the tag, perhaps based on other criteria. 804 The body length count allows the signer of a message to permit data 805 to be appended to the end of the body of a signed message. The body 806 length count MUST be calculated following the canonicalization 807 algorithm; for example, any whitespace ignored by a canonicalization 808 algorithm is not included as part of the body length count. 810 A body length count of zero means that the body is completely 811 unsigned. 813 Signers wishing to ensure that no modification of any sort can occur 814 should specify the "simple" canonicalization algorithm for both 815 header and body and omit the body length count. 817 3.4.6. Canonicalization Examples (INFORMATIVE) 819 In the following examples, actual whitespace is used only for 820 clarity. The actual input and output text is designated using 821 bracketed descriptors: "" for a space character, "" for a 822 tab character, and "" for a carriage-return/line-feed sequence. 823 For example, "X Y" and "XY" represent the same three 824 characters. 826 Example 1: A message reading: 827 A: X 828 B : Y 829 Z 830 831 C 832 D E 833 834 836 when canonicalized using relaxed canonicalization for both header and 837 body results in a header reading: 838 a:X 839 b:Y Z 841 and a body reading: 842 C 843 D E 845 Example 2: The same message canonicalized using simple 846 canonicalization for both header and body results in a header 847 reading: 848 A: X 849 B : Y 850 Z 852 and a body reading: 853 C 854 D E 856 Example 3: When processed using relaxed header canonicalization and 857 simple body canonicalization, the canonicalized version has a header 858 of: 859 a:X 860 b:Y Z 862 and a body reading: 863 C 864 D E 866 3.5. The DKIM-Signature Header Field 868 The signature of the email is stored in the DKIM-Signature header 869 field. This header field contains all of the signature and key- 870 fetching data. The DKIM-Signature value is a tag-list as described 871 in Section 3.2. 873 The DKIM-Signature header field SHOULD be treated as though it were a 874 trace header field as defined in Section 3.6 of [RFC5322], and hence 875 SHOULD NOT be reordered and SHOULD be prepended to the message. 877 The DKIM-Signature header field being created or verified is always 878 included in the signature calculation, after the rest of the header 879 fields being signed; however, when calculating or verifying the 880 signature, the value of the "b=" tag (signature value) of that DKIM- 881 Signature header field MUST be treated as though it were an empty 882 string. Unknown tags in the DKIM-Signature header field MUST be 883 included in the signature calculation but MUST be otherwise ignored 884 by verifiers. Other DKIM-Signature header fields that are included 885 in the signature should be treated as normal header fields; in 886 particular, the "b=" tag is not treated specially. 888 The encodings for each field type are listed below. Tags described 889 as qp-section are encoded as described in Section 6.7 of MIME Part 890 One [RFC2045], with the additional conversion of semicolon characters 891 to "=3B"; intuitively, this is one line of quoted-printable encoded 892 text. The dkim-quoted-printable syntax is defined in Section 2.11. 894 Tags on the DKIM-Signature header field along with their type and 895 requirement status are shown below. Unrecognized tags MUST be 896 ignored. 898 v= Version (MUST be included). This tag defines the version of this 899 specification that applies to the signature record. It MUST have 900 the value "1". Note that verifiers must do a string comparison on 901 this value; for example, "1" is not the same as "1.0". 903 ABNF: 905 sig-v-tag = %x76 [FWS] "=" [FWS] "1" 907 INFORMATIVE NOTE: DKIM-Signature version numbers may increase 908 arithmetically as new versions of this specification are 909 released. 911 a= The algorithm used to generate the signature (plain-text; 912 REQUIRED). Verifiers MUST support "rsa-sha1" and "rsa-sha256"; 913 signers SHOULD sign using "rsa-sha256". See Section 3.3 for a 914 description of the algorithms. 916 ABNF: 918 sig-a-tag = %x61 [FWS] "=" [FWS] sig-a-tag-alg 919 sig-a-tag-alg = sig-a-tag-k "-" sig-a-tag-h 920 sig-a-tag-k = "rsa" / x-sig-a-tag-k 921 sig-a-tag-h = "sha1" / "sha256" / x-sig-a-tag-h 922 x-sig-a-tag-k = ALPHA *(ALPHA / DIGIT) 923 ; for later extension 924 x-sig-a-tag-h = ALPHA *(ALPHA / DIGIT) 925 ; for later extension 927 b= The signature data (base64; REQUIRED). Whitespace is ignored in 928 this value and MUST be ignored when reassembling the original 929 signature. In particular, the signing process can safely insert 930 FWS in this value in arbitrary places to conform to line-length 931 limits. See Signer Actions (Section 5) for how the signature is 932 computed. 934 ABNF: 936 sig-b-tag = %x62 [FWS] "=" [FWS] sig-b-tag-data 937 sig-b-tag-data = base64string 939 bh= The hash of the canonicalized body part of the message as 940 limited by the "l=" tag (base64; REQUIRED). Whitespace is ignored 941 in this value and MUST be ignored when reassembling the original 942 signature. In particular, the signing process can safely insert 943 FWS in this value in arbitrary places to conform to line-length 944 limits. See Section 3.7 for how the body hash is computed. 946 ABNF: 948 sig-bh-tag = %x62 %x68 [FWS] "=" [FWS] sig-bh-tag-data 949 sig-bh-tag-data = base64string 951 c= Message canonicalization (plain-text; OPTIONAL, default is 952 "simple/simple"). This tag informs the verifier of the type of 953 canonicalization used to prepare the message for signing. It 954 consists of two names separated by a "slash" (%d47) character, 955 corresponding to the header and body canonicalization algorithms 956 respectively. These algorithms are described in Section 3.4. If 957 only one algorithm is named, that algorithm is used for the header 958 and "simple" is used for the body. For example, "c=relaxed" is 959 treated the same as "c=relaxed/simple". 961 ABNF: 963 sig-c-tag = %x63 [FWS] "=" [FWS] sig-c-tag-alg 964 ["/" sig-c-tag-alg] 965 sig-c-tag-alg = "simple" / "relaxed" / x-sig-c-tag-alg 966 x-sig-c-tag-alg = hyphenated-word ; for later extension 968 d= The SDID claiming responsibility for an introduction of a message 969 into the mail stream (plain-text; REQUIRED). Hence, the SDID 970 value is used to form the query for the public key. The SDID MUST 971 correspond to a valid DNS name under which the DKIM key record is 972 published. The conventions and semantics used by a signer to 973 create and use a specific SDID are outside the scope of the DKIM 974 Signing specification, as is any use of those conventions and 975 semantics. When presented with a signature that does not meet 976 these requirements, verifiers MUST consider the signature invalid. 978 Internationalized domain names MUST be encoded as A-Labels, as 979 described in Section 2.3 of [RFC5890]. 981 ABNF: 983 sig-d-tag = %x64 [FWS] "=" [FWS] domain-name 984 domain-name = sub-domain 1*("." sub-domain) 985 ; from RFC5321 Domain, excluding address-literal 987 h= Signed header fields (plain-text, but see description; REQUIRED). 988 A colon-separated list of header field names that identify the 989 header fields presented to the signing algorithm. The field MUST 990 contain the complete list of header fields in the order presented 991 to the signing algorithm. The field MAY contain names of header 992 fields that do not exist when signed; nonexistent header fields do 993 not contribute to the signature computation (that is, they are 994 treated as the null input, including the header field name, the 995 separating colon, the header field value, and any CRLF 996 terminator). The field MUST NOT include the DKIM-Signature header 997 field that is being created or verified, but may include others. 998 Folding whitespace (FWS) MAY be included on either side of the 999 colon separator. Header field names MUST be compared against 1000 actual header field names in a case-insensitive manner. This list 1001 MUST NOT be empty. See Section 5.4 for a discussion of choosing 1002 header fields to sign. 1004 ABNF: 1006 sig-h-tag = %x68 [FWS] "=" [FWS] hdr-name 1007 0*( [FWS] ":" [FWS] hdr-name ) 1009 INFORMATIVE EXPLANATION: By "signing" header fields that do not 1010 actually exist, a signer can allow a verifier to detect 1011 insertion of those header fields after signing. However, since 1012 a signer cannot possibly know what header fields might be 1013 created in the future, and that some MUAs might present header 1014 fields that are embedded inside a message (e.g., as a message/ 1015 rfc822 content type), the security of this solution is not 1016 total. 1018 INFORMATIVE EXPLANATION: The exclusion of the header field name 1019 and colon as well as the header field value for non-existent 1020 header fields allows detection of an attacker that inserts an 1021 actual header field with a null value. 1023 i= The Agent or User Identifier (AUID) on behalf of which the SDID is 1024 taking responsibility (dkim-quoted-printable; OPTIONAL, default is 1025 an empty Local-part followed by an "@" followed by the domain from 1026 the "d=" tag). 1028 The syntax is a standard email address where the Local-part MAY be 1029 omitted. The domain part of the address MUST be the same as, or a 1030 subdomain of, the value of the "d=" tag. 1032 Internationalized domain names MUST be encoded as A-Labels, as 1033 described in Section 2.3 of [RFC5890]. 1035 ABNF: 1037 sig-i-tag = %x69 [FWS] "=" [FWS] [ Local-part ] 1038 "@" domain-name 1040 The AUID is specified as having the same syntax as an email 1041 address, but need not have the same semantics. Notably, the 1042 domain name need not be registered in the DNS -- so it might not 1043 resolve in a query -- and the Local-part MAY be drawn from a 1044 namespace unrelated to any mailbox. The details of the structure 1045 and semantics for the namespace are determined by the Signer. Any 1046 knowledge or use of those details by verifiers or assessors is 1047 outside the scope of the DKIM Signing specification. The Signer 1048 MAY choose to use the same namespace for its AUIDs as its users' 1049 email addresses or MAY choose other means of representing its 1050 users. However, the signer SHOULD use the same AUID for each 1051 message intended to be evaluated as being within the same sphere 1052 of responsibility, if it wishes to offer receivers the option of 1053 using the AUID as a stable identifier that is finer grained than 1054 the SDID. 1056 INFORMATIVE NOTE: The Local-part of the "i=" tag is optional 1057 because in some cases a signer may not be able to establish a 1058 verified individual identity. In such cases, the signer might 1059 wish to assert that although it is willing to go as far as 1060 signing for the domain, it is unable or unwilling to commit to 1061 an individual user name within their domain. It can do so by 1062 including the domain part but not the Local-part of the 1063 identity. 1065 INFORMATIVE DISCUSSION: This specification does not require the 1066 value of the "i=" tag to match the identity in any message 1067 header fields. This is considered to be a verifier policy 1068 issue. Constraints between the value of the "i=" tag and other 1069 identities in other header fields seek to apply basic 1070 authentication into the semantics of trust associated with a 1071 role such as content author. Trust is a broad and complex 1072 topic and trust mechanisms are subject to highly creative 1073 attacks. The real-world efficacy of any but the most basic 1074 bindings between the "i=" value and other identities is not 1075 well established, nor is its vulnerability to subversion by an 1076 attacker. Hence reliance on the use of these options should be 1077 strictly limited. In particular, it is not at all clear to 1078 what extent a typical end-user recipient can rely on any 1079 assurances that might be made by successful use of the "i=" 1080 options. 1082 l= Body length count (plain-text unsigned decimal integer; OPTIONAL, 1083 default is entire body). This tag informs the verifier of the 1084 number of octets in the body of the email after canonicalization 1085 included in the cryptographic hash, starting from 0 immediately 1086 following the CRLF preceding the body. This value MUST NOT be 1087 larger than the actual number of octets in the canonicalized 1088 message body. 1090 INFORMATIVE IMPLEMENTATION WARNING: Use of the "l=" tag might 1091 allow display of fraudulent content without appropriate warning 1092 to end users. The "l=" tag is intended for increasing 1093 signature robustness when sending to mailing lists that both 1094 modify their content and do not sign their messages. However, 1095 using the "l=" tag enables attacks in which an intermediary 1096 with malicious intent modifies a message to include content 1097 that solely benefits the attacker. It is possible for the 1098 appended content to completely replace the original content in 1099 the end recipient's eyes and to defeat duplicate message 1100 detection algorithms. Examples are described in Security 1101 Considerations (Section 8). To avoid this attack, signers 1102 should be extremely wary of using this tag, and assessors might 1103 wish to ignore signatures that use the tag. 1105 INFORMATIVE NOTE: The value of the "l=" tag is constrained to 1106 76 decimal digits. This constraint is not intended to predict 1107 the size of future messages or to require implementations to 1108 use an integer representation large enough to represent the 1109 maximum possible value, but is intended to remind the 1110 implementer to check the length of this and all other tags 1111 during verification and to test for integer overflow when 1112 decoding the value. Implementers may need to limit the actual 1113 value expressed to a value smaller than 10^76, e.g., to allow a 1114 message to fit within the available storage space. 1116 ABNF: 1118 sig-l-tag = %x6c [FWS] "=" [FWS] 1119 1*76DIGIT 1121 q= A colon-separated list of query methods used to retrieve the 1122 public key (plain-text; OPTIONAL, default is "dns/txt"). Each 1123 query method is of the form "type[/options]", where the syntax and 1124 semantics of the options depend on the type and specified options. 1125 If there are multiple query mechanisms listed, the choice of query 1126 mechanism MUST NOT change the interpretation of the signature. 1127 Implementations MUST use the recognized query mechanisms in the 1128 order presented. Unrecognized query mechanisms MUST be ignored. 1130 Currently, the only valid value is "dns/txt", which defines the 1131 DNS TXT resource record (RR) lookup algorithm described elsewhere 1132 in this document. The only option defined for the "dns" query 1133 type is "txt", which MUST be included. Verifiers and signers MUST 1134 support "dns/txt". 1136 ABNF: 1138 sig-q-tag = %x71 [FWS] "=" [FWS] sig-q-tag-method 1139 *([FWS] ":" [FWS] sig-q-tag-method) 1140 sig-q-tag-method = "dns/txt" / x-sig-q-tag-type 1141 ["/" x-sig-q-tag-args] 1142 x-sig-q-tag-type = hyphenated-word ; for future extension 1143 x-sig-q-tag-args = qp-hdr-value 1145 s= The selector subdividing the namespace for the "d=" (domain) tag 1146 (plain-text; REQUIRED). 1148 Internationalized selector names MUST be encoded as A-Labels, as 1149 described in Section 2.3 of [RFC5890]. 1151 ABNF: 1153 sig-s-tag = %x73 [FWS] "=" [FWS] selector 1155 t= Signature Timestamp (plain-text unsigned decimal integer; 1156 RECOMMENDED, default is an unknown creation time). The time that 1157 this signature was created. The format is the number of seconds 1158 since 00:00:00 on January 1, 1970 in the UTC time zone. The value 1159 is expressed as an unsigned integer in decimal ASCII. This value 1160 is not constrained to fit into a 31- or 32-bit integer. 1161 Implementations SHOULD be prepared to handle values up to at least 1162 10^12 (until approximately AD 200,000; this fits into 40 bits). 1163 To avoid denial-of-service attacks, implementations MAY consider 1164 any value longer than 12 digits to be infinite. Leap seconds are 1165 not counted. Implementations MAY ignore signatures that have a 1166 timestamp in the future. 1168 ABNF: 1170 sig-t-tag = %x74 [FWS] "=" [FWS] 1*12DIGIT 1172 x= Signature Expiration (plain-text unsigned decimal integer; 1173 RECOMMENDED, default is no expiration). The format is the same as 1174 in the "t=" tag, represented as an absolute date, not as a time 1175 delta from the signing timestamp. The value is expressed as an 1176 unsigned integer in decimal ASCII, with the same constraints on 1177 the value in the "t=" tag. Signatures MAY be considered invalid 1178 if the verification time at the verifier is past the expiration 1179 date. The verification time should be the time that the message 1180 was first received at the administrative domain of the verifier if 1181 that time is reliably available; otherwise the current time should 1182 be used. The value of the "x=" tag MUST be greater than the value 1183 of the "t=" tag if both are present. 1185 INFORMATIVE NOTE: The "x=" tag is not intended as an anti- 1186 replay defense. 1188 INFORMATIVE NOTE: Due to clock drift, the receiver's notion of 1189 when to consider the signature expired may not match exactly 1190 when the sender is expecting. Receivers MAY add a 'fudge 1191 factor' to allow for such possible drift. 1193 ABNF: 1195 sig-x-tag = %x78 [FWS] "=" [FWS] 1196 1*12DIGIT 1198 z= Copied header fields (dkim-quoted-printable, but see description; 1199 OPTIONAL, default is null). A vertical-bar-separated list of 1200 selected header fields present when the message was signed, 1201 including both the field name and value. It is not required to 1202 include all header fields present at the time of signing. This 1203 field need not contain the same header fields listed in the "h=" 1204 tag. The header field text itself must encode the vertical bar 1205 ("|", %x7C) character (i.e., vertical bars in the "z=" text are 1206 meta-characters, and any actual vertical bar characters in a 1207 copied header field must be encoded). Note that all whitespace 1208 must be encoded, including whitespace between the colon and the 1209 header field value. After encoding, FWS MAY be added at arbitrary 1210 locations in order to avoid excessively long lines; such 1211 whitespace is NOT part of the value of the header field, and MUST 1212 be removed before decoding. 1214 The header fields referenced by the "h=" tag refer to the fields 1215 in the [RFC5322] header of the message, not to any copied fields 1216 in the "z=" tag. Copied header field values are for diagnostic 1217 use. 1219 ABNF: 1221 sig-z-tag = %x7A [FWS] "=" [FWS] sig-z-tag-copy 1222 *( "|" [FWS] sig-z-tag-copy ) 1223 sig-z-tag-copy = hdr-name [FWS] ":" qp-hdr-value 1224 INFORMATIVE EXAMPLE of a signature header field spread across 1225 multiple continuation lines: 1226 DKIM-Signature: v=1; a=rsa-sha256; d=example.net; s=brisbane; 1227 c=simple; q=dns/txt; i=@eng.example.net; 1228 t=1117574938; x=1118006938; 1229 h=from:to:subject:date; 1230 z=From:foo@eng.example.net|To:joe@example.com| 1231 Subject:demo=20run|Date:July=205,=202005=203:44:08=20PM=20-0700; 1232 bh=MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=; 1233 b=dzdVyOfAKCdLXdJOc9G2q8LoXSlEniSbav+yuU4zGeeruD00lszZVoG4ZHRNiYzR 1235 3.6. Key Management and Representation 1237 Signature applications require some level of assurance that the 1238 verification public key is associated with the claimed signer. Many 1239 applications achieve this by using public key certificates issued by 1240 a trusted third party. However, DKIM can achieve a sufficient level 1241 of security, with significantly enhanced scalability, by simply 1242 having the verifier query the purported signer's DNS entry (or some 1243 security-equivalent) in order to retrieve the public key. 1245 DKIM keys can potentially be stored in multiple types of key servers 1246 and in multiple formats. The storage and format of keys are 1247 irrelevant to the remainder of the DKIM algorithm. 1249 Parameters to the key lookup algorithm are the type of the lookup 1250 (the "q=" tag), the domain of the signer (the "d=" tag of the DKIM- 1251 Signature header field), and the selector (the "s=" tag). 1253 public_key = dkim_find_key(q_val, d_val, s_val) 1255 This document defines a single binding, using DNS TXT RRs to 1256 distribute the keys. Other bindings may be defined in the future. 1258 3.6.1. Textual Representation 1260 It is expected that many key servers will choose to present the keys 1261 in an otherwise unstructured text format (for example, an XML form 1262 would not be considered to be unstructured text for this purpose). 1263 The following definition MUST be used for any DKIM key represented in 1264 an otherwise unstructured textual form. 1266 The overall syntax is a tag-list as described in Section 3.2. The 1267 current valid tags are described below. Other tags MAY be present 1268 and MUST be ignored by any implementation that does not understand 1269 them. 1271 v= Version of the DKIM key record (plain-text; RECOMMENDED, default 1272 is "DKIM1"). If specified, this tag MUST be set to "DKIM1" 1273 (without the quotes). This tag MUST be the first tag in the 1274 record. Records beginning with a "v=" tag with any other value 1275 MUST be discarded. Note that verifiers must do a string 1276 comparison on this value; for example, "DKIM1" is not the same as 1277 "DKIM1.0". 1279 ABNF: 1280 key-v-tag = %x76 [FWS] "=" [FWS] %x44.4B.49.4D.31 1282 h= Acceptable hash algorithms (plain-text; OPTIONAL, defaults to 1283 allowing all algorithms). A colon-separated list of hash 1284 algorithms that might be used. Unrecognized algorithms MUST be 1285 ignored. Refer to Section 3.3 for a discussion of the hash 1286 algorithms implemented by Signers and Verifiers. The set of 1287 algorithms listed in this tag in each record is an operational 1288 choice made by the Signer. 1290 ABNF: 1292 key-h-tag = %x68 [FWS] "=" [FWS] key-h-tag-alg 1293 0*( [FWS] ":" [FWS] key-h-tag-alg ) 1294 key-h-tag-alg = "sha1" / "sha256" / x-key-h-tag-alg 1295 x-key-h-tag-alg = hyphenated-word ; for future extension 1297 k= Key type (plain-text; OPTIONAL, default is "rsa"). Signers and 1298 verifiers MUST support the "rsa" key type. The "rsa" key type 1299 indicates that an ASN.1 DER-encoded [ITU-X660-1997] RSAPublicKey 1300 [RFC3447] (see Sections Section 3.1 and A.1.1) is being used in 1301 the "p=" tag. (Note: the "p=" tag further encodes the value using 1302 the base64 algorithm.) Unrecognized key types MUST be ignored. 1304 ABNF: 1306 key-k-tag = %x76 [FWS] "=" [FWS] key-k-tag-type 1307 key-k-tag-type = "rsa" / x-key-k-tag-type 1308 x-key-k-tag-type = hyphenated-word ; for future extension 1309 n= Notes that might be of interest to a human (qp-section; OPTIONAL, 1310 default is empty). No interpretation is made by any program. 1311 This tag should be used sparingly in any key server mechanism that 1312 has space limitations (notably DNS). This is intended for use by 1313 administrators, not end users. 1315 ABNF: 1317 key-n-tag = %x6e [FWS] "=" [FWS] qp-section 1319 p= Public-key data (base64; REQUIRED). An empty value means that 1320 this public key has been revoked. The syntax and semantics of 1321 this tag value before being encoded in base64 are defined by the 1322 "k=" tag. 1324 INFORMATIVE RATIONALE: If a private key has been compromised or 1325 otherwise disabled (e.g., an outsourcing contract has been 1326 terminated), a signer might want to explicitly state that it 1327 knows about the selector, but all messages using that selector 1328 should fail verification. Verifiers SHOULD return an error 1329 code for any DKIM-Signature header field with a selector 1330 referencing a revoked key. (See Section 6.1.2 for details.) 1332 ABNF: 1334 key-p-tag = %x70 [FWS] "=" [ [FWS] base64string] 1336 INFORMATIVE NOTE: A base64string is permitted to include white 1337 space (FWS) at arbitrary places; however, any CRLFs must be 1338 followed by at least one WSP character. Implementors and 1339 administrators are cautioned to ensure that selector TXT RRs 1340 conform to this specification. 1342 s= Service Type (plain-text; OPTIONAL; default is "*"). A colon- 1343 separated list of service types to which this record applies. 1344 Verifiers for a given service type MUST ignore this record if the 1345 appropriate type is not listed. Unrecognized service types MUST 1346 be ignored. Currently defined service types are as follows: 1348 * matches all service types 1350 email electronic mail (not necessarily limited to SMTP) 1352 This tag is intended to constrain the use of keys for other 1353 purposes, should use of DKIM be defined by other services in the 1354 future. 1356 ABNF: 1358 key-s-tag = %x73 [FWS] "=" [FWS] key-s-tag-type 1359 0*( [FWS] ":" [FWS] key-s-tag-type ) 1360 key-s-tag-type = "email" / "*" / x-key-s-tag-type 1361 x-key-s-tag-type = hyphenated-word ; for future extension 1363 t= Flags, represented as a colon-separated list of names (plain- 1364 text; OPTIONAL, default is no flags set). Unrecognized flags MUST 1365 be ignored. The defined flags are as follows: 1367 y This domain is testing DKIM. Verifiers MUST NOT treat messages 1368 from signers in testing mode differently from unsigned email, even 1369 should the signature fail to verify. Verifiers MAY wish to track 1370 testing mode results to assist the signer. 1372 s Any DKIM-Signature header fields using the "i=" tag MUST have the 1373 same domain value on the right-hand side of the "@" in the "i=" 1374 tag and the value of the "d=" tag. That is, the "i=" domain MUST 1375 NOT be a subdomain of "d=". Use of this flag is RECOMMENDED 1376 unless subdomaining is required. 1378 ABNF: 1380 key-t-tag = %x74 [FWS] "=" [FWS] key-t-tag-flag 1381 0*( [FWS] ":" [FWS] key-t-tag-flag ) 1382 key-t-tag-flag = "y" / "s" / x-key-t-tag-flag 1383 x-key-t-tag-flag = hyphenated-word ; for future extension 1385 3.6.2. DNS Binding 1387 A binding using DNS TXT RRs as a key service is hereby defined. All 1388 implementations MUST support this binding. 1390 3.6.2.1. Namespace 1392 All DKIM keys are stored in a subdomain named "_domainkey". Given a 1393 DKIM-Signature field with a "d=" tag of "example.com" and an "s=" tag 1394 of "foo.bar", the DNS query will be for 1395 "foo.bar._domainkey.example.com". 1397 3.6.2.2. Resource Record Types for Key Storage 1399 The DNS Resource Record type used is specified by an option to the 1400 query-type ("q=") tag. The only option defined in this base 1401 specification is "txt", indicating the use of a TXT RR. A later 1402 extension of this standard may define another RR type. 1404 Strings in a TXT RR MUST be concatenated together before use with no 1405 intervening whitespace. TXT RRs MUST be unique for a particular 1406 selector name; that is, if there are multiple records in an RRset, 1407 the results are undefined. 1409 TXT RRs are encoded as described in Section 3.6.1. 1411 3.7. Computing the Message Hashes 1413 Both signing and verifying message signatures start with a step of 1414 computing two cryptographic hashes over the message. Signers will 1415 choose the parameters of the signature as described in Signer Actions 1416 (Section 5); verifiers will use the parameters specified in the DKIM- 1417 Signature header field being verified. In the following discussion, 1418 the names of the tags in the DKIM-Signature header field that either 1419 exists (when verifying) or will be created (when signing) are used. 1420 Note that canonicalization (Section 3.4) is only used to prepare the 1421 email for signing or verifying; it does not affect the transmitted 1422 email in any way. 1424 The signer/verifier MUST compute two hashes, one over the body of the 1425 message and one over the selected header fields of the message. 1427 Signers MUST compute them in the order shown. Verifiers MAY compute 1428 them in any order convenient to the verifier, provided that the 1429 result is semantically identical to the semantics that would be the 1430 case had they been computed in this order. 1432 In hash step 1, the signer/verifier MUST hash the message body, 1433 canonicalized using the body canonicalization algorithm specified in 1434 the "c=" tag and then truncated to the length specified in the "l=" 1435 tag. That hash value is then converted to base64 form and inserted 1436 into (signers) or compared to (verifiers) the "bh=" tag of the DKIM- 1437 Signature header field. 1439 In hash step 2, the signer/verifier MUST pass the following to the 1440 hash algorithm in the indicated order. 1442 1. The header fields specified by the "h=" tag, in the order 1443 specified in that tag, and canonicalized using the header 1444 canonicalization algorithm specified in the "c=" tag. Each 1445 header field MUST be terminated with a single CRLF. 1447 2. The DKIM-Signature header field that exists (verifying) or will 1448 be inserted (signing) in the message, with the value of the "b=" 1449 tag (including all surrounding whitespace) deleted (i.e., treated 1450 as the empty string), canonicalized using the header 1451 canonicalization algorithm specified in the "c=" tag, and without 1452 a trailing CRLF. 1454 All tags and their values in the DKIM-Signature header field are 1455 included in the cryptographic hash with the sole exception of the 1456 value portion of the "b=" (signature) tag, which MUST be treated as 1457 the null string. All tags MUST be included even if they might not be 1458 understood by the verifier. The header field MUST be presented to 1459 the hash algorithm after the body of the message rather than with the 1460 rest of the header fields and MUST be canonicalized as specified in 1461 the "c=" (canonicalization) tag. The DKIM-Signature header field 1462 MUST NOT be included in its own h= tag, although other DKIM-Signature 1463 header fields MAY be signed (see Section 4). 1465 When calculating the hash on messages that will be transmitted using 1466 base64 or quoted-printable encoding, signers MUST compute the hash 1467 after the encoding. Likewise, the verifier MUST incorporate the 1468 values into the hash before decoding the base64 or quoted-printable 1469 text. However, the hash MUST be computed before transport level 1470 encodings such as SMTP "dot-stuffing" (the modification of lines 1471 beginning with a "." to avoid confusion with the SMTP end-of-message 1472 marker, as specified in [RFC5321]). 1474 With the exception of the canonicalization procedure described in 1475 Section 3.4, the DKIM signing process treats the body of messages as 1476 simply a string of octets. DKIM messages MAY be either in plain-text 1477 or in MIME format; no special treatment is afforded to MIME content. 1478 Message attachments in MIME format MUST be included in the content 1479 that is signed. 1481 More formally, pseudo-code for the signature algorithm is: 1482 body-hash = hash-alg (canon-body, l-param) 1483 data-hash = hash-alg (h-headers, D-SIG, content-hash) 1484 signature = sig-alg (d-domain, selector, data-hash) 1486 where: 1488 body-hash: is the output from hashing the body, using hash-alg. 1490 hash-alg: is the hashing algorithm specified in the "a" 1491 parameter. 1493 canon-body: is a canonicalized representation of the body, 1494 produced by using the body algorithm specified in the "c" 1495 parameter, as defined in Section 3.4 and excluding the 1496 DKIM-Signature field. 1498 l-param: is the length-of-body value of the "l" parameter. 1500 data-hash: is the output from using the hash-alg algorithm, to 1501 hash the header including the DKIM-Signature header, and the 1502 body hash. 1504 h-headers: is the list of headers to be signed, as specified in 1505 the "h" parameter. 1507 D-SIG: is the canonicalized DKIM-Signature field without the 1508 signature value portion of the parameter, itself; that is, an 1509 empty parameter value. 1511 signature: is the signature value produced by the signing 1512 algorithm. 1514 sig-alg: is the signature algorithm specified by the "a" 1515 parameter. 1517 d-domain: is the domain name specified in the "d" parameter. 1519 selector: is the selector value specified in the "s" parameter. 1521 NOTE: Many digital signature APIs provide both hashing and 1522 application of the RSA private key using a single "sign()" 1523 primitive. When using such an API, the last two steps in the 1524 algorithm would probably be combined into a single call that would 1525 perform both the "a-hash-alg" and the "sig-alg". 1527 3.8. Input Requirements 1529 DKIM's design is predicated on valid input. Therefore, signers and 1530 verifiers SHOULD take reasonable steps to ensure that the messages 1531 they are processing are valid according to [RFC5322], [RFC2045], and 1532 any other relevant message format standards. See Section 8.14 and 1533 Section 8.15 for additional discussion and references. 1535 3.9. Output Requirements 1537 For each signature that verifies successfully or produces a TEMPFAIL 1538 result, the output of a DKIM verifier module MUST include the set of: 1540 o The domain name, taken from the "d=" signature tag; and 1542 o The result of the verification attempt for that signature. 1544 The output MAY include other signature properties or result meta- 1545 data, including PERMFAILed or otherwise ignored signatures, for use 1546 by modules that consume those results. 1548 See Section 6.1 for discussion of signature validation result codes. 1550 3.10. Signing by Parent Domains 1552 In some circumstances, it is desirable for a domain to apply a 1553 signature on behalf of any of its subdomains without the need to 1554 maintain separate selectors (key records) in each subdomain. By 1555 default, private keys corresponding to key records can be used to 1556 sign messages for any subdomain of the domain in which they reside; 1557 for example, a key record for the domain example.com can be used to 1558 verify messages where the AUID ("i=" tag of the signature) is 1559 sub.example.com, or even sub1.sub2.example.com. In order to limit 1560 the capability of such keys when this is not intended, the "s" flag 1561 MAY be set in the "t=" tag of the key record, to constrain the 1562 validity of the domain of the AUID. If the referenced key record 1563 contains the "s" flag as part of the "t=" tag, the domain of the AUID 1564 ("i=" flag) MUST be the same as that of the SDID (d=) domain. If 1565 this flag is absent, the domain of the AUID MUST be the same as, or a 1566 subdomain of, the SDID. 1568 3.11. Relationship between SDID and AUID 1570 DKIM's primary task is to communicate from the Signer to a recipient- 1571 side Identity Assessor a single Signing Domain Identifier (SDID) that 1572 refers to a responsible identity. DKIM MAY optionally provide a 1573 single responsible Agent or User Identifier (AUID). 1575 Hence, DKIM's mandatory output to a receive-side Identity Assessor is 1576 a single domain name. Within the scope of its use as DKIM output, 1577 the name has only basic domain name semantics; any possible owner- 1578 specific semantics are outside the scope of DKIM. That is, within 1579 its role as a DKIM identifier, additional semantics cannot be assumed 1580 by an Identity Assessor. 1582 Upon successfully verifying the signature, a receive-side DKIM 1583 verifier MUST communicate the Signing Domain Identifier (d=) to a 1584 consuming Identity Assessor module and MAY communicate the Agent or 1585 User Identifier (i=) if present. 1587 To the extent that a receiver attempts to intuit any structured 1588 semantics for either of the identifiers, this is a heuristic function 1589 that is outside the scope of DKIM's specification and semantics. 1590 Hence, it is relegated to a higher-level service, such as a delivery 1591 handling filter that integrates a variety of inputs and performs 1592 heuristic analysis of them. 1594 INFORMATIVE DISCUSSION: This document does not require the value 1595 of the SDID or AUID to match an identifier in any other message 1596 header field. This requirement is, instead, an assessor policy 1597 issue. The purpose of such a linkage would be to authenticate the 1598 value in that other header field. This, in turn, is the basis for 1599 applying a trust assessment based on the identifier value. Trust 1600 is a broad and complex topic and trust mechanisms are subject to 1601 highly creative attacks. The real-world efficacy of any but the 1602 most basic bindings between the SDID or AUID and other identities 1603 is not well established, nor is its vulnerability to subversion by 1604 an attacker. Hence, reliance on the use of such bindings should 1605 be strictly limited. In particular, it is not at all clear to 1606 what extent a typical end-user recipient can rely on any 1607 assurances that might be made by successful use of the SDID or 1608 AUID. 1610 4. Semantics of Multiple Signatures 1612 4.1. Example Scenarios 1614 There are many reasons why a message might have multiple signatures. 1615 For example, a given signer might sign multiple times, perhaps with 1616 different hashing or signing algorithms during a transition phase. 1618 INFORMATIVE EXAMPLE: Suppose SHA-256 is in the future found to be 1619 insufficiently strong, and DKIM usage transitions to SHA-1024. A 1620 signer might immediately sign using the newer algorithm, but 1621 continue to sign using the older algorithm for interoperability 1622 with verifiers that had not yet upgraded. The signer would do 1623 this by adding two DKIM-Signature header fields, one using each 1624 algorithm. Older verifiers that did not recognize SHA-1024 as an 1625 acceptable algorithm would skip that signature and use the older 1626 algorithm; newer verifiers could use either signature at their 1627 option, and all other things being equal might not even attempt to 1628 verify the other signature. 1630 Similarly, a signer might sign a message including all headers and no 1631 "l=" tag (to satisfy strict verifiers) and a second time with a 1632 limited set of headers and an "l=" tag (in anticipation of possible 1633 message modifications in route to other verifiers). Verifiers could 1634 then choose which signature they preferred. 1636 INFORMATIVE EXAMPLE: A verifier might receive a message with two 1637 signatures, one covering more of the message than the other. If 1638 the signature covering more of the message verified, then the 1639 verifier could make one set of policy decisions; if that signature 1640 failed but the signature covering less of the message verified, 1641 the verifier might make a different set of policy decisions. 1643 Of course, a message might also have multiple signatures because it 1644 passed through multiple signers. A common case is expected to be 1645 that of a signed message that passes through a mailing list that also 1646 signs all messages. Assuming both of those signatures verify, a 1647 recipient might choose to accept the message if either of those 1648 signatures were known to come from trusted sources. 1650 INFORMATIVE EXAMPLE: Recipients might choose to whitelist mailing 1651 lists to which they have subscribed and that have acceptable anti- 1652 abuse policies so as to accept messages sent to that list even 1653 from unknown authors. They might also subscribe to less trusted 1654 mailing lists (e.g., those without anti-abuse protection) and be 1655 willing to accept all messages from specific authors, but insist 1656 on doing additional abuse scanning for other messages. 1658 Another related example of multiple signers might be forwarding 1659 services, such as those commonly associated with academic alumni 1660 sites. 1662 INFORMATIVE EXAMPLE: A recipient might have an address at 1663 members.example.org, a site that has anti-abuse protection that is 1664 somewhat less effective than the recipient would prefer. Such a 1665 recipient might have specific authors whose messages would be 1666 trusted absolutely, but messages from unknown authors that had 1667 passed the forwarder's scrutiny would have only medium trust. 1669 4.2. Interpretation 1671 A signer that is adding a signature to a message merely creates a new 1672 DKIM-Signature header, using the usual semantics of the h= option. A 1673 signer MAY sign previously existing DKIM-Signature header fields 1674 using the method described in Section 5.4 to sign trace header 1675 fields. 1677 INFORMATIVE NOTE: Signers should be cognizant that signing DKIM- 1678 Signature header fields may result in signature failures with 1679 intermediaries that do not recognize that DKIM-Signature header 1680 fields are trace header fields and unwittingly reorder them, thus 1681 breaking such signatures. For this reason, signing existing DKIM- 1682 Signature header fields is unadvised, albeit legal. 1684 INFORMATIVE NOTE: If a header field with multiple instances is 1685 signed, those header fields are always signed from the bottom up. 1686 Thus, it is not possible to sign only specific DKIM-Signature 1687 header fields. For example, if the message being signed already 1688 contains three DKIM-Signature header fields A, B, and C, it is 1689 possible to sign all of them, B and C only, or C only, but not A 1690 only, B only, A and B only, or A and C only. 1692 A signer MAY add more than one DKIM-Signature header field using 1693 different parameters. For example, during a transition period a 1694 signer might want to produce signatures using two different hash 1695 algorithms. 1697 Signers SHOULD NOT remove any DKIM-Signature header fields from 1698 messages they are signing, even if they know that the signatures 1699 cannot be verified. 1701 When evaluating a message with multiple signatures, a verifier SHOULD 1702 evaluate signatures independently and on their own merits. For 1703 example, a verifier that by policy chooses not to accept signatures 1704 with deprecated cryptographic algorithms would consider such 1705 signatures invalid. Verifiers MAY process signatures in any order of 1706 their choice; for example, some verifiers might choose to process 1707 signatures corresponding to the From field in the message header 1708 before other signatures. See Section 6.1 for more information about 1709 signature choices. 1711 INFORMATIVE IMPLEMENTATION NOTE: Verifier attempts to correlate 1712 valid signatures with invalid signatures in an attempt to guess 1713 why a signature failed are ill-advised. In particular, there is 1714 no general way that a verifier can determine that an invalid 1715 signature was ever valid. 1717 Verifiers SHOULD continue to check signatures until a signature 1718 successfully verifies to the satisfaction of the verifier. To limit 1719 potential denial-of-service attacks, verifiers MAY limit the total 1720 number of signatures they will attempt to verify. 1722 If a verifier module reports signatures whose evaluations produced 1723 PERMFAIL results, identity assessors SHOULD ignore those signatures 1724 (see Section 6.1), acting as though they were not present in the 1725 message. 1727 5. Signer Actions 1729 The following steps are performed in order by signers. 1731 5.1. Determine Whether the Email Should Be Signed and by Whom 1733 A signer can obviously only sign email for domains for which it has a 1734 private key and the necessary knowledge of the corresponding public 1735 key and selector information. However, there are a number of other 1736 reasons beyond the lack of a private key why a signer could choose 1737 not to sign an email. 1739 INFORMATIVE NOTE: Signing modules may be incorporated into any 1740 portion of the mail system as deemed appropriate, including an 1741 MUA, a SUBMISSION server, or an MTA. Wherever implemented, 1742 signers should beware of signing (and thereby asserting 1743 responsibility for) messages that may be problematic. In 1744 particular, within a trusted enclave the signing address might be 1745 derived from the header according to local policy; SUBMISSION 1746 servers might only sign messages from users that are properly 1747 authenticated and authorized. 1749 INFORMATIVE IMPLEMENTER ADVICE: SUBMISSION servers should not sign 1750 Received header fields if the outgoing gateway MTA obfuscates 1751 Received header fields, for example, to hide the details of 1752 internal topology. 1754 If an email cannot be signed for some reason, it is a local policy 1755 decision as to what to do with that email. 1757 5.2. Select a Private Key and Corresponding Selector Information 1759 This specification does not define the basis by which a signer should 1760 choose which private key and selector information to use. Currently, 1761 all selectors are equal as far as this specification is concerned, so 1762 the decision should largely be a matter of administrative 1763 convenience. Distribution and management of private keys is also 1764 outside the scope of this document. 1766 INFORMATIVE OPERATIONS ADVICE: A signer should not sign with a 1767 private key when the selector containing the corresponding public 1768 key is expected to be revoked or removed before the verifier has 1769 an opportunity to validate the signature. The signer should 1770 anticipate that verifiers may choose to defer validation, perhaps 1771 until the message is actually read by the final recipient. In 1772 particular, when rotating to a new key pair, signing should 1773 immediately commence with the new private key and the old public 1774 key should be retained for a reasonable validation interval before 1775 being removed from the key server. 1777 5.3. Normalize the Message to Prevent Transport Conversions 1779 Some messages, particularly those using 8-bit characters, are subject 1780 to modification during transit, notably conversion to 7-bit form. 1781 Such conversions will break DKIM signatures. In order to minimize 1782 the chances of such breakage, signers SHOULD convert the message to a 1783 suitable MIME content transfer encoding such as quoted-printable or 1784 base64 as described in [RFC2045] before signing. Such conversion is 1785 outside the scope of DKIM; the actual message SHOULD be converted to 1786 7-bit MIME by an MUA or MSA prior to presentation to the DKIM 1787 algorithm. 1789 Similarly, a message that is not compliant with RFC5322, RFC2045 and 1790 RFC2047 can be subject to attempts by intermediaries to correct or 1791 interpret such content. See Section 8 of [RFC4409] for examples of 1792 changes that are commonly made. Such "corrections" may break DKIM 1793 signatures or have other undesirable effects. Therefore, a verifier 1794 SHOULD NOT validate a message that is not compliant with those 1795 specifications. 1797 If the message is submitted to the signer with any local encoding 1798 that will be modified before transmission, that modification to 1799 canonical [RFC5322] form MUST be done before signing. In particular, 1800 bare CR or LF characters (used by some systems as a local line 1801 separator convention) MUST be converted to the SMTP-standard CRLF 1802 sequence before the message is signed. Any conversion of this sort 1803 SHOULD be applied to the message actually sent to the recipient(s), 1804 not just to the version presented to the signing algorithm. 1806 More generally, the signer MUST sign the message as it is expected to 1807 be received by the verifier rather than in some local or internal 1808 form. 1810 5.4. Determine the Header Fields to Sign 1812 The From header field MUST be signed (that is, included in the "h=" 1813 tag of the resulting DKIM-Signature header field). Signers SHOULD 1814 NOT sign an existing header field likely to be legitimately modified 1815 or removed in transit. In particular, [RFC5321] explicitly permits 1816 modification or removal of the Return-Path header field in transit. 1817 Signers MAY include any other header fields present at the time of 1818 signing at the discretion of the signer. 1820 INFORMATIVE OPERATIONS NOTE: The choice of which header fields to 1821 sign is non-obvious. One strategy is to sign all existing, non- 1822 repeatable header fields. An alternative strategy is to sign only 1823 header fields that are likely to be displayed to or otherwise be 1824 likely to affect the processing of the message at the receiver. A 1825 third strategy is to sign only "well known" headers. Note that 1826 verifiers may treat unsigned header fields with extreme 1827 skepticism, including refusing to display them to the end user or 1828 even ignoring the signature if it does not cover certain header 1829 fields. For this reason, signing fields present in the message 1830 such as Date, Subject, Reply-To, Sender, and all MIME header 1831 fields are highly advised. 1833 The DKIM-Signature header field is always implicitly signed and MUST 1834 NOT be included in the "h=" tag except to indicate that other 1835 preexisting signatures are also signed. 1837 Signers MAY claim to have signed header fields that do not exist 1838 (that is, signers MAY include the header field name in the "h=" tag 1839 even if that header field does not exist in the message). When 1840 computing the signature, the non-existing header field MUST be 1841 treated as the null string (including the header field name, header 1842 field value, all punctuation, and the trailing CRLF). 1844 INFORMATIVE RATIONALE: This allows signers to explicitly assert 1845 the absence of a header field; if that header field is added later 1846 the signature will fail. 1848 INFORMATIVE NOTE: A header field name need only be listed once 1849 more than the actual number of that header field in a message at 1850 the time of signing in order to prevent any further additions. 1851 For example, if there is a single Comments header field at the 1852 time of signing, listing Comments twice in the "h=" tag is 1853 sufficient to prevent any number of Comments header fields from 1854 being appended; it is not necessary (but is legal) to list 1855 Comments three or more times in the "h=" tag. 1857 Signers choosing to sign an existing header field that occurs more 1858 than once in the message (such as Received) MUST sign the physically 1859 last instance of that header field in the header block. Signers 1860 wishing to sign multiple instances of such a header field MUST 1861 include the header field name multiple times in the h= tag of the 1862 DKIM-Signature header field, and MUST sign such header fields in 1863 order from the bottom of the header field block to the top. The 1864 signer MAY include more instances of a header field name in h= than 1865 there are actual corresponding header fields to indicate that 1866 additional header fields of that name SHOULD NOT be added. 1868 INFORMATIVE EXAMPLE: 1870 If the signer wishes to sign two existing Received header fields, 1871 and the existing header contains: 1872 Received: 1873 Received: 1874 Received: 1876 then the resulting DKIM-Signature header field should read: 1878 DKIM-Signature: ... h=Received : Received :... 1879 and Received header fields and will be signed in that 1880 order. 1882 Signers should be careful of signing header fields that might have 1883 additional instances added later in the delivery process, since such 1884 header fields might be inserted after the signed instance or 1885 otherwise reordered. Trace header fields (such as Received) and 1886 Resent-* blocks are the only fields prohibited by [RFC5322] from 1887 being reordered. In particular, since DKIM-Signature header fields 1888 may be reordered by some intermediate MTAs, signing existing DKIM- 1889 Signature header fields is error-prone. 1891 INFORMATIVE ADMONITION: Despite the fact that [RFC5322] permits 1892 header fields to be reordered (with the exception of Received 1893 header fields), reordering of signed header fields with multiple 1894 instances by intermediate MTAs will cause DKIM signatures to be 1895 broken; such anti-social behavior should be avoided. 1897 INFORMATIVE IMPLEMENTER'S NOTE: Although not required by this 1898 specification, all end-user visible header fields should be signed 1899 to avoid possible "indirect spamming". For example, if the 1900 Subject header field is not signed, a spammer can resend a 1901 previously signed mail, replacing the legitimate subject with a 1902 one-line spam. 1904 5.5. Recommended Signature Content 1906 The purpose of the DKIM cryptographic algorithm is to affix an 1907 identifier to the message in a way that is both robust against normal 1908 transit-related changes and resistant to kinds of replay attacks. An 1909 essential aspect of satisfying these requirements is choosing what 1910 header fields to include in the hash and what fields to exclude. 1912 The basic rule for choosing fields to include is to select those 1913 fields that constitute the "core" of the message content. Hence, any 1914 replay attack will have to include these in order to have the 1915 signature succeed; but with these included, the core of the message 1916 is valid, even if sent on to new recipients. 1918 Common examples of fields with addresses and fields with textual 1919 content related to the body are: 1921 o From (REQUIRED; see Section 5.4) 1923 o Reply-To 1925 o Subject 1927 o Date 1929 o To, Cc 1931 o Resent-Date, Resent-From, Resent-To, Resent-Cc 1933 o In-Reply-To, References 1935 o List-Id, List-Help, List-Unsubscribe, List-Subscribe, List-Post, 1936 List-Owner, List-Archive 1938 If the "l=" signature tag is in use (see Section 3.5), the Content- 1939 Type field is also a candidate for being included as it could be 1940 replaced in a way that causes completely different content to be 1941 rendered to the receiving user. 1943 There are tradeoffs in the decision of what constitutes the "core" of 1944 the message, which for some fields is a subjective concept. 1945 Including fields such as "Message-ID" for example is useful if one 1946 considers a mechanism for being able to distinguish separate 1947 instances of the same message to be core content. Similarly, "In- 1948 Reply-To" and "References" might be desirable to include if one 1949 considers message threading to be a core part of the message. 1951 Another class of fields that may be of interest are those that convey 1952 security-related information about the message, such as 1953 Authentication-Results [RFC5451]. 1955 The basic rule for choosing fields to exclude is to select those 1956 fields for which there are multiple fields with the same name, and 1957 fields that are modified in transit. Examples of these are: 1959 o Return-Path 1961 o Received 1963 o Comments, Keywords 1965 Note that the DKIM-Signature field is also excluded from the header 1966 hash, because its handling is specified separately. 1968 Typically, it is better to exclude other, optional fields because of 1969 the potential that additional fields of the same name will be 1970 legitimately added or re-ordered prior to verification. There are 1971 likely to be legitimate exceptions to this rule, because of the wide 1972 variety of application-specific header fields that might be applied 1973 to a message, some of which are unlikely to be duplicated, modified, 1974 or reordered. 1976 Signers SHOULD choose canonicalization algorithms based on the types 1977 of messages they process and their aversion to risk. For example, 1978 e-commerce sites sending primarily purchase receipts, which are not 1979 expected to be processed by mailing lists or other software likely to 1980 modify messages, will generally prefer "simple" canonicalization. 1981 Sites sending primarily person-to-person email will likely prefer to 1982 be more resilient to modification during transport by using "relaxed" 1983 canonicalization. 1985 Signers SHOULD NOT use "l=" unless they intend to accommodate 1986 intermediate mail processors that append text to a message. For 1987 example, many mailing list processors append "unsubscribe" 1988 information to message bodies. If signers use "l=", they SHOULD 1989 include the entire message body existing at the time of signing in 1990 computing the count. In particular, signers SHOULD NOT specify a 1991 body length of 0 since this may be interpreted as a meaningless 1992 signature by some verifiers. 1994 5.6. Compute the Message Hash and Signature 1996 The signer MUST compute the message hash as described in Section 3.7 1997 and then sign it using the selected public-key algorithm. This will 1998 result in a DKIM-Signature header field that will include the body 1999 hash and a signature of the header hash, where that header includes 2000 the DKIM-Signature header field itself. 2002 Entities such as mailing list managers that implement DKIM and that 2003 modify the message or a header field (for example, inserting 2004 unsubscribe information) before retransmitting the message SHOULD 2005 check any existing signature on input and MUST make such 2006 modifications before re-signing the message. 2008 The signer MAY elect to limit the number of bytes of the body that 2009 will be included in the hash and hence signed. The length actually 2010 hashed should be inserted in the "l=" tag of the DKIM-Signature 2011 header field. 2013 5.7. Insert the DKIM-Signature Header Field 2015 Finally, the signer MUST insert the DKIM-Signature header field 2016 created in the previous step prior to transmitting the email. The 2017 DKIM-Signature header field MUST be the same as used to compute the 2018 hash as described above, except that the value of the "b=" tag MUST 2019 be the appropriately signed hash computed in the previous step, 2020 signed using the algorithm specified in the "a=" tag of the DKIM- 2021 Signature header field and using the private key corresponding to the 2022 selector given in the "s=" tag of the DKIM-Signature header field, as 2023 chosen above in Section 5.2 2025 The DKIM-Signature header field MUST be inserted before any other 2026 DKIM-Signature fields in the header block. 2028 INFORMATIVE IMPLEMENTATION NOTE: The easiest way to achieve this 2029 is to insert the DKIM-Signature header field at the beginning of 2030 the header block. In particular, it may be placed before any 2031 existing Received header fields. This is consistent with treating 2032 DKIM-Signature as a trace header field. 2034 6. Verifier Actions 2036 Since a signer MAY remove or revoke a public key at any time, it is 2037 advised that verification occur in a timely manner. In many 2038 configurations, the most timely place is during acceptance by the 2039 border MTA or shortly thereafter. In particular, deferring 2040 verification until the message is accessed by the end user is 2041 discouraged. 2043 A border or intermediate MTA MAY verify the message signature(s). An 2044 MTA who has performed verification MAY communicate the result of that 2045 verification by adding a verification header field to incoming 2046 messages. This considerably simplifies things for the user, who can 2047 now use an existing mail user agent. Most MUAs have the ability to 2048 filter messages based on message header fields or content; these 2049 filters would be used to implement whatever policy the user wishes 2050 with respect to unsigned mail. 2052 A verifying MTA MAY implement a policy with respect to unverifiable 2053 mail, regardless of whether or not it applies the verification header 2054 field to signed messages. 2056 Verifiers MUST produce a result that is semantically equivalent to 2057 applying the following steps in the order listed. In practice, 2058 several of these steps can be performed in parallel in order to 2059 improve performance. 2061 6.1. Extract Signatures from the Message 2063 The order in which verifiers try DKIM-Signature header fields is not 2064 defined; verifiers MAY try signatures in any order they like. For 2065 example, one implementation might try the signatures in textual 2066 order, whereas another might try signatures by identities that match 2067 the contents of the From header field before trying other signatures. 2068 Verifiers MUST NOT attribute ultimate meaning to the order of 2069 multiple DKIM-Signature header fields. In particular, there is 2070 reason to believe that some relays will reorder the header fields in 2071 potentially arbitrary ways. 2073 INFORMATIVE IMPLEMENTATION NOTE: Verifiers might use the order as 2074 a clue to signing order in the absence of any other information. 2075 However, other clues as to the semantics of multiple signatures 2076 (such as correlating the signing host with Received header fields) 2077 might also be considered. 2079 A verifier SHOULD NOT treat a message that has one or more bad 2080 signatures and no good signatures differently from a message with no 2081 signature at all; such treatment is a matter of local policy and is 2082 beyond the scope of this document. 2084 When a signature successfully verifies, a verifier will either stop 2085 processing or attempt to verify any other signatures, at the 2086 discretion of the implementation. A verifier MAY limit the number of 2087 signatures it tries to avoid denial-of-service attacks. 2089 INFORMATIVE NOTE: An attacker could send messages with large 2090 numbers of faulty signatures, each of which would require a DNS 2091 lookup and corresponding CPU time to verify the message. This 2092 could be an attack on the domain that receives the message, by 2093 slowing down the verifier by requiring it to do a large number of 2094 DNS lookups and/or signature verifications. It could also be an 2095 attack against the domains listed in the signatures, essentially 2096 by enlisting innocent verifiers in launching an attack against the 2097 DNS servers of the actual victim. 2099 In the following description, text reading "return status 2100 (explanation)" (where "status" is one of "PERMFAIL" or "TEMPFAIL") 2101 means that the verifier MUST immediately cease processing that 2102 signature. The verifier SHOULD proceed to the next signature, if any 2103 is present, and completely ignore the bad signature. If the status 2104 is "PERMFAIL", the signature failed and should not be reconsidered. 2105 If the status is "TEMPFAIL", the signature could not be verified at 2106 this time but may be tried again later. A verifier MAY either 2107 arrange to defer the message for later processing, or try another 2108 signature; if no good signature is found and any of the signatures 2109 resulted in a TEMPFAIL status, the verifier MAY arrange to defer the 2110 message for later processing. The "(explanation)" is not normative 2111 text; it is provided solely for clarification. 2113 Verifiers that are prepared to validate multiple signature header 2114 fields SHOULD proceed to the next signature header field, if one 2115 exists. However, verifiers MAY make note of the fact that an invalid 2116 signature was present for consideration at a later step. 2118 INFORMATIVE NOTE: The rationale of this requirement is to permit 2119 messages that have invalid signatures but also a valid signature 2120 to work. For example, a mailing list exploder might opt to leave 2121 the original submitter signature in place even though the exploder 2122 knows that it is modifying the message in some way that will break 2123 that signature, and the exploder inserts its own signature. In 2124 this case, the message should succeed even in the presence of the 2125 known-broken signature. 2127 For each signature to be validated, the following steps should be 2128 performed in such a manner as to produce a result that is 2129 semantically equivalent to performing them in the indicated order. 2131 6.1.1. Validate the Signature Header Field 2133 Implementers MUST meticulously validate the format and values in the 2134 DKIM-Signature header field; any inconsistency or unexpected values 2135 MUST cause the header field to be completely ignored and the verifier 2136 to return PERMFAIL (signature syntax error). Being "liberal in what 2137 you accept" is definitely a bad strategy in this security context. 2138 Note however that this does not include the existence of unknown tags 2139 in a DKIM-Signature header field, which are explicitly permitted. 2140 Verifiers MUST return PERMFAIL (incompatible version) when presented 2141 a DKIM-Signature header field with a "v=" tag that is inconsistent 2142 with this specification. 2144 INFORMATIVE IMPLEMENTATION NOTE: An implementation may, of course, 2145 choose to also verify signatures generated by older versions of 2146 this specification. 2148 If any tag listed as "required" in Section 3.5 is omitted from the 2149 DKIM-Signature header field, the verifier MUST ignore the DKIM- 2150 Signature header field and return PERMFAIL (signature missing 2151 required tag). 2153 INFORMATIONAL NOTE: The tags listed as required in Section 3.5 are 2154 "v=", "a=", "b=", "bh=", "d=", "h=", and "s=". Should there be a 2155 conflict between this note and Section 3.5, Section 3.5 is 2156 normative. 2158 If the DKIM-Signature header field does not contain the "i=" tag, the 2159 verifier MUST behave as though the value of that tag were "@d", where 2160 "d" is the value from the "d=" tag. 2162 Verifiers MUST confirm that the domain specified in the "d=" tag is 2163 the same as or a parent domain of the domain part of the "i=" tag. 2164 If not, the DKIM-Signature header field MUST be ignored and the 2165 verifier should return PERMFAIL (domain mismatch). 2167 If the "h=" tag does not include the From header field, the verifier 2168 MUST ignore the DKIM-Signature header field and return PERMFAIL (From 2169 field not signed). 2171 Verifiers MAY ignore the DKIM-Signature header field and return 2172 PERMFAIL (signature expired) if it contains an "x=" tag and the 2173 signature has expired. 2175 Verifiers MAY ignore the DKIM-Signature header field if the domain 2176 used by the signer in the "d=" tag is not associated with a valid 2177 signing entity. For example, signatures with "d=" values such as 2178 "com" and "co.uk" may be ignored. The list of unacceptable domains 2179 SHOULD be configurable. 2181 Verifiers MAY ignore the DKIM-Signature header field and return 2182 PERMFAIL (unacceptable signature header) for any other reason, for 2183 example, if the signature does not sign header fields that the 2184 verifier views to be essential. As a case in point, if MIME header 2185 fields are not signed, certain attacks may be possible that the 2186 verifier would prefer to avoid. 2188 6.1.2. Get the Public Key 2190 The public key for a signature is needed to complete the verification 2191 process. The process of retrieving the public key depends on the 2192 query type as defined by the "q=" tag in the DKIM-Signature header 2193 field. Obviously, a public key need only be retrieved if the process 2194 of extracting the signature information is completely successful. 2195 Details of key management and representation are described in 2196 Section 3.6. The verifier MUST validate the key record and MUST 2197 ignore any public key records that are malformed. 2199 NOTE: The use of a wildcard TXT RR that covers a queried DKIM domain 2200 name will produce a response to a DKIM query that is unlikely to 2201 be valid DKIM key record. This problem is not specific to DKIM 2202 and applies to many other types of queries. Client software that 2203 processes DNS responses needs to take this problem into account. 2205 When validating a message, a verifier MUST perform the following 2206 steps in a manner that is semantically the same as performing them in 2207 the order indicated -- in some cases the implementation may 2208 parallelize or reorder these steps, as long as the semantics remain 2209 unchanged: 2211 1. Retrieve the public key as described in Section 3.6 using the 2212 algorithm in the "q=" tag, the domain from the "d=" tag, and the 2213 selector from the "s=" tag. 2215 2. If the query for the public key fails to respond, the verifier 2216 MAY seek a later verification attempt by returning TEMPFAIL (key 2217 unavailable). 2219 3. If the query for the public key fails because the corresponding 2220 key record does not exist, the verifier MUST immediately return 2221 PERMFAIL (no key for signature). 2223 4. If the query for the public key returns multiple key records, the 2224 verifier may choose one of the key records or may cycle through 2225 the key records performing the remainder of these steps on each 2226 record at the discretion of the implementer. The order of the 2227 key records is unspecified. If the verifier chooses to cycle 2228 through the key records, then the "return ..." wording in the 2229 remainder of this section means "try the next key record, if any; 2230 if none, return to try another signature in the usual way". 2232 5. If the result returned from the query does not adhere to the 2233 format defined in this specification, the verifier MUST ignore 2234 the key record and return PERMFAIL (key syntax error). Verifiers 2235 are urged to validate the syntax of key records carefully to 2236 avoid attempted attacks. In particular, the verifier MUST ignore 2237 keys with a version code ("v=" tag) that they do not implement. 2239 6. If the "h=" tag exists in the public key record and the hash 2240 algorithm implied by the "a=" tag in the DKIM-Signature header 2241 field is not included in the contents of the "h=" tag, the 2242 verifier MUST ignore the key record and return PERMFAIL 2243 (inappropriate hash algorithm). 2245 7. If the public key data (the "p=" tag) is empty, then this key has 2246 been revoked and the verifier MUST treat this as a failed 2247 signature check and return PERMFAIL (key revoked). There is no 2248 defined semantic difference between a key that has been revoked 2249 and a key record that has been removed. 2251 8. If the public key data is not suitable for use with the algorithm 2252 and key types defined by the "a=" and "k=" tags in the DKIM- 2253 Signature header field, the verifier MUST immediately return 2254 PERMFAIL (inappropriate key algorithm). 2256 6.1.3. Compute the Verification 2258 Given a signer and a public key, verifying a signature consists of 2259 actions semantically equivalent to the following steps. 2261 1. Based on the algorithm defined in the "c=" tag, the body length 2262 specified in the "l=" tag, and the header field names in the "h=" 2263 tag, prepare a canonicalized version of the message as is 2264 described in Section 3.7 (note that this version does not 2265 actually need to be instantiated). When matching header field 2266 names in the "h=" tag against the actual message header field, 2267 comparisons MUST be case-insensitive. 2269 2. Based on the algorithm indicated in the "a=" tag, compute the 2270 message hashes from the canonical copy as described in 2271 Section 3.7. 2273 3. Verify that the hash of the canonicalized message body computed 2274 in the previous step matches the hash value conveyed in the "bh=" 2275 tag. If the hash does not match, the verifier SHOULD ignore the 2276 signature and return PERMFAIL (body hash did not verify). 2278 4. Using the signature conveyed in the "b=" tag, verify the 2279 signature against the header hash using the mechanism appropriate 2280 for the public key algorithm described in the "a=" tag. If the 2281 signature does not validate, the verifier SHOULD ignore the 2282 signature and return PERMFAIL (signature did not verify). 2284 5. Otherwise, the signature has correctly verified. 2286 INFORMATIVE IMPLEMENTER'S NOTE: Implementations might wish to 2287 initiate the public-key query in parallel with calculating the 2288 hash as the public key is not needed until the final decryption is 2289 calculated. Implementations may also verify the signature on the 2290 message header before validating that the message hash listed in 2291 the "bh=" tag in the DKIM-Signature header field matches that of 2292 the actual message body; however, if the body hash does not match, 2293 the entire signature must be considered to have failed. 2295 A body length specified in the "l=" tag of the signature limits the 2296 number of bytes of the body passed to the verification algorithm. 2297 All data beyond that limit is not validated by DKIM. Hence, 2298 verifiers might treat a message that contains bytes beyond the 2299 indicated body length with suspicion, such as by declaring the 2300 signature invalid (e.g., by returning PERMFAIL (unsigned content)), 2301 or conveying the partial verification to the policy module. 2303 6.2. Communicate Verification Results 2305 Verifiers wishing to communicate the results of verification to other 2306 parts of the mail system may do so in whatever manner they see fit. 2307 For example, implementations might choose to add an email header 2308 field to the message before passing it on. Any such header field 2309 SHOULD be inserted before any existing DKIM-Signature or preexisting 2310 authentication status header fields in the header field block. The 2311 Authentication-Results: header field ([RFC5451]) MAY be used for this 2312 purpose. 2314 INFORMATIVE ADVICE to MUA filter writers: Patterns intended to 2315 search for results header fields to visibly mark authenticated 2316 mail for end users should verify that such header field was added 2317 by the appropriate verifying domain and that the verified identity 2318 matches the author identity that will be displayed by the MUA. In 2319 particular, MUA filters should not be influenced by bogus results 2320 header fields added by attackers. To circumvent this attack, 2321 verifiers MAY wish to request deletion of existing results header 2322 fields after verification and before arranging to add a new header 2323 field. 2325 6.3. Interpret Results/Apply Local Policy 2327 It is beyond the scope of this specification to describe what actions 2328 an Identity Assessor can make, but mail carrying a validated SDID 2329 presents an opportunity to an Identity Assessor that unauthenticated 2330 email does not. Specifically, an authenticated email creates a 2331 predictable identifier by which other decisions can reliably be 2332 managed, such as trust and reputation. Conversely, unauthenticated 2333 email lacks a reliable identifier that can be used to assign trust 2334 and reputation. It is reasonable to treat unauthenticated email as 2335 lacking any trust and having no positive reputation. 2337 In general, modules that consume DKIM verification output SHOULD NOT 2338 determine message acceptability based solely on a lack of any 2339 signature or on an unverifiable signature; such rejection would cause 2340 severe interoperability problems. If an MTA does wish to reject such 2341 messages during an SMTP session (for example, when communicating with 2342 a peer who, by prior agreement, agrees to only send signed messages), 2343 and a signature is missing or does not verify, the handling MTA 2344 SHOULD use a 550/5.7.x reply code. 2346 Where the verifier is integrated within the MTA and it is not 2347 possible to fetch the public key, perhaps because the key server is 2348 not available, a temporary failure message MAY be generated using a 2349 451/4.7.5 reply code, such as: 2350 451 4.7.5 Unable to verify signature - key server unavailable 2352 Temporary failures such as inability to access the key server or 2353 other external service are the only conditions that SHOULD use a 4xx 2354 SMTP reply code. In particular, cryptographic signature verification 2355 failures MUST NOT provoke 4xx SMTP replies. 2357 Once the signature has been verified, that information MUST be 2358 conveyed to the Identity Assessor (such as an explicit allow/ 2359 whitelist and reputation system) and/or to the end user. If the SDID 2360 is not the same as the address in the From: header field, the mail 2361 system SHOULD take pains to ensure that the actual SDID is clear to 2362 the reader. 2364 While the symptoms of a failed verification are obvious -- the 2365 signature doesn't verify -- establishing the exact cause can be more 2366 difficult. If a selector cannot be found, is that because the 2367 selector has been removed, or was the value changed somehow in 2368 transit? If the signature line is missing, is that because it was 2369 never there, or was it removed by an overzealous filter? For 2370 diagnostic purposes, the exact reason why the verification fails 2371 SHOULD be made available and possibly recorded in the system logs. 2372 If the email cannot be verified, then it SHOULD be treated the same 2373 as all unverified email regardless of whether or not it looks like it 2374 was signed. 2376 See Section 8.14 and Section 8.15 for additional discussion and 2377 references. 2379 7. IANA Considerations 2381 DKIM has registered namespaces with IANA. In all cases, new values 2382 are assigned only for values that have been documented in a published 2383 RFC that has IETF Consensus [RFC5226]. 2385 This memo updates these registries as described below. Of note is 2386 the addition of a new "status" column. All registrations into these 2387 namespaces MUST include the name being registered, the document in 2388 which it was registered or updated, and an indication of its current 2389 status which MUST be one of "active" (in current use) or "historic" 2390 (no longer in current use). 2392 No new tags are defined in this specification compared to [RFC4871], 2393 but one has been obsoleted. 2395 7.1. DKIM-Signature Tag Specifications 2397 A DKIM-Signature provides for a list of tag specifications. IANA has 2398 established the DKIM-Signature Tag Specification Registry for tag 2399 specifications that can be used in DKIM-Signature fields. 2401 The updated entries in the registry comprise: 2403 +------+-----------------+--------+ 2404 | TYPE | REFERENCE | STATUS | 2405 +------+-----------------+--------+ 2406 | v | (this document) | active | 2407 | a | (this document) | active | 2408 | b | (this document) | active | 2409 | bh | (this document) | active | 2410 | c | (this document) | active | 2411 | d | (this document) | active | 2412 | h | (this document) | active | 2413 | i | (this document) | active | 2414 | l | (this document) | active | 2415 | q | (this document) | active | 2416 | s | (this document) | active | 2417 | t | (this document) | active | 2418 | x | (this document) | active | 2419 | z | (this document) | active | 2420 +------+-----------------+--------+ 2422 Table 1: DKIM-Signature Tag Specification Registry Updated Values 2424 7.2. DKIM-Signature Query Method Registry 2426 The "q=" tag-spec (specified in Section 3.5) provides for a list of 2427 query methods. 2429 IANA has established the DKIM-Signature Query Method Registry for 2430 mechanisms that can be used to retrieve the key that will permit 2431 validation processing of a message signed using DKIM. 2433 The updated entry in the registry comprises: 2435 +------+--------+-----------------+--------+ 2436 | TYPE | OPTION | REFERENCE | STATUS | 2437 +------+--------+-----------------+--------+ 2438 | dns | txt | (this document) | active | 2439 +------+--------+-----------------+--------+ 2441 DKIM-Signature Query Method Registry Updated Values 2443 7.3. DKIM-Signature Canonicalization Registry 2445 The "c=" tag-spec (specified in Section 3.5) provides for a specifier 2446 for canonicalization algorithms for the header and body of the 2447 message. 2449 IANA has established the DKIM-Signature Canonicalization Algorithm 2450 Registry for algorithms for converting a message into a canonical 2451 form before signing or verifying using DKIM. 2453 The updated entries in the header registry comprise: 2455 +---------+-----------------+--------+ 2456 | TYPE | REFERENCE | STATUS | 2457 +---------+-----------------+--------+ 2458 | simple | (this document) | active | 2459 | relaxed | (this document) | active | 2460 +---------+-----------------+--------+ 2462 DKIM-Signature Header Canonicalization Algorithm Registry 2463 Updated Values 2465 The updated entries in the body registry comprise: 2467 +---------+-----------------+--------+ 2468 | TYPE | REFERENCE | STATUS | 2469 +---------+-----------------+--------+ 2470 | simple | (this document) | active | 2471 | relaxed | (this document) | active | 2472 +---------+-----------------+--------+ 2474 DKIM-Signature Body Canonicalization Algorithm Registry 2475 Updated Values 2477 7.4. _domainkey DNS TXT Resource Record Tag Specifications 2479 A _domainkey DNS TXT RR provides for a list of tag specifications. 2480 IANA has established the DKIM _domainkey DNS TXT Tag Specification 2481 Registry for tag specifications that can be used in DNS TXT resource 2482 records. 2484 The updated entries in the registry comprise: 2486 +------+-----------------+----------+ 2487 | TYPE | REFERENCE | STATUS | 2488 +------+-----------------+----------+ 2489 | v | (this document) | active | 2490 | g | [RFC4871] | historic | 2491 | h | (this document) | active | 2492 | k | (this document) | active | 2493 | n | (this document) | active | 2494 | p | (this document) | active | 2495 | s | (this document) | active | 2496 | t | (this document) | active | 2497 +------+-----------------+----------+ 2499 DKIM _domainkey DNS TXT Tag Specification Registry 2500 Updated Values 2502 7.5. DKIM Key Type Registry 2504 The "k=" (specified in Section 3.6.1) and the "a=" (specified in Section 3.5) tags provide for a list of 2506 mechanisms that can be used to decode a DKIM signature. 2508 IANA has established the DKIM Key Type Registry for such mechanisms. 2510 The updated entry in the registry comprises: 2512 +------+-----------+--------+ 2513 | TYPE | REFERENCE | STATUS | 2514 +------+-----------+--------+ 2515 | rsa | [RFC3447] | active | 2516 +------+-----------+--------+ 2518 DKIM Key Type Updated Values 2520 7.6. DKIM Hash Algorithms Registry 2522 The "h=" (specified in Section 3.6.1) and the "a=" (specified in Section 3.5) tags provide for a list of 2524 mechanisms that can be used to produce a digest of message data. 2526 IANA has established the DKIM Hash Algorithms Registry for such 2527 mechanisms. 2529 The updated entries in the registry comprise: 2531 +--------+-------------------+--------+ 2532 | TYPE | REFERENCE | STATUS | 2533 +--------+-------------------+--------+ 2534 | sha1 | [FIPS-180-3-2008] | active | 2535 | sha256 | [FIPS-180-3-2008] | active | 2536 +--------+-------------------+--------+ 2538 DKIM Hash Algorithms Updated Values 2540 7.7. DKIM Service Types Registry 2542 The "s=" tag (specified in Section 3.6.1) provides for a 2543 list of service types to which this selector may apply. 2545 IANA has established the DKIM Service Types Registry for service 2546 types. 2548 The updated entries in the registry comprise: 2550 +-------+-----------------+--------+ 2551 | TYPE | REFERENCE | STATUS | 2552 +-------+-----------------+--------+ 2553 | email | (this document) | active | 2554 | * | (this document) | active | 2555 +-------+-----------------+--------+ 2557 DKIM Service Types Registry Updated Values 2559 7.8. DKIM Selector Flags Registry 2561 The "t=" tag (specified in Section 3.6.1) provides for a 2562 list of flags to modify interpretation of the selector. 2564 IANA has established the DKIM Selector Flags Registry for additional 2565 flags. 2567 The updated entries in the registry comprise: 2569 +------+-----------------+--------+ 2570 | TYPE | REFERENCE | STATUS | 2571 +------+-----------------+--------+ 2572 | y | (this document) | active | 2573 | s | (this document) | active | 2574 +------+-----------------+--------+ 2576 DKIM Selector Flags Registry Updated Values 2578 7.9. DKIM-Signature Header Field 2580 IANA has added DKIM-Signature to the "Permanent Message Header 2581 Fields" registry (see [RFC3864]) for the "mail" protocol, using this 2582 document as the reference. 2584 8. Security Considerations 2586 It has been observed that any mechanism that is introduced that 2587 attempts to stem the flow of spam is subject to intensive attack. 2588 DKIM needs to be carefully scrutinized to identify potential attack 2589 vectors and the vulnerability to each. See also [RFC4686]. 2591 8.1. Misuse of Body Length Limits ("l=" Tag) 2593 As noted in Section 3.4.5, use of the "l=" signature tag enables a 2594 variety of attacks in which added content can partially or completely 2595 change the recipient's view of the message. 2597 8.2. Misappropriated Private Key 2599 If the private key for a user is resident on their computer and is 2600 not protected by an appropriately secure mechanism, it is possible 2601 for malware to send mail as that user and any other user sharing the 2602 same private key. The malware would not, however, be able to 2603 generate signed spoofs of other signers' addresses, which would aid 2604 in identification of the infected user and would limit the 2605 possibilities for certain types of attacks involving socially 2606 engineered messages. This threat applies mainly to MUA-based 2607 implementations; protection of private keys on servers can be easily 2608 achieved through the use of specialized cryptographic hardware. 2610 A larger problem occurs if malware on many users' computers obtains 2611 the private keys for those users and transmits them via a covert 2612 channel to a site where they can be shared. The compromised users 2613 would likely not know of the misappropriation until they receive 2614 "bounce" messages from messages they are purported to have sent. 2615 Many users might not understand the significance of these bounce 2616 messages and would not take action. 2618 One countermeasure is to use a user-entered passphrase to encrypt the 2619 private key, although users tend to choose weak passphrases and often 2620 reuse them for different purposes, possibly allowing an attack 2621 against DKIM to be extended into other domains. Nevertheless, the 2622 decoded private key might be briefly available to compromise by 2623 malware when it is entered, or might be discovered via keystroke 2624 logging. The added complexity of entering a passphrase each time one 2625 sends a message would also tend to discourage the use of a secure 2626 passphrase. 2628 A somewhat more effective countermeasure is to send messages through 2629 an outgoing MTA that can authenticate the submitter using existing 2630 techniques (e.g., SMTP Authentication), possibly validate the message 2631 itself (e.g., verify that the header is legitimate and that the 2632 content passes a spam content check), and sign the message using a 2633 key appropriate for the submitter address. Such an MTA can also 2634 apply controls on the volume of outgoing mail each user is permitted 2635 to originate in order to further limit the ability of malware to 2636 generate bulk email. 2638 8.3. Key Server Denial-of-Service Attacks 2640 Since the key servers are distributed (potentially separate for each 2641 domain), the number of servers that would need to be attacked to 2642 defeat this mechanism on an Internet-wide basis is very large. 2643 Nevertheless, key servers for individual domains could be attacked, 2644 impeding the verification of messages from that domain. This is not 2645 significantly different from the ability of an attacker to deny 2646 service to the mail exchangers for a given domain, although it 2647 affects outgoing, not incoming, mail. 2649 A variation on this attack is that if a very large amount of mail 2650 were to be sent using spoofed addresses from a given domain, the key 2651 servers for that domain could be overwhelmed with requests. However, 2652 given the low overhead of verification compared with handling of the 2653 email message itself, such an attack would be difficult to mount. 2655 8.4. Attacks Against the DNS 2657 Since the DNS is a required binding for key services, specific 2658 attacks against the DNS must be considered. 2660 While the DNS is currently insecure [RFC3833], these security 2661 problems are the motivation behind DNS Security (DNSSEC) [RFC4033], 2662 and all users of the DNS will reap the benefit of that work. 2664 DKIM is only intended as a "sufficient" method of proving 2665 authenticity. It is not intended to provide strong cryptographic 2666 proof about authorship or contents. Other technologies such as 2667 OpenPGP [RFC4880] and S/MIME [RFC5751] address those requirements. 2669 A second security issue related to the DNS revolves around the 2670 increased DNS traffic as a consequence of fetching selector-based 2671 data as well as fetching signing domain policy. Widespread 2672 deployment of DKIM will result in a significant increase in DNS 2673 queries to the claimed signing domain. In the case of forgeries on a 2674 large scale, DNS servers could see a substantial increase in queries. 2676 A specific DNS security issue that should be considered by DKIM 2677 verifiers is the name chaining attack described in Section 2.3 of 2678 [RFC3833]. A DKIM verifier, while verifying a DKIM-Signature header 2679 field, could be prompted to retrieve a key record of an attacker's 2680 choosing. This threat can be minimized by ensuring that name 2681 servers, including recursive name servers, used by the verifier 2682 enforce strict checking of "glue" and other additional information in 2683 DNS responses and are therefore not vulnerable to this attack. 2685 8.5. Replay Attacks 2687 In this attack, a spammer sends a message to be spammed to an 2688 accomplice, which results in the message being signed by the 2689 originating MTA. The accomplice resends the message, including the 2690 original signature, to a large number of recipients, possibly by 2691 sending the message to many compromised machines that act as MTAs. 2692 The messages, not having been modified by the accomplice, have valid 2693 signatures. 2695 Partial solutions to this problem involve the use of reputation 2696 services to convey the fact that the specific email address is being 2697 used for spam and that messages from that signer are likely to be 2698 spam. This requires a real-time detection mechanism in order to 2699 react quickly enough. However, such measures might be prone to 2700 abuse, if for example an attacker resent a large number of messages 2701 received from a victim in order to make them appear to be a spammer. 2703 Large verifiers might be able to detect unusually large volumes of 2704 mails with the same signature in a short time period. Smaller 2705 verifiers can get substantially the same volume of information via 2706 existing collaborative systems. 2708 8.6. Limits on Revoking Keys 2710 When a large domain detects undesirable behavior on the part of one 2711 of its users, it might wish to revoke the key used to sign that 2712 user's messages in order to disavow responsibility for messages that 2713 have not yet been verified or that are the subject of a replay 2714 attack. However, the ability of the domain to do so can be limited 2715 if the same key, for scalability reasons, is used to sign messages 2716 for many other users. Mechanisms for explicitly revoking keys on a 2717 per-address basis have been proposed but require further study as to 2718 their utility and the DNS load they represent. 2720 8.7. Intentionally Malformed Key Records 2722 It is possible for an attacker to publish key records in DNS that are 2723 intentionally malformed, with the intent of causing a denial-of- 2724 service attack on a non-robust verifier implementation. The attacker 2725 could then cause a verifier to read the malformed key record by 2726 sending a message to one of its users referencing the malformed 2727 record in a (not necessarily valid) signature. Verifiers MUST 2728 thoroughly verify all key records retrieved from the DNS and be 2729 robust against intentionally as well as unintentionally malformed key 2730 records. 2732 8.8. Intentionally Malformed DKIM-Signature Header Fields 2734 Verifiers MUST be prepared to receive messages with malformed DKIM- 2735 Signature header fields, and thoroughly verify the header field 2736 before depending on any of its contents. 2738 8.9. Information Leakage 2740 An attacker could determine when a particular signature was verified 2741 by using a per-message selector and then monitoring their DNS traffic 2742 for the key lookup. This would act as the equivalent of a "web bug" 2743 for verification time rather than when the message was read. 2745 8.10. Remote Timing Attacks 2747 In some cases it may be possible to extract private keys using a 2748 remote timing attack [BONEH03]. Implementations should consider 2749 obfuscating the timing to prevent such attacks. 2751 8.11. Reordered Header Fields 2753 Existing standards allow intermediate MTAs to reorder header fields. 2754 If a signer signs two or more header fields of the same name, this 2755 can cause spurious verification errors on otherwise legitimate 2756 messages. In particular, signers that sign any existing DKIM- 2757 Signature fields run the risk of having messages incorrectly fail to 2758 verify. 2760 8.12. RSA Attacks 2762 An attacker could create a large RSA signing key with a small 2763 exponent, thus requiring that the verification key have a large 2764 exponent. This will force verifiers to use considerable computing 2765 resources to verify the signature. Verifiers might avoid this attack 2766 by refusing to verify signatures that reference selectors with public 2767 keys having unreasonable exponents. 2769 In general, an attacker might try to overwhelm a verifier by flooding 2770 it with messages requiring verification. This is similar to other 2771 MTA denial-of-service attacks and should be dealt with in a similar 2772 fashion. 2774 8.13. Inappropriate Signing by Parent Domains 2776 The trust relationship described in Section 3.10 could conceivably be 2777 used by a parent domain to sign messages with identities in a 2778 subdomain not administratively related to the parent. For example, 2779 the ".com" registry could create messages with signatures using an 2780 "i=" value in the example.com domain. There is no general solution 2781 to this problem, since the administrative cut could occur anywhere in 2782 the domain name. For example, in the domain "example.podunk.ca.us" 2783 there are three administrative cuts (podunk.ca.us, ca.us, and us), 2784 any of which could create messages with an identity in the full 2785 domain. 2787 INFORMATIVE NOTE: This is considered an acceptable risk for the 2788 same reason that it is acceptable for domain delegation. For 2789 example, in the example above any of the domains could potentially 2790 simply delegate "example.podunk.ca.us" to a server of their choice 2791 and completely replace all DNS-served information. Note that a 2792 verifier MAY ignore signatures that come from an unlikely domain 2793 such as ".com", as discussed in Section 6.1.1. 2795 8.14. Attacks Involving Addition of Header Fields 2797 Many email implementations do not enforce [RFC5322] with strictness. 2798 As discussed in Section 5.3, DKIM processing is predicated on a valid 2799 mail message as its input. However, DKIM implementers should be 2800 aware of the potential effect of having loose enforcement by email 2801 components interacting with DKIM modules. 2803 For example, a message with multiple From: header fields violates 2804 Section 3.6 of [RFC5322]. With the intent of providing a better user 2805 experience, many agents tolerate these violations and deliver the 2806 message anyway. An MUA then might elect to render to the user the 2807 value of the first, or "top", From: field. This may also be done 2808 simply out of the expectation that there is only one, where a "find 2809 first" algorithm would have the same result. Such code in an MUA can 2810 be exploited to fool the user if it is also known that the other 2811 From: field is the one checked by arriving message filters. Such is 2812 the case with DKIM; although the From: field must be signed, a 2813 malformed message bearing more than one From: field might only have 2814 the first ("bottom") one signed, in an attempt to show the message 2815 with some "DKIM passed" annotation while also rendering the From: 2816 field that was not authenticated. (This can also be taken as a 2817 demonstration that DKIM is not designed to support author 2818 validation.) 2820 Note that the technique for using "h=...:from:from:...", described in 2821 Section 8.15 below, is of no effect in the case of an attacker that 2822 is also the signer. 2824 The From: field is used above to illustrate this issue, but it is 2825 only one of several fields that Section 3.6 of [RFC5322] constrains 2826 in this way. In reality any agent that forgives such malformations, 2827 or is careless about identifying which parts of a message were 2828 authenticated, is open to exploitation. 2830 8.15. Malformed Inputs 2832 DKIM allows additional header fields to be added to a signed message 2833 without breaking the signature. This tolerance can be abused, for 2834 example in a replay attack or a man-in-the-middle attack. The attack 2835 is accomplished by creating additional instances of header fields to 2836 an already signed message, without breaking the signature. These 2837 then might be displayed to the end user or are used as filtering 2838 input. Applicable fields might include From: and Subject:. 2840 The resulting message violates section 3.6 of [RFC5322]. The way 2841 such input will be handled and displayed by an MUA is unpredictable, 2842 but it will commonly display the newly added header fields rather 2843 than those that are part of the originally signed message alongside 2844 some "valid DKIM signature" annotation. This might allow an attacker 2845 to replay a previously sent, signed message with a different 2846 Subject:, From: or To: field. 2848 However, [RFC5322] also tolerates obsolete message syntax, which does 2849 allow things like multiple From: fields on messages. The 2850 implementation of DKIM thus potentially creates a more stringent 2851 layer of expectation regarding the meaning of an identity, while that 2852 additional meaning is either obscured from or incorrectly presented 2853 to an end user in this context. 2855 Implementers need to consider this possibility when designing their 2856 input handling functions. Outright rejection of messages that 2857 violate the relevant standards such as [RFC5322], [RFC2045], etc. 2858 will interfere with delivery of legacy formats. Instead, given such 2859 input, a signing module could return an error rather than generate a 2860 signature; a verifying module might return a syntax error code or 2861 arrange not to return a positive result even if the signature 2862 technically validates. 2864 Senders concerned that their messages might be particularly 2865 vulnerable to this sort of attack and who do not wish to rely on 2866 receiver filtering of invalid messages can ensure that adding 2867 additional header fields will break the DKIM signature by including 2868 two copies of the header fields about which they are concerned in the 2869 signature (e.g. "h= ... from:from:to:to:subject:subject ..."). See 2870 Sections 3.5 and 5.4 for further discussion of this mechanism. 2872 Specific validity rules for all known header fields can be gleaned 2873 from the IANA "Permanent Header Field Registry" and the reference 2874 documents it identifies. 2876 9. References 2878 9.1. Normative References 2880 [FIPS-180-3-2008] 2881 U.S. Department of Commerce, "Secure Hash Standard", FIPS 2882 PUB 180-3, October 2008. 2884 [ITU-X660-1997] 2885 "Information Technology - ASN.1 encoding rules: 2886 Specification of Basic Encoding Rules (BER), Canonical 2887 Encoding Rules (CER) and Distinguished Encoding Rules 2888 (DER)", 1997. 2890 [RFC1034] Mockapetris, P., "DOMAIN NAMES - CONCEPTS AND FACILITIES", 2891 RFC 1034, November 1987. 2893 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 2894 Extensions (MIME) Part One: Format of Internet Message 2895 Bodies", RFC 2045, November 1996. 2897 [RFC2049] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 2898 Extensions (MIME) Part Five: Conformance Criteria and 2899 Examples", RFC 2049, November 1996. 2901 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2902 Requirement Levels", BCP 14, RFC 2119, March 1997. 2904 [RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography 2905 Standards (PKCS) #1: RSA Cryptography Specifications 2906 Version 2.1", RFC 3447, February 2003. 2908 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 2909 Specifications: ABNF", RFC 5234, January 2008. 2911 [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 2912 October 2008. 2914 [RFC5322] Resnick, P., "Internet Message Format", RFC 5322, 2915 October 2008. 2917 [RFC5598] Crocker, D., "Internet Mail Architecture", RFC 5598, 2918 July 2009. 2920 [RFC5890] Klensin, J., "Internationalizing Domain Names in 2921 Applications (IDNA): Definitions and Document Framework", 2922 RFC 5890, August 2010. 2924 9.2. Informative References 2926 [BONEH03] "Remote Timing Attacks are Practical", Proceedings 12th 2927 USENIX Security Symposium, 2003. 2929 [I-D.DKIM-MAILINGLISTS] 2930 Kucherawy, M., "DKIM And Mailing Lists", 2931 I-D draft-ietf-dkim-mailinglists, June 2011. 2933 [RFC3766] Orman, H. and P. Hoffman, "Determining Strengths For 2934 Public Keys Used For Exchanging Symmetric Keys", BCP 86, 2935 RFC 3766, April 2004. 2937 [RFC3833] Atkins, D. and R. Austein, "Threat Analysis of the Domain 2938 Name System (DNS)", RFC 3833, August 2004. 2940 [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration 2941 Procedures for Message Header Fields", BCP 90, RFC 3864, 2942 September 2004. 2944 [RFC4033] Arends, R., Austein, R., Larson, M., Massey, D., and S. 2945 Rose, "DNS Security Introduction and Requirements", 2946 RFC 4033, March 2005. 2948 [RFC4409] Gellens, R. and J. Klensin, "Message Submission for Mail", 2949 RFC 4409, April 2006. 2951 [RFC4686] Fenton, J., "Analysis of Threats Motivating DomainKeys 2952 Identified Mail (DKIM)", RFC 4686, September 2006. 2954 [RFC4870] Delany, M., "Domain-Based Email Authentication Using 2955 Public Keys Advertised in the DNS (DomainKeys)", RFC 4870, 2956 May 2007. 2958 [RFC4871] Allman, E., Callas, J., Delany, M., Libbey, M., Fenton, 2959 J., and M. Thomas, "DomainKeys Identified Mail (DKIM) 2960 Signatures", RFC 4871, May 2007. 2962 [RFC4880] Callas, J., Donnerhacke, L., Finney, H., and R. Thayer, 2963 "OpenPGP Message Format", RFC 4880, November 2007. 2965 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 2966 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 2967 May 2008. 2969 [RFC5451] Kucherawy, M., "Message Header Field for Indicating 2970 Message Authentication Status", RFC 5451, April 2009. 2972 [RFC5585] Hansen, T., Crocker, D., and P. Hallam-Baker, "DomainKeys 2973 Identified Mail (DKIM) Service Overview", RFC 5585, 2974 July 2009. 2976 [RFC5672] Crocker, D., Ed., "RFC 4871 DomainKeys Identified Mail 2977 (DKIM) Signatures -- Update", RFC 5672, August 2009. 2979 [RFC5751] Ramsdell, B., "Secure/Multipurpose Internet Mail 2980 Extensions (S/MIME) Version 3.1 Message Specification", 2981 RFC 5751, January 2010. 2983 [RFC5863] Hansen, T., Siegel, E., Hallam-Baker, P., and D. Crocker, 2984 "DomainKeys Identified Mail (DKIM) Development, 2985 Deployment, and Operations", RFC 5863, May 2010. 2987 Appendix A. Example of Use (INFORMATIVE) 2989 This section shows the complete flow of an email from submission to 2990 final delivery, demonstrating how the various components fit 2991 together. The key used in this example is shown in Appendix C. 2993 A.1. The User Composes an Email 2994 From: Joe SixPack 2995 To: Suzie Q 2996 Subject: Is dinner ready? 2997 Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT) 2998 Message-ID: <20030712040037.46341.5F8J@football.example.com> 3000 Hi. 3002 We lost the game. Are you hungry yet? 3004 Joe. 3006 Figure 1: The User Composes an Email 3008 A.2. The Email is Signed 3010 This email is signed by the example.com outbound email server and now 3011 looks like this: 3012 DKIM-Signature: v=1; a=rsa-sha256; s=brisbane; d=example.com; 3013 c=simple/simple; q=dns/txt; i=joe@football.example.com; 3014 h=Received : From : To : Subject : Date : Message-ID; 3015 bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=; 3016 b=AuUoFEfDxTDkHlLXSZEpZj79LICEps6eda7W3deTVFOk4yAUoqOB 3017 4nujc7YopdG5dWLSdNg6xNAZpOPr+kHxt1IrE+NahM6L/LbvaHut 3018 KVdkLLkpVaVVQPzeRDI009SO2Il5Lu7rDNH6mZckBdrIx0orEtZV 3019 4bmp/YzhwvcubU4=; 3020 Received: from client1.football.example.com [192.0.2.1] 3021 by submitserver.example.com with SUBMISSION; 3022 Fri, 11 Jul 2003 21:01:54 -0700 (PDT) 3023 From: Joe SixPack 3024 To: Suzie Q 3025 Subject: Is dinner ready? 3026 Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT) 3027 Message-ID: <20030712040037.46341.5F8J@football.example.com> 3029 Hi. 3031 We lost the game. Are you hungry yet? 3033 Joe. 3035 The Email is Signed 3037 The signing email server requires access to the private key 3038 associated with the "brisbane" selector to generate this signature. 3040 A.3. The Email Signature is Verified 3042 The signature is normally verified by an inbound SMTP server or 3043 possibly the final delivery agent. However, intervening MTAs can 3044 also perform this verification if they choose to do so. The 3045 verification process uses the domain "example.com" extracted from the 3046 "d=" tag and the selector "brisbane" from the "s=" tag in the DKIM- 3047 Signature header field to form the DNS DKIM query for: 3048 brisbane._domainkey.example.com 3050 Signature verification starts with the physically last Received 3051 header field, the From header field, and so forth, in the order 3052 listed in the "h=" tag. Verification follows with a single CRLF 3053 followed by the body (starting with "Hi."). The email is canonically 3054 prepared for verifying with the "simple" method. The result of the 3055 query and subsequent verification of the signature is stored (in this 3056 example) in the X-Authentication-Results header field line. After 3057 successful verification, the email looks like this: 3058 X-Authentication-Results: shopping.example.net 3059 header.from=joe@football.example.com; dkim=pass 3060 Received: from mout23.football.example.com (192.168.1.1) 3061 by shopping.example.net with SMTP; 3062 Fri, 11 Jul 2003 21:01:59 -0700 (PDT) 3063 DKIM-Signature: v=1; a=rsa-sha256; s=brisbane; d=example.com; 3064 c=simple/simple; q=dns/txt; i=joe@football.example.com; 3065 h=Received : From : To : Subject : Date : Message-ID; 3066 bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=; 3067 b=AuUoFEfDxTDkHlLXSZEpZj79LICEps6eda7W3deTVFOk4yAUoqOB 3068 4nujc7YopdG5dWLSdNg6xNAZpOPr+kHxt1IrE+NahM6L/LbvaHut 3069 KVdkLLkpVaVVQPzeRDI009SO2Il5Lu7rDNH6mZckBdrIx0orEtZV 3070 4bmp/YzhwvcubU4=; 3071 Received: from client1.football.example.com [192.0.2.1] 3072 by submitserver.example.com with SUBMISSION; 3073 Fri, 11 Jul 2003 21:01:54 -0700 (PDT) 3074 From: Joe SixPack 3075 To: Suzie Q 3076 Subject: Is dinner ready? 3077 Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT) 3078 Message-ID: <20030712040037.46341.5F8J@football.example.com> 3080 Hi. 3082 We lost the game. Are you hungry yet? 3084 Joe. 3086 Successful verification 3088 Appendix B. Usage Examples (INFORMATIVE) 3090 DKIM signing and validating can be used in different ways, for 3091 different operational scenarios. This Appendix discusses some common 3092 examples. 3094 NOTE: Descriptions in this Appendix are for informational purposes 3095 only. They describe various ways that DKIM can be used, given 3096 particular constraints and needs. In no case are these examples 3097 intended to be taken as providing explanation or guidance 3098 concerning DKIM specification details, when creating an 3099 implementation. 3101 B.1. Alternate Submission Scenarios 3103 In the most simple scenario, a user's MUA, MSA, and Internet 3104 (boundary) MTA are all within the same administrative environment, 3105 using the same domain name. Therefore, all of the components 3106 involved in submission and initial transfer are related. However, it 3107 is common for two or more of the components to be under independent 3108 administrative control. This creates challenges for choosing and 3109 administering the domain name to use for signing, and for its 3110 relationship to common email identity header fields. 3112 B.1.1. Delegated Business Functions 3114 Some organizations assign specific business functions to discrete 3115 groups, inside or outside the organization. The goal, then, is to 3116 authorize that group to sign some mail, but to constrain what 3117 signatures they can generate. DKIM selectors (the "s=" signature 3118 tag) facilitate this kind of restricted authorization. Examples of 3119 these outsourced business functions are legitimate email marketing 3120 providers and corporate benefits providers. 3122 Here, the delegated group needs to be able to send messages that are 3123 signed, using the email domain of the client company. At the same 3124 time, the client often is reluctant to register a key for the 3125 provider that grants the ability to send messages for arbitrary 3126 addresses in the domain. 3128 There are multiple ways to administer these usage scenarios. In one 3129 case, the client organization provides all of the public query 3130 service (for example, DNS) administration, and in another it uses DNS 3131 delegation to enable all ongoing administration of the DKIM key 3132 record by the delegated group. 3134 If the client organization retains responsibility for all of the DNS 3135 administration, the outsourcing company can generate a key pair, 3136 supplying the public key to the client company, which then registers 3137 it in the query service, using a unique selector. The client company 3138 retains control over the use of the delegated key because it retains 3139 the ability to revoke the key at any time. 3141 If the client wants the delegated group to do the DNS administration, 3142 it can have the domain name that is specified with the selector point 3143 to the provider's DNS server. The provider then creates and 3144 maintains all of the DKIM signature information for that selector. 3145 Hence, the client cannot provide constraints on the Local-part of 3146 addresses that get signed, but it can revoke the provider's signing 3147 rights by removing the DNS delegation record. 3149 B.1.2. PDAs and Similar Devices 3151 PDAs demonstrate the need for using multiple keys per domain. 3152 Suppose that John Doe wanted to be able to send messages using his 3153 corporate email address, jdoe@example.com, and his email device did 3154 not have the ability to make a Virtual Private Network (VPN) 3155 connection to the corporate network, either because the device is 3156 limited or because there are restrictions enforced by his Internet 3157 access provider. If the device was equipped with a private key 3158 registered for jdoe@example.com by the administrator of the 3159 example.com domain, and appropriate software to sign messages, John 3160 could sign the message on the device itself before transmission 3161 through the outgoing network of the access service provider. 3163 B.1.3. Roaming Users 3165 Roaming users often find themselves in circumstances where it is 3166 convenient or necessary to use an SMTP server other than their home 3167 server; examples are conferences and many hotels. In such 3168 circumstances, a signature that is added by the submission service 3169 will use an identity that is different from the user's home system. 3171 Ideally, roaming users would connect back to their home server using 3172 either a VPN or a SUBMISSION server running with SMTP AUTHentication 3173 on port 587. If the signing can be performed on the roaming user's 3174 laptop, then they can sign before submission, although the risk of 3175 further modification is high. If neither of these are possible, 3176 these roaming users will not be able to send mail signed using their 3177 own domain key. 3179 B.1.4. Independent (Kiosk) Message Submission 3181 Stand-alone services, such as walk-up kiosks and web-based 3182 information services, have no enduring email service relationship 3183 with the user, but users occasionally request that mail be sent on 3184 their behalf. For example, a website providing news often allows the 3185 reader to forward a copy of the article to a friend. This is 3186 typically done using the reader's own email address, to indicate who 3187 the author is. This is sometimes referred to as the "Evite problem", 3188 named after the website of the same name that allows a user to send 3189 invitations to friends. 3191 A common way this is handled is to continue to put the reader's email 3192 address in the From header field of the message, but put an address 3193 owned by the email posting site into the Sender header field. The 3194 posting site can then sign the message, using the domain that is in 3195 the Sender field. This provides useful information to the receiving 3196 email site, which is able to correlate the signing domain with the 3197 initial submission email role. 3199 Receiving sites often wish to provide their end users with 3200 information about mail that is mediated in this fashion. Although 3201 the real efficacy of different approaches is a subject for human 3202 factors usability research, one technique that is used is for the 3203 verifying system to rewrite the From header field, to indicate the 3204 address that was verified. For example: From: John Doe via 3205 news@news-site.com . (Note that such rewriting 3206 will break a signature, unless it is done after the verification pass 3207 is complete.) 3209 B.2. Alternate Delivery Scenarios 3211 Email is often received at a mailbox that has an address different 3212 from the one used during initial submission. In these cases, an 3213 intermediary mechanism operates at the address originally used and it 3214 then passes the message on to the final destination. This mediation 3215 process presents some challenges for DKIM signatures. 3217 B.2.1. Affinity Addresses 3219 "Affinity addresses" allow a user to have an email address that 3220 remains stable, even as the user moves among different email 3221 providers. They are typically associated with college alumni 3222 associations, professional organizations, and recreational 3223 organizations with which they expect to have a long-term 3224 relationship. These domains usually provide forwarding of incoming 3225 email, and they often have an associated Web application that 3226 authenticates the user and allows the forwarding address to be 3227 changed. However, these services usually depend on users sending 3228 outgoing messages through their own service providers' MTAs. Hence, 3229 mail that is signed with the domain of the affinity address is not 3230 signed by an entity that is administered by the organization owning 3231 that domain. 3233 With DKIM, affinity domains could use the Web application to allow 3234 users to register per-user keys to be used to sign messages on behalf 3235 of their affinity address. The user would take away the secret half 3236 of the key pair for signing, and the affinity domain would publish 3237 the public half in DNS for access by verifiers. 3239 This is another application that takes advantage of user-level 3240 keying, and domains used for affinity addresses would typically have 3241 a very large number of user-level keys. Alternatively, the affinity 3242 domain could handle outgoing mail, operating a mail submission agent 3243 that authenticates users before accepting and signing messages for 3244 them. This is of course dependent on the user's service provider not 3245 blocking the relevant TCP ports used for mail submission. 3247 B.2.2. Simple Address Aliasing (.forward) 3249 In some cases a recipient is allowed to configure an email address to 3250 cause automatic redirection of email messages from the original 3251 address to another, such as through the use of a Unix .forward file. 3252 In this case, messages are typically redirected by the mail handling 3253 service of the recipient's domain, without modification, except for 3254 the addition of a Received header field to the message and a change 3255 in the envelope recipient address. In this case, the recipient at 3256 the final address' mailbox is likely to be able to verify the 3257 original signature since the signed content has not changed, and DKIM 3258 is able to validate the message signature. 3260 B.2.3. Mailing Lists and Re-Posters 3262 There is a wide range of behaviors in services that take delivery of 3263 a message and then resubmit it. A primary example is with mailing 3264 lists (collectively called "forwarders" below), ranging from those 3265 that make no modification to the message itself, other than to add a 3266 Received header field and change the envelope information, to those 3267 that add header fields, change the Subject header field, add content 3268 to the body (typically at the end), or reformat the body in some 3269 manner. The simple ones produce messages that are quite similar to 3270 the automated alias services. More elaborate systems essentially 3271 create a new message. 3273 A Forwarder that does not modify the body or signed header fields of 3274 a message is likely to maintain the validity of the existing 3275 signature. It also could choose to add its own signature to the 3276 message. 3278 Forwarders which modify a message in a way that could make an 3279 existing signature invalid are particularly good candidates for 3280 adding their own signatures (e.g., mailing-list-name@example.net). 3282 Since (re-)signing is taking responsibility for the content of the 3283 message, these signing forwarders are likely to be selective, and 3284 forward or re-sign a message only if it is received with a valid 3285 signature or if they have some other basis for knowing that the 3286 message is not spoofed. 3288 A common practice among systems that are primarily redistributors of 3289 mail is to add a Sender header field to the message, to identify the 3290 address being used to sign the message. This practice will remove 3291 any preexisting Sender header field as required by [RFC5322]. The 3292 forwarder applies a new DKIM-Signature header field with the 3293 signature, public key, and related information of the forwarder. 3295 See [I-D.DKIM-MAILINGLISTS] for additional related topics and 3296 discussion. 3298 Appendix C. Creating a Public Key (INFORMATIVE) 3300 The default signature is an RSA signed SHA-256 digest of the complete 3301 email. For ease of explanation, the openssl command is used to 3302 describe the mechanism by which keys and signatures are managed. One 3303 way to generate a 1024-bit, unencrypted private key suitable for DKIM 3304 is to use openssl like this: 3305 $ openssl genrsa -out rsa.private 1024 3306 For increased security, the "-passin" parameter can also be added to 3307 encrypt the private key. Use of this parameter will require entering 3308 a password for several of the following steps. Servers may prefer to 3309 use hardware cryptographic support. 3311 The "genrsa" step results in the file rsa.private containing the key 3312 information similar to this: 3313 -----BEGIN RSA PRIVATE KEY----- 3314 MIICXwIBAAKBgQDwIRP/UC3SBsEmGqZ9ZJW3/DkMoGeLnQg1fWn7/zYtIxN2SnFC 3315 jxOCKG9v3b4jYfcTNh5ijSsq631uBItLa7od+v/RtdC2UzJ1lWT947qR+Rcac2gb 3316 to/NMqJ0fzfVjH4OuKhitdY9tf6mcwGjaNBcWToIMmPSPDdQPNUYckcQ2QIDAQAB 3317 AoGBALmn+XwWk7akvkUlqb+dOxyLB9i5VBVfje89Teolwc9YJT36BGN/l4e0l6QX 3318 /1//6DWUTB3KI6wFcm7TWJcxbS0tcKZX7FsJvUz1SbQnkS54DJck1EZO/BLa5ckJ 3319 gAYIaqlA9C0ZwM6i58lLlPadX/rtHb7pWzeNcZHjKrjM461ZAkEA+itss2nRlmyO 3320 n1/5yDyCluST4dQfO8kAB3toSEVc7DeFeDhnC1mZdjASZNvdHS4gbLIA1hUGEF9m 3321 3hKsGUMMPwJBAPW5v/U+AWTADFCS22t72NUurgzeAbzb1HWMqO4y4+9Hpjk5wvL/ 3322 eVYizyuce3/fGke7aRYw/ADKygMJdW8H/OcCQQDz5OQb4j2QDpPZc0Nc4QlbvMsj 3323 7p7otWRO5xRa6SzXqqV3+F0VpqvDmshEBkoCydaYwc2o6WQ5EBmExeV8124XAkEA 3324 qZzGsIxVP+sEVRWZmW6KNFSdVUpk3qzK0Tz/WjQMe5z0UunY9Ax9/4PVhp/j61bf 3325 eAYXunajbBSOLlx4D+TunwJBANkPI5S9iylsbLs6NkaMHV6k5ioHBBmgCak95JGX 3326 GMot/L2x0IYyMLAz6oLWh2hm7zwtb0CgOrPo1ke44hFYnfc= 3327 -----END RSA PRIVATE KEY----- 3328 To extract the public-key component from the private key, use openssl 3329 like this: 3330 $ openssl rsa -in rsa.private -out rsa.public -pubout -outform PEM 3332 This results in the file rsa.public containing the key information 3333 similar to this: 3334 -----BEGIN PUBLIC KEY----- 3335 MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDwIRP/UC3SBsEmGqZ9ZJW3/DkM 3336 oGeLnQg1fWn7/zYtIxN2SnFCjxOCKG9v3b4jYfcTNh5ijSsq631uBItLa7od+v/R 3337 tdC2UzJ1lWT947qR+Rcac2gbto/NMqJ0fzfVjH4OuKhitdY9tf6mcwGjaNBcWToI 3338 MmPSPDdQPNUYckcQ2QIDAQAB 3339 -----END PUBLIC KEY----- 3341 This public-key data (without the BEGIN and END tags) is placed in 3342 the DNS: 3343 $ORIGIN _domainkey.example.org. 3344 brisbane IN TXT ("v=DKIM1; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQ" 3345 "KBgQDwIRP/UC3SBsEmGqZ9ZJW3/DkMoGeLnQg1fWn7/zYt" 3346 "IxN2SnFCjxOCKG9v3b4jYfcTNh5ijSsq631uBItLa7od+v" 3347 "/RtdC2UzJ1lWT947qR+Rcac2gbto/NMqJ0fzfVjH4OuKhi" 3348 "tdY9tf6mcwGjaNBcWToIMmPSPDdQPNUYckcQ2QIDAQAB") 3350 C.1. Compatibility with DomainKeys Key Records 3352 DKIM key records were designed to be backwards-compatible in many 3353 cases with key records used by DomainKeys [RFC4870] (sometimes 3354 referred to as "selector records" in the DomainKeys context). One 3355 area of incompatibility warrants particular attention. The "g=" tag/ 3356 value may be used in DomainKeys and [RFC4871] key records to provide 3357 finer granularity of the validity of the key record to a specific 3358 local-part. A null "g=" value in DomainKeys is valid for all 3359 addresses in the domain. This differs from the usage in the original 3360 DKIM specification, where a null "g=" value is not valid for any 3361 address. In particular, the example public key record in Section 3362 3.2.3 of [RFC4870] with DKIM. 3364 C.2. RFC4871 Compatibility 3366 Although the "g=" tag has been deprecated in this version of the DKIM 3367 specification (and thus MUST now be ignored), signers are advised not 3368 to include the "g=" tag in key records because some [RFC4871]- 3369 compliant verifiers will be in use for a considerable period to come. 3371 Appendix D. MUA Considerations (INFORMATIVE) 3373 When a DKIM signature is verified, the processing system sometimes 3374 makes the result available to the recipient user's MUA. How to 3375 present this information to the user in a way that helps them is a 3376 matter of continuing human factors usability research. The tendency 3377 is to have the MUA highlight the SDID, in an attempt to show the user 3378 the identity that is claiming responsibility for the message. An MUA 3379 might do this with visual cues such as graphics, or it might include 3380 the address in an alternate view, or it might even rewrite the 3381 original From address using the verified information. Some MUAs 3382 might indicate which header fields were protected by the validated 3383 DKIM signature. This could be done with a positive indication on the 3384 signed header fields, with a negative indication on the unsigned 3385 header fields, by visually hiding the unsigned header fields, or some 3386 combination of these. If an MUA uses visual indications for signed 3387 header fields, the MUA probably needs to be careful not to display 3388 unsigned header fields in a way that might be construed by the end 3389 user as having been signed. If the message has an l= tag whose value 3390 does not extend to the end of the message, the MUA might also hide or 3391 mark the portion of the message body that was not signed. 3393 The aforementioned information is not intended to be exhaustive. The 3394 MUA may choose to highlight, accentuate, hide, or otherwise display 3395 any other information that may, in the opinion of the MUA author, be 3396 deemed important to the end user. 3398 Appendix E. Changes since RFC4871 3400 o Abstract and introduction refined based on accumulated experience. 3402 o Various references updated. 3404 o Several errata resolved: 3406 * 1376 applied 3408 * 1377 applied 3410 * 1378 applied 3412 * 1379 applied 3414 * 1380 applied 3416 * 1381 applied 3418 * 1382 applied 3420 * 1383 discarded (no longer applies) 3421 * 1384 applied 3423 * 1386 applied 3425 * 1461 applied 3427 * 1487 applied 3429 * 1532 applied 3431 * 1596 applied 3433 o Introductory section enumerating relevant architectural documents 3434 added. 3436 o Introductory section briefly discussing the matter of data 3437 integrity added. 3439 o Allow tolerance of some clock drift. 3441 o Drop "g=" tag from key records. The implementation report 3442 indicates that it is not in use. 3444 o Remove errant note about wildcards in the DNS. 3446 o Remove SMTP-specific advice in most places. 3448 o Reduce (non-normative) recommended signature content list, and 3449 rework the text in that section. 3451 o Clarify signature generation algorithm by rewriting its pseudo- 3452 code. 3454 o Numerous terminology subsections added, imported from [RFC5672]. 3455 Also began using these terms throughout the document (e.g., SDID, 3456 AUID). 3458 o Sections added that specify input and output requirements. Input 3459 requirements address a security concern raised by the working 3460 group (see also new sections in Security Considerations). Output 3461 requirements are imported from [RFC5672]. 3463 o Appendix subsection added discussing compatibility with DomainKeys 3464 ([RFC4870]) records. 3466 o Refer to [RFC5451] as an example method of communicating the 3467 results of DKIM verification. 3469 o Remove advice about possible uses of the "l=" signature tag. 3471 o IANA registry update. 3473 o Add two new Security Considerations sections talking about 3474 malformed message attacks. 3476 o Various copy editing. 3478 Appendix F. Acknowledgements 3480 The previous IETF version of DKIM [RFC4871] was edited by: Eric 3481 Allman, Jon Callas, Mark Delany, Miles Libbey, Jim Fenton and Michael 3482 Thomas. 3484 That specification was the result of an extended, collaborative 3485 effort, including participation by: Russ Allbery, Edwin Aoki, Claus 3486 Assmann, Steve Atkins, Rob Austein, Fred Baker, Mark Baugher, Steve 3487 Bellovin, Nathaniel Borenstein, Dave Crocker, Michael Cudahy, Dennis 3488 Dayman, Jutta Degener, Frank Ellermann, Patrik Faeltstroem, Mark 3489 Fanto, Stephen Farrell, Duncan Findlay, Elliot Gillum, Olafur 3490 Gu[eth]mundsson, Phillip Hallam-Baker, Tony Hansen, Sam Hartman, 3491 Arvel Hathcock, Amir Herzberg, Paul Hoffman, Russ Housley, Craig 3492 Hughes, Cullen Jennings, Don Johnsen, Harry Katz, Murray S. 3493 Kucherawy, Barry Leiba, John Levine, Charles Lindsey, Simon 3494 Longsdale, David Margrave, Justin Mason, David Mayne, Thierry Moreau, 3495 Steve Murphy, Russell Nelson, Dave Oran, Doug Otis, Shamim Pirzada, 3496 Juan Altmayer Pizzorno, Sanjay Pol, Blake Ramsdell, Christian Renaud, 3497 Scott Renfro, Neil Rerup, Eric Rescorla, Dave Rossetti, Hector 3498 Santos, Jim Schaad, the Spamhaus.org team, Malte S. Stretz, Robert 3499 Sanders, Rand Wacker, Sam Weiler, and Dan Wing. 3501 The earlier DomainKeys was a primary source from which DKIM was 3502 derived. Further information about DomainKeys is at [RFC4870]. 3504 This revision received contributions from: Steve Atkins, Mark Delany, 3505 J.D. Falk, Jim Fenton, Michael Hammer, Barry Leiba, John Levine, 3506 Charles Lindsey, Jeff Macdonald, Franck Martin, Brett McDowell, Doug 3507 Otis, Bill Oxley, Hector Santos, Rolf Sonneveld, Michael Thomas, and 3508 Alessandro Vesely. 3510 Authors' Addresses 3512 D. Crocker (editor) 3513 Brandenburg InternetWorking 3514 675 Spruce Dr. 3515 Sunnyvale 3516 USA 3518 Phone: +1.408.246.8253 3519 Email: dcrocker@bbiw.net 3520 URI: http://bbiw.net 3522 Tony Hansen (editor) 3523 AT&T Laboratories 3524 200 Laurel Ave. South 3525 Middletown, NJ 07748 3526 USA 3528 Email: tony+dkimov@maillennium.att.com 3530 M. Kucherawy (editor) 3531 Cloudmark 3532 128 King St., 2nd Floor 3533 San Francisco, CA 94107 3534 USA 3536 Email: msk@cloudmark.com