7Internet Engineering Task Force (IETF) D. Crocker, Ed.
8Request for Comments: 6376 Brandenburg InternetWorking
9Obsoletes: 4871, 5672 T. Hansen, Ed.
10Category: Standards Track AT&T Laboratories
11ISSN: 2070-1721 M. Kucherawy, Ed.
16 DomainKeys Identified Mail (DKIM) Signatures
20 DomainKeys Identified Mail (DKIM) permits a person, role, or
21 organization that owns the signing domain to claim some
22 responsibility for a message by associating the domain with the
23 message. This can be an author's organization, an operational relay,
24 or one of their agents. DKIM separates the question of the identity
25 of the Signer of the message from the purported author of the
26 message. Assertion of responsibility is validated through a
27 cryptographic signature and by querying the Signer's domain directly
28 to retrieve the appropriate public key. Message transit from author
29 to recipient is through relays that typically make no substantive
30 change to the message content and thus preserve the DKIM signature.
32 This memo obsoletes RFC 4871 and RFC 5672.
36 This is an Internet Standards Track document.
38 This document is a product of the Internet Engineering Task Force
39 (IETF). It represents the consensus of the IETF community. It has
40 received public review and has been approved for publication by the
41 Internet Engineering Steering Group (IESG). Further information on
42 Internet Standards is available in Section 2 of RFC 5741.
44 Information about the current status of this document, any errata,
45 and how to provide feedback on it may be obtained at
46 http://www.rfc-editor.org/info/rfc6376.
50 Copyright (c) 2011 IETF Trust and the persons identified as the
51 document authors. All rights reserved.
58Crocker, et al. Standards Track [Page 1]
60RFC 6376 DKIM Signatures September 2011
63 This document is subject to BCP 78 and the IETF Trust's Legal
64 Provisions Relating to IETF Documents
65 (http://trustee.ietf.org/license-info) in effect on the date of
66 publication of this document. Please review these documents
67 carefully, as they describe your rights and restrictions with respect
68 to this document. Code Components extracted from this document must
69 include Simplified BSD License text as described in Section 4.e of
70 the Trust Legal Provisions and are provided without warranty as
71 described in the Simplified BSD License.
73 This document may contain material from IETF Documents or IETF
74 Contributions published or made publicly available before November
75 10, 2008. The person(s) controlling the copyright in some of this
76 material may not have granted the IETF Trust the right to allow
77 modifications of such material outside the IETF Standards Process.
78 Without obtaining an adequate license from the person(s) controlling
79 the copyright in such materials, this document may not be modified
80 outside the IETF Standards Process, and derivative works of it may
81 not be created outside the IETF Standards Process, except to format
82 it for publication as an RFC or to translate it into languages other
87 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4
88 1.1. DKIM Architecture Documents . . . . . . . . . . . . . . . 5
89 1.2. Signing Identity . . . . . . . . . . . . . . . . . . . . . 5
90 1.3. Scalability . . . . . . . . . . . . . . . . . . . . . . . 5
91 1.4. Simple Key Management . . . . . . . . . . . . . . . . . . 6
92 1.5. Data Integrity . . . . . . . . . . . . . . . . . . . . . . 6
93 2. Terminology and Definitions . . . . . . . . . . . . . . . . . 6
94 2.1. Signers . . . . . . . . . . . . . . . . . . . . . . . . . 6
95 2.2. Verifiers . . . . . . . . . . . . . . . . . . . . . . . . 7
96 2.3. Identity . . . . . . . . . . . . . . . . . . . . . . . . . 7
97 2.4. Identifier . . . . . . . . . . . . . . . . . . . . . . . . 7
98 2.5. Signing Domain Identifier (SDID) . . . . . . . . . . . . . 7
99 2.6. Agent or User Identifier (AUID) . . . . . . . . . . . . . 7
100 2.7. Identity Assessor . . . . . . . . . . . . . . . . . . . . 7
101 2.8. Whitespace . . . . . . . . . . . . . . . . . . . . . . . . 8
102 2.9. Imported ABNF Tokens . . . . . . . . . . . . . . . . . . . 8
103 2.10. Common ABNF Tokens . . . . . . . . . . . . . . . . . . . . 9
104 2.11. DKIM-Quoted-Printable . . . . . . . . . . . . . . . . . . 9
105 3. Protocol Elements . . . . . . . . . . . . . . . . . . . . . . 10
106 3.1. Selectors . . . . . . . . . . . . . . . . . . . . . . . . 10
107 3.2. Tag=Value Lists . . . . . . . . . . . . . . . . . . . . . 12
108 3.3. Signing and Verification Algorithms . . . . . . . . . . . 13
109 3.4. Canonicalization . . . . . . . . . . . . . . . . . . . . . 14
110 3.5. The DKIM-Signature Header Field . . . . . . . . . . . . . 18
114Crocker, et al. Standards Track [Page 2]
116RFC 6376 DKIM Signatures September 2011
119 3.6. Key Management and Representation . . . . . . . . . . . . 26
120 3.7. Computing the Message Hashes . . . . . . . . . . . . . . . 29
121 3.8. Input Requirements . . . . . . . . . . . . . . . . . . . . 32
122 3.9. Output Requirements . . . . . . . . . . . . . . . . . . . 32
123 3.10. Signing by Parent Domains . . . . . . . . . . . . . . . . 33
124 3.11. Relationship between SDID and AUID . . . . . . . . . . . . 33
125 4. Semantics of Multiple Signatures . . . . . . . . . . . . . . . 34
126 4.1. Example Scenarios . . . . . . . . . . . . . . . . . . . . 34
127 4.2. Interpretation . . . . . . . . . . . . . . . . . . . . . . 35
128 5. Signer Actions . . . . . . . . . . . . . . . . . . . . . . . . 36
129 5.1. Determine Whether the Email Should Be Signed and by
130 Whom . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
131 5.2. Select a Private Key and Corresponding Selector
132 Information . . . . . . . . . . . . . . . . . . . . . . . 37
133 5.3. Normalize the Message to Prevent Transport Conversions . . 37
134 5.4. Determine the Header Fields to Sign . . . . . . . . . . . 38
135 5.5. Compute the Message Hash and Signature . . . . . . . . . . 43
136 5.6. Insert the DKIM-Signature Header Field . . . . . . . . . . 43
137 6. Verifier Actions . . . . . . . . . . . . . . . . . . . . . . . 43
138 6.1. Extract Signatures from the Message . . . . . . . . . . . 44
139 6.2. Communicate Verification Results . . . . . . . . . . . . . 49
140 6.3. Interpret Results/Apply Local Policy . . . . . . . . . . . 50
141 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 51
142 7.1. Email Authentication Methods Registry . . . . . . . . . . 51
143 7.2. DKIM-Signature Tag Specifications . . . . . . . . . . . . 51
144 7.3. DKIM-Signature Query Method Registry . . . . . . . . . . . 52
145 7.4. DKIM-Signature Canonicalization Registry . . . . . . . . . 52
146 7.5. _domainkey DNS TXT Resource Record Tag Specifications . . 53
147 7.6. DKIM Key Type Registry . . . . . . . . . . . . . . . . . . 53
148 7.7. DKIM Hash Algorithms Registry . . . . . . . . . . . . . . 54
149 7.8. DKIM Service Types Registry . . . . . . . . . . . . . . . 54
150 7.9. DKIM Selector Flags Registry . . . . . . . . . . . . . . . 55
151 7.10. DKIM-Signature Header Field . . . . . . . . . . . . . . . 55
152 8. Security Considerations . . . . . . . . . . . . . . . . . . . 55
153 8.1. ASCII Art Attacks . . . . . . . . . . . . . . . . . . . . 55
154 8.2. Misuse of Body Length Limits ("l=" Tag) . . . . . . . . . 55
155 8.3. Misappropriated Private Key . . . . . . . . . . . . . . . 56
156 8.4. Key Server Denial-of-Service Attacks . . . . . . . . . . . 56
157 8.5. Attacks against the DNS . . . . . . . . . . . . . . . . . 57
158 8.6. Replay/Spam Attacks . . . . . . . . . . . . . . . . . . . 57
159 8.7. Limits on Revoking Keys . . . . . . . . . . . . . . . . . 58
160 8.8. Intentionally Malformed Key Records . . . . . . . . . . . 58
161 8.9. Intentionally Malformed DKIM-Signature Header Fields . . . 58
162 8.10. Information Leakage . . . . . . . . . . . . . . . . . . . 58
163 8.11. Remote Timing Attacks . . . . . . . . . . . . . . . . . . 59
164 8.12. Reordered Header Fields . . . . . . . . . . . . . . . . . 59
165 8.13. RSA Attacks . . . . . . . . . . . . . . . . . . . . . . . 59
166 8.14. Inappropriate Signing by Parent Domains . . . . . . . . . 59
170Crocker, et al. Standards Track [Page 3]
172RFC 6376 DKIM Signatures September 2011
175 8.15. Attacks Involving Extra Header Fields . . . . . . . . . . 60
176 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 61
177 9.1. Normative References . . . . . . . . . . . . . . . . . . . 61
178 9.2. Informative References . . . . . . . . . . . . . . . . . . 62
179 Appendix A. Example of Use (INFORMATIVE) . . . . . . . . . . . . 64
180 A.1. The User Composes an Email . . . . . . . . . . . . . . . . 64
181 A.2. The Email is Signed . . . . . . . . . . . . . . . . . . . 65
182 A.3. The Email Signature is Verified . . . . . . . . . . . . . 66
183 Appendix B. Usage Examples (INFORMATIVE) . . . . . . . . . . . . 67
184 B.1. Alternate Submission Scenarios . . . . . . . . . . . . . . 67
185 B.2. Alternate Delivery Scenarios . . . . . . . . . . . . . . . 69
186 Appendix C. Creating a Public Key (INFORMATIVE) . . . . . . . . . 71
187 C.1. Compatibility with DomainKeys Key Records . . . . . . . . 72
188 C.2. RFC 4871 Compatibility . . . . . . . . . . . . . . . . . . 73
189 Appendix D. MUA Considerations (INFORMATIVE) . . . . . . . . . . 73
190 Appendix E. Changes since RFC 4871 . . . . . . . . . . . . . . . 73
191 Appendix F. Acknowledgments . . . . . . . . . . . . . . . . . . . 75
195 DomainKeys Identified Mail (DKIM) permits a person, role, or
196 organization to claim some responsibility for a message by
197 associating a domain name [RFC1034] with the message [RFC5322], which
198 they are authorized to use. This can be an author's organization, an
199 operational relay, or one of their agents. Assertion of
200 responsibility is validated through a cryptographic signature and by
201 querying the Signer's domain directly to retrieve the appropriate
202 public key. Message transit from author to recipient is through
203 relays that typically make no substantive change to the message
204 content and thus preserve the DKIM signature. A message can contain
205 multiple signatures, from the same or different organizations
206 involved with the message.
208 The approach taken by DKIM differs from previous approaches to
209 message signing (e.g., Secure/Multipurpose Internet Mail Extensions
210 (S/MIME) [RFC5751], OpenPGP [RFC4880]) in that:
212 o the message signature is written as a message header field so that
213 neither human recipients nor existing MUA (Mail User Agent)
214 software is confused by signature-related content appearing in the
217 o there is no dependency on public- and private-key pairs being
218 issued by well-known, trusted certificate authorities;
220 o there is no dependency on the deployment of any new Internet
221 protocols or services for public-key distribution or revocation;
226Crocker, et al. Standards Track [Page 4]
228RFC 6376 DKIM Signatures September 2011
231 o signature verification failure does not force rejection of the
234 o no attempt is made to include encryption as part of the mechanism;
237 o message archiving is not a design goal.
241 o is compatible with the existing email infrastructure and
242 transparent to the fullest extent possible;
244 o requires minimal new infrastructure;
246 o can be implemented independently of clients in order to reduce
249 o can be deployed incrementally; and
251 o allows delegation of signing to third parties.
2531.1. DKIM Architecture Documents
255 Readers are advised to be familiar with the material in [RFC4686],
256 [RFC5585], and [RFC5863], which provide the background for the
257 development of DKIM, an overview of the service, and deployment and
258 operations guidance and advice, respectively.
262 DKIM separates the question of the identity of the Signer of the
263 message from the purported author of the message. In particular, a
264 signature includes the identity of the Signer. Verifiers can use the
265 signing information to decide how they want to process the message.
266 The signing identity is included as part of the signature header
269 INFORMATIVE RATIONALE: The signing identity specified by a DKIM
270 signature is not required to match an address in any particular
271 header field because of the broad methods of interpretation by
272 recipient mail systems, including MUAs.
276 DKIM is designed to support the extreme scalability requirements that
277 characterize the email identification problem. There are many
278 millions of domains and a much larger number of individual addresses.
282Crocker, et al. Standards Track [Page 5]
284RFC 6376 DKIM Signatures September 2011
287 DKIM seeks to preserve the positive aspects of the current email
288 infrastructure, such as the ability for anyone to communicate with
289 anyone else without introduction.
2911.4. Simple Key Management
293 DKIM differs from traditional hierarchical public-key systems in that
294 no certificate authority infrastructure is required; the Verifier
295 requests the public key from a repository in the domain of the
296 claimed Signer directly rather than from a third party.
298 The DNS is proposed as the initial mechanism for the public keys.
299 Thus, DKIM currently depends on DNS administration and the security
300 of the DNS system. DKIM is designed to be extensible to other key
301 fetching services as they become available.
305 A DKIM signature associates the "d=" name with the computed hash of
306 some or all of the message (see Section 3.7) in order to prevent the
307 reuse of the signature with different messages. Verifying the
308 signature asserts that the hashed content has not changed since it
309 was signed and asserts nothing else about "protecting" the end-to-end
310 integrity of the message.
3122. Terminology and Definitions
314 This section defines terms used in the rest of the document.
316 DKIM is designed to operate within the Internet Mail service, as
317 defined in [RFC5598]. Basic email terminology is taken from that
320 Syntax descriptions use Augmented BNF (ABNF) [RFC5234].
322 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
323 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
324 "OPTIONAL" in this document are to be interpreted as described in
325 [RFC2119]. These words take their normative meanings only when they
326 are presented in ALL UPPERCASE.
330 Elements in the mail system that sign messages on behalf of a domain
331 are referred to as Signers. These may be MUAs (Mail User Agents),
332 MSAs (Mail Submission Agents), MTAs (Mail Transfer Agents), or other
333 agents such as mailing list exploders. In general, any Signer will
338Crocker, et al. Standards Track [Page 6]
340RFC 6376 DKIM Signatures September 2011
343 be involved in the injection of a message into the message system in
344 some way. The key issue is that a message must be signed before it
345 leaves the administrative domain of the Signer.
349 Elements in the mail system that verify signatures are referred to as
350 Verifiers. These may be MTAs, Mail Delivery Agents (MDAs), or MUAs.
351 In most cases, it is expected that Verifiers will be close to an end
352 user (reader) of the message or some consuming agent such as a
353 mailing list exploder.
357 A person, role, or organization. In the context of DKIM, examples
358 include the author, the author's organization, an ISP along the
359 handling path, an independent trust assessment service, and a mailing
364 A label that refers to an identity.
3662.5. Signing Domain Identifier (SDID)
368 A single domain name that is the mandatory payload output of DKIM and
369 that refers to the identity claiming some responsibility for the
370 message by signing it. It is specified in Section 3.5.
3722.6. Agent or User Identifier (AUID)
374 A single identifier that refers to the agent or user on behalf of
375 whom the Signing Domain Identifier (SDID) has taken responsibility.
376 The AUID comprises a domain name and an optional <local-part>. The
377 domain name is the same as that used for the SDID or is a subdomain
378 of it. For DKIM processing, the domain name portion of the AUID has
379 only basic domain name semantics; any possible owner-specific
380 semantics are outside the scope of DKIM. It is specified in
383 Note that acceptable values for the AUID may be constrained via a
384 flag in the public-key record. (See Section 3.6.1.)
3862.7. Identity Assessor
388 An element in the mail system that consumes DKIM's payload, which is
389 the responsible Signing Domain Identifier (SDID). The Identity
390 Assessor is dedicated to the assessment of the delivered identifier.
394Crocker, et al. Standards Track [Page 7]
396RFC 6376 DKIM Signatures September 2011
399 Other DKIM (and non-DKIM) values can also be used by the Identity
400 Assessor (if they are available) to provide a more general message
401 evaluation filtering engine. However, this additional activity is
402 outside the scope of this specification.
406 There are three forms of whitespace:
408 o WSP represents simple whitespace, i.e., a space or a tab character
409 (formal definition in [RFC5234]).
411 o LWSP is linear whitespace, defined as WSP plus CRLF (formal
412 definition in [RFC5234]).
414 o FWS is folding whitespace. It allows multiple lines separated by
415 CRLF followed by at least one whitespace, to be joined.
417 The formal ABNF for these are (WSP and LWSP are given for information
421 LWSP = *(WSP / CRLF WSP)
422 FWS = [*WSP CRLF] 1*WSP
424 The definition of FWS is identical to that in [RFC5322] except for
425 the exclusion of obs-FWS.
4272.9. Imported ABNF Tokens
429 The following tokens are imported from other RFCs as noted. Those
430 RFCs should be considered definitive.
432 The following tokens are imported from [RFC5321]:
438 The following tokens are imported from [RFC5322]:
440 o "field-name" (name of a header field)
442 o "dot-atom-text" (in the local-part of an email address)
444 The following tokens are imported from [RFC2045]:
446 o "qp-section" (a single line of quoted-printable-encoded text)
450Crocker, et al. Standards Track [Page 8]
452RFC 6376 DKIM Signatures September 2011
455 o "hex-octet" (a quoted-printable encoded octet)
457 INFORMATIVE NOTE: Be aware that the ABNF in [RFC2045] does not
458 obey the rules of [RFC5234] and must be interpreted accordingly,
459 particularly as regards case folding.
461 Other tokens not defined herein are imported from [RFC5234]. These
462 are intuitive primitives such as SP, HTAB, WSP, ALPHA, DIGIT, CRLF,
4652.10. Common ABNF Tokens
467 The following ABNF tokens are used elsewhere in this document:
470 ALPHADIGITPS = (ALPHA / DIGIT / "+" / "/")
471 base64string = ALPHADIGITPS *([FWS] ALPHADIGITPS)
472 [ [FWS] "=" [ [FWS] "=" ] ]
4762.11. DKIM-Quoted-Printable
478 The DKIM-Quoted-Printable encoding syntax resembles that described in
479 Quoted-Printable [RFC2045], Section 6.7: any character MAY be encoded
480 as an "=" followed by two hexadecimal digits from the alphabet
481 "0123456789ABCDEF" (no lowercase characters permitted) representing
482 the hexadecimal-encoded integer value of that character. All control
483 characters (those with values < %x20), 8-bit characters (values >
484 %x7F), and the characters DEL (%x7F), SPACE (%x20), and semicolon
485 (";", %x3B) MUST be encoded. Note that all whitespace, including
486 SPACE, CR, and LF characters, MUST be encoded. After encoding, FWS
487 MAY be added at arbitrary locations in order to avoid excessively
488 long lines; such whitespace is NOT part of the value, and MUST be
489 removed before decoding. Use of characters not listed as "mail-safe"
490 in [RFC2049] is NOT RECOMMENDED.
495 ; hex-octet is from RFC2045
496 dkim-safe-char = %x21-3A / %x3C / %x3E-7E
506Crocker, et al. Standards Track [Page 9]
508RFC 6376 DKIM Signatures September 2011
511 INFORMATIVE NOTE: DKIM-Quoted-Printable differs from Quoted-
512 Printable as defined in [RFC2045] in several important ways:
514 1. Whitespace in the input text, including CR and LF, must be
515 encoded. [RFC2045] does not require such encoding, and does
516 not permit encoding of CR or LF characters that are part of a
519 2. Whitespace in the encoded text is ignored. This is to allow
520 tags encoded using DKIM-Quoted-Printable to be wrapped as
521 needed. In particular, [RFC2045] requires that line breaks in
522 the input be represented as physical line breaks; that is not
525 3. The "soft line break" syntax ("=" as the last non-whitespace
526 character on the line) does not apply.
528 4. DKIM-Quoted-Printable does not require that encoded lines be
529 no more than 76 characters long (although there may be other
530 requirements depending on the context in which the encoded
535 Protocol Elements are conceptual parts of the protocol that are not
536 specific to either Signers or Verifiers. The protocol descriptions
537 for Signers and Verifiers are described in later sections ("Signer
538 Actions" (Section 5) and "Verifier Actions" (Section 6)). NOTE: This
539 section must be read in the context of those sections.
543 To support multiple concurrent public keys per signing domain, the
544 key namespace is subdivided using "selectors". For example,
545 selectors might indicate the names of office locations (e.g.,
546 "sanfrancisco", "coolumbeach", and "reykjavik"), the signing date
547 (e.g., "january2005", "february2005", etc.), or even an individual
550 Selectors are needed to support some important use cases. For
553 o Domains that want to delegate signing capability for a specific
554 address for a given duration to a partner, such as an advertising
555 provider or other outsourced function.
557 o Domains that want to allow frequent travelers to send messages
558 locally without the need to connect with a particular MSA.
562Crocker, et al. Standards Track [Page 10]
564RFC 6376 DKIM Signatures September 2011
567 o "Affinity" domains (e.g., college alumni associations) that
568 provide forwarding of incoming mail, but that do not operate a
569 mail submission agent for outgoing mail.
571 Periods are allowed in selectors and are component separators. When
572 keys are retrieved from the DNS, periods in selectors define DNS
573 label boundaries in a manner similar to the conventional use in
574 domain names. Selector components might be used to combine dates
575 with locations, for example, "march2005.reykjavik". In a DNS
576 implementation, this can be used to allow delegation of a portion of
577 the selector namespace.
583 The number of public keys and corresponding selectors for each domain
584 is determined by the domain owner. Many domain owners will be
585 satisfied with just one selector, whereas administratively
586 distributed organizations can choose to manage disparate selectors
587 and key pairs in different regions or on different email servers.
589 Beyond administrative convenience, selectors make it possible to
590 seamlessly replace public keys on a routine basis. If a domain
591 wishes to change from using a public key associated with selector
592 "january2005" to a public key associated with selector
593 "february2005", it merely makes sure that both public keys are
594 advertised in the public-key repository concurrently for the
595 transition period during which email may be in transit prior to
596 verification. At the start of the transition period, the outbound
597 email servers are configured to sign with the "february2005" private
598 key. At the end of the transition period, the "january2005" public
599 key is removed from the public-key repository.
601 INFORMATIVE NOTE: A key may also be revoked as described below.
602 The distinction between revoking and removing a key selector
603 record is subtle. When phasing out keys as described above, a
604 signing domain would probably simply remove the key record after
605 the transition period. However, a signing domain could elect to
606 revoke the key (but maintain the key record) for a further period.
607 There is no defined semantic difference between a revoked key and
610 While some domains may wish to make selector values well-known,
611 others will want to take care not to allocate selector names in a way
612 that allows harvesting of data by outside parties. For example, if
613 per-user keys are issued, the domain owner will need to decide
618Crocker, et al. Standards Track [Page 11]
620RFC 6376 DKIM Signatures September 2011
623 whether to associate this selector directly with the name of a
624 registered end user or make it some unassociated random value, such
625 as a fingerprint of the public key.
627 INFORMATIVE OPERATIONS NOTE: Reusing a selector with a new key
628 (for example, changing the key associated with a user's name)
629 makes it impossible to tell the difference between a message that
630 didn't verify because the key is no longer valid and a message
631 that is actually forged. For this reason, Signers are ill-advised
632 to reuse selectors for new keys. A better strategy is to assign
633 new keys to new selectors.
637 DKIM uses a simple "tag=value" syntax in several contexts, including
638 in messages and domain signature records.
640 Values are a series of strings containing either plain text, "base64"
641 text (as defined in [RFC2045], Section 6.8), "qp-section" (ibid,
642 Section 6.7), or "dkim-quoted-printable" (as defined in
644 each value. Unencoded semicolon (";") characters MUST NOT occur in
645 the tag value, since that separates tag-specs.
647 INFORMATIVE IMPLEMENTATION NOTE: Although the "plain text" defined
648 below (as "tag-value") only includes 7-bit characters, an
649 implementation that wished to anticipate future standards would be
650 advised not to preclude the use of UTF-8-encoded ([RFC3629]) text
653 Formally, the ABNF syntax rules are as follows:
659 ; Prohibits WSP and FWS at beginning and end
661 VALCHAR = %x21-3A / %x3C-7E
662 ; EXCLAMATION to TILDE except SEMICOLON
663 ALNUMPUNC = ALPHA / DIGIT / "_"
665 Note that WSP is allowed anywhere around tags. In particular, any
666 WSP after the "=" and any WSP before the terminating ";" is not part
667 of the value; however, WSP inside the value is significant.
674Crocker, et al. Standards Track [Page 12]
676RFC 6376 DKIM Signatures September 2011
680 processed as case sensitive unless the specific tag description of
681 semantics specifies case insensitivity.
684 a tag name does occur more than once, the entire tag-list is invalid.
686 Whitespace within a value MUST be retained unless explicitly excluded
687 by the specific tag description.
689 Tag=value pairs that represent the default value MAY be included to
694 Tags that have an empty value are not the same as omitted tags. An
695 omitted tag is treated as having the default value; a tag with an
696 empty value explicitly designates the empty string as the value.
6983.3. Signing and Verification Algorithms
700 DKIM supports multiple digital signature algorithms. Two algorithms
701 are defined by this specification at this time: rsa-sha1 and rsa-
702 sha256. Signers MUST implement and SHOULD sign using rsa-sha256.
703 Verifiers MUST implement both rsa-sha1 and rsa-sha256.
705 INFORMATIVE NOTE: Although rsa-sha256 is strongly encouraged, some
706 senders might prefer to use rsa-sha1 when balancing security
707 strength against performance, complexity, or other needs. In
708 general, however, rsa-sha256 should always be used whenever
7113.3.1. The rsa-sha1 Signing Algorithm
713 The rsa-sha1 Signing Algorithm computes a message hash as described
714 in Section 3.7 using SHA-1 [FIPS-180-3-2008] as the hash-alg. That
715 hash is then signed by the Signer using the RSA algorithm (defined in
716 Public-Key Cryptography Standards (PKCS) #1 version 1.5 [RFC3447]) as
717 the crypt-alg and the Signer's private key. The hash MUST NOT be
718 truncated or converted into any form other than the native binary
719 form before being signed. The signing algorithm SHOULD use a public
7223.3.2. The rsa-sha256 Signing Algorithm
724 The rsa-sha256 Signing Algorithm computes a message hash as described
725 in Section 3.7 using SHA-256 [FIPS-180-3-2008] as the hash-alg. That
726 hash is then signed by the Signer using the RSA algorithm (defined in
730Crocker, et al. Standards Track [Page 13]
732RFC 6376 DKIM Signatures September 2011
735 PKCS#1 version 1.5 [RFC3447]) as the crypt-alg and the Signer's
736 private key. The hash MUST NOT be truncated or converted into any
737 form other than the native binary form before being signed. The
738 signing algorithm SHOULD use a public exponent of 65537.
742 Selecting appropriate key sizes is a trade-off between cost,
743 performance, and risk. Since short RSA keys more easily succumb to
744 off-line attacks, Signers MUST use RSA keys of at least 1024 bits for
745 long-lived keys. Verifiers MUST be able to validate signatures with
746 keys ranging from 512 bits to 2048 bits, and they MAY be able to
747 validate signatures with larger keys. Verifier policies may use the
748 length of the signing key as one metric for determining whether a
749 signature is acceptable.
751 Factors that should influence the key size choice include the
754 o The practical constraint that large (e.g., 4096-bit) keys might
755 not fit within a 512-byte DNS UDP response packet
758 subject to off-line attacks
760 o Larger keys impose higher CPU costs to verify and sign email
762 o Keys can be replaced on a regular basis; thus, their lifetime can
765 o The security goals of this specification are modest compared to
766 typical goals of other systems that employ digital signatures
768 See [RFC3766] for further discussion on selecting key sizes.
7703.3.4. Other Algorithms
772 Other algorithms MAY be defined in the future. Verifiers MUST ignore
773 any signatures using algorithms that they do not implement.
777 Some mail systems modify email in transit, potentially invalidating a
778 signature. For most Signers, mild modification of email is
779 immaterial to validation of the DKIM domain name's use. For such
780 Signers, a canonicalization algorithm that survives modest in-transit
781 modification is preferred.
786Crocker, et al. Standards Track [Page 14]
788RFC 6376 DKIM Signatures September 2011
791 Other Signers demand that any modification of the email, however
792 minor, result in a signature verification failure. These Signers
793 prefer a canonicalization algorithm that does not tolerate in-transit
794 modification of the signed email.
796 Some Signers may be willing to accept modifications to header fields
797 that are within the bounds of email standards such as [RFC5322], but
798 are unwilling to accept any modification to the body of messages.
800 To satisfy all requirements, two canonicalization algorithms are
801 defined for each of the header and the body: a "simple" algorithm
802 that tolerates almost no modification and a "relaxed" algorithm that
803 tolerates common modifications such as whitespace replacement and
804 header field line rewrapping. A Signer MAY specify either algorithm
805 for header or body when signing an email. If no canonicalization
806 algorithm is specified by the Signer, the "simple" algorithm defaults
807 for both header and body. Verifiers MUST implement both
808 canonicalization algorithms. Note that the header and body may use
809 different canonicalization algorithms. Further canonicalization
811 signatures that use unrecognized canonicalization algorithms.
813 Canonicalization simply prepares the email for presentation to the
814 signing or verification algorithm. It MUST NOT change the
815 transmitted data in any way. Canonicalization of header fields and
816 body are described below.
818 NOTE: This section assumes that the message is already in "network
819 normal" format (text is ASCII encoded, lines are separated with CRLF
820 characters, etc.). See also Section 5.3 for information about
821 normalizing the message.
825 The "simple" header canonicalization algorithm does not change header
826 fields in any way. Header fields MUST be presented to the signing or
827 verification algorithm exactly as they are in the message being
828 signed or verified. In particular, header field names MUST NOT be
829 case folded and whitespace MUST NOT be changed.
833 The "relaxed" header canonicalization algorithm MUST apply the
834 following steps in order:
836 o Convert all header field names (not the header field values) to
837 lowercase. For example, convert "SUBJect: AbC" to "subject: AbC".
842Crocker, et al. Standards Track [Page 15]
844RFC 6376 DKIM Signatures September 2011
847 o Unfold all header field continuation lines as described in
848 [RFC5322]; in particular, lines with terminators embedded in
849 continued header field values (that is, CRLF sequences followed by
850 WSP) MUST be interpreted without the CRLF. Implementations MUST
851 NOT remove the CRLF at the end of the header field value.
853 o Convert all sequences of one or more WSP characters to a single SP
854 character. WSP characters here include those before and after a
855 line folding boundary.
857 o Delete all WSP characters at the end of each unfolded header field
860 o Delete any WSP characters remaining before and after the colon
861 separating the header field name from the header field value. The
862 colon separator MUST be retained.
866 The "simple" body canonicalization algorithm ignores all empty lines
867 at the end of the message body. An empty line is a line of zero
868 length after removal of the line terminator. If there is no body or
869 no trailing CRLF on the message body, a CRLF is added. It makes no
870 other changes to the message body. In more formal terms, the
871 "simple" body canonicalization algorithm converts "*CRLF" at the end
872 of the body to a single "CRLF".
874 Note that a completely empty or missing body is canonicalized as a
875 single "CRLF"; that is, the canonicalized length will be 2 octets.
877 The SHA-1 value (in base64) for an empty body (canonicalized to a
880 uoq1oCgLlTqpdDX/iUbLy7J1Wic=
882 The SHA-256 value is:
884 frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN/XKdLCPjaYaY=
888 The "relaxed" body canonicalization algorithm MUST apply the
889 following steps (a) and (b) in order:
891 a. Reduce whitespace:
894 MUST NOT remove the CRLF at the end of the line.
898Crocker, et al. Standards Track [Page 16]
900RFC 6376 DKIM Signatures September 2011
903 * Reduce all sequences of WSP within a line to a single SP
906 b. Ignore all empty lines at the end of the message body. "Empty
907 line" is defined in Section 3.4.3. If the body is non-empty but
908 does not end with a CRLF, a CRLF is added. (For email, this is
909 only possible when using extensions to SMTP or non-SMTP transport
912 The SHA-1 value (in base64) for an empty body (canonicalized to a
915 2jmj7l5rSw0yVb/vlWAYkK/YBwk=
917 The SHA-256 value is:
919 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=
9213.4.5. Canonicalization Examples (INFORMATIVE)
923 In the following examples, actual whitespace is used only for
924 clarity. The actual input and output text is designated using
925 bracketed descriptors: "<SP>" for a space character, "<HTAB>" for a
926 tab character, and "<CRLF>" for a carriage-return/line-feed sequence.
927 For example, "X <SP> Y" and "X<SP>Y" represent the same three
930 Example 1: A message reading:
933 B <SP> : <SP> Y <HTAB><CRLF>
934 <HTAB> Z <SP><SP><CRLF>
937 D <SP><HTAB><SP> E <CRLF>
941 when canonicalized using relaxed canonicalization for both header and
942 body results in a header reading:
954Crocker, et al. Standards Track [Page 17]
956RFC 6376 DKIM Signatures September 2011
959 Example 2: The same message canonicalized using simple
960 canonicalization for both header and body results in a header
964 B <SP> : <SP> Y <HTAB><CRLF>
965 <HTAB> Z <SP><SP><CRLF>
970 D <SP><HTAB><SP> E <CRLF>
972 Example 3: When processed using relaxed header canonicalization and
973 simple body canonicalization, the canonicalized version has a header
982 D <SP><HTAB><SP> E <CRLF>
9843.5. The DKIM-Signature Header Field
986 The signature of the email is stored in the DKIM-Signature header
987 field. This header field contains all of the signature and key-
988 fetching data. The DKIM-Signature value is a tag-list as described
991 The DKIM-Signature header field SHOULD be treated as though it were a
992 trace header field as defined in Section 3.6 of [RFC5322] and hence
993 SHOULD NOT be reordered and SHOULD be prepended to the message.
995 The DKIM-Signature header field being created or verified is always
996 included in the signature calculation, after the rest of the header
998 signature, the value of the "b=" tag (signature value) of that DKIM-
999 Signature header field MUST be treated as though it were an empty
1000 string. Unknown tags in the DKIM-Signature header field MUST be
1001 included in the signature calculation but MUST be otherwise ignored
1002 by Verifiers. Other DKIM-Signature header fields that are included
1003 in the signature should be treated as normal header fields; in
1004 particular, the "b=" tag is not treated specially.
1010Crocker, et al. Standards Track [Page 18]
1012RFC 6376 DKIM Signatures September 2011
1015 The encodings for each field type are listed below. Tags described
1016 as qp-section are encoded as described in Section 6.7 of MIME Part
1017 One [RFC2045], with the additional conversion of semicolon characters
1018 to "=3B"; intuitively, this is one line of quoted-printable encoded
1019 text. The dkim-quoted-printable syntax is defined in Section 2.11.
1026 this specification that applies to the signature record. It MUST
1027 have the value "1" for implementations compliant with this version
1032 sig-v-tag = %x76 [FWS] "=" [FWS] 1*DIGIT
1034 INFORMATIVE NOTE: DKIM-Signature version numbers may increase
1035 arithmetically as new versions of this specification are
1039 REQUIRED). Verifiers MUST support "rsa-sha1" and "rsa-sha256";
1040 Signers SHOULD sign using "rsa-sha256". See Section 3.3 for a
1041 description of the algorithms.
1045 sig-a-tag = %x61 [FWS] "=" [FWS] sig-a-tag-alg
1047 sig-a-tag-k = "rsa" / x-sig-a-tag-k
1048 sig-a-tag-h = "sha1" / "sha256" / x-sig-a-tag-h
1049 x-sig-a-tag-k = ALPHA *(ALPHA / DIGIT)
1050 ; for later extension
1051 x-sig-a-tag-h = ALPHA *(ALPHA / DIGIT)
1052 ; for later extension
1055 this value and MUST be ignored when reassembling the original
1056 signature. In particular, the signing process can safely insert
1057 FWS in this value in arbitrary places to conform to line-length
1058 limits. See "Signer Actions" (Section 5) for how the signature is
1066Crocker, et al. Standards Track [Page 19]
1068RFC 6376 DKIM Signatures September 2011
1073 sig-b-tag = %x62 [FWS] "=" [FWS] sig-b-tag-data
1074 sig-b-tag-data = base64string
1077 limited by the "l=" tag (base64; REQUIRED). Whitespace is ignored
1078 in this value and MUST be ignored when reassembling the original
1079 signature. In particular, the signing process can safely insert
1080 FWS in this value in arbitrary places to conform to line-length
1081 limits. See Section 3.7 for how the body hash is computed.
1085 sig-bh-tag = %x62 %x68 [FWS] "=" [FWS] sig-bh-tag-data
1086 sig-bh-tag-data = base64string
1089 "simple/simple"). This tag informs the Verifier of the type of
1090 canonicalization used to prepare the message for signing. It
1091 consists of two names separated by a "slash" (%d47) character,
1092 corresponding to the header and body canonicalization algorithms,
1093 respectively. These algorithms are described in Section 3.4. If
1094 only one algorithm is named, that algorithm is used for the header
1095 and "simple" is used for the body. For example, "c=relaxed" is
1096 treated the same as "c=relaxed/simple".
1102 sig-c-tag-alg = "simple" / "relaxed" / x-sig-c-tag-alg
1103 x-sig-c-tag-alg = hyphenated-word ; for later extension
1106 into the mail stream (plain-text; REQUIRED). Hence, the SDID
1107 value is used to form the query for the public key. The SDID MUST
1108 correspond to a valid DNS name under which the DKIM key record is
1109 published. The conventions and semantics used by a Signer to
1110 create and use a specific SDID are outside the scope of this
1111 specification, as is any use of those conventions and semantics.
1112 When presented with a signature that does not meet these
1113 requirements, Verifiers MUST consider the signature invalid.
1116 described in Section 2.3 of [RFC5890].
1122Crocker, et al. Standards Track [Page 20]
1124RFC 6376 DKIM Signatures September 2011
1129 sig-d-tag = %x64 [FWS] "=" [FWS] domain-name
1130 domain-name = sub-domain 1*("." sub-domain)
1131 ; from [RFC5321] Domain,
1132 ; excluding address-literal
1135 A colon-separated list of header field names that identify the
1136 header fields presented to the signing algorithm. The field MUST
1137 contain the complete list of header fields in the order presented
1138 to the signing algorithm. The field MAY contain names of header
1139 fields that do not exist when signed; nonexistent header fields do
1140 not contribute to the signature computation (that is, they are
1141 treated as the null input, including the header field name, the
1142 separating colon, the header field value, and any CRLF
1143 terminator). The field MAY contain multiple instances of a header
1144 field name, meaning multiple occurrences of the corresponding
1145 header field are included in the header hash. The field MUST NOT
1146 include the DKIM-Signature header field that is being created or
1147 verified but may include others. Folding whitespace (FWS) MAY be
1148 included on either side of the colon separator. Header field
1149 names MUST be compared against actual header field names in a
1150 case-insensitive manner. This list MUST NOT be empty. See
1151 Section 5.4 for a discussion of choosing header fields to sign and
1152 Section 5.4.2 for requirements when signing multiple instances of
1158 *( [FWS] ":" [FWS] hdr-name )
1160 INFORMATIVE EXPLANATION: By "signing" header fields that do not
1161 actually exist, a Signer can allow a Verifier to detect
1162 insertion of those header fields after signing. However, since
1163 a Signer cannot possibly know what header fields might be
1164 defined in the future, this mechanism cannot be used to prevent
1165 the addition of any possible unknown header fields.
1167 INFORMATIVE NOTE: "Signing" fields that are not present at the
1168 time of signing not only prevents fields and values from being
1169 added but also prevents adding fields with no values.
1173 an empty local-part followed by an "@" followed by the domain from
1178Crocker, et al. Standards Track [Page 21]
1180RFC 6376 DKIM Signatures September 2011
1183 The syntax is a standard email address where the local-part MAY be
1184 omitted. The domain part of the address MUST be the same as, or a
1185 subdomain of, the value of the "d=" tag.
1188 described in Section 2.3 of [RFC5890].
1195 The AUID is specified as having the same syntax as an email
1196 address but it need not have the same semantics. Notably, the
1197 domain name need not be registered in the DNS -- so it might not
1198 resolve in a query -- and the local-part MAY be drawn from a
1199 namespace unrelated to any mailbox. The details of the structure
1200 and semantics for the namespace are determined by the Signer. Any
1201 knowledge or use of those details by Verifiers or Assessors is
1202 outside the scope of this specification. The Signer MAY choose to
1203 use the same namespace for its AUIDs as its users' email addresses
1204 or MAY choose other means of representing its users. However, the
1205 Signer SHOULD use the same AUID for each message intended to be
1206 evaluated as being within the same sphere of responsibility, if it
1207 wishes to offer receivers the option of using the AUID as a stable
1208 identifier that is finer grained than the SDID.
1210 INFORMATIVE NOTE: The local-part of the "i=" tag is optional
1211 because in some cases a Signer may not be able to establish a
1212 verified individual identity. In such cases, the Signer might
1213 wish to assert that although it is willing to go as far as
1214 signing for the domain, it is unable or unwilling to commit to
1215 an individual user name within the domain. It can do so by
1216 including the domain part but not the local-part of the
1219 INFORMATIVE DISCUSSION: This specification does not require the
1220 value of the "i=" tag to match the identity in any message
1221 header fields. This is considered to be a Verifier policy
1222 issue. Constraints between the value of the "i=" tag and other
1223 identities in other header fields seek to apply basic
1224 authentication into the semantics of trust associated with a
1225 role such as content author. Trust is a broad and complex
1226 topic, and trust mechanisms are subject to highly creative
1227 attacks. The real-world efficacy of any but the most basic
1228 bindings between the "i=" value and other identities is not
1229 well established, nor is its vulnerability to subversion by an
1230 attacker. Hence, reliance on the use of these options should
1234Crocker, et al. Standards Track [Page 22]
1236RFC 6376 DKIM Signatures September 2011
1239 be strictly limited. In particular, it is not at all clear to
1240 what extent a typical end-user recipient can rely on any
1241 assurances that might be made by successful use of the "i="
1245 default is entire body). This tag informs the Verifier of the
1246 number of octets in the body of the email after canonicalization
1247 included in the cryptographic hash, starting from 0 immediately
1248 following the CRLF preceding the body. This value MUST NOT be
1249 larger than the actual number of octets in the canonicalized
1250 message body. See further discussion in Section 8.2.
1252 INFORMATIVE NOTE: The value of the "l=" tag is constrained to
1253 76 decimal digits. This constraint is not intended to predict
1254 the size of future messages or to require implementations to
1255 use an integer representation large enough to represent the
1256 maximum possible value but is intended to remind the
1257 implementer to check the length of this and all other tags
1258 during verification and to test for integer overflow when
1259 decoding the value. Implementers may need to limit the actual
1260 value expressed to a value smaller than 10^76, e.g., to allow a
1261 message to fit within the available storage space.
1269 public key (plain-text; OPTIONAL, default is "dns/txt"). Each
1270 query method is of the form "type[/options]", where the syntax and
1271 semantics of the options depend on the type and specified options.
1272 If there are multiple query mechanisms listed, the choice of query
1273 mechanism MUST NOT change the interpretation of the signature.
1274 Implementations MUST use the recognized query mechanisms in the
1275 order presented. Unrecognized query mechanisms MUST be ignored.
1277 Currently, the only valid value is "dns/txt", which defines the
1278 DNS TXT resource record (RR) lookup algorithm described elsewhere
1279 in this document. The only option defined for the "dns" query
1280 type is "txt", which MUST be included. Verifiers and Signers MUST
1286 *([FWS] ":" [FWS] sig-q-tag-method)
1290Crocker, et al. Standards Track [Page 23]
1292RFC 6376 DKIM Signatures September 2011
1296 ["/" x-sig-q-tag-args]
1297 x-sig-q-tag-type = hyphenated-word ; for future extension
1298 x-sig-q-tag-args = qp-hdr-value
1301 (plain-text; REQUIRED).
1304 described in Section 2.3 of [RFC5890].
1308 sig-s-tag = %x73 [FWS] "=" [FWS] selector
1311 RECOMMENDED, default is an unknown creation time). The time that
1312 this signature was created. The format is the number of seconds
1313 since 00:00:00 on January 1, 1970 in the UTC time zone. The value
1314 is expressed as an unsigned integer in decimal ASCII. This value
1315 is not constrained to fit into a 31- or 32-bit integer.
1316 Implementations SHOULD be prepared to handle values up to at least
1317 10^12 (until approximately AD 200,000; this fits into 40 bits).
1318 To avoid denial-of-service attacks, implementations MAY consider
1319 any value longer than 12 digits to be infinite. Leap seconds are
1320 not counted. Implementations MAY ignore signatures that have a
1321 timestamp in the future.
1328 RECOMMENDED, default is no expiration). The format is the same as
1329 in the "t=" tag, represented as an absolute date, not as a time
1330 delta from the signing timestamp. The value is expressed as an
1331 unsigned integer in decimal ASCII, with the same constraints on
1332 the value in the "t=" tag. Signatures MAY be considered invalid
1333 if the verification time at the Verifier is past the expiration
1334 date. The verification time should be the time that the message
1335 was first received at the administrative domain of the Verifier if
1336 that time is reliably available; otherwise, the current time
1338 the value of the "t=" tag if both are present.
1346Crocker, et al. Standards Track [Page 24]
1348RFC 6376 DKIM Signatures September 2011
1351 INFORMATIVE NOTE: Due to clock drift, the receiver's notion of
1352 when to consider the signature expired may not exactly match
1353 what the sender is expecting. Receivers MAY add a 'fudge
1354 factor' to allow for such possible drift.
1362 OPTIONAL, default is null). A vertical-bar-separated list of
1363 selected header fields present when the message was signed,
1364 including both the field name and value. It is not required to
1365 include all header fields present at the time of signing. This
1366 field need not contain the same header fields listed in the "h="
1367 tag. The header field text itself must encode the vertical bar
1368 ("|", %x7C) character (i.e., vertical bars in the "z=" text are
1369 meta-characters, and any actual vertical bar characters in a
1370 copied header field must be encoded). Note that all whitespace
1371 must be encoded, including whitespace between the colon and the
1373 locations in order to avoid excessively long lines; such
1374 whitespace is NOT part of the value of the header field and MUST
1375 be removed before decoding.
1377 The header fields referenced by the "h=" tag refer to the fields
1378 in the [RFC5322] header of the message, not to any copied fields
1379 in the "z=" tag. Copied header field values are for diagnostic
1385 *( "|" [FWS] sig-z-tag-copy )
1388 INFORMATIVE EXAMPLE of a signature header field spread across
1389 multiple continuation lines:
1392 c=simple; q=dns/txt; i=@eng.example.net;
1394 h=from:to:subject:date;
1395 z=From:foo@eng.example.net|To:joe@example.com|
1396 Subject:demo=20run|Date:July=205,=202005=203:44:08=20PM=20-0700;
1397 bh=MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=;
1398 b=dzdVyOfAKCdLXdJOc9G2q8LoXSlEniSbav+yuU4zGeeruD00lszZVoG4ZHRNiYzR
1402Crocker, et al. Standards Track [Page 25]
1404RFC 6376 DKIM Signatures September 2011
14073.6. Key Management and Representation
1409 Signature applications require some level of assurance that the
1410 verification public key is associated with the claimed Signer. Many
1411 applications achieve this by using public-key certificates issued by
1412 a trusted third party. However, DKIM can achieve a sufficient level
1413 of security, with significantly enhanced scalability, by simply
1414 having the Verifier query the purported Signer's DNS entry (or some
1415 security-equivalent) in order to retrieve the public key.
1417 DKIM keys can potentially be stored in multiple types of key servers
1418 and in multiple formats. The storage and format of keys are
1419 irrelevant to the remainder of the DKIM algorithm.
1421 Parameters to the key lookup algorithm are the type of the lookup
1422 (the "q=" tag), the domain of the Signer (the "d=" tag of the DKIM-
1423 Signature header field), and the selector (the "s=" tag).
1425 public_key = dkim_find_key(q_val, d_val, s_val)
1427 This document defines a single binding, using DNS TXT RRs to
1428 distribute the keys. Other bindings may be defined in the future.
14303.6.1. Textual Representation
1432 It is expected that many key servers will choose to present the keys
1433 in an otherwise unstructured text format (for example, an XML form
1434 would not be considered to be unstructured text for this purpose).
1435 The following definition MUST be used for any DKIM key represented in
1436 an otherwise unstructured textual form.
1440 and MUST be ignored by any implementation that does not understand
1444 is "DKIM1"). If specified, this tag MUST be set to "DKIM1"
1445 (without the quotes). This tag MUST be the first tag in the
1446 record. Records beginning with a "v=" tag with any other value
1447 MUST be discarded. Note that Verifiers must do a string
1448 comparison on this value; for example, "DKIM1" is not the same as
1453 key-v-tag = %x76 [FWS] "=" [FWS] %x44.4B.49.4D.31
1458Crocker, et al. Standards Track [Page 26]
1460RFC 6376 DKIM Signatures September 2011
1464 allowing all algorithms). A colon-separated list of hash
1465 algorithms that might be used. Unrecognized algorithms MUST be
1466 ignored. Refer to Section 3.3 for a discussion of the hash
1467 algorithms implemented by Signers and Verifiers. The set of
1468 algorithms listed in this tag in each record is an operational
1469 choice made by the Signer.
1473 key-h-tag = %x68 [FWS] "=" [FWS] key-h-tag-alg
1474 *( [FWS] ":" [FWS] key-h-tag-alg )
1475 key-h-tag-alg = "sha1" / "sha256" / x-key-h-tag-alg
1476 x-key-h-tag-alg = hyphenated-word ; for future extension
1479 Verifiers MUST support the "rsa" key type. The "rsa" key type
1480 indicates that an ASN.1 DER-encoded [ITU-X660-1997] RSAPublicKey
1481 (see [RFC3447], Sections 3.1 and A.1.1) is being used in the "p="
1482 tag. (Note: the "p=" tag further encodes the value using the
1483 base64 algorithm.) Unrecognized key types MUST be ignored.
1487 key-k-tag = %x76 [FWS] "=" [FWS] key-k-tag-type
1488 key-k-tag-type = "rsa" / x-key-k-tag-type
1489 x-key-k-tag-type = hyphenated-word ; for future extension
1492 default is empty). No interpretation is made by any program.
1493 This tag should be used sparingly in any key server mechanism that
1494 has space limitations (notably DNS). This is intended for use by
1495 administrators, not end users.
1499 key-n-tag = %x6e [FWS] "=" [FWS] qp-section
1502 this public key has been revoked. The syntax and semantics of
1503 this tag value before being encoded in base64 are defined by the
1506 INFORMATIVE RATIONALE: If a private key has been compromised or
1507 otherwise disabled (e.g., an outsourcing contract has been
1508 terminated), a Signer might want to explicitly state that it
1509 knows about the selector, but all messages using that selector
1514Crocker, et al. Standards Track [Page 27]
1516RFC 6376 DKIM Signatures September 2011
1519 should fail verification. Verifiers SHOULD return an error
1520 code for any DKIM-Signature header field with a selector
1521 referencing a revoked key. (See Section 6.1.2 for details.)
1525 key-p-tag = %x70 [FWS] "=" [ [FWS] base64string]
1527 INFORMATIVE NOTE: A base64string is permitted to include
1528 whitespace (FWS) at arbitrary places; however, any CRLFs must
1529 be followed by at least one WSP character. Implementers and
1530 administrators are cautioned to ensure that selector TXT RRs
1531 conform to this specification.
1534 separated list of service types to which this record applies.
1535 Verifiers for a given service type MUST ignore this record if the
1536 appropriate type is not listed. Unrecognized service types MUST
1537 be ignored. Currently defined service types are as follows:
1539 * matches all service types
1543 This tag is intended to constrain the use of keys for other
1544 purposes, should use of DKIM be defined by other services in the
1549 key-s-tag = %x73 [FWS] "=" [FWS] key-s-tag-type
1550 *( [FWS] ":" [FWS] key-s-tag-type )
1551 key-s-tag-type = "email" / "*" / x-key-s-tag-type
1552 x-key-s-tag-type = hyphenated-word ; for future extension
1555 text; OPTIONAL, default is no flags set). Unrecognized flags MUST
1556 be ignored. The defined flags are as follows:
1559 from Signers in testing mode differently from unsigned email,
1560 even should the signature fail to verify. Verifiers MAY wish
1561 to track testing mode results to assist the Signer.
1570Crocker, et al. Standards Track [Page 28]
1572RFC 6376 DKIM Signatures September 2011
1576 the same domain value on the right-hand side of the "@" in the
1577 "i=" tag and the value of the "d=" tag. That is, the "i="
1578 domain MUST NOT be a subdomain of "d=". Use of this flag is
1579 RECOMMENDED unless subdomaining is required.
1583 key-t-tag = %x74 [FWS] "=" [FWS] key-t-tag-flag
1584 *( [FWS] ":" [FWS] key-t-tag-flag )
1585 key-t-tag-flag = "y" / "s" / x-key-t-tag-flag
1586 x-key-t-tag-flag = hyphenated-word ; for future extension
1590 A binding using DNS TXT RRs as a key service is hereby defined. All
1591 implementations MUST support this binding.
1595 All DKIM keys are stored in a subdomain named "_domainkey". Given a
1596 DKIM-Signature field with a "d=" tag of "example.com" and an "s=" tag
1597 of "foo.bar", the DNS query will be for
1598 "foo.bar._domainkey.example.com".
16003.6.2.2. Resource Record Types for Key Storage
1602 The DNS Resource Record type used is specified by an option to the
1603 query-type ("q=") tag. The only option defined in this base
1604 specification is "txt", indicating the use of a TXT RR. A later
1605 extension of this standard may define another RR type.
1607 Strings in a TXT RR MUST be concatenated together before use with no
1608 intervening whitespace. TXT RRs MUST be unique for a particular
1610 the results are undefined.
1612 TXT RRs are encoded as described in Section 3.6.1.
16143.7. Computing the Message Hashes
1616 Both signing and verifying message signatures start with a step of
1617 computing two cryptographic hashes over the message. Signers will
1618 choose the parameters of the signature as described in "Signer
1619 Actions" (Section 5); Verifiers will use the parameters specified in
1620 the DKIM-Signature header field being verified. In the following
1621 discussion, the names of the tags in the DKIM-Signature header field
1622 that either exists (when verifying) or will be created (when signing)
1626Crocker, et al. Standards Track [Page 29]
1628RFC 6376 DKIM Signatures September 2011
1631 are used. Note that canonicalization (Section 3.4) is only used to
1632 prepare the email for signing or verifying; it does not affect the
1633 transmitted email in any way.
1635 The Signer/Verifier MUST compute two hashes: one over the body of the
1636 message and one over the selected header fields of the message.
1638 Signers MUST compute them in the order shown. Verifiers MAY compute
1639 them in any order convenient to the Verifier, provided that the
1640 result is semantically identical to the semantics that would be the
1641 case had they been computed in this order.
1643 In hash step 1, the Signer/Verifier MUST hash the message body,
1644 canonicalized using the body canonicalization algorithm specified in
1645 the "c=" tag and then truncated to the length specified in the "l="
1646 tag. That hash value is then converted to base64 form and inserted
1647 into (Signers) or compared to (Verifiers) the "bh=" tag of the DKIM-
1648 Signature header field.
1650 In hash step 2, the Signer/Verifier MUST pass the following to the
1651 hash algorithm in the indicated order.
1653 1. The header fields specified by the "h=" tag, in the order
1654 specified in that tag, and canonicalized using the header
1655 canonicalization algorithm specified in the "c=" tag. Each
1656 header field MUST be terminated with a single CRLF.
1658 2. The DKIM-Signature header field that exists (verifying) or will
1660 tag (including all surrounding whitespace) deleted (i.e., treated
1661 as the empty string), canonicalized using the header
1662 canonicalization algorithm specified in the "c=" tag, and without
1665 All tags and their values in the DKIM-Signature header field are
1666 included in the cryptographic hash with the sole exception of the
1668 the null string. All tags MUST be included even if they might not be
1669 understood by the Verifier. The header field MUST be presented to
1670 the hash algorithm after the body of the message rather than with the
1671 rest of the header fields and MUST be canonicalized as specified in
1672 the "c=" (canonicalization) tag. The DKIM-Signature header field
1673 MUST NOT be included in its own "h=" tag, although other DKIM-
1674 Signature header fields MAY be signed (see Section 4).
1676 When calculating the hash on messages that will be transmitted using
1677 base64 or quoted-printable encoding, Signers MUST compute the hash
1678 after the encoding. Likewise, the Verifier MUST incorporate the
1682Crocker, et al. Standards Track [Page 30]
1684RFC 6376 DKIM Signatures September 2011
1687 values into the hash before decoding the base64 or quoted-printable
1688 text. However, the hash MUST be computed before transport-level
1689 encodings such as SMTP "dot-stuffing" (the modification of lines
1690 beginning with a "." to avoid confusion with the SMTP end-of-message
1691 marker, as specified in [RFC5321]).
1693 With the exception of the canonicalization procedure described in
1694 Section 3.4, the DKIM signing process treats the body of messages as
1695 simply a string of octets. DKIM messages MAY be either in plain-text
1696 or in MIME format; no special treatment is afforded to MIME content.
1697 Message attachments in MIME format MUST be included in the content
1702 body-hash = hash-alg (canon-body, l-param)
1703 data-hash = hash-alg (h-headers, D-SIG, body-hash)
1704 signature = sig-alg (d-domain, selector, data-hash)
1708 body-hash: is the output from hashing the body, using hash-alg.
1710 hash-alg: is the hashing algorithm specified in the "a" parameter.
1712 canon-body: is a canonicalized representation of the body, produced
1713 using the body algorithm specified in the "c" parameter,
1714 as defined in Section 3.4 and excluding the
1715 DKIM-Signature field.
1717 l-param: is the length-of-body value of the "l" parameter.
1719 data-hash: is the output from using the hash-alg algorithm, to hash
1720 the header including the DKIM-Signature header, and the
1723 h-headers: is the list of headers to be signed, as specified in the
1726 D-SIG: is the canonicalized DKIM-Signature field itself without
1727 the signature value portion of the parameter, that is, an
1728 empty parameter value.
1730 signature: is the signature value produced by the signing algorithm.
1732 sig-alg: is the signature algorithm specified by the "a"
1738Crocker, et al. Standards Track [Page 31]
1740RFC 6376 DKIM Signatures September 2011
1743 d-domain: is the domain name specified in the "d" parameter.
1745 selector: is the selector value specified in the "s" parameter.
1747 NOTE: Many digital signature APIs provide both hashing and
1748 application of the RSA private key using a single "sign()"
1749 primitive. When using such an API, the last two steps in the
1750 algorithm would probably be combined into a single call that would
1751 perform both the "a-hash-alg" and the "sig-alg".
17533.8. Input Requirements
1755 A message that is not compliant with [RFC5322], [RFC2045], and
1756 [RFC2047] can be subject to attempts by intermediaries to correct or
1757 interpret such content. See Section 8 of [RFC4409] for examples of
1758 changes that are commonly made. Such "corrections" may invalidate
1759 DKIM signatures or have other undesirable effects, including some
1760 that involve changes to the way a message is presented to an end
1763 Accordingly, DKIM's design is predicated on valid input. Therefore,
1764 Signers and Verifiers SHOULD take reasonable steps to ensure that the
1765 messages they are processing are valid according to [RFC5322],
1766 [RFC2045], and any other relevant message format standards.
1768 See Section 8.15 for additional discussion.
1772 The evaluation of each signature ends in one of three states, which
1773 this document refers to as follows:
1775 SUCCESS: a successful verification
1777 PERMFAIL: a permanent, non-recoverable error such as a signature
1778 verification failure
1780 TEMPFAIL: a temporary, recoverable error such as a DNS query timeout
1782 For each signature that verifies successfully or produces a TEMPFAIL
1783 result, output of the DKIM algorithm MUST include the set of:
1785 o The domain name, taken from the "d=" signature tag; and
1787 o The result of the verification attempt for that signature.
1794Crocker, et al. Standards Track [Page 32]
1796RFC 6376 DKIM Signatures September 2011
1799 The output MAY include other signature properties or result meta-
1800 data, including PERMFAILed or otherwise ignored signatures, for use
1801 by modules that consume those results.
1803 See Section 6.1 for discussion of signature validation result codes.
1807 In some circumstances, it is desirable for a domain to apply a
1808 signature on behalf of any of its subdomains without the need to
1809 maintain separate selectors (key records) in each subdomain. By
1810 default, private keys corresponding to key records can be used to
1811 sign messages for any subdomain of the domain in which they reside;
1812 for example, a key record for the domain example.com can be used to
1813 verify messages where the AUID ("i=" tag of the signature) is
1814 sub.example.com, or even sub1.sub2.example.com. In order to limit
1815 the capability of such keys when this is not intended, the "s" flag
1816 MAY be set in the "t=" tag of the key record, to constrain the
1817 validity of the domain of the AUID. If the referenced key record
1818 contains the "s" flag as part of the "t=" tag, the domain of the AUID
1819 ("i=" flag) MUST be the same as that of the SDID (d=) domain. If
1820 this flag is absent, the domain of the AUID MUST be the same as, or a
1821 subdomain of, the SDID.
18233.11. Relationship between SDID and AUID
1825 DKIM's primary task is to communicate from the Signer to a recipient-
1826 side Identity Assessor a single Signing Domain Identifier (SDID) that
1827 refers to a responsible identity. DKIM MAY optionally provide a
1828 single responsible Agent or User Identifier (AUID).
1830 Hence, DKIM's mandatory output to a receive-side Identity Assessor is
1831 a single domain name. Within the scope of its use as DKIM output,
1832 the name has only basic domain name semantics; any possible owner-
1833 specific semantics are outside the scope of DKIM. That is, within
1834 its role as a DKIM identifier, additional semantics cannot be assumed
1835 by an Identity Assessor.
1837 Upon successfully verifying the signature, a receive-side DKIM
1838 Verifier MUST communicate the Signing Domain Identifier (d=) to a
1839 consuming Identity Assessor module and MAY communicate the Agent or
1840 User Identifier (i=) if present.
1842 To the extent that a receiver attempts to intuit any structured
1843 semantics for either of the identifiers, this is a heuristic function
1844 that is outside the scope of DKIM's specification and semantics.
1850Crocker, et al. Standards Track [Page 33]
1852RFC 6376 DKIM Signatures September 2011
1855 Hence, it is relegated to a higher-level service, such as a delivery-
1856 handling filter that integrates a variety of inputs and performs
1857 heuristic analysis of them.
1859 INFORMATIVE DISCUSSION: This document does not require the value
1860 of the SDID or AUID to match an identifier in any other message
1861 header field. This requirement is, instead, an Assessor policy
1862 issue. The purpose of such a linkage would be to authenticate the
1863 value in that other header field. This, in turn, is the basis for
1864 applying a trust assessment based on the identifier value. Trust
1865 is a broad and complex topic, and trust mechanisms are subject to
1866 highly creative attacks. The real-world efficacy of any but the
1867 most basic bindings between the SDID or AUID and other identities
1868 is not well established, nor is its vulnerability to subversion by
1869 an attacker. Hence, reliance on the use of such bindings should
1870 be strictly limited. In particular, it is not at all clear to
1871 what extent a typical end-user recipient can rely on any
1872 assurances that might be made by successful use of the SDID or
18754. Semantics of Multiple Signatures
18774.1. Example Scenarios
1879 There are many reasons why a message might have multiple signatures.
1880 For example, suppose SHA-256 is in the future found to be
1881 insufficiently strong, and DKIM usage transitions to SHA-1024. A
1882 Signer might immediately sign using the newer algorithm but also
1883 continue to sign using the older algorithm for interoperability with
1884 Verifiers that had not yet upgraded. The Signer would do this by
1885 adding two DKIM-Signature header fields, one using each algorithm.
1886 Older Verifiers that did not recognize SHA-1024 as an acceptable
1887 algorithm would skip that signature and use the older algorithm;
1888 newer Verifiers could use either signature at their option and, all
1889 other things being equal, might not even attempt to verify the other
1892 Similarly, a Signer might sign a message including all header fields
1893 and no "l=" tag (to satisfy strict Verifiers) and a second time with
1894 a limited set of header fields and an "l=" tag (in anticipation of
1895 possible message modifications en route to other Verifiers).
1896 Verifiers could then choose which signature they prefer.
1898 Of course, a message might also have multiple signatures because it
1899 passed through multiple Signers. A common case is expected to be
1900 that of a signed message that passes through a mailing list that also
1906Crocker, et al. Standards Track [Page 34]
1908RFC 6376 DKIM Signatures September 2011
1911 signs all messages. Assuming both of those signatures verify, a
1912 recipient might choose to accept the message if either of those
1913 signatures were known to come from trusted sources.
1916 which they have subscribed and that have acceptable anti-abuse
1917 policies so as to accept messages sent to that list even from unknown
1918 authors. They might also subscribe to less trusted mailing lists
1919 (e.g., those without anti-abuse protection) and be willing to accept
1920 all messages from specific authors but insist on doing additional
1921 abuse scanning for other messages.
1923 Another related example of multiple Signers might be forwarding
1924 services, such as those commonly associated with academic alumni
1925 sites. For example, a recipient might have an address at
1926 members.example.org, a site that has anti-abuse protection that is
1927 somewhat less effective than the recipient would prefer. Such a
1928 recipient might have specific authors whose messages would be trusted
1929 absolutely, but messages from unknown authors that had passed the
1930 forwarder's scrutiny would have only medium trust.
1934 A Signer that is adding a signature to a message merely creates a new
1935 DKIM-Signature header, using the usual semantics of the "h=" option.
1936 A Signer MAY sign previously existing DKIM-Signature header fields
1937 using the method described in Section 5.4 to sign trace header
1940 Note that Signers should be cognizant that signing DKIM-Signature
1941 header fields may result in signature failures with intermediaries
1942 that do not recognize that DKIM-Signature header fields are trace
1943 header fields and unwittingly reorder them, thus breaking such
1944 signatures. For this reason, signing existing DKIM-Signature header
1945 fields is unadvised, albeit legal.
1947 INFORMATIVE NOTE: If a header field with multiple instances is
1948 signed, those header fields are always signed from the bottom up.
1949 Thus, it is not possible to sign only specific DKIM-Signature
1950 header fields. For example, if the message being signed already
1951 contains three DKIM-Signature header fields A, B, and C, it is
1952 possible to sign all of them, B and C only, or C only, but not A
1953 only, B only, A and B only, or A and C only.
1955 A Signer MAY add more than one DKIM-Signature header field using
1956 different parameters. For example, during a transition period, a
1957 Signer might want to produce signatures using two different hash
1962Crocker, et al. Standards Track [Page 35]
1964RFC 6376 DKIM Signatures September 2011
1967 Signers SHOULD NOT remove any DKIM-Signature header fields from
1968 messages they are signing, even if they know that the signatures
1971 When evaluating a message with multiple signatures, a Verifier SHOULD
1972 evaluate signatures independently and on their own merits. For
1973 example, a Verifier that by policy chooses not to accept signatures
1974 with deprecated cryptographic algorithms would consider such
1975 signatures invalid. Verifiers MAY process signatures in any order of
1976 their choice; for example, some Verifiers might choose to process
1977 signatures corresponding to the From field in the message header
1978 before other signatures. See Section 6.1 for more information about
1981 INFORMATIVE IMPLEMENTATION NOTE: Verifier attempts to correlate
1982 valid signatures with invalid signatures in an attempt to guess
1983 why a signature failed are ill-advised. In particular, there is
1984 no general way that a Verifier can determine that an invalid
1985 signature was ever valid.
1987 Verifiers SHOULD continue to check signatures until a signature
1988 successfully verifies to the satisfaction of the Verifier. To limit
1989 potential denial-of-service attacks, Verifiers MAY limit the total
1990 number of signatures they will attempt to verify.
1992 If a Verifier module reports signatures whose evaluations produced
1993 PERMFAIL results, Identity Assessors SHOULD ignore those signatures
1994 (see Section 6.1), acting as though they were not present in the
1999 The following steps are performed in order by Signers.
20015.1. Determine Whether the Email Should Be Signed and by Whom
2003 A Signer can obviously only sign email for domains for which it has a
2004 private key and the necessary knowledge of the corresponding public
2005 key and selector information. However, there are a number of other
2006 reasons beyond the lack of a private key why a Signer could choose
2007 not to sign an email.
2009 INFORMATIVE NOTE: A Signer can be implemented as part of any
2010 portion of the mail system as deemed appropriate, including an
2011 MUA, a SUBMISSION server, or an MTA. Wherever implemented,
2012 Signers should beware of signing (and thereby asserting
2013 responsibility for) messages that may be problematic. In
2014 particular, within a trusted enclave, the signing domain might be
2018Crocker, et al. Standards Track [Page 36]
2020RFC 6376 DKIM Signatures September 2011
2023 derived from the header according to local policy; SUBMISSION
2024 servers might only sign messages from users that are properly
2025 authenticated and authorized.
2027 INFORMATIVE IMPLEMENTER ADVICE: SUBMISSION servers should not sign
2028 Received header fields if the outgoing gateway MTA obfuscates
2029 Received header fields, for example, to hide the details of
2032 If an email cannot be signed for some reason, it is a local policy
2033 decision as to what to do with that email.
20355.2. Select a Private Key and Corresponding Selector Information
2037 This specification does not define the basis by which a Signer should
2038 choose which private key and selector information to use. Currently,
2039 all selectors are equal as far as this specification is concerned, so
2040 the decision should largely be a matter of administrative
2041 convenience. Distribution and management of private keys is also
2042 outside the scope of this document.
2044 INFORMATIVE OPERATIONS ADVICE: A Signer should not sign with a
2045 private key when the selector containing the corresponding public
2046 key is expected to be revoked or removed before the Verifier has
2047 an opportunity to validate the signature. The Signer should
2048 anticipate that Verifiers can choose to defer validation, perhaps
2049 until the message is actually read by the final recipient. In
2050 particular, when rotating to a new key pair, signing should
2051 immediately commence with the new private key, and the old public
2052 key should be retained for a reasonable validation interval before
2053 being removed from the key server.
20555.3. Normalize the Message to Prevent Transport Conversions
2057 Some messages, particularly those using 8-bit characters, are subject
2058 to modification during transit, notably conversion to 7-bit form.
2059 Such conversions will break DKIM signatures. In order to minimize
2060 the chances of such breakage, Signers SHOULD convert the message to a
2061 suitable MIME content-transfer encoding such as quoted-printable or
2062 base64 as described in [RFC2045] before signing. Such conversion is
2063 outside the scope of DKIM; the actual message SHOULD be converted to
2064 7-bit MIME by an MUA or MSA prior to presentation to the DKIM
2067 If the message is submitted to the Signer with any local encoding
2068 that will be modified before transmission, that modification to
2069 canonical [RFC5322] form MUST be done before signing. In particular,
2070 bare CR or LF characters (used by some systems as a local line
2074Crocker, et al. Standards Track [Page 37]
2076RFC 6376 DKIM Signatures September 2011
2079 separator convention) MUST be converted to the SMTP-standard CRLF
2080 sequence before the message is signed. Any conversion of this sort
2081 SHOULD be applied to the message actually sent to the recipient(s),
2082 not just to the version presented to the signing algorithm.
2084 More generally, the Signer MUST sign the message as it is expected to
2085 be received by the Verifier rather than in some local or internal
2090 A body length count MAY be specified to limit the signature
2091 calculation to an initial prefix of the body text, measured in
2092 octets. If the body length count is not specified, the entire
2093 message body is signed.
2095 INFORMATIVE RATIONALE: This capability is provided because it is
2096 very common for mailing lists to add trailers to messages (e.g.,
2097 instructions on how to get off the list). Until those messages
2098 are also signed, the body length count is a useful tool for the
2099 Verifier since it can, as a matter of policy, accept messages
2100 having valid signatures with extraneous data.
2102 The length actually hashed should be inserted in the "l=" tag of the
2103 DKIM-Signature header field. (See Section 3.5.)
2105 The body length count allows the Signer of a message to permit data
2106 to be appended to the end of the body of a signed message. The body
2107 length count MUST be calculated following the canonicalization
2108 algorithm; for example, any whitespace ignored by a canonicalization
2109 algorithm is not included as part of the body length count.
2111 A body length count of zero means that the body is completely
2114 Signers wishing to ensure that no modification of any sort can occur
2115 should specify the "simple" canonicalization algorithm for both
2116 header and body and omit the body length count.
2118 See Section 8.2 for further discussion.
21205.4. Determine the Header Fields to Sign
2123 tag of the resulting DKIM-Signature header field). Signers SHOULD
2124 NOT sign an existing header field likely to be legitimately modified
2125 or removed in transit. In particular, [RFC5321] explicitly permits
2130Crocker, et al. Standards Track [Page 38]
2132RFC 6376 DKIM Signatures September 2011
2135 modification or removal of the Return-Path header field in transit.
2136 Signers MAY include any other header fields present at the time of
2137 signing at the discretion of the Signer.
2140 sign is non-obvious. One strategy is to sign all existing, non-
2141 repeatable header fields. An alternative strategy is to sign only
2142 header fields that are likely to be displayed to or otherwise be
2143 likely to affect the processing of the message at the receiver. A
2144 third strategy is to sign only "well-known" headers. Note that
2145 Verifiers may treat unsigned header fields with extreme
2146 skepticism, including refusing to display them to the end user or
2147 even ignoring the signature if it does not cover certain header
2148 fields. For this reason, signing fields present in the message
2149 such as Date, Subject, Reply-To, Sender, and all MIME header
2150 fields are highly advised.
2152 The DKIM-Signature header field is always implicitly signed and MUST
2153 NOT be included in the "h=" tag except to indicate that other
2154 preexisting signatures are also signed.
2157 (that is, Signers MAY include the header field name in the "h=" tag
2158 even if that header field does not exist in the message). When
2159 computing the signature, the nonexisting header field MUST be treated
2160 as the null string (including the header field name, header field
2161 value, all punctuation, and the trailing CRLF).
2163 INFORMATIVE RATIONALE: This allows Signers to explicitly assert
2164 the absence of a header field; if that header field is added
2165 later, the signature will fail.
2167 INFORMATIVE NOTE: A header field name need only be listed once
2168 more than the actual number of that header field in a message at
2169 the time of signing in order to prevent any further additions.
2170 For example, if there is a single Comments header field at the
2171 time of signing, listing Comments twice in the "h=" tag is
2172 sufficient to prevent any number of Comments header fields from
2173 being appended; it is not necessary (but is legal) to list
2174 Comments three or more times in the "h=" tag.
2176 Refer to Section 5.4.2 for a discussion of the procedure to be
2177 followed when canonicalizing a header with more than one instance of
2178 a particular header field name.
2180 Signers need to be careful of signing header fields that might have
2181 additional instances added later in the delivery process, since such
2182 header fields might be inserted after the signed instance or
2186Crocker, et al. Standards Track [Page 39]
2188RFC 6376 DKIM Signatures September 2011
2191 otherwise reordered. Trace header fields (such as Received) and
2192 Resent-* blocks are the only fields prohibited by [RFC5322] from
2193 being reordered. In particular, since DKIM-Signature header fields
2194 may be reordered by some intermediate MTAs, signing existing DKIM-
2195 Signature header fields is error-prone.
2197 INFORMATIVE ADMONITION: Despite the fact that [RFC5322] does not
2198 prohibit the reordering of header fields, reordering of signed
2199 header fields with multiple instances by intermediate MTAs will
2200 cause DKIM signatures to be broken; such antisocial behavior
2204 specification, all end-user visible header fields should be signed
2205 to avoid possible "indirect spamming". For example, if the
2206 Subject header field is not signed, a spammer can resend a
2207 previously signed mail, replacing the legitimate subject with a
22105.4.1. Recommended Signature Content
2213 identifier to the message in a way that is both robust against normal
2214 transit-related changes and resistant to kinds of replay attacks. An
2215 essential aspect of satisfying these requirements is choosing what
2216 header fields to include in the hash and what fields to exclude.
2218 The basic rule for choosing fields to include is to select those
2219 fields that constitute the "core" of the message content. Hence, any
2220 replay attack will have to include these in order to have the
2221 signature succeed; however, with these included, the core of the
2222 message is valid, even if sent on to new recipients.
2224 Common examples of fields with addresses and fields with textual
2225 content related to the body are:
2227 o From (REQUIRED; see Section 5.4)
2237 o Resent-Date, Resent-From, Resent-To, Resent-Cc
2242Crocker, et al. Standards Track [Page 40]
2244RFC 6376 DKIM Signatures September 2011
2247 o In-Reply-To, References
2249 o List-Id, List-Help, List-Unsubscribe, List-Subscribe, List-Post,
2250 List-Owner, List-Archive
2252 If the "l=" signature tag is in use (see Section 3.5), the Content-
2253 Type field is also a candidate for being included as it could be
2254 replaced in a way that causes completely different content to be
2255 rendered to the receiving user.
2257 There are trade-offs in the decision of what constitutes the "core"
2258 of the message, which for some fields is a subjective concept.
2259 Including fields such as "Message-ID", for example, is useful if one
2260 considers a mechanism for being able to distinguish separate
2261 instances of the same message to be core content. Similarly, "In-
2262 Reply-To" and "References" might be desirable to include if one
2263 considers message threading to be a core part of the message.
2265 Another class of fields that may be of interest are those that convey
2266 security-related information about the message, such as
2267 Authentication-Results [RFC5451].
2270 fields for which there are multiple fields with the same name and
2271 fields that are modified in transit. Examples of these are:
2277 o Comments, Keywords
2279 Note that the DKIM-Signature field is also excluded from the header
2280 hash because its handling is specified separately.
2282 Typically, it is better to exclude other optional fields because of
2283 the potential that additional fields of the same name will be
2284 legitimately added or reordered prior to verification. There are
2285 likely to be legitimate exceptions to this rule because of the wide
2286 variety of application-specific header fields that might be applied
2287 to a message, some of which are unlikely to be duplicated, modified,
2290 Signers SHOULD choose canonicalization algorithms based on the types
2291 of messages they process and their aversion to risk. For example,
2292 e-commerce sites sending primarily purchase receipts, which are not
2293 expected to be processed by mailing lists or other software likely to
2294 modify messages, will generally prefer "simple" canonicalization.
2298Crocker, et al. Standards Track [Page 41]
2300RFC 6376 DKIM Signatures September 2011
2303 Sites sending primarily person-to-person email will likely prefer to
2304 be more resilient to modification during transport by using "relaxed"
2308 lists that might add "unsubscribe" instructions to the bottom of the
2309 message body, the "l=" tag is likely to convey no additional benefit
2310 while providing an avenue for unauthorized addition of text to a
2311 message. The use of "l=0" takes this to the extreme, allowing
2312 complete alteration of the text of the message without invalidating
2313 the signature. Moreover, a Verifier would be within its rights to
2314 consider a partly signed message body as unacceptable. Judicious use
23175.4.2. Signatures Involving Multiple Instances of a Field
2319 Signers choosing to sign an existing header field that occurs more
2320 than once in the message (such as Received) MUST sign the physically
2321 last instance of that header field in the header block. Signers
2322 wishing to sign multiple instances of such a header field MUST
2323 include the header field name multiple times in the "h=" tag of the
2324 DKIM-Signature header field and MUST sign such header fields in order
2325 from the bottom of the header field block to the top. The Signer MAY
2326 include more instances of a header field name in "h=" than there are
2327 actual corresponding header fields so that the signature will not
2328 verify if additional header fields of that name are added.
2330 INFORMATIVE EXAMPLE:
2332 If the Signer wishes to sign two existing Received header fields,
2333 and the existing header contains:
2339 then the resulting DKIM-Signature header field should read:
2341 DKIM-Signature: ... h=Received : Received :...
2343 and Received header fields <C> and <B> will be signed in that
2354Crocker, et al. Standards Track [Page 42]
2356RFC 6376 DKIM Signatures September 2011
23595.5. Compute the Message Hash and Signature
2361 The Signer MUST compute the message hash as described in Section 3.7
2362 and then sign it using the selected public-key algorithm. This will
2363 result in a DKIM-Signature header field that will include the body
2364 hash and a signature of the header hash, where that header includes
2365 the DKIM-Signature header field itself.
2367 Entities such as mailing list managers that implement DKIM and that
2368 modify the message or a header field (for example, inserting
2369 unsubscribe information) before retransmitting the message SHOULD
2370 check any existing signature on input and MUST make such
2371 modifications before re-signing the message.
23735.6. Insert the DKIM-Signature Header Field
2375 Finally, the Signer MUST insert the DKIM-Signature header field
2376 created in the previous step prior to transmitting the email. The
2378 hash as described above, except that the value of the "b=" tag MUST
2379 be the appropriately signed hash computed in the previous step,
2380 signed using the algorithm specified in the "a=" tag of the DKIM-
2381 Signature header field and using the private key corresponding to the
2382 selector given in the "s=" tag of the DKIM-Signature header field, as
2383 chosen above in Section 5.2.
2385 The DKIM-Signature header field MUST be inserted before any other
2386 DKIM-Signature fields in the header block.
2388 INFORMATIVE IMPLEMENTATION NOTE: The easiest way to achieve this
2389 is to insert the DKIM-Signature header field at the beginning of
2390 the header block. In particular, it may be placed before any
2391 existing Received header fields. This is consistent with treating
2392 DKIM-Signature as a trace header field.
2396 Since a Signer MAY remove or revoke a public key at any time, it is
2397 advised that verification occur in a timely manner. In many
2398 configurations, the most timely place is during acceptance by the
2399 border MTA or shortly thereafter. In particular, deferring
2400 verification until the message is accessed by the end user is
2403 A border or intermediate MTA MAY verify the message signature(s). An
2404 MTA who has performed verification MAY communicate the result of that
2405 verification by adding a verification header field to incoming
2406 messages. This simplifies things considerably for the user, who can
2410Crocker, et al. Standards Track [Page 43]
2412RFC 6376 DKIM Signatures September 2011
2415 now use an existing mail user agent. Most MUAs have the ability to
2416 filter messages based on message header fields or content; these
2417 filters would be used to implement whatever policy the user wishes
2418 with respect to unsigned mail.
2420 A verifying MTA MAY implement a policy with respect to unverifiable
2421 mail, regardless of whether or not it applies the verification header
2422 field to signed messages.
2424 Verifiers MUST produce a result that is semantically equivalent to
2425 applying the steps listed in Sections 6.1, 6.1.1, and 6.1.2 in order.
2426 In practice, several of these steps can be performed in parallel in
2427 order to improve performance.
24296.1. Extract Signatures from the Message
2431 The order in which Verifiers try DKIM-Signature header fields is not
2432 defined; Verifiers MAY try signatures in any order they like. For
2433 example, one implementation might try the signatures in textual
2434 order, whereas another might try signatures by identities that match
2435 the contents of the From header field before trying other signatures.
2436 Verifiers MUST NOT attribute ultimate meaning to the order of
2437 multiple DKIM-Signature header fields. In particular, there is
2438 reason to believe that some relays will reorder the header fields in
2439 potentially arbitrary ways.
2441 INFORMATIVE IMPLEMENTATION NOTE: Verifiers might use the order as
2442 a clue to signing order in the absence of any other information.
2443 However, other clues as to the semantics of multiple signatures
2444 (such as correlating the signing host with Received header fields)
2445 might also be considered.
2448 signatures can fail to verify through no fault of the Signer.
2449 Therefore, a Verifier SHOULD NOT treat a message that has one or more
2450 bad signatures and no good signatures differently from a message with
2451 no signature at all.
2453 When a signature successfully verifies, a Verifier will either stop
2454 processing or attempt to verify any other signatures, at the
2455 discretion of the implementation. A Verifier MAY limit the number of
2456 signatures it tries, in order to avoid denial-of-service attacks (see
2457 Section 8.4 for further discussion).
2460 (explanation)" (where "status" is one of "PERMFAIL" or "TEMPFAIL")
2461 means that the Verifier MUST immediately cease processing that
2462 signature. The Verifier SHOULD proceed to the next signature, if one
2466Crocker, et al. Standards Track [Page 44]
2468RFC 6376 DKIM Signatures September 2011
2471 is present, and completely ignore the bad signature. If the status
2472 is "PERMFAIL", the signature failed and should not be reconsidered.
2473 If the status is "TEMPFAIL", the signature could not be verified at
2474 this time but may be tried again later. A Verifier MAY either
2475 arrange to defer the message for later processing or try another
2476 signature; if no good signature is found and any of the signatures
2477 resulted in a TEMPFAIL status, the Verifier MAY arrange to defer the
2478 message for later processing. The "(explanation)" is not normative
2479 text; it is provided solely for clarification.
2481 Verifiers that are prepared to validate multiple signature header
2482 fields SHOULD proceed to the next signature header field, if one
2483 exists. However, Verifiers MAY make note of the fact that an invalid
2484 signature was present for consideration at a later step.
2486 INFORMATIVE NOTE: The rationale of this requirement is to permit
2487 messages that have invalid signatures but also a valid signature
2488 to work. For example, a mailing list exploder might opt to leave
2489 the original submitter signature in place even though the exploder
2490 knows that it is modifying the message in some way that will break
2491 that signature, and the exploder inserts its own signature. In
2492 this case, the message should succeed even in the presence of the
2493 known-broken signature.
2495 For each signature to be validated, the following steps should be
2496 performed in such a manner as to produce a result that is
2497 semantically equivalent to performing them in the indicated order.
24996.1.1. Validate the Signature Header Field
2501 Implementers MUST meticulously validate the format and values in the
2502 DKIM-Signature header field; any inconsistency or unexpected values
2504 to return PERMFAIL (signature syntax error). Being "liberal in what
2505 you accept" is definitely a bad strategy in this security context.
2506 Note, however, that this does not include the existence of unknown
2507 tags in a DKIM-Signature header field, which are explicitly
2508 permitted. Verifiers MUST return PERMFAIL (incompatible version)
2509 when presented a DKIM-Signature header field with a "v=" tag that is
2510 inconsistent with this specification.
2512 INFORMATIVE IMPLEMENTATION NOTE: An implementation may, of course,
2513 choose to also verify signatures generated by older versions of
2522Crocker, et al. Standards Track [Page 45]
2524RFC 6376 DKIM Signatures September 2011
2527 If any tag listed as "required" in Section 3.5 is omitted from the
2528 DKIM-Signature header field, the Verifier MUST ignore the DKIM-
2529 Signature header field and return PERMFAIL (signature missing
2533 "v=", "a=", "b=", "bh=", "d=", "h=", and "s=". Should there be a
2534 conflict between this note and Section 3.5, Section 3.5 is
2538 Verifier MUST behave as though the value of that tag were "@d", where
2539 "d" is the value from the "d=" tag.
2542 the same as or a parent domain of the domain part of the "i=" tag.
2543 If not, the DKIM-Signature header field MUST be ignored, and the
2544 Verifier should return PERMFAIL (domain mismatch).
2547 MUST ignore the DKIM-Signature header field and return PERMFAIL (From
2551 PERMFAIL (signature expired) if it contains an "x=" tag and the
2552 signature has expired.
2555 used by the Signer in the "d=" tag is not associated with a valid
2556 signing entity. For example, signatures with "d=" values such as
2557 "com" and "co.uk" could be ignored. The list of unacceptable domains
2558 SHOULD be configurable.
2561 PERMFAIL (unacceptable signature header) for any other reason, for
2562 example, if the signature does not sign header fields that the
2563 Verifier views to be essential. As a case in point, if MIME header
2564 fields are not signed, certain attacks may be possible that the
2565 Verifier would prefer to avoid.
25676.1.2. Get the Public Key
2569 The public key for a signature is needed to complete the verification
2570 process. The process of retrieving the public key depends on the
2571 query type as defined by the "q=" tag in the DKIM-Signature header
2572 field. Obviously, a public key need only be retrieved if the process
2573 of extracting the signature information is completely successful.
2578Crocker, et al. Standards Track [Page 46]
2580RFC 6376 DKIM Signatures September 2011
2583 Details of key management and representation are described in
2585 ignore any public-key records that are malformed.
2587 NOTE: The use of a wildcard TXT RR that covers a queried DKIM
2588 domain name will produce a response to a DKIM query that is
2589 unlikely to be a valid DKIM key record. This problem is not
2590 specific to DKIM and applies to many other types of queries.
2591 Client software that processes DNS responses needs to take this
2592 problem into account.
2594 When validating a message, a Verifier MUST perform the following
2595 steps in a manner that is semantically the same as performing them in
2596 the order indicated; in some cases, the implementation may
2597 parallelize or reorder these steps, as long as the semantics remain
2600 1. The Verifier retrieves the public key as described in Section 3.6
2601 using the algorithm in the "q=" tag, the domain from the "d="
2602 tag, and the selector from the "s=" tag.
2605 MAY seek a later verification attempt by returning TEMPFAIL (key
2609 key record does not exist, the Verifier MUST immediately return
2610 PERMFAIL (no key for signature).
2613 Verifier can choose one of the key records or may cycle through
2614 the key records, performing the remainder of these steps on each
2615 record at the discretion of the implementer. The order of the
2616 key records is unspecified. If the Verifier chooses to cycle
2617 through the key records, then the "return ..." wording in the
2618 remainder of this section means "try the next key record, if any;
2619 if none, return to try another signature in the usual way".
2622 format defined in this specification, the Verifier MUST ignore
2623 the key record and return PERMFAIL (key syntax error). Verifiers
2624 are urged to validate the syntax of key records carefully to
2625 avoid attempted attacks. In particular, the Verifier MUST ignore
2626 keys with a version code ("v=" tag) that they do not implement.
2634Crocker, et al. Standards Track [Page 47]
2636RFC 6376 DKIM Signatures September 2011
2640 algorithm implied by the "a=" tag in the DKIM-Signature header
2641 field is not included in the contents of the "h=" tag, the
2642 Verifier MUST ignore the key record and return PERMFAIL
2643 (inappropriate hash algorithm).
2646 been revoked and the Verifier MUST treat this as a failed
2647 signature check and return PERMFAIL (key revoked). There is no
2648 defined semantic difference between a key that has been revoked
2649 and a key record that has been removed.
2652 and key types defined by the "a=" and "k=" tags in the DKIM-
2653 Signature header field, the Verifier MUST immediately return
2654 PERMFAIL (inappropriate key algorithm).
2658 Given a Signer and a public key, verifying a signature consists of
2659 actions semantically equivalent to the following steps.
2661 1. Based on the algorithm defined in the "c=" tag, the body length
2662 specified in the "l=" tag, and the header field names in the "h="
2663 tag, prepare a canonicalized version of the message as is
2664 described in Section 3.7 (note that this canonicalized version
2665 does not actually replace the original content). When matching
2666 header field names in the "h=" tag against the actual message
2667 header field, comparisons MUST be case-insensitive.
2669 2. Based on the algorithm indicated in the "a=" tag, compute the
2670 message hashes from the canonical copy as described in
2673 3. Verify that the hash of the canonicalized message body computed
2674 in the previous step matches the hash value conveyed in the "bh="
2675 tag. If the hash does not match, the Verifier SHOULD ignore the
2676 signature and return PERMFAIL (body hash did not verify).
2678 4. Using the signature conveyed in the "b=" tag, verify the
2679 signature against the header hash using the mechanism appropriate
2680 for the public-key algorithm described in the "a=" tag. If the
2681 signature does not validate, the Verifier SHOULD ignore the
2682 signature and return PERMFAIL (signature did not verify).
2690Crocker, et al. Standards Track [Page 48]
2692RFC 6376 DKIM Signatures September 2011
2695 5. Otherwise, the signature has correctly verified.
2698 initiate the public-key query in parallel with calculating the
2699 hash as the public key is not needed until the final decryption is
2700 calculated. Implementations may also verify the signature on the
2701 message header before validating that the message hash listed in
2702 the "bh=" tag in the DKIM-Signature header field matches that of
2703 the actual message body; however, if the body hash does not match,
2704 the entire signature must be considered to have failed.
2707 number of bytes of the body passed to the verification algorithm.
2708 All data beyond that limit is not validated by DKIM. Hence,
2709 Verifiers might treat a message that contains bytes beyond the
2710 indicated body length with suspicion and can choose to treat the
2711 signature as if it were invalid (e.g., by returning PERMFAIL
2712 (unsigned content)).
2714 Should the algorithm reach this point, the verification has
2715 succeeded, and DKIM reports SUCCESS for this signature.
27176.2. Communicate Verification Results
2719 Verifiers wishing to communicate the results of verification to other
2720 parts of the mail system may do so in whatever manner they see fit.
2721 For example, implementations might choose to add an email header
2722 field to the message before passing it on. Any such header field
2723 SHOULD be inserted before any existing DKIM-Signature or preexisting
2724 authentication status header fields in the header field block. The
2725 Authentication-Results: header field ([RFC5451]) MAY be used for this
2728 INFORMATIVE ADVICE to MUA filter writers: Patterns intended to
2729 search for results header fields to visibly mark authenticated
2730 mail for end users should verify that such a header field was
2731 added by the appropriate verifying domain and that the verified
2732 identity matches the author identity that will be displayed by the
2733 MUA. In particular, MUA filters should not be influenced by bogus
2734 results header fields added by attackers. To circumvent this
2735 attack, Verifiers MAY wish to request deletion of existing results
2736 header fields after verification and before arranging to add a new
2746Crocker, et al. Standards Track [Page 49]
2748RFC 6376 DKIM Signatures September 2011
27516.3. Interpret Results/Apply Local Policy
2753 It is beyond the scope of this specification to describe what actions
2754 an Identity Assessor can make, but mail carrying a validated SDID
2755 presents an opportunity to an Identity Assessor that unauthenticated
2756 email does not. Specifically, an authenticated email creates a
2757 predictable identifier by which other decisions can reliably be
2758 managed, such as trust and reputation. Conversely, unauthenticated
2759 email lacks a reliable identifier that can be used to assign trust
2760 and reputation. It is reasonable to treat unauthenticated email as
2761 lacking any trust and having no positive reputation.
2763 In general, modules that consume DKIM verification output SHOULD NOT
2764 determine message acceptability based solely on a lack of any
2765 signature or on an unverifiable signature; such rejection would cause
2766 severe interoperability problems. If an MTA does wish to reject such
2767 messages during an SMTP session (for example, when communicating with
2768 a peer who, by prior agreement, agrees to only send signed messages),
2769 and a signature is missing or does not verify, the handling MTA
2770 SHOULD use a 550/5.7.x reply code.
2772 Where the Verifier is integrated within the MTA and it is not
2773 possible to fetch the public key, perhaps because the key server is
2774 not available, a temporary failure message MAY be generated using a
2775 451/4.7.5 reply code, such as:
2779 Temporary failures such as inability to access the key server or
2780 other external service are the only conditions that SHOULD use a 4xx
2781 SMTP reply code. In particular, cryptographic signature verification
2782 failures MUST NOT provoke 4xx SMTP replies.
2784 Once the signature has been verified, that information MUST be
2785 conveyed to the Identity Assessor (such as an explicit allow/
2786 whitelist and reputation system) and/or to the end user. If the SDID
2787 is not the same as the address in the From: header field, the mail
2788 system SHOULD take pains to ensure that the actual SDID is clear to
2791 While the symptoms of a failed verification are obvious -- the
2792 signature doesn't verify -- establishing the exact cause can be more
2793 difficult. If a selector cannot be found, is that because the
2794 selector has been removed, or was the value changed somehow in
2795 transit? If the signature line is missing, is that because it was
2796 never there, or was it removed by an overzealous filter? For
2797 diagnostic purposes, the exact reason why the verification fails
2798 SHOULD be made available and possibly recorded in the system logs.
2802Crocker, et al. Standards Track [Page 50]
2804RFC 6376 DKIM Signatures September 2011
2807 If the email cannot be verified, then it SHOULD be treated the same
2808 as all unverified email, regardless of whether or not it looks like
2811 See Section 8.15 for additional discussion.
28137. IANA Considerations
2815 DKIM has registered namespaces with IANA. In all cases, new values
2816 are assigned only for values that have been documented in a published
2817 RFC that has IETF Consensus [RFC5226].
2819 This memo updates these registries as described below. Of note is
2820 the addition of a new "status" column. All registrations into these
2821 namespaces MUST include the name being registered, the document in
2822 which it was registered or updated, and an indication of its current
2823 status, which MUST be one of "active" (in current use) or "historic"
2824 (no longer in current use).
2826 No new tags are defined in this specification compared to [RFC4871],
2827 but one has been designated as "historic".
2829 Also, the "Email Authentication Methods" registry is revised to refer
28327.1. Email Authentication Methods Registry
2834 The "Email Authentication Methods" registry is updated to indicate
2835 that "dkim" is defined in this memo.
28377.2. DKIM-Signature Tag Specifications
2839 A DKIM-Signature provides for a list of tag specifications. IANA has
2840 established the "DKIM-Signature Tag Specifications" registry for tag
2841 specifications that can be used in DKIM-Signature fields.
2858Crocker, et al. Standards Track [Page 51]
2860RFC 6376 DKIM Signatures September 2011
2863 +------+-----------------+--------+
2864 | TYPE | REFERENCE | STATUS |
2865 +------+-----------------+--------+
2866 | v | (this document) | active |
2867 | a | (this document) | active |
2868 | b | (this document) | active |
2869 | bh | (this document) | active |
2870 | c | (this document) | active |
2871 | d | (this document) | active |
2872 | h | (this document) | active |
2873 | i | (this document) | active |
2874 | l | (this document) | active |
2875 | q | (this document) | active |
2876 | s | (this document) | active |
2877 | t | (this document) | active |
2878 | x | (this document) | active |
2879 | z | (this document) | active |
2880 +------+-----------------+--------+
2882 Table 1: DKIM-Signature Tag Specifications Registry Updated Values
28847.3. DKIM-Signature Query Method Registry
2886 The "q=" tag-spec (specified in Section 3.5) provides for a list of
2889 IANA has established the "DKIM-Signature Query Method" registry for
2890 mechanisms that can be used to retrieve the key that will permit
2891 validation processing of a message signed using DKIM.
2893 +------+--------+-----------------+--------+
2894 | TYPE | OPTION | REFERENCE | STATUS |
2895 +------+--------+-----------------+--------+
2896 | dns | txt | (this document) | active |
2897 +------+--------+-----------------+--------+
2899 Table 2: DKIM-Signature Query Method Registry Updated Values
29017.4. DKIM-Signature Canonicalization Registry
2903 The "c=" tag-spec (specified in Section 3.5) provides for a specifier
2904 for canonicalization algorithms for the header and body of the
2907 IANA has established the "DKIM-Signature Canonicalization Header"
2908 Registry for algorithms for converting a message into a canonical
2909 form before signing or verifying using DKIM.
2914Crocker, et al. Standards Track [Page 52]
2916RFC 6376 DKIM Signatures September 2011
2919 +---------+-----------------+--------+
2920 | TYPE | REFERENCE | STATUS |
2921 +---------+-----------------+--------+
2922 | simple | (this document) | active |
2923 | relaxed | (this document) | active |
2924 +---------+-----------------+--------+
2926 Table 3: DKIM-Signature Canonicalization Header Registry Updated
2929 +---------+-----------------+--------+
2930 | TYPE | REFERENCE | STATUS |
2931 +---------+-----------------+--------+
2932 | simple | (this document) | active |
2933 | relaxed | (this document) | active |
2934 +---------+-----------------+--------+
2936 Table 4: DKIM-Signature Canonicalization Body Registry Updated Values
29387.5. _domainkey DNS TXT Resource Record Tag Specifications
2940 A _domainkey DNS TXT RR provides for a list of tag specifications.
2941 IANA has established the DKIM "_domainkey DNS TXT Record Tag
2942 Specifications" registry for tag specifications that can be used in
2943 DNS TXT resource records.
2945 +------+-----------------+----------+
2946 | TYPE | REFERENCE | STATUS |
2947 +------+-----------------+----------+
2948 | v | (this document) | active |
2949 | g | [RFC4871] | historic |
2950 | h | (this document) | active |
2951 | k | (this document) | active |
2952 | n | (this document) | active |
2953 | p | (this document) | active |
2954 | s | (this document) | active |
2955 | t | (this document) | active |
2956 +------+-----------------+----------+
2958 Table 5: _domainkey DNS TXT Record Tag Specifications Registry
29617.6. DKIM Key Type Registry
2963 The "k=" <key-k-tag> (specified in Section 3.6.1) and the "a=" <sig-
2964 a-tag-k> (specified in Section 3.5) tags provide for a list of
2965 mechanisms that can be used to decode a DKIM signature.
2970Crocker, et al. Standards Track [Page 53]
2972RFC 6376 DKIM Signatures September 2011
2975 IANA has established the "DKIM Key Type" registry for such
2978 +------+-----------+--------+
2979 | TYPE | REFERENCE | STATUS |
2980 +------+-----------+--------+
2981 | rsa | [RFC3447] | active |
2982 +------+-----------+--------+
2984 Table 6: DKIM Key Type Registry Updated Values
29867.7. DKIM Hash Algorithms Registry
2988 The "h=" <key-h-tag> (specified in Section 3.6.1) and the "a=" <sig-
2989 a-tag-h> (specified in Section 3.5) tags provide for a list of
2990 mechanisms that can be used to produce a digest of message data.
2992 IANA has established the "DKIM Hash Algorithms" registry for such
2995 +--------+-------------------+--------+
2996 | TYPE | REFERENCE | STATUS |
2997 +--------+-------------------+--------+
2998 | sha1 | [FIPS-180-3-2008] | active |
2999 | sha256 | [FIPS-180-3-2008] | active |
3000 +--------+-------------------+--------+
3002 Table 7: DKIM Hash Algorithms Registry Updated Values
30047.8. DKIM Service Types Registry
3006 The "s=" <key-s-tag> tag (specified in Section 3.6.1) provides for a
3007 list of service types to which this selector may apply.
3009 IANA has established the "DKIM Service Types" registry for service
3012 +-------+-----------------+--------+
3013 | TYPE | REFERENCE | STATUS |
3014 +-------+-----------------+--------+
3015 | email | (this document) | active |
3016 | * | (this document) | active |
3017 +-------+-----------------+--------+
3019 Table 8: DKIM Service Types Registry Updated Values
3026Crocker, et al. Standards Track [Page 54]
3028RFC 6376 DKIM Signatures September 2011
30317.9. DKIM Selector Flags Registry
3033 The "t=" <key-t-tag> tag (specified in Section 3.6.1) provides for a
3034 list of flags to modify interpretation of the selector.
3036 IANA has established the "DKIM Selector Flags" registry for
3039 +------+-----------------+--------+
3040 | TYPE | REFERENCE | STATUS |
3041 +------+-----------------+--------+
3042 | y | (this document) | active |
3043 | s | (this document) | active |
3044 +------+-----------------+--------+
3046 Table 9: DKIM Selector Flags Registry Updated Values
30487.10. DKIM-Signature Header Field
3050 IANA has added DKIM-Signature to the "Permanent Message Header Field
3051 Names" registry (see [RFC3864]) for the "mail" protocol, using this
3052 document as the reference.
30548. Security Considerations
3056 It has been observed that any introduced mechanism that attempts to
3057 stem the flow of spam is subject to intensive attack. DKIM needs to
3058 be carefully scrutinized to identify potential attack vectors and the
3059 vulnerability to each. See also [RFC4686].
30618.1. ASCII Art Attacks
3063 The relaxed body canonicalization algorithm may enable certain types
3064 of extremely crude "ASCII Art" attacks where a message may be
3065 conveyed by adjusting the spacing between words. If this is a
3066 concern, the "simple" body canonicalization algorithm should be used
30698.2. Misuse of Body Length Limits ("l=" Tag)
3071 Use of the "l=" tag might allow display of fraudulent content without
3072 appropriate warning to end users. The "l=" tag is intended for
3073 increasing signature robustness when sending to mailing lists that
3074 both modify their content and do not sign their modified messages.
3075 However, using the "l=" tag enables attacks in which an intermediary
3076 with malicious intent can modify a message to include content that
3077 solely benefits the attacker. It is possible for the appended
3082Crocker, et al. Standards Track [Page 55]
3084RFC 6376 DKIM Signatures September 2011
3087 content to completely replace the original content in the end
3088 recipient's eyes and to defeat duplicate message detection
3091 An example of such an attack includes altering the MIME structure,
3092 exploiting lax HTML parsing in the MUA, and defeating duplicate
3093 message detection algorithms.
3095 To avoid this attack, Signers should be extremely wary of using this
3096 tag, and Assessors might wish to ignore signatures that use the tag.
30988.3. Misappropriated Private Key
3100 As with any other security application that uses private- or public-
3101 key pairs, DKIM requires caution around the handling and protection
3102 of keys. A compromised private key or access to one means an
3103 intruder or malware can send mail signed by the domain that
3104 advertises the matching public key.
3106 Thus, private keys issued to users, rather than one used by an
3107 ADministrative Management Domain (ADMD) itself, create the usual
3108 problem of securing data stored on personal resources that can affect
3111 A more secure architecture involves sending messages through an
3112 outgoing MTA that can authenticate the submitter using existing
3113 techniques (e.g., SMTP Authentication), possibly validate the message
3114 itself (e.g., verify that the header is legitimate and that the
3115 content passes a spam content check), and sign the message using a
3116 key appropriate for the submitter address. Such an MTA can also
3117 apply controls on the volume of outgoing mail each user is permitted
3118 to originate in order to further limit the ability of malware to
3119 generate bulk email.
31218.4. Key Server Denial-of-Service Attacks
3123 Since the key servers are distributed (potentially separate for each
3124 domain), the number of servers that would need to be attacked to
3125 defeat this mechanism on an Internet-wide basis is very large.
3126 Nevertheless, key servers for individual domains could be attacked,
3127 impeding the verification of messages from that domain. This is not
3128 significantly different from the ability of an attacker to deny
3129 service to the mail exchangers for a given domain, although it
3130 affects outgoing, not incoming, mail.
3132 A variation on this attack involves a very large amount of mail being
3133 sent using spoofed signatures from a given domain: the key servers
3134 for that domain could be overwhelmed with requests in a denial-of-
3138Crocker, et al. Standards Track [Page 56]
3140RFC 6376 DKIM Signatures September 2011
3143 service attack (see [RFC4732]). However, given the low overhead of
3144 verification compared with handling of the email message itself, such
3145 an attack would be difficult to mount.
31478.5. Attacks against the DNS
3149 Since the DNS is a required binding for key services, specific
3150 attacks against the DNS must be considered.
3152 While the DNS is currently insecure [RFC3833], these security
3153 problems are the motivation behind DNS Security (DNSSEC) [RFC4033],
3154 and all users of the DNS will reap the benefit of that work.
3156 DKIM is only intended as a "sufficient" method of proving
3157 authenticity. It is not intended to provide strong cryptographic
3158 proof about authorship or contents. Other technologies such as
3159 OpenPGP [RFC4880] and S/MIME [RFC5751] address those requirements.
3161 A second security issue related to the DNS revolves around the
3162 increased DNS traffic as a consequence of fetching selector-based
3163 data as well as fetching signing domain policy. Widespread
3164 deployment of DKIM will result in a significant increase in DNS
3165 queries to the claimed signing domain. In the case of forgeries on a
3166 large scale, DNS servers could see a substantial increase in queries.
3168 A specific DNS security issue that should be considered by DKIM
3169 Verifiers is the name chaining attack described in Section 2.3 of
3170 [RFC3833]. A DKIM Verifier, while verifying a DKIM-Signature header
3171 field, could be prompted to retrieve a key record of an attacker's
3172 choosing. This threat can be minimized by ensuring that name
3173 servers, including recursive name servers, used by the Verifier
3174 enforce strict checking of "glue" and other additional information in
3175 DNS responses and are therefore not vulnerable to this attack.
31778.6. Replay/Spam Attacks
3179 In this attack, a spammer sends a piece of spam through an MTA that
3180 signs it, banking on the reputation of the signing domain (e.g., a
3181 large popular mailbox provider) rather than its own, and then re-
3182 sends that message to a large number of intended recipients. The
3183 recipients observe the valid signature from the well-known domain,
3184 elevating their trust in the message and increasing the likelihood of
3185 delivery and presentation to the user.
3187 Partial solutions to this problem involve the use of reputation
3188 services to convey the fact that the specific email address is being
3189 used for spam and that messages from that Signer are likely to be
3190 spam. This requires a real-time detection mechanism in order to
3194Crocker, et al. Standards Track [Page 57]
3196RFC 6376 DKIM Signatures September 2011
3199 react quickly enough. However, such measures might be prone to
3200 abuse, if, for example, an attacker re-sent a large number of
3201 messages received from a victim in order to make the victim appear to
3204 Large Verifiers might be able to detect unusually large volumes of
3205 mails with the same signature in a short time period. Smaller
3206 Verifiers can get substantially the same volume of information via
3207 existing collaborative systems.
32098.7. Limits on Revoking Keys
3211 When a large domain detects undesirable behavior on the part of one
3212 of its users, it might wish to revoke the key used to sign that
3213 user's messages in order to disavow responsibility for messages that
3214 have not yet been verified or that are the subject of a replay
3215 attack. However, the ability of the domain to do so can be limited
3216 if the same key, for scalability reasons, is used to sign messages
3217 for many other users. Mechanisms for explicitly revoking keys on a
3218 per-address basis have been proposed but require further study as to
3219 their utility and the DNS load they represent.
32218.8. Intentionally Malformed Key Records
3223 It is possible for an attacker to publish key records in DNS that are
3224 intentionally malformed, with the intent of causing a denial-of-
3225 service attack on a non-robust Verifier implementation. The attacker
3226 could then cause a Verifier to read the malformed key record by
3227 sending a message to one of its users referencing the malformed
3228 record in a (not necessarily valid) signature. Verifiers MUST
3229 thoroughly verify all key records retrieved from the DNS and be
3230 robust against intentionally as well as unintentionally malformed key
32338.9. Intentionally Malformed DKIM-Signature Header Fields
3235 Verifiers MUST be prepared to receive messages with malformed DKIM-
3236 Signature header fields and thoroughly verify the header field before
3237 depending on any of its contents.
32398.10. Information Leakage
3241 An attacker could determine when a particular signature was verified
3242 by using a per-message selector and then monitoring their DNS traffic
3243 for the key lookup. This would act as the equivalent of a "web bug"
3244 for verification time rather than the time the message was read.
3250Crocker, et al. Standards Track [Page 58]
3252RFC 6376 DKIM Signatures September 2011
32558.11. Remote Timing Attacks
3257 In some cases, it may be possible to extract private keys using a
3258 remote timing attack [BONEH03]. Implementations should consider
3259 obfuscating the timing to prevent such attacks.
32618.12. Reordered Header Fields
3263 Existing standards allow intermediate MTAs to reorder header fields.
3264 If a Signer signs two or more header fields of the same name, this
3265 can cause spurious verification errors on otherwise legitimate
3266 messages. In particular, Signers that sign any existing DKIM-
3267 Signature fields run the risk of having messages incorrectly fail to
3272 An attacker could create a large RSA signing key with a small
3273 exponent, thus requiring that the verification key have a large
3274 exponent. This will force Verifiers to use considerable computing
3275 resources to verify the signature. Verifiers might avoid this attack
3276 by refusing to verify signatures that reference selectors with public
3277 keys having unreasonable exponents.
3279 In general, an attacker might try to overwhelm a Verifier by flooding
3280 it with messages requiring verification. This is similar to other
3281 MTA denial-of-service attacks and should be dealt with in a similar
3286 The trust relationship described in Section 3.10 could conceivably be
3287 used by a parent domain to sign messages with identities in a
3288 subdomain not administratively related to the parent. For example,
3289 the ".com" registry could create messages with signatures using an
3290 "i=" value in the example.com domain. There is no general solution
3291 to this problem, since the administrative cut could occur anywhere in
3292 the domain name. For example, in the domain "example.podunk.ca.us",
3293 there are three administrative cuts (podunk.ca.us, ca.us, and us),
3294 any of which could create messages with an identity in the full
3297 INFORMATIVE NOTE: This is considered an acceptable risk for the
3298 same reason that it is acceptable for domain delegation. For
3299 example, in the case above, any of the domains could potentially
3300 simply delegate "example.podunk.ca.us" to a server of their choice
3306Crocker, et al. Standards Track [Page 59]
3308RFC 6376 DKIM Signatures September 2011
3311 and completely replace all DNS-served information. Note that a
3312 Verifier MAY ignore signatures that come from an unlikely domain
3313 such as ".com", as discussed in Section 6.1.1.
33158.15. Attacks Involving Extra Header Fields
3317 Many email components, including MTAs, MSAs, MUAs, and filtering
3318 modules, implement message format checks only loosely. This is done
3319 out of years of industry pressure to be liberal in what is accepted
3320 into the mail stream for the sake of reducing support costs;
3321 improperly formed messages are often silently fixed in transit,
3322 delivered unrepaired, or displayed inappropriately (e.g., by showing
3323 only the first of multiple From: fields).
3325 Agents that evaluate or apply DKIM output need to be aware that a
3326 DKIM Signer can sign messages that are malformed (e.g., violate
3327 [RFC5322], such as by having multiple instances of a field that is
3328 only permitted once), that become malformed in transit, or that
3329 contain header or body content that is not true or valid. Use of
3330 DKIM on such messages might constitute an attack against a receiver,
3331 especially where additional credence is given to a signed message
3332 without adequate evaluation of the Signer.
3334 These can represent serious attacks, but they have nothing to do with
3335 DKIM; they are attacks on the recipient or on the wrongly identified
3338 Moreover, an agent would be incorrect to infer that all instances of
3339 a header field are signed just because one is.
3341 A genuine signature from the domain under attack can be obtained by
3342 legitimate means, but extra header fields can then be added, either
3343 by interception or by replay. In this scenario, DKIM can aid in
3344 detecting addition of specific fields in transit. This is done by
3345 having the Signer list the field name(s) in the "h=" tag an extra
3346 time (e.g., "h=from:from:..." for a message with one From field), so
3347 that addition of an instance of that field downstream will render the
3348 signature unable to be verified. (See Section 3.5 for details.)
3349 This, in essence, is an explicit indication that the Signer
3350 repudiates responsibility for such a malformed message.
3352 DKIM signs and validates the data it is told to and works correctly.
3353 So in this case, DKIM has done its job of delivering a validated
3354 domain (the "d=" value) and, given the semantics of a DKIM signature,
3355 essentially the Signer has taken some responsibility for a
3356 problematic message. It is up to the Identity Assessor or some other
3362Crocker, et al. Standards Track [Page 60]
3364RFC 6376 DKIM Signatures September 2011
3367 subsequent agent to act on such messages as needed, such as degrading
3368 the trust of the message (or, indeed, of the Signer), warning the
3369 recipient, or even refusing delivery.
3371 All components of the mail system that perform loose enforcement of
3372 other mail standards will need to revisit that posture when
3373 incorporating DKIM, especially when considering matters of potential
3374 attacks such as those described.
33789.1. Normative References
3381 U.S. Department of Commerce, "Secure Hash Standard", FIPS
3382 PUB 180-3, October 2008.
3385 "Information Technology - ASN.1 encoding rules:
3386 Specification of Basic Encoding Rules (BER), Canonical
3387 Encoding Rules (CER) and Distinguished Encoding Rules
3390 [RFC1034] Mockapetris, P., "Domain names - concepts and facilities",
3391 STD 13, RFC 1034, November 1987.
3393 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
3394 Extensions (MIME) Part One: Format of Internet Message
3395 Bodies", RFC 2045, November 1996.
3397 [RFC2049] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
3398 Extensions (MIME) Part Five: Conformance Criteria and
3399 Examples", RFC 2049, November 1996.
3401 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
3402 Requirement Levels", BCP 14, RFC 2119, March 1997.
3404 [RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography
3405 Standards (PKCS) #1: RSA Cryptography Specifications
3406 Version 2.1", RFC 3447, February 2003.
3408 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax
3409 Specifications: ABNF", STD 68, RFC 5234, January 2008.
3411 [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321,
3418Crocker, et al. Standards Track [Page 61]
3420RFC 6376 DKIM Signatures September 2011
3423 [RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322,
3426 [RFC5598] Crocker, D., "Internet Mail Architecture", RFC 5598,
3429 [RFC5890] Klensin, J., "Internationalized Domain Names for
3430 Applications (IDNA): Definitions and Document Framework",
3431 RFC 5890, August 2010.
34339.2. Informative References
3435 [BONEH03] "Remote Timing Attacks are Practical", Proceedings 12th
3436 USENIX Security Symposium, 2003.
3438 [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions)
3439 Part Three: Message Header Extensions for Non-ASCII Text",
3440 RFC 2047, November 1996.
3442 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO
3443 10646", STD 63, RFC 3629, November 2003.
3445 [RFC3766] Orman, H. and P. Hoffman, "Determining Strengths For
3446 Public Keys Used For Exchanging Symmetric Keys", BCP 86,
3447 RFC 3766, April 2004.
3449 [RFC3833] Atkins, D. and R. Austein, "Threat Analysis of the Domain
3450 Name System (DNS)", RFC 3833, August 2004.
3452 [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration
3453 Procedures for Message Header Fields", BCP 90, RFC 3864,
3456 [RFC4033] Arends, R., Austein, R., Larson, M., Massey, D., and S.
3457 Rose, "DNS Security Introduction and Requirements",
3458 RFC 4033, March 2005.
3460 [RFC4409] Gellens, R. and J. Klensin, "Message Submission for Mail",
3461 RFC 4409, April 2006.
3463 [RFC4686] Fenton, J., "Analysis of Threats Motivating DomainKeys
3464 Identified Mail (DKIM)", RFC 4686, September 2006.
3466 [RFC4732] Handley, M., Rescorla, E., and IAB, "Internet Denial-of-
3467 Service Considerations", RFC 4732, December 2006.
3474Crocker, et al. Standards Track [Page 62]
3476RFC 6376 DKIM Signatures September 2011
3479 [RFC4870] Delany, M., "Domain-Based Email Authentication Using
3480 Public Keys Advertised in the DNS (DomainKeys)", RFC 4870,
3483 [RFC4871] Allman, E., Callas, J., Delany, M., Libbey, M., Fenton,
3484 J., and M. Thomas, "DomainKeys Identified Mail (DKIM)
3485 Signatures", RFC 4871, May 2007.
3487 [RFC4880] Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R.
3488 Thayer, "OpenPGP Message Format", RFC 4880, November 2007.
3490 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an
3491 IANA Considerations Section in RFCs", BCP 26, RFC 5226,
3494 [RFC5451] Kucherawy, M., "Message Header Field for Indicating
3495 Message Authentication Status", RFC 5451, April 2009.
3497 [RFC5585] Hansen, T., Crocker, D., and P. Hallam-Baker, "DomainKeys
3498 Identified Mail (DKIM) Service Overview", RFC 5585,
3501 [RFC5672] Crocker, D., "RFC 4871 DomainKeys Identified Mail (DKIM)
3502 Signatures -- Update", RFC 5672, August 2009.
3504 [RFC5751] Ramsdell, B. and S. Turner, "Secure/Multipurpose Internet
3505 Mail Extensions (S/MIME) Version 3.2 Message
3506 Specification", RFC 5751, January 2010.
3508 [RFC5863] Hansen, T., Siegel, E., Hallam-Baker, P., and D. Crocker,
3509 "DomainKeys Identified Mail (DKIM) Development,
3510 Deployment, and Operations", RFC 5863, May 2010.
3512 [RFC6377] Kucherawy, M., "DomainKeys Identified Mail (DKIM) and
3513 Mailing Lists", RFC 6377, September 2011.
3530Crocker, et al. Standards Track [Page 63]
3532RFC 6376 DKIM Signatures September 2011
3535Appendix A. Example of Use (INFORMATIVE)
3537 This section shows the complete flow of an email from submission to
3538 final delivery, demonstrating how the various components fit
3539 together. The key used in this example is shown in Appendix C.
3541A.1. The User Composes an Email
3543 From: Joe SixPack <joe@football.example.com>
3544 To: Suzie Q <suzie@shopping.example.net>
3545 Subject: Is dinner ready?
3546 Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT)
3547 Message-ID: <20030712040037.46341.5F8J@football.example.com>
3551 We lost the game. Are you hungry yet?
3555 Figure 1: The User Composes an Email
3586Crocker, et al. Standards Track [Page 64]
3588RFC 6376 DKIM Signatures September 2011
3591A.2. The Email is Signed
3593 This email is signed by the example.com outbound email server and now
3596 DKIM-Signature: v=1; a=rsa-sha256; s=brisbane; d=example.com;
3597 c=simple/simple; q=dns/txt; i=joe@football.example.com;
3598 h=Received : From : To : Subject : Date : Message-ID;
3599 bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=;
3600 b=AuUoFEfDxTDkHlLXSZEpZj79LICEps6eda7W3deTVFOk4yAUoqOB
3601 4nujc7YopdG5dWLSdNg6xNAZpOPr+kHxt1IrE+NahM6L/LbvaHut
3602 KVdkLLkpVaVVQPzeRDI009SO2Il5Lu7rDNH6mZckBdrIx0orEtZV
3604 Received: from client1.football.example.com [192.0.2.1]
3605 by submitserver.example.com with SUBMISSION;
3606 Fri, 11 Jul 2003 21:01:54 -0700 (PDT)
3607 From: Joe SixPack <joe@football.example.com>
3608 To: Suzie Q <suzie@shopping.example.net>
3609 Subject: Is dinner ready?
3610 Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT)
3611 Message-ID: <20030712040037.46341.5F8J@football.example.com>
3615 We lost the game. Are you hungry yet?
3619 Figure 2: The Email is Signed
3621 The signing email server requires access to the private key
3622 associated with the "brisbane" selector to generate this signature.
3642Crocker, et al. Standards Track [Page 65]
3644RFC 6376 DKIM Signatures September 2011
3647A.3. The Email Signature is Verified
3649 The signature is normally verified by an inbound SMTP server or
3650 possibly the final delivery agent. However, intervening MTAs can
3651 also perform this verification if they choose to do so. The
3652 verification process uses the domain "example.com" extracted from the
3653 "d=" tag and the selector "brisbane" from the "s=" tag in the DKIM-
3654 Signature header field to form the DNS DKIM query for:
3655 brisbane._domainkey.example.com
3657 Signature verification starts with the physically last Received
3658 header field, the From header field, and so forth, in the order
3659 listed in the "h=" tag. Verification follows with a single CRLF
3660 followed by the body (starting with "Hi."). The email is canonically
3661 prepared for verifying with the "simple" method. The result of the
3662 query and subsequent verification of the signature is stored (in this
3663 example) in the X-Authentication-Results header field line. After
3664 successful verification, the email looks like this:
3666 X-Authentication-Results: shopping.example.net
3667 header.from=joe@football.example.com; dkim=pass
3668 Received: from mout23.football.example.com (192.168.1.1)
3669 by shopping.example.net with SMTP;
3670 Fri, 11 Jul 2003 21:01:59 -0700 (PDT)
3671 DKIM-Signature: v=1; a=rsa-sha256; s=brisbane; d=example.com;
3672 c=simple/simple; q=dns/txt; i=joe@football.example.com;
3673 h=Received : From : To : Subject : Date : Message-ID;
3674 bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=;
3675 b=AuUoFEfDxTDkHlLXSZEpZj79LICEps6eda7W3deTVFOk4yAUoqOB
3676 4nujc7YopdG5dWLSdNg6xNAZpOPr+kHxt1IrE+NahM6L/LbvaHut
3677 KVdkLLkpVaVVQPzeRDI009SO2Il5Lu7rDNH6mZckBdrIx0orEtZV
3679 Received: from client1.football.example.com [192.0.2.1]
3680 by submitserver.example.com with SUBMISSION;
3681 Fri, 11 Jul 2003 21:01:54 -0700 (PDT)
3682 From: Joe SixPack <joe@football.example.com>
3683 To: Suzie Q <suzie@shopping.example.net>
3684 Subject: Is dinner ready?
3685 Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT)
3686 Message-ID: <20030712040037.46341.5F8J@football.example.com>
3690 We lost the game. Are you hungry yet?
3694 Figure 3: Successful Verification
3698Crocker, et al. Standards Track [Page 66]
3700RFC 6376 DKIM Signatures September 2011
3703Appendix B. Usage Examples (INFORMATIVE)
3705 DKIM signing and validating can be used in different ways, for
3706 different operational scenarios. This Appendix discusses some common
3709 NOTE: Descriptions in this Appendix are for informational purposes
3710 only. They describe various ways that DKIM can be used, given
3711 particular constraints and needs. In no case are these examples
3712 intended to be taken as providing explanation or guidance
3713 concerning DKIM specification details when creating an
3718 In the most simple scenario, a user's MUA, MSA, and Internet
3719 (boundary) MTA are all within the same administrative environment,
3720 using the same domain name. Therefore, all of the components
3721 involved in submission and initial transfer are related. However, it
3722 is common for two or more of the components to be under independent
3723 administrative control. This creates challenges for choosing and
3724 administering the domain name to use for signing and for its
3725 relationship to common email identity header fields.
3727B.1.1. Delegated Business Functions
3729 Some organizations assign specific business functions to discrete
3730 groups, inside or outside the organization. The goal, then, is to
3731 authorize that group to sign some mail but to constrain what
3732 signatures they can generate. DKIM selectors (the "s=" signature
3733 tag) facilitate this kind of restricted authorization. Examples of
3734 these outsourced business functions are legitimate email marketing
3735 providers and corporate benefits providers.
3737 Here, the delegated group needs to be able to send messages that are
3738 signed, using the email domain of the client company. At the same
3739 time, the client often is reluctant to register a key for the
3740 provider that grants the ability to send messages for arbitrary
3741 addresses in the domain.
3743 There are multiple ways to administer these usage scenarios. In one
3744 case, the client organization provides all of the public query
3745 service (for example, DNS) administration, and in another, it uses
3746 DNS delegation to enable all ongoing administration of the DKIM key
3747 record by the delegated group.
3754Crocker, et al. Standards Track [Page 67]
3756RFC 6376 DKIM Signatures September 2011
3759 If the client organization retains responsibility for all of the DNS
3760 administration, the outsourcing company can generate a key pair,
3761 supplying the public key to the client company, which then registers
3762 it in the query service using a unique selector. The client company
3763 retains control over the use of the delegated key because it retains
3764 the ability to revoke the key at any time.
3766 If the client wants the delegated group to do the DNS administration,
3767 it can have the domain name that is specified with the selector point
3768 to the provider's DNS server. The provider then creates and
3769 maintains all of the DKIM signature information for that selector.
3770 Hence, the client cannot provide constraints on the local-part of
3771 addresses that get signed, but it can revoke the provider's signing
3772 rights by removing the DNS delegation record.
3774B.1.2. PDAs and Similar Devices
3776 PDAs demonstrate the need for using multiple keys per domain.
3777 Suppose that John Doe wants to be able to send messages using his
3778 corporate email address, jdoe@example.com, and his email device does
3779 not have the ability to make a Virtual Private Network (VPN)
3780 connection to the corporate network, either because the device is
3781 limited or because there are restrictions enforced by his Internet
3782 access provider. If the device is equipped with a private key
3783 registered for jdoe@example.com by the administrator of the
3784 example.com domain and appropriate software to sign messages, John
3785 could sign the message on the device itself before transmission
3786 through the outgoing network of the access service provider.
3790 Roaming users often find themselves in circumstances where it is
3791 convenient or necessary to use an SMTP server other than their home
3792 server; examples are conferences and many hotels. In such
3793 circumstances, a signature that is added by the submission service
3794 will use an identity that is different from the user's home system.
3796 Ideally, roaming users would connect back to their home server using
3797 either a VPN or a SUBMISSION server running with SMTP AUTHentication
3798 on port 587. If the signing can be performed on the roaming user's
3799 laptop, then they can sign before submission, although the risk of
3800 further modification is high. If neither of these are possible,
3801 these roaming users will not be able to send mail signed using their
3810Crocker, et al. Standards Track [Page 68]
3812RFC 6376 DKIM Signatures September 2011
3815B.1.4. Independent (Kiosk) Message Submission
3817 Stand-alone services, such as walk-up kiosks and web-based
3818 information services, have no enduring email service relationship
3819 with the user, but users occasionally request that mail be sent on
3820 their behalf. For example, a website providing news often allows the
3821 reader to forward a copy of the article to a friend. This is
3822 typically done using the reader's own email address, to indicate who
3823 the author is. This is sometimes referred to as the "Evite" problem,
3824 named after the website of the same name that allows a user to send
3825 invitations to friends.
3827 A common way this is handled is to continue to put the reader's email
3828 address in the From header field of the message but put an address
3829 owned by the email posting site into the Sender header field. The
3830 posting site can then sign the message, using the domain that is in
3831 the Sender field. This provides useful information to the receiving
3832 email site, which is able to correlate the signing domain with the
3833 initial submission email role.
3835 Receiving sites often wish to provide their end users with
3836 information about mail that is mediated in this fashion. Although
3837 the real efficacy of different approaches is a subject for human
3838 factors usability research, one technique that is used is for the
3839 verifying system to rewrite the From header field to indicate the
3840 address that was verified, for example: From: John Doe via
3841 news@news-site.example <jdoe@example.com>. (Note that such rewriting
3842 will break a signature, unless it is done after the verification pass
3845B.2. Alternate Delivery Scenarios
3847 Email is often received at a mailbox that has an address different
3848 from the one used during initial submission. In these cases, an
3849 intermediary mechanism operates at the address originally used, and
3850 it then passes the message on to the final destination. This
3851 mediation process presents some challenges for DKIM signatures.
3853B.2.1. Affinity Addresses
3855 "Affinity addresses" allow a user to have an email address that
3856 remains stable, even as the user moves among different email
3857 providers. They are typically associated with college alumni
3858 associations, professional organizations, and recreational
3859 organizations with which they expect to have a long-term
3860 relationship. These domains usually provide forwarding of incoming
3861 email, and they often have an associated Web application that
3862 authenticates the user and allows the forwarding address to be
3866Crocker, et al. Standards Track [Page 69]
3868RFC 6376 DKIM Signatures September 2011
3871 changed. However, these services usually depend on users sending
3872 outgoing messages through their own service provider's MTAs. Hence,
3873 mail that is signed with the domain of the affinity address is not
3874 signed by an entity that is administered by the organization owning
3877 With DKIM, affinity domains could use the Web application to allow
3878 users to register per-user keys to be used to sign messages on behalf
3879 of their affinity address. The user would take away the secret half
3880 of the key pair for signing, and the affinity domain would publish
3881 the public half in DNS for access by Verifiers.
3883 This is another application that takes advantage of user-level
3884 keying, and domains used for affinity addresses would typically have
3885 a very large number of user-level keys. Alternatively, the affinity
3886 domain could handle outgoing mail, operating a mail submission agent
3887 that authenticates users before accepting and signing messages for
3888 them. This is, of course, dependent on the user's service provider
3889 not blocking the relevant TCP ports used for mail submission.
3891B.2.2. Simple Address Aliasing (.forward)
3893 In some cases, a recipient is allowed to configure an email address
3894 to cause automatic redirection of email messages from the original
3895 address to another, such as through the use of a Unix .forward file.
3896 In this case, messages are typically redirected by the mail handling
3897 service of the recipient's domain, without modification, except for
3898 the addition of a Received header field to the message and a change
3899 in the envelope recipient address. In this case, the recipient at
3900 the final address' mailbox is likely to be able to verify the
3901 original signature since the signed content has not changed, and DKIM
3902 is able to validate the message signature.
3904B.2.3. Mailing Lists and Re-Posters
3906 There is a wide range of behaviors in services that take delivery of
3907 a message and then resubmit it. A primary example is with mailing
3908 lists (collectively called "forwarders" below), ranging from those
3909 that make no modification to the message itself, other than to add a
3910 Received header field and change the envelope information, to those
3911 that add header fields, change the Subject header field, add content
3912 to the body (typically at the end), or reformat the body in some
3913 manner. The simple ones produce messages that are quite similar to
3914 the automated alias services. More elaborate systems essentially
3915 create a new message.
3922Crocker, et al. Standards Track [Page 70]
3924RFC 6376 DKIM Signatures September 2011
3927 A Forwarder that does not modify the body or signed header fields of
3928 a message is likely to maintain the validity of the existing
3929 signature. It also could choose to add its own signature to the
3932 Forwarders that modify a message in a way that could make an existing
3933 signature invalid are particularly good candidates for adding their
3934 own signatures (e.g., mailing-list-name@example.net). Since
3935 (re-)signing is taking responsibility for the content of the message,
3936 these signing forwarders are likely to be selective and forward or
3937 re-sign a message only if it is received with a valid signature or if
3938 they have some other basis for knowing that the message is not
3941 A common practice among systems that are primarily redistributors of
3942 mail is to add a Sender header field to the message to identify the
3943 address being used to sign the message. This practice will remove
3944 any preexisting Sender header field as required by [RFC5322]. The
3945 forwarder applies a new DKIM-Signature header field with the
3946 signature, public key, and related information of the forwarder.
3948 See [RFC6377] for additional related topics and discussion.
3950Appendix C. Creating a Public Key (INFORMATIVE)
3952 The default signature is an RSA-signed SHA-256 digest of the complete
3953 email. For ease of explanation, the openssl command is used to
3954 describe the mechanism by which keys and signatures are managed. One
3955 way to generate a 1024-bit, unencrypted private key suitable for DKIM
3956 is to use openssl like this:
3958 $ openssl genrsa -out rsa.private 1024
3960 For increased security, the "-passin" parameter can also be added to
3961 encrypt the private key. Use of this parameter will require entering
3962 a password for several of the following steps. Servers may prefer to
3963 use hardware cryptographic support.
3965 The "genrsa" step results in the file rsa.private containing the key
3966 information similar to this:
3978Crocker, et al. Standards Track [Page 71]
3980RFC 6376 DKIM Signatures September 2011
3983 -----BEGIN RSA PRIVATE KEY-----
3984 MIICXwIBAAKBgQDwIRP/UC3SBsEmGqZ9ZJW3/DkMoGeLnQg1fWn7/zYtIxN2SnFC
3985 jxOCKG9v3b4jYfcTNh5ijSsq631uBItLa7od+v/RtdC2UzJ1lWT947qR+Rcac2gb
3986 to/NMqJ0fzfVjH4OuKhitdY9tf6mcwGjaNBcWToIMmPSPDdQPNUYckcQ2QIDAQAB
3987 AoGBALmn+XwWk7akvkUlqb+dOxyLB9i5VBVfje89Teolwc9YJT36BGN/l4e0l6QX
3988 /1//6DWUTB3KI6wFcm7TWJcxbS0tcKZX7FsJvUz1SbQnkS54DJck1EZO/BLa5ckJ
3989 gAYIaqlA9C0ZwM6i58lLlPadX/rtHb7pWzeNcZHjKrjM461ZAkEA+itss2nRlmyO
3990 n1/5yDyCluST4dQfO8kAB3toSEVc7DeFeDhnC1mZdjASZNvdHS4gbLIA1hUGEF9m
3991 3hKsGUMMPwJBAPW5v/U+AWTADFCS22t72NUurgzeAbzb1HWMqO4y4+9Hpjk5wvL/
3992 eVYizyuce3/fGke7aRYw/ADKygMJdW8H/OcCQQDz5OQb4j2QDpPZc0Nc4QlbvMsj
3993 7p7otWRO5xRa6SzXqqV3+F0VpqvDmshEBkoCydaYwc2o6WQ5EBmExeV8124XAkEA
3994 qZzGsIxVP+sEVRWZmW6KNFSdVUpk3qzK0Tz/WjQMe5z0UunY9Ax9/4PVhp/j61bf
3995 eAYXunajbBSOLlx4D+TunwJBANkPI5S9iylsbLs6NkaMHV6k5ioHBBmgCak95JGX
3996 GMot/L2x0IYyMLAz6oLWh2hm7zwtb0CgOrPo1ke44hFYnfc=
3997 -----END RSA PRIVATE KEY-----
3999 To extract the public-key component from the private key, use openssl
4002 $ openssl rsa -in rsa.private -out rsa.public -pubout -outform PEM
4004 This results in the file rsa.public containing the key information
4007 -----BEGIN PUBLIC KEY-----
4008 MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDwIRP/UC3SBsEmGqZ9ZJW3/DkM
4009 oGeLnQg1fWn7/zYtIxN2SnFCjxOCKG9v3b4jYfcTNh5ijSsq631uBItLa7od+v/R
4010 tdC2UzJ1lWT947qR+Rcac2gbto/NMqJ0fzfVjH4OuKhitdY9tf6mcwGjaNBcWToI
4011 MmPSPDdQPNUYckcQ2QIDAQAB
4012 -----END PUBLIC KEY-----
4014 This public-key data (without the BEGIN and END tags) is placed in
4017 $ORIGIN _domainkey.example.org.
4018 brisbane IN TXT ("v=DKIM1; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQ"
4019 "KBgQDwIRP/UC3SBsEmGqZ9ZJW3/DkMoGeLnQg1fWn7/zYt"
4020 "IxN2SnFCjxOCKG9v3b4jYfcTNh5ijSsq631uBItLa7od+v"
4021 "/RtdC2UzJ1lWT947qR+Rcac2gbto/NMqJ0fzfVjH4OuKhi"
4022 "tdY9tf6mcwGjaNBcWToIMmPSPDdQPNUYckcQ2QIDAQAB")
4024C.1. Compatibility with DomainKeys Key Records
4026 DKIM key records were designed to be backward compatible in many
4027 cases with key records used by DomainKeys [RFC4870] (sometimes
4028 referred to as "selector records" in the DomainKeys context). One
4029 area of incompatibility warrants particular attention. The "g=" tag
4030 value may be used in DomainKeys and [RFC4871] key records to provide
4034Crocker, et al. Standards Track [Page 72]
4036RFC 6376 DKIM Signatures September 2011
4039 finer granularity of the validity of the key record to a specific
4040 local-part. A null "g=" value in DomainKeys is valid for all
4041 addresses in the domain. This differs from the usage in the original
4042 DKIM specification ([RFC4871]), where a null "g=" value is not valid
4043 for any address. In particular, see the example public-key record in
4044 Section 3.2.3 of [RFC4870].
4046C.2. RFC 4871 Compatibility
4048 Although the "g=" tag has been deprecated in this version of the DKIM
4049 specification (and thus MUST now be ignored), Signers are advised not
4050 to include the "g=" tag in key records because some [RFC4871]-
4051 compliant Verifiers will be in use for a considerable period to come.
4053Appendix D. MUA Considerations (INFORMATIVE)
4055 When a DKIM signature is verified, the processing system sometimes
4056 makes the result available to the recipient user's MUA. How to
4057 present this information to users in a way that helps them is a
4058 matter of continuing human factors usability research. The tendency
4059 is to have the MUA highlight the SDID, in an attempt to show the user
4060 the identity that is claiming responsibility for the message. An MUA
4061 might do this with visual cues such as graphics, might include the
4062 address in an alternate view, or might even rewrite the original From
4063 address using the verified information. Some MUAs might indicate
4064 which header fields were protected by the validated DKIM signature.
4065 This could be done with a positive indication on the signed header
4066 fields, with a negative indication on the unsigned header fields, by
4067 visually hiding the unsigned header fields, or some combination of
4068 these. If an MUA uses visual indications for signed header fields,
4069 the MUA probably needs to be careful not to display unsigned header
4070 fields in a way that might be construed by the end user as having
4071 been signed. If the message has an "l=" tag whose value does not
4072 extend to the end of the message, the MUA might also hide or mark the
4073 portion of the message body that was not signed.
4075 The aforementioned information is not intended to be exhaustive. The
4076 MUA can choose to highlight, accentuate, hide, or otherwise display
4077 any other information that may, in the opinion of the MUA author, be
4078 deemed important to the end user.
4080Appendix E. Changes since RFC 4871
4082 o Abstract and introduction refined based on accumulated experience.
4084 o Various references updated.
4090Crocker, et al. Standards Track [Page 73]
4092RFC 6376 DKIM Signatures September 2011
4095 o Several errata resolved (see http://www.rfc-editor.org/):
4111 * 1383 discarded (no longer applies)
4125 o Introductory section enumerating relevant architectural documents
4128 o Introductory section briefly discussing the matter of data
4131 o Allowed tolerance of some clock drift.
4133 o Dropped "g=" tag from key records. The implementation report
4134 indicates that it is not in use.
4136 o Removed errant note about wildcards in the DNS.
4138 o Removed SMTP-specific advice in most places.
4140 o Reduced (non-normative) recommended signature content list, and
4141 reworked the text in that section.
4146Crocker, et al. Standards Track [Page 74]
4148RFC 6376 DKIM Signatures September 2011
4151 o Clarified signature generation algorithm by rewriting its pseudo-
4154 o Numerous terminology subsections added, imported from [RFC5672].
4155 Also, began using these terms throughout the document (e.g., SDID,
4158 o Sections added that specify input and output requirements. Input
4159 requirements address a security concern raised by the working
4160 group (see also new sections in Security Considerations). Output
4161 requirements are imported from [RFC5672].
4163 o Appendix subsection added discussing compatibility with DomainKeys
4164 ([RFC4870]) records.
4166 o Referred to [RFC5451] as an example method of communicating the
4167 results of DKIM verification.
4169 o Removed advice about possible uses of the "l=" signature tag.
4171 o IANA registry updated.
4173 o Added two new Security Considerations sections talking about
4174 malformed message attacks.
4176 o Various copy editing.
4178Appendix F. Acknowledgments
4180 The previous IETF version of DKIM [RFC4871] was edited by Eric
4181 Allman, Jon Callas, Mark Delany, Miles Libbey, Jim Fenton, and
4184 That specification was the result of an extended collaborative
4185 effort, including participation by Russ Allbery, Edwin Aoki, Claus
4186 Assmann, Steve Atkins, Rob Austein, Fred Baker, Mark Baugher, Steve
4187 Bellovin, Nathaniel Borenstein, Dave Crocker, Michael Cudahy, Dennis
4188 Dayman, Jutta Degener, Frank Ellermann, Patrik Faeltstroem, Mark
4189 Fanto, Stephen Farrell, Duncan Findlay, Elliot Gillum, Olafur
4190 Gudmundsson, Phillip Hallam-Baker, Tony Hansen, Sam Hartman, Arvel
4191 Hathcock, Amir Herzberg, Paul Hoffman, Russ Housley, Craig Hughes,
4192 Cullen Jennings, Don Johnsen, Harry Katz, Murray S. Kucherawy, Barry
4193 Leiba, John Levine, Charles Lindsey, Simon Longsdale, David Margrave,
4194 Justin Mason, David Mayne, Thierry Moreau, Steve Murphy, Russell
4195 Nelson, Dave Oran, Doug Otis, Shamim Pirzada, Juan Altmayer Pizzorno,
4196 Sanjay Pol, Blake Ramsdell, Christian Renaud, Scott Renfro, Neil
4202Crocker, et al. Standards Track [Page 75]
4204RFC 6376 DKIM Signatures September 2011
4207 Rerup, Eric Rescorla, Dave Rossetti, Hector Santos, Jim Schaad, the
4208 Spamhaus.org team, Malte S. Stretz, Robert Sanders, Rand Wacker, Sam
4209 Weiler, and Dan Wing.
4211 The earlier DomainKeys was a primary source from which DKIM was
4212 derived. Further information about DomainKeys is at [RFC4870].
4214 This revision received contributions from Steve Atkins, Mark Delany,
4215 J.D. Falk, Jim Fenton, Michael Hammer, Barry Leiba, John Levine,
4216 Charles Lindsey, Jeff Macdonald, Franck Martin, Brett McDowell, Doug
4217 Otis, Bill Oxley, Hector Santos, Rolf Sonneveld, Michael Thomas, and
4222 Dave Crocker (editor)
4223 Brandenburg InternetWorking
4228 Phone: +1.408.246.8253
4229 EMail: dcrocker@bbiw.net
4230 URI: http://bbiw.net
4233 Tony Hansen (editor)
4235 200 Laurel Ave. South
4236 Middletown, NJ 07748
4239 EMail: tony+dkimsig@maillennium.att.com
4242 Murray S. Kucherawy (editor)
4244 128 King St., 2nd Floor
4245 San Francisco, CA 94107
4248 EMail: msk@cloudmark.com
4258Crocker, et al. Standards Track [Page 76]