--- 1/draft-ietf-dkim-base-07.txt 2007-01-20 01:12:11.000000000 +0100 +++ 2/draft-ietf-dkim-base-08.txt 2007-01-20 01:12:11.000000000 +0100 @@ -1,25 +1,25 @@ DKIM E. Allman Internet-Draft Sendmail, Inc. -Expires: June 7, 2007 J. Callas +Expires: July 22, 2007 J. Callas PGP Corporation M. Delany M. Libbey Yahoo! Inc J. Fenton M. Thomas Cisco Systems, Inc. - December 4, 2006 + January 18, 2007 DomainKeys Identified Mail (DKIM) Signatures - draft-ietf-dkim-base-07 + draft-ietf-dkim-base-08 Status of this Memo By submitting this Internet-Draft, each author represents that any applicable patent or other IPR claims of which he or she is aware have been or will be disclosed, and any of which he or she becomes aware will be disclosed, in accordance with Section 6 of BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that @@ -30,25 +30,25 @@ and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt. The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. - This Internet-Draft will expire on June 7, 2007. + This Internet-Draft will expire on July 22, 2007. Copyright Notice - Copyright (C) The Internet Society (2006). + Copyright (C) The Internet Society (2007). Abstract DomainKeys Identified Mail (DKIM) defines a domain-level authentication framework for email using public-key cryptography and key server technology to permit verification of the source and contents of messages by either Mail Transfer Agents (MTAs) or Mail User Agents (MUAs). The ultimate goal of this framework is to permit a signing domain to assert responsibility for a message, thus protecting message signer identity and the integrity of the messages @@ -62,95 +62,100 @@ "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5 1.1 Signing Identity . . . . . . . . . . . . . . . . . . . . . 6 1.2 Scalability . . . . . . . . . . . . . . . . . . . . . . . 6 1.3 Simple Key Management . . . . . . . . . . . . . . . . . . 6 2. Terminology and Definitions . . . . . . . . . . . . . . . . 6 - 2.1 Signers . . . . . . . . . . . . . . . . . . . . . . . . . 7 + 2.1 Signers . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.2 Verifiers . . . . . . . . . . . . . . . . . . . . . . . . 7 2.3 White Space . . . . . . . . . . . . . . . . . . . . . . . 7 2.4 Common ABNF Tokens . . . . . . . . . . . . . . . . . . . . 7 2.5 Imported ABNF Tokens . . . . . . . . . . . . . . . . . . . 8 2.6 DKIM-Quoted-Printable . . . . . . . . . . . . . . . . . . 8 3. Protocol Elements . . . . . . . . . . . . . . . . . . . . . 9 3.1 Selectors . . . . . . . . . . . . . . . . . . . . . . . . 9 3.2 Tag=Value Lists . . . . . . . . . . . . . . . . . . . . . 11 3.3 Signing and Verification Algorithms . . . . . . . . . . . 12 3.4 Canonicalization . . . . . . . . . . . . . . . . . . . . . 14 3.5 The DKIM-Signature header field . . . . . . . . . . . . . 18 - 3.6 Key Management and Representation . . . . . . . . . . . . 25 + 3.6 Key Management and Representation . . . . . . . . . . . . 26 3.7 Computing the Message Hashes . . . . . . . . . . . . . . . 30 3.8 Signing by Parent Domains . . . . . . . . . . . . . . . . 32 - 4. Semantics of Multiple Signatures . . . . . . . . . . . . . . 32 - 5. Signer Actions . . . . . . . . . . . . . . . . . . . . . . . 33 - 5.1 Determine if the Email Should be Signed and by Whom . . . 33 - 5.2 Select a private-key and corresponding selector - information . . . . . . . . . . . . . . . . . . . . . . . 33 - 5.3 Normalize the Message to Prevent Transport Conversions . . 34 - 5.4 Determine the header fields to Sign . . . . . . . . . . . 34 - 5.5 Compute the Message Hash and Signature . . . . . . . . . . 36 - 5.6 Insert the DKIM-Signature header field . . . . . . . . . . 37 - 6. Verifier Actions . . . . . . . . . . . . . . . . . . . . . . 37 - 6.1 Extract Signatures from the Message . . . . . . . . . . . 38 - 6.2 Communicate Verification Results . . . . . . . . . . . . . 43 - 6.3 Interpret Results/Apply Local Policy . . . . . . . . . . . 44 - 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . 45 - 7.1 DKIM-Signature Tag Specifications . . . . . . . . . . . . 45 - 7.2 DKIM-Signature Query Method Registry . . . . . . . . . . . 46 - 7.3 DKIM-Signature Canonicalization Registry . . . . . . . . . 46 - 7.4 _domainkey DNS TXT Record Tag Specifications . . . . . . . 47 - 7.5 DKIM Key Type Registry . . . . . . . . . . . . . . . . . . 48 - 7.6 DKIM Hash Algorithms Registry . . . . . . . . . . . . . . 48 - 7.7 DKIM Service Types Registry . . . . . . . . . . . . . . . 48 - 7.8 DKIM Selector Flags Registry . . . . . . . . . . . . . . . 49 - 7.9 DKIM-Signature Header Field . . . . . . . . . . . . . . . 49 - 8. Security Considerations . . . . . . . . . . . . . . . . . . 49 - 8.1 Misuse of Body Length Limits ("l=" Tag) . . . . . . . . . 49 - 8.2 Misappropriated Private Key . . . . . . . . . . . . . . . 50 - 8.3 Key Server Denial-of-Service Attacks . . . . . . . . . . . 51 - 8.4 Attacks Against DNS . . . . . . . . . . . . . . . . . . . 51 - 8.5 Replay Attacks . . . . . . . . . . . . . . . . . . . . . . 52 - 8.6 Limits on Revoking Keys . . . . . . . . . . . . . . . . . 53 - 8.7 Intentionally malformed Key Records . . . . . . . . . . . 53 - 8.8 Intentionally Malformed DKIM-Signature header fields . . . 53 - 8.9 Information Leakage . . . . . . . . . . . . . . . . . . . 53 - 8.10 Remote Timing Attacks . . . . . . . . . . . . . . . . . 53 - 8.11 Reordered Header Fields . . . . . . . . . . . . . . . . 54 - 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 54 - 9.1 Normative References . . . . . . . . . . . . . . . . . . . 54 - 9.2 Informative References . . . . . . . . . . . . . . . . . . 55 - Authors' Addresses . . . . . . . . . . . . . . . . . . . . . 55 - A. Example of Use (INFORMATIVE) . . . . . . . . . . . . . . . . 57 - A.1 The user composes an email . . . . . . . . . . . . . . . . 57 - A.2 The email is signed . . . . . . . . . . . . . . . . . . . 57 - A.3 The email signature is verified . . . . . . . . . . . . . 58 - B. Usage Examples (INFORMATIVE) . . . . . . . . . . . . . . . . 59 - B.1 Alternate Submission Scenarios . . . . . . . . . . . . . . 59 - B.2 Alternate Delivery Scenarios . . . . . . . . . . . . . . . 62 - C. Creating a public key (INFORMATIVE) . . . . . . . . . . . . 64 - D. MUA Considerations . . . . . . . . . . . . . . . . . . . . . 65 - E. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 66 - F. Edit History . . . . . . . . . . . . . . . . . . . . . . . . 66 - F.1 Changes since -ietf-06 version . . . . . . . . . . . . . . 67 - F.2 Changes since -ietf-05 version . . . . . . . . . . . . . . 67 - F.3 Changes since -ietf-04 version . . . . . . . . . . . . . . 68 - F.4 Changes since -ietf-03 version . . . . . . . . . . . . . . 68 - F.5 Changes since -ietf-02 version . . . . . . . . . . . . . . 69 - F.6 Changes since -ietf-01 version . . . . . . . . . . . . . . 70 - F.7 Changes since -ietf-00 version . . . . . . . . . . . . . . 71 - F.8 Changes since -allman-01 version . . . . . . . . . . . . . 71 - F.9 Changes since -allman-00 version . . . . . . . . . . . . . 72 - Intellectual Property and Copyright Statements . . . . . . . 73 + 4. Semantics of Multiple Signatures . . . . . . . . . . . . . . 33 + 4.1 Example Scenarios . . . . . . . . . . . . . . . . . . . . 33 + 4.2 Interpretation . . . . . . . . . . . . . . . . . . . . . . 34 + 5. Signer Actions . . . . . . . . . . . . . . . . . . . . . . . 35 + 5.1 Determine if the Email Should be Signed and by Whom . . . 35 + 5.2 Select a Private Key and Corresponding Selector + Information . . . . . . . . . . . . . . . . . . . . . . . 36 + 5.3 Normalize the Message to Prevent Transport Conversions . . 36 + 5.4 Determine the Header Fields to Sign . . . . . . . . . . . 37 + 5.5 Compute the Message Hash and Signature . . . . . . . . . . 40 + 5.6 Insert the DKIM-Signature Header Field . . . . . . . . . . 40 + 6. Verifier Actions . . . . . . . . . . . . . . . . . . . . . . 41 + 6.1 Extract Signatures from the Message . . . . . . . . . . . 41 + 6.2 Communicate Verification Results . . . . . . . . . . . . . 47 + 6.3 Interpret Results/Apply Local Policy . . . . . . . . . . . 47 + 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . 49 + 7.1 DKIM-Signature Tag Specifications . . . . . . . . . . . . 49 + 7.2 DKIM-Signature Query Method Registry . . . . . . . . . . . 49 + 7.3 DKIM-Signature Canonicalization Registry . . . . . . . . . 50 + 7.4 _domainkey DNS TXT Record Tag Specifications . . . . . . . 50 + 7.5 DKIM Key Type Registry . . . . . . . . . . . . . . . . . . 51 + 7.6 DKIM Hash Algorithms Registry . . . . . . . . . . . . . . 51 + 7.7 DKIM Service Types Registry . . . . . . . . . . . . . . . 52 + 7.8 DKIM Selector Flags Registry . . . . . . . . . . . . . . . 52 + 7.9 DKIM-Signature Header Field . . . . . . . . . . . . . . . 53 + 8. Security Considerations . . . . . . . . . . . . . . . . . . 53 + 8.1 Misuse of Body Length Limits ("l=" Tag) . . . . . . . . . 53 + 8.2 Misappropriated Private Key . . . . . . . . . . . . . . . 54 + 8.3 Key Server Denial-of-Service Attacks . . . . . . . . . . . 54 + 8.4 Attacks Against DNS . . . . . . . . . . . . . . . . . . . 55 + 8.5 Replay Attacks . . . . . . . . . . . . . . . . . . . . . . 55 + 8.6 Limits on Revoking Keys . . . . . . . . . . . . . . . . . 56 + 8.7 Intentionally malformed Key Records . . . . . . . . . . . 56 + 8.8 Intentionally Malformed DKIM-Signature header fields . . . 56 + 8.9 Information Leakage . . . . . . . . . . . . . . . . . . . 57 + 8.10 Remote Timing Attacks . . . . . . . . . . . . . . . . . 57 + 8.11 Reordered Header Fields . . . . . . . . . . . . . . . . 57 + 8.12 RSA Attacks . . . . . . . . . . . . . . . . . . . . . . 57 + 8.13 Inappropriate Signing by Parent Domains . . . . . . . . 57 + 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 58 + 9.1 Normative References . . . . . . . . . . . . . . . . . . . 58 + 9.2 Informative References . . . . . . . . . . . . . . . . . . 59 + Authors' Addresses . . . . . . . . . . . . . . . . . . . . . 59 + A. Example of Use (INFORMATIVE) . . . . . . . . . . . . . . . . 61 + A.1 The user composes an email . . . . . . . . . . . . . . . . 61 + A.2 The email is signed . . . . . . . . . . . . . . . . . . . 61 + A.3 The email signature is verified . . . . . . . . . . . . . 62 + B. Usage Examples (INFORMATIVE) . . . . . . . . . . . . . . . . 63 + B.1 Alternate Submission Scenarios . . . . . . . . . . . . . . 64 + B.2 Alternate Delivery Scenarios . . . . . . . . . . . . . . . 66 + C. Creating a public key (INFORMATIVE) . . . . . . . . . . . . 68 + D. MUA Considerations . . . . . . . . . . . . . . . . . . . . . 70 + E. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 70 + F. Edit History . . . . . . . . . . . . . . . . . . . . . . . . 71 + F.1 Changes since -ietf-07 version . . . . . . . . . . . . . . 71 + F.2 Changes since -ietf-06 version . . . . . . . . . . . . . . 72 + F.3 Changes since -ietf-05 version . . . . . . . . . . . . . . 73 + F.4 Changes since -ietf-04 version . . . . . . . . . . . . . . 73 + F.5 Changes since -ietf-03 version . . . . . . . . . . . . . . 74 + F.6 Changes since -ietf-02 version . . . . . . . . . . . . . . 75 + F.7 Changes since -ietf-01 version . . . . . . . . . . . . . . 76 + F.8 Changes since -ietf-00 version . . . . . . . . . . . . . . 76 + F.9 Changes since -allman-01 version . . . . . . . . . . . . . 77 + F.10 Changes since -allman-00 version . . . . . . . . . . . . 77 + Intellectual Property and Copyright Statements . . . . . . . 79 1. Introduction [[Note: text in double square brackets (such as this text) will be deleted before publication.]] DomainKeys Identified Mail (DKIM) defines a mechanism by which email messages can be cryptographically signed, permitting a signing domain to claim responsibility for the introduction of a message into the mail stream. Message recipients can verify the signature by querying @@ -182,23 +187,20 @@ DKIM: o is compatible with the existing email infrastructure and transparent to the fullest extent possible; o requires minimal new infrastructure; o can be implemented independently of clients in order to reduce deployment time; - o does not require the use of an additional trusted third party - (such as a certificate authority or other entity) which might - impose significant costs or introduce delays to deployment; o can be deployed incrementally; o allows delegation of signing to third parties. 1.1 Signing Identity DKIM separates the question of the identity of the signer of the message from the purported author of the message. In particular, a signature includes the identity of the signer. Verifiers can use the signing information to decide how they want to process the message. @@ -220,39 +222,39 @@ communicate with anyone else without introduction. 1.3 Simple Key Management DKIM differs from traditional hierarchical public-key systems in that no Certificate Authority infrastructure is required; the verifier requests the public key from a repository in the domain of the claimed signer directly rather than from a third party. The DNS is proposed as the initial mechanism for the public keys. - Thus, DKIM currently depends on DNS adminstration and the security of - the DNS system. DKIM is designed to be extensible to other key + Thus, DKIM currently depends on DNS administration and the security + of the DNS system. DKIM is designed to be extensible to other key fetching services as they become available. 2. Terminology and Definitions This section defines terms used in the rest of the document. Syntax descriptions use the form described in Augmented BNF for Syntax Specifications [RFC4234]. 2.1 Signers - Elements in the mail system that sign messages are referred to as - signers. These may be MUAs (Mail User Agents), MSAs (Mail Submission - Agents), MTAs (Mail Transfer Agents), or other agents such as mailing - list exploders. In general any signer will be involved in the - injection of a message into the message system in some way. The key - issue is that a message must be signed before it leaves the - administrative domain of the signer. + Elements in the mail system that sign messages on behalf of a domain + are referred to as signers. These may be MUAs (Mail User Agents), + MSAs (Mail Submission Agents), MTAs (Mail Transfer Agents), or other + agents such as mailing list exploders. In general any signer will be + involved in the injection of a message into the message system in + some way. The key issue is that a message must be signed before it + leaves the administrative domain of the signer. 2.2 Verifiers Elements in the mail system that verify signatures are referred to as verifiers. These may be MTAs, Mail Delivery Agents (MDAs), or MUAs. In most cases it is expected that verifiers will be close to an end user (reader) of the message or some consuming agent such as a mailing list exploder. 2.3 White Space @@ -277,21 +279,21 @@ The definition of FWS is identical to that in [RFC2822] except for the exclusion of obs-FWS. 2.4 Common ABNF Tokens The following ABNF tokens are used elsewhere in this document. hyphenated-word = ALPHA [ *(ALPHA / DIGIT / "-") (ALPHA / DIGIT) ] base64string = 1*(ALPHA / DIGIT / "+" / "/" / LWSP) - [ "=" *LWSP [ "=" *LWSP ] ] + [ "=" LWSP [ "=" LWSP ] ] 2.5 Imported ABNF Tokens The following tokens are imported from other RFCs as noted. Those RFCs should be considered definitive. The following tokens are imported from [RFC2821]: o "Local-part" (implementation warning: this permits quoted strings) @@ -413,47 +415,48 @@ in different regions or on different email servers. Beyond administrative convenience, Selectors make it possible to seamlessly replace public keys on a routine basis. If a domain wishes to change from using a public key associated with Selector "january2005" to a public key associated with Selector "february2005", it merely makes sure that both public keys are advertised in the public-key repository concurrently for the transition period during which email may be in transit prior to verification. At the start of the transition period, the outbound - email servers are configured to sign with the "february2005" private- + email servers are configured to sign with the "february2005" private key. At the end of the transition period, the "january2005" public key is removed from the public-key repository. INFORMATIVE NOTE: A key may also be revoked as described below. The distinction between revoking and removing a key selector record is subtle. When phasing out keys as described above, a signing domain would probably simply remove the key record after the transition period. However, a signing domain could elect to revoke the key (but maintain the key record) for a further period. There is no defined semantic difference between a revoked key and a removed key. While some domains may wish to make Selector values well known, others will want to take care not to allocate Selector names in a way that allows harvesting of data by outside parties. For example, if per-user keys are issued, the domain owner will need to make the decision as to whether to associate this Selector directly with the user name, or make it some unassociated random value, such as a fingerprint of the public key. - Reusing a Selector with a new key (for example, changing the key - associated with a user's name) makes it impossible to tell the - difference between a message that didn't verify because the key is no - longer valid versus a message that is actually forged. Signers - SHOULD NOT change the key associated with a Selector. When creating - a new key, signers SHOULD associate it with a new Selector. + INFORMATIVE OPERATIONS NOTE: Reusing a Selector with a new key + (for example, changing the key associated with a user's name) + makes it impossible to tell the difference between a message that + didn't verify because the key is no longer valid versus a message + that is actually forged. For this reason, signers are ill-advised + to reuse selectors for new keys. A better strategy is to assign + new keys to new selectors. 3.2 Tag=Value Lists DKIM uses a simple "tag=value" syntax in several contexts, including in messages and domain signature records. Values are a series of strings containing either plain text, "base64" text (as defined in [RFC2045], section 6.8), "qp-section" (ibid, section 6.7), or "dkim-quoted-printable" (as defined in Section 2.6). The name of the tag will determine the encoding of each value. @@ -543,22 +546,22 @@ performance and risk. Since short RSA keys more easily succumb to off-line attacks, signers MUST use RSA keys of at least 1024 bits for long-lived keys. Verifiers MUST be able to validate signatures with keys ranging from 512 bits to 2048 bits, and they MAY be able to validate signatures with larger keys. Verifier policies may use the length of the signing key as one metric for determining whether a signature is acceptable. Factors that should influence the key size choice include: - o The practical constraint that large keys may not fit within a 512 - byte DNS UDP response packet + o The practical constraint that large (e.g., 4096 bit) keys may not + fit within a 512 byte DNS UDP response packet o The security constraint that keys smaller than 1024 bits are subject to off-line attacks o Larger keys impose higher CPU costs to verify and sign email o Keys can be replaced on a regular basis, thus their lifetime can be relatively short o The security goals of this specification are modest compared to typical goals of other systems that employ digital signatures @@ -643,25 +646,28 @@ value. o Delete any WSP characters remaining before and after the colon separating the header field name from the header field value. The colon separator MUST be retained. 3.4.3 The "simple" Body Canonicalization Algorithm The "simple" body canonicalization algorithm ignores all empty lines at the end of the message body. An empty line is a line of zero - length after removal of the line terminator. If there is no trailing - CRLF on the message, a CRLF is added. It makes no other changes to - the message body. In more formal terms, the "simple" body - canonicalization algorithm converts "0*CRLF" at the end of the body - to a single "CRLF". + length after removal of the line terminator. If there is no body or + no trailing CRLF on the message body, a CRLF is added. It makes no + other changes to the message body. In more formal terms, the + "simple" body canonicalization algorithm converts "0*CRLF" at the end + of the body to a single "CRLF". + + Note that a completely empty or missing body is canonicalized as a + single "CRLF"; that is, the canonicalized length will be 2 octets. 3.4.4 The "relaxed" Body Canonicalization Algorithm The "relaxed" body canonicalization algorithm: o Ignores all white space at the end of lines. Implementations MUST NOT remove the CRLF at the end of the line. o Reduces all sequences of WSP within a line to a single SP character. @@ -700,21 +706,23 @@ algorithm is not included as part of the body length count. Signers of MIME messages that include a body length count SHOULD be sure that the length extends to the closing MIME boundary string. INFORMATIVE IMPLEMENTATION NOTE: A signer wishing to ensure that the only acceptable modifications are to add to the MIME postlude would use a body length count encompassing the entire final MIME boundary string, including the final "--CRLF". A signer wishing to allow additional MIME parts but not modification of existing parts would use a body length count extending through the final - MIME boundary string, omitting the final "--CRLF". + MIME boundary string, omitting the final "--CRLF". Note that this + only works for some MIME types, e.g., multipart/mixed but not + multipart/signed. A body length count of zero means that the body is completely unsigned. Signers wishing to ensure that no modification of any sort can occur should specify the "simple" canonicalization algorithm for both header and body and omit the body length count. 3.4.6 Canonicalization Examples (INFORMATIVE) @@ -791,32 +799,34 @@ One [RFC2045], with the additional conversion of semicolon characters to "=3B"; intuitively, this is one line of quoted-printable encoded text. The dkim-quoted-printable syntax is defined in Section 2.6. Tags on the DKIM-Signature header field along with their type and requirement status are shown below. Unrecognized tags MUST be ignored. v= Version (MUST be included). This tag defines the version of this specification that applies to the signature record. It MUST have - the value 0.5. + the value 0.5. Note that verifiers must do a string comparison + on this value; for example, "1" is not the same as "1.0". ABNF: sig-v-tag = %x76 [FWS] "=" [FWS] "0.5" INFORMATIVE NOTE: DKIM-Signature version numbers are expected to increase arithmetically as new versions of this specification are released. [[INFORMATIVE NOTE: Upon publication, this version number - should be changed to "1", and this note should be deleted.]] + should be changed to "1" (two places), and this note should + be deleted.]] a= The algorithm used to generate the signature (plain-text; REQUIRED). Verifiers MUST support "rsa-sha1" and "rsa-sha256"; signers SHOULD sign using "rsa-sha256". See Section 3.3 for a description of algorithms. ABNF: sig-a-tag = %x61 [FWS] "=" [FWS] sig-a-tag-alg sig-a-tag-alg = sig-a-tag-k "-" sig-a-tag-h @@ -976,27 +988,30 @@ include content that solely benefits the attacker. It is possible for the appended content to completely replace the original content in the end recipient's eyes and to defeat duplicate message detection algorithms. Examples are described in Security Considerations (Section 8). To avoid this attack, signers should be extremely wary of using this tag, and verifiers might wish to ignore the tag or remove text that appears after the specified content length. INFORMATIVE NOTE: The value of the l= tag is constrained to - 76 decimal digits, which will fit in a 256-bit binary integer - field. This constraint is not intended to predict the size - of future messages, but is intended to remind the implementer - to check the length of this and all other tags during - verification. Implementers may need to limit the actual - value expressed to a value smaller than 10^76, e.g., to allow - a message to fit within the available storage space. + 76 decimal digits. This constraint is not intended to + predict the size of future messages or to require + implementations to use an integer representation large enough + to represent the maximum possible value, but is intended to + remind the implementer to check the length of this and all + other tags during verification and to test for integer + overflow when decoding the value. Implementers may need to + limit the actual value expressed to a value smaller than + 10^76, e.g., to allow a message to fit within the available + storage space. ABNF: sig-l-tag = %x6c [FWS] "=" [FWS] 1*76DIGIT q= A colon-separated list of query methods used to retrieve the public key (plain-text; OPTIONAL, default is "dns/txt"). Each query method is of the form "type[/options]", where the syntax and semantics of the options depends on the type and specified options. If there are multiple query mechanisms listed, the @@ -1027,21 +1043,22 @@ t= Signature Timestamp (plain-text unsigned decimal integer; RECOMMENDED, default is an unknown creation time). The time that this signature was created. The format is the number of seconds since 00:00:00 on January 1, 1970 in the UTC time zone. The value is expressed as an unsigned integer in decimal ASCII. This value is not constrained to fit into a 31- or 32-bit integer. Implementations SHOULD be prepared to handle values up to at least 10^12 (until approximately AD 200,000; this fits into 40 bits). To avoid denial of service attacks, implementations MAY consider any value longer than 12 digits to be infinite. Leap - seconds are not counted. + seconds are not counted. Implementations MAY ignore signatures + that have a timestamp in the future. ABNF: sig-t-tag = %x74 [FWS] "=" [FWS] 1*12DIGIT x= Signature Expiration (plain-text unsigned decimal integer; RECOMMENDED, default is no expiration). The format is the same as in the "t=" tag, represented as an absolute date, not as a time delta from the signing timestamp. The value is expressed as an unsigned integer in decimal ASCII, with the same constraints @@ -1068,23 +1086,23 @@ tag. The header field text itself must encode the vertical bar ("|", %x7C) character (i.e., vertical bars in the z= text are metacharacters, and any actual vertical bar characters in a copied header field must be encoded). Note that all white space must be encoded, including white space between the colon and the header field value. After encoding, LWSP MAY be added at arbitrary locations in order to avoid excessively long lines; such white space is NOT part of the value of the header field, and MUST be removed before decoding. - Verifiers MUST NOT use the header field names or copied values - for checking the signature in any way. Copied header field - values are for diagnostic use only. + The header fields referenced by the h= tag refer to the fields in + the 2822 header of the message, not to any copied fields in the + z= tag. Copied header field values are for diagnostic use. Header fields with characters requiring conversion (perhaps from legacy MTAs which are not [RFC2822] compliant) SHOULD be converted as described in MIME Part Three [RFC2047]. ABNF: sig-z-tag = %x7A [FWS] "=" [FWS] sig-z-tag-copy *( [FWS] "|" sig-z-tag-copy ) sig-z-tag-copy = hdr-name ":" qp-hdr-value qp-hdr-value = dkim-quoted-printable ; with "|" encoded @@ -1110,22 +1128,22 @@ a trusted third party. However, DKIM can achieve a sufficient level of security, with significantly enhanced scalability, by simply having the verifier query the purported signer's DNS entry (or some security-equivalent) in order to retrieve the public key. DKIM keys can potentially be stored in multiple types of key servers and in multiple formats. The storage and format of keys are irrelevant to the remainder of the DKIM algorithm. Parameters to the key lookup algorithm are the type of the lookup - (the "q=" tag), the domain of the responsible signer (the "d=" tag of - the DKIM-Signature header field), and the Selector (the "s=" tag). + (the "q=" tag), the domain of the signer (the "d=" tag of the DKIM- + Signature header field), and the Selector (the "s=" tag). public_key = dkim_find_key(q_val, d_val, s_val) This document defines a single binding, using DNS TXT records to distribute the keys. Other bindings may be defined in the future. 3.6.1 Textual Representation It is expected that many key servers will choose to present the keys in an otherwise unstructured text format (for example, an XML form @@ -1135,40 +1153,46 @@ The overall syntax is a tag-list as described in Section 3.2. The current valid tags are described below. Other tags MAY be present and MUST be ignored by any implementation that does not understand them. v= Version of the DKIM key record (plain-text; RECOMMENDED, default is "DKIM1"). If specified, this tag MUST be set to "DKIM1" (without the quotes). This tag MUST be the first tag in the record. Records beginning with a "v=" tag with any other value - MUST be discarded. + MUST be discarded. Note that verifiers must do a string + comparison on this value; for example, "DKIM1" is not the same as + "DKIM1.0". ABNF: key-v-tag = %x76 [FWS] "=" [FWS] "DKIM1" + g= granularity of the key (plain-text; OPTIONAL, default is "*"). This value MUST match the Local-part of the "i=" tag of the DKIM- Signature header field (or its default value of the empty string - if "i=" is not specified), with a "*" character matching a - sequence of zero or more arbitrary characters ("wildcarding"). + if "i=" is not specified), with a single, optional "*" character + matching a sequence of zero or more arbitrary characters + ("wildcarding"). An email with a signing address that does not + match the value of this tag constitutes a failed verification. The intent of this tag is to constrain which signing address can - legitimately use this Selector. An email with a signing address - that does not match the value of this tag constitutes a failed - verification. Wildcarding allows matching for addresses such as - "user+*". An empty "g=" value never matches any addresses. + legitimately use this Selector, for example, when delegating a + key to a third party that should only be used for special + purposes. Wildcarding allows matching for addresses such as + "user+*" or "*-offer". An empty "g=" value never matches any + addresses. ABNF: key-g-tag = %x67 [FWS] "=" [FWS] key-g-tag-lpart - key-g-tag-lpart = [dot-atom-text] ["*"] [dot-atom-text] + key-g-tag-lpart = [dot-atom-text] ["*" [dot-atom-text] ] [[NON-NORMATIVE DISCUSSION POINT: "*" is legal in a "dot- atom-text". This should probably use a different character for wildcarding. Unfortunately, the options are non-mnemonic (e.g., "@", "(", ":"). Alternatively we could insist on escaping a "*" intended as a literal "*" in the address.]] h= Acceptable hash algorithms (plain-text; OPTIONAL, defaults to allowing all algorithms). A colon-separated list of hash algorithms that might be used. Signers and Verifiers MUST @@ -1191,21 +1215,22 @@ ABNF: key-k-tag = %x76 [FWS] "=" [FWS] key-k-tag-type key-k-tag-type = "rsa" / x-key-k-tag-type x-key-k-tag-type = hyphenated-word ; for future extension n= Notes that might be of interest to a human (qp-section; OPTIONAL, default is empty). No interpretation is made by any program. This tag should be used sparingly in any key server mechanism - that has space limitations (notably DNS). + that has space limitations (notably DNS). This is intended for + use by administrators, not end users. ABNF: key-n-tag = %x6e [FWS] "=" [FWS] qp-section p= Public-key data (base64; REQUIRED). An empty value means that this public key has been revoked. The syntax and semantics of this tag value before being encoded in base64 is defined by the k= tag. @@ -1224,29 +1249,28 @@ s= Service Type (plain-text; OPTIONAL; default is "*"). A colon- separated list of service types to which this record applies. Verifiers for a given service type MUST ignore this record if the appropriate type is not listed. Currently defined service types are: * matches all service types email electronic mail (not necessarily limited to SMTP) - This tag is intended to permit signers to constrain the use of - delegated keys, e.g., where a company is willing to delegate the - right to send mail in their name to an outsourcer, but not to - send IM or make VoIP calls. (This of course presumes that these - keys are used in other services in the future.) + This tag is intended to constrain the use of keys for other + purposes, should use of DKIM be defined by other services in the + future. + ABNF: key-s-tag = %x73 [FWS] "=" [FWS] key-s-tag-type - 0*( [FWS] ":" [FWS] key-s-tag-type + 0*( [FWS] ":" [FWS] key-s-tag-type ) key-s-tag-type = "email" / "*" / x-key-s-tag-type x-key-s-tag-type = hyphenated-word ; for future extension t= Flags, represented as a colon-separated list of names (plain- text; OPTIONAL, default is no flags set). The defined flags are: y This domain is testing DKIM. Verifiers MUST NOT treat messages from signers in testing mode differently from unsigned email, even should the signature fail to verify. Verifiers MAY wish to track testing mode results to assist @@ -1304,34 +1328,35 @@ computing two cryptographic hashes over the message. Signers will choose the parameters of the signature as described in Signer Actions (Section 5); verifiers will use the parameters specified in the "DKIM-Signature" header field being verified. In the following discussion, the names of the tags in the "DKIM-Signature" header field which either exists (when verifying) or will be created (when signing) are used. Note that canonicalization (Section 3.4) is only used to prepare the email for signing or verifying; it does not affect the transmitted email in any way. - The signer or verifier MUST compute two hashes, one over the body of - the message and one over the selected header fields of the message. + The signer/verifier MUST compute two hashes, one over the body of the + message and one over the selected header fields of the message. Signers MUST compute them in the order shown. Verifiers MAY compute them in any order convenient to the verifier, provided that the result is semantically identical to the semantics that would be the case had they been computed in this order. - In hash step 1, the signer or verifier MUST hash the message body, + In hash step 1, the signer/verifier MUST hash the message body, canonicalized using the body canonicalization algorithm specified in - the "c=" tag and truncated to the length specified in the "l=" tag. - That hash value is then converted to base64 form and inserted into - the "bh=" tag of the DKIM-Signature: header field. + the "c=" tag and then truncated to the length specified in the "l=" + tag. That hash value is then converted to base64 form and inserted + into (signers) or compared to (verifiers) the "bh=" tag of the DKIM- + Signature: header field. - In hash step 2, the signer or verifier MUST pass the following to the + In hash step 2, the signer/verifier MUST pass the following to the hash algorithm in the indicated order. 1. The header fields specified by the "h=" tag, in the order specified in that tag, and canonicalized using the header canonicalization algorithm specified in the "c=" tag. Each header field MUST be terminated with a single CRLF. 2. The "DKIM-Signature" header field that exists (verifying) or will be inserted (signing) in the message, with the value of the "b=" tag deleted (i.e., treated as the empty string), canonicalized @@ -1347,21 +1372,23 @@ rest of the header fields and MUST be canonicalized as specified in the "c=" (canonicalization) tag. The DKIM-Signature header field MUST NOT be included in its own h= tag, although other DKIM-Signature header fields MAY be signed (see Section 4). When calculating the hash on messages that will be transmitted using base64 or quoted-printable encoding, signers MUST compute the hash after the encoding. Likewise, the verifier MUST incorporate the values into the hash before decoding the base64 or quoted-printable text. However, the hash MUST be computed before transport level - encodings such as SMTP "dot-stuffing." + encodings such as SMTP "dot-stuffing" (the modification of lines + beginning with a "." to avoid confusion with the SMTP end-of-message + marker, as specified in [RFC2821]). With the exception of the canonicalization procedure described in Section 3.4, the DKIM signing process treats the body of messages as simply a string of octets. DKIM messages MAY be either in plain-text or in MIME format; no special treatment is afforded to MIME content. Message attachments in MIME format MUST be included in the content which is signed. More formally, the algorithm for the signature is: body-hash = hash-alg(canon_body) @@ -1397,62 +1424,134 @@ of the record to exactly the domain of the signing identity. If the referenced key record contains the "s" flag as part of the t= tag, the domain of the signing identity (i= flag) MUST be the same as that of the d= domain. If this flag is absent, the domain of the signing identity MUST be the same as, or a subdomain of, the d= domain. Key records which are not intended for use with subdomains SHOULD specify the "s" flag in the t= tag. 4. Semantics of Multiple Signatures +4.1 Example Scenarios + + There are many reasons that a message might have multiple signatures. + For example, a given signer might sign multiple times, perhaps with + different hashing or signing algorithms during a transition phase. + + INFORMATIVE EXAMPLE: Suppose SHA-256 is in the future found to be + insufficiently strong, and DKIM usage transitions to SHA-1024. A + signer might immediately sign using the newer algorithm, but + continue to sign using the older algorithm for interoperability + with verifiers that had not yet upgraded. The signer would do + this by adding two DKIM-Signature header fields, one using each + algorithm. Older verifiers that did not recognize SHA-1024 as an + acceptable algorithm would skip that signature and use the older + algorithm; newer verifiers could use either signature at their + option, and all other things being equal might not even attempt to + verify the other signature. + + Similarly, a signer might sign a message including all headers and no + "l=" tag (to satisfy strict verifiers) and a second time with a + limited set of headers and an "l=" tag (in anticipation of possible + message modifications in route to other verifiers). Verifiers could + then choose which signature they preferred. + + INFORMATIVE EXAMPLE: A verifier might receive a message with two + signatures, one covering more of the message than the other. If + the signature covering more of the message verified, then the + verifier could make one set of policy decisions; if that signature + failed but the signature covering less of the message verified, + the verifier might make a different set of policy decisions. + + Of course, a message might also have multiple signatures because it + passed through multiple signers. A common case is expected to be + that of a signed message that passes through a mailing list that also + signs all messages. Assuming both of those signatures verify, a + recipient might choose to accept the message if either of those + signatures were known to come from trusted sources. + + INFORMATIVE EXAMPLE: Recipients might choose to whitelist mailing + lists to which they have subscribed and which have acceptable + anti-abuse policies so as to accept messages sent to that list + even from unknown authors. They might also subscribe to less + trusted mailing lists (e.g., those without anti-abuse protection) + and be willing to accept all messages from specific authors, but + insist on doing additional abuse scanning for other messages. + + Another related example of multiple signers might be forwarding + services, such as those commonly associated with academic alumni + sites. + + INFORMATIVE EXAMPLE: A recipient might have an address at + alumni.example.edu, a site that has anti-abuse protection that is + somewhat less effective than the recipient would prefer. Such a + recipient might have specific authors whose messages would be + trusted absolutely, but messages from unknown authors which had + passed the forwarder's scrutiny would have only medium trust. + +4.2 Interpretation + A signer that is adding a signature to a message merely creates a new DKIM-Signature header, using the usual semantics of the h= option. A signer MAY sign previously existing DKIM-Signature header fields using the method described in section Section 5.4 to sign trace header fields. INFORMATIVE NOTE: Signers should be cognizant that signing DKIM- Signature header fields may result in signature failures with intermediaries that do not recognize that DKIM-Signature header fields are trace header fields and unwittingly reorder them, thus - breaking such signatures. + breaking such signatures. For this reason, signing existing DKIM- + Signature header fields is unadvised, albeit legal. INFORMATIVE NOTE: If a header field with multiple instances is signed, those header fields are always signed from the bottom up. Thus, it is not possible to sign only specific DKIM-Signature header fields. For example, if the message being signed already contains three DKIM-Signature header fields A, B, and C, it is possible to sign all of them, B and C only, or C only, but not A only, B only, A and B only, or A and C only. - When evaluating a message with multiple signatures, a verifier should - evaluate signatures independently and on their own merits. For - example, a verifier that by policy chooses not to accept signatures - with deprecated cryptographic algorithms should consider such - signatures invalid. As with messages with a single signature, - verifiers are at liberty to use the presence of valid signatures as - an input to local policy; likewise, the interpretation of multiple - valid signatures in combination is a local policy decision of the - verifier. + A signer MAY add more than one DKIM-Signature header field using + different parameters. For example, during a transition period a + signer might want to produce signatures using two different hash + algorithms. Signers SHOULD NOT remove any DKIM-Signature header fields from messages they are signing, even if they know that the signatures cannot be verified. + When evaluating a message with multiple signatures, a verifier SHOULD + evaluate signatures independently and on their own merits. For + example, a verifier that by policy chooses not to accept signatures + with deprecated cryptographic algorithms would consider such + signatures invalid. Verifiers MAY process signatures in any order of + their choice; for example, some verifiers might choose to process + signatures corresponding to the From field in the message header + before other signatures. See Section 6.1 for more information about + signature choices. + + Verifiers SHOULD ignore failed signatures as though they were not + present in the message. Verifiers SHOULD continue to check + signatures until a signature successfully verifies to the + satisfaction of the verifier. To limit potential denial-of-service + attacks, verifiers MAY limit the total number of signatures they will + attempt to verify. + 5. Signer Actions The following steps are performed in order by signers. 5.1 Determine if the Email Should be Signed and by Whom A signer can obviously only sign email for domains for which it has a - private-key and the necessary knowledge of the corresponding public + private key and the necessary knowledge of the corresponding public key and Selector information. However there are a number of other reasons beyond the lack of a private key why a signer could choose not to sign an email. INFORMATIVE NOTE: Signing modules may be incorporated into any portion of the mail system as deemed appropriate, including an MUA, a SUBMISSION server, or an MTA. Wherever implemented, signers should beware of signing (and thereby asserting responsibility for) messages that may be problematic. In particular, within a trusted enclave the signing address might be @@ -1461,27 +1560,27 @@ authenticated and authorized. INFORMATIVE IMPLEMENTER ADVICE: SUBMISSION servers should not sign Received header fields if the outgoing gateway MTA obfuscates Received header fields, for example to hide the details of internal topology. If an email cannot be signed for some reason, it is a local policy decision as to what to do with that email. -5.2 Select a private-key and corresponding selector information +5.2 Select a Private Key and Corresponding Selector Information This specification does not define the basis by which a signer should - choose which private-key and Selector information to use. Currently, + choose which private key and Selector information to use. Currently, all Selectors are equal as far as this specification is concerned, so the decision should largely be a matter of administrative - convenience. Distribution and management of private-keys is also + convenience. Distribution and management of private keys is also outside the scope of this document. INFORMATIVE OPERATIONS ADVICE: A signer should not sign with a private key when the Selector containing the corresponding public key is expected to be revoked or removed before the verifier has an opportunity to validate the signature. The signer should anticipate that verifiers may choose to defer validation, perhaps until the message is actually read by the final recipient. In particular, when rotating to a new key pair, signing should immediately commence with the new private key and the old public @@ -1506,21 +1605,21 @@ bare CR or LF characters (used by some systems as a local line separator convention) MUST be converted to the SMTP-standard CRLF sequence before the message is signed. Any conversion of this sort SHOULD be applied to the message actually sent to the recipient(s), not just to the version presented to the signing algorithm. More generally, the signer MUST sign the message as it is expected to be received by the verifier rather than in some local or internal form. -5.4 Determine the header fields to Sign +5.4 Determine the Header Fields to Sign The From header field MUST be signed (that is, included in the h= tag of the resulting DKIM-Signature header field). Signers SHOULD NOT sign an existing header field likely to be legitimately modified or removed in transit. In particular, [RFC2821] explicitly permits modification or removal of the "Return-Path" header field in transit. Signers MAY include any other header fields present at the time of signing at the discretion of the signer. INFORMATIVE OPERATIONS NOTE: The choice of which header fields to @@ -1583,57 +1682,125 @@ then the resulting DKIM-Signature header field should read: DKIM-Signature: ... h=Received : Received : ... and Received header fields and will be signed in that order. Signers should be careful of signing header fields that might have additional instances added later in the delivery process, since such header fields might be inserted after the signed instance or - otherwise reordered. Trace header fields (such as Received and DKIM- - Signature) and Resent-* blocks are the only fields prohibited by - [RFC2822] from being reordered. + otherwise reordered. Trace header fields (such as Received) and + Resent-* blocks are the only fields prohibited by [RFC2822] from + being reordered. In particular, since DKIM-Signature header fields + may be reordered by some intermediate MTAs, signing existing DKIM- + Signature header fields is error-prone. INFORMATIVE ADMONITION: Despite the fact that [RFC2822] permits header fields to be reordered (with the exception of Received header fields), reordering of signed header fields with multiple instances by intermediate MTAs will cause DKIM signatures to be broken; such anti-social behavior should be avoided. INFORMATIVE IMPLEMENTER'S NOTE: Although not required by this specification, all end-user visible header fields should be signed to avoid possible "indirect spamming." For example, if the "Subject" header field is not signed, a spammer can resend a previously signed mail, replacing the legitimate subject with a one-line spam. +5.4.1 Recommended Signature Content + + In order to maximize compatibility with a variety of verifiers, it is + recommended that signers follow the practices outlined in this + section when signing a message. However, these are generic + recommendations applying to the general case; specific senders may + wish to modify these guidelines as required by their unique + situations. Verifiers MUST be capable of verifying signatures even + if one or more of the recommended header fields is not signed (with + the exception of From, which must always be signed) or if one or more + of the disrecommended header fields is signed. Note that verifiers + do have the option of ignoring signatures that do not cover a + sufficient portion of the header or body, just as they may ignore + signatures from an identity they do not trust. + + The following header fields SHOULD be included in the signature, if + they are present in the message being signed: + + o From (REQUIRED in all signatures) + + o Sender, Reply-To + + o Subject + + o Date, Message-ID + + o To, Cc + + o MIME-Version + + o Content-Type, Content-Transfer-Encoding, Content-ID, Content- + Description + + o Resent-Date, Resent-From, Resent-Sender, Resent-To, Resent-cc, + Resent-Message-ID + + o In-Reply-To, References + + o List-Id, List-Help, List-Unsubscribe, List-Subscribe, List-Post, + List-Owner, List-Archive + + The following header fields SHOULD NOT be included in the signature: + + o Return-Path + + o Received + + o Comments, Keywords + + o Bcc, Resent-Bcc + + o DKIM-Signature + + Optional header fields (those not mentioned above) normally SHOULD + NOT be included in the signature, because of the potential for + additional header fields of the same name to be legitimately added or + reordered prior to verification. There are likely to be legitimate + exceptions to this rule, because of the wide variety of application- + specific header fields which may be applied to a message, some of + which are unlikely to be duplicated, modified, or reordered. + + Signers SHOULD include all or nearly all of the body content when + specifying the body length count (l= tag) in the signature. In + particular, signers SHOULD NOT specify a body length of 0 since this + may be interpreted as a meaningless signature by some verifiers. + 5.5 Compute the Message Hash and Signature The signer MUST compute the message hash as described in Section 3.7 and then sign it using the selected public-key algorithm. This will result in a DKIM-Signature header field which will include the body hash and a signature of the header hash, where that header includes the DKIM-Signature header field itself. Entities such as mailing list managers that implement DKIM and which modify the message or a header field (for example, inserting unsubscribe information) before retransmitting the message SHOULD check any existing signature on input and MUST make such modifications before re-signing the message. The signer MAY elect to limit the number of bytes of the body that will be included in the hash and hence signed. The length actually hashed should be inserted in the "l=" tag of the "DKIM-Signature" header field. -5.6 Insert the DKIM-Signature header field +5.6 Insert the DKIM-Signature Header Field Finally, the signer MUST insert the "DKIM-Signature:" header field created in the previous step prior to transmitting the email. The "DKIM-Signature" header field MUST be the same as used to compute the hash as described above, except that the value of the "b=" tag MUST be the appropriately signed hash computed in the previous step, signed using the algorithm specified in the "a=" tag of the "DKIM- Signature" header field and using the private key corresponding to the Selector given in the "s=" tag of the "DKIM-Signature" header field, as chosen above in Section 5.2 @@ -1643,22 +1810,25 @@ INFORMATIVE IMPLEMENTATION NOTE: The easiest way to achieve this is to insert the "DKIM-Signature" header field at the beginning of the header block. In particular, it may be placed before any existing Received header fields. This is consistent with treating "DKIM-Signature" as a trace header field. 6. Verifier Actions Since a signer MAY remove or revoke a public key at any time, it is - recommended that verification occur in a timely manner with the most - timely place being during acceptance by the border MTA. + recommended that verification occur in a timely manner. In many + configurations, the most timely place is during acceptance by the + border MTA or shortly thereafter. In particular, deferring + verification until the message is accessed by the end user is + discouraged. A border or intermediate MTA MAY verify the message signature(s). An MTA who has performed verification MAY communicate the result of that verification by adding a verification header field to incoming messages. This considerably simplifies things for the user, who can now use an existing mail user agent. Most MUAs have the ability to filter messages based on message header fields or content; these filters would be used to implement whatever policy the user wishes with respect to unsigned mail. @@ -1960,33 +2130,35 @@ a verifier system should make, but an authenticated email presents an opportunity to a receiving system that unauthenticated email cannot. Specifically, an authenticated email creates a predictable identifier by which other decisions can reliably be managed, such as trust and reputation. Conversely, unauthenticated email lacks a reliable identifier that can be used to assign trust and reputation. It is reasonable to treat unauthenticated email as lacking any trust and having no positive reputation. In general verifiers SHOULD NOT reject messages solely on the basis - of a lack of signature or an unverifiable signature. However, if the - verifier does opt to reject such messages, and the verifier runs - synchronously with the SMTP session and a signature is missing or - does not verify, the MTA SHOULD reject the message with an error such - as: + of a lack of signature or an unverifiable signature; such rejection + would cause severe interoperability problems. However, if the + verifier does opt to reject such messages (for example, when + communicating with a peer who, by prior agreement, agrees to only + send signed messages), and the verifier runs synchronously with the + SMTP session and a signature is missing or does not verify, the MTA + SHOULD use a 550/5.7.x reply code, for example: 550 5.7.1 Unsigned messages not accepted 550 5.7.5 Message signature incorrect If it is not possible to fetch the public key, perhaps because the key server is not available, a temporary failure message MAY be - generated, such as: + generated using a 451/4.7.5 reply code, such as: 451 4.7.5 Unable to verify signature - key server unavailable Temporary failures such as inability to access the key server or other external service are the only conditions that SHOULD use a 4xx SMTP reply code. In particular, cryptographic signature verification failures MUST NOT return 4xx SMTP replies. Once the signature has been verified, that information MUST be conveyed to higher level systems (such as explicit allow/white lists @@ -2000,29 +2172,29 @@ before display to the end user. While the symptoms of a failed verification are obvious -- the signature doesn't verify -- establishing the exact cause can be more difficult. If a Selector cannot be found, is that because the Selector has been removed or was the value changed somehow in transit? If the signature line is missing is that because it was never there, or was it removed by an over-zealous filter? For diagnostic purposes, the exact reason why the verification fails SHOULD be made available to the policy module and possibly recorded - in the system logs. However in terms of presentation to the end - user, the result SHOULD be presented as a simple binary result: - either the email is verified or it is not. If the email cannot be - verified, then it SHOULD be rendered the same as all unverified email - regardless of whether it looks like it was signed or not. + in the system logs. If the email cannot be verified, then it SHOULD + be rendered the same as all unverified email regardless of whether it + looks like it was signed or not. 7. IANA Considerations - DKIM introduces some new namespaces that require IANA registry. + DKIM introduces some new namespaces that require IANA registry. In + all cases, new values are assigned only for Standards Track RFCs + approved by the IESG. 7.1 DKIM-Signature Tag Specifications A DKIM-Signature provides for a list of tag specifications. IANA is requested to establish the DKIM Signature Tag Specification Registry, for tag specifications that can be used in DKIM-Signature fields and that have been specified in any published RFC. The initial entries in the registry comprise: @@ -2289,56 +2461,54 @@ were to be sent using spoofed addresses from a given domain, the key servers for that domain could be overwhelmed with requests. However, given the low overhead of verification compared with handling of the email message itself, such an attack would be difficult to mount. 8.4 Attacks Against DNS Since DNS is a required binding for key services, specific attacks against DNS must be considered. - While the DNS is currently insecure [RFC3833], it is expected that - the security problems should and will be solved by DNSSEC [RFC4033], - and all users of the DNS will reap the benefit of that work. - - Secondly, the types of DNS attacks relevant to DKIM are very costly - and are far less rewarding than DNS attacks on other Internet - protocols. For example, attacking A records (to force users to a - phishing site) is likely to be a more lucrative reason to poison DNS - caches. None the less, the security of DKIM is strongly tied to the - security of DNS. - - To systematically thwart the intent of DKIM, an attacker must conduct - a very costly and very extensive attack on many parts of the DNS over - an extended period. No one knows for sure how attackers will - respond, however the cost/benefit of conducting prolonged DNS attacks - of this nature is expected to be uneconomical. + While the DNS is currently insecure [RFC3833], these security + problems are the motivation behind DNSSEC [RFC4033], and all users of + the DNS will reap the benefit of that work. - Finally, DKIM is only intended as a "sufficient" method of proving + DKIM is only intended as a "sufficient" method of proving authenticity. It is not intended to provide strong cryptographic proof about authorship or contents. Other technologies such as OpenPGP [RFC2440] and S/MIME [RFC3851] address those requirements. A second security issue related to the DNS revolves around the increased DNS traffic as a consequence of fetching Selector-based data as well as fetching signing domain policy. Widespread deployment of DKIM will result in a significant increase in DNS queries to the claimed signing domain. In the case of forgeries on a large scale, DNS servers could see a substantial increase in queries. + A specific DNS security issue which should be considered by DKIM + verifiers is the name chaining attack described in section 2.3 of the + DNS Threat Analysis [RFC3833]. A DKIM verifier, while verifying a + DKIM-Signature header field, could be prompted to retrieve a key + record of an attacker's choosing. This threat can be minimized by + ensuring that name servers, including recursive name servers, used by + the verifier enforce strict checking of "glue" and other additional + information in DNS responses and are therefore not vulnerable to this + attack. + 8.5 Replay Attacks In this attack, a spammer sends a message to be spammed to an accomplice, which results in the message being signed by the originating MTA. The accomplice resends the message, including the original signature, to a large number of recipients, possibly by sending the message to many compromised machines that act as MTAs. + The messages, not having been modified by the accomplice, have valid signatures. Partial solutions to this problem involve the use of reputation services to convey the fact that the specific email address is being used for spam, and that messages from that signer are likely to be spam. This requires a real-time detection mechanism in order to react quickly enough. However, such measures might be prone to abuse, if for example an attacker resent a large number of messages received from a victim in order to make them appear to be a spammer. @@ -2389,21 +2559,56 @@ In some cases it may be possible to extract private keys using a remote timing attack [BONEH03]. Implementations should consider obfuscating the timing to prevent such attacks. 8.11 Reordered Header Fields Existing standards allow intermediate MTAs to reorder header fields. If a signer signs two or more header fields of the same name, this can cause spurious verification errors on otherwise legitimate - messages. + messages. In particular, signers that sign any existing DKIM- + Signature fields run the risk of having messages incorrectly fail to + verify. + +8.12 RSA Attacks + + An attacker could create a large RSA signing key with a small + exponent, thus requiring that the verification key have a large + exponent. This will force verifiers to use considerable computing + resources to verify the signature. Verifiers might avoid this attack + by refusing to verify signatures that reference selectors with public + keys having unreasonable exponents. + + In general, an attacker might try to overwhelm a verifier by flooding + it with messages requiring verification. This is similar to other + MTA denial-of-service attacks and should be dealt with in a similar + fashion. + +8.13 Inappropriate Signing by Parent Domains + + The trust relationship described in Section 3.8 could conceivably be + used by a parent domain to sign messages with identities in a + subdomain not administratively related to the parent. For example, + the ".com" registry could create messages with signatures using an + "i=" value in the example.com domain. There is no general solution + to this problem, since the administrative cut could occur anywhere in + the domain name. For example, in the domain "example.podunk.ca.us" + there are three administrative cuts (podunk.ca.us, ca.us, and us), + any of which could create messages with an identity in the full + domain. + + INFORMATIVE NOTE: This is considered an acceptable risk for the + same reason that it is acceptable for domain delegation. For + example, in the example above any of the domains could potentially + simply delegate "example.podunk.ca.us" to a server of their choice + and completely replace all DNS-served information. 9. References 9.1 Normative References [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies", RFC 2045, November 1996. [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions) @@ -2557,36 +2762,36 @@ looks like this: DKIM-Signature: a=rsa-sha256; s=brisbane; d=example.com; c=simple; q=dns/txt; i=joe@football.example.com; h=Received : From : To : Subject : Date : Message-ID; bh=jpltwNFTq83Bkjt/Y2ekyqr/+i296daNkFZSdaz8VCY=; b=bnUoMBPJ5wBigyZG2V4OG2JxLWJATkSkb9Ig+8OAu3cE2x/er+B 7Tp1a1kEwZKdOtlTHlvF4JKg6RZUbN5urRJoaiD4RiSbf8D6fmMHt zEn8/OHpTCcdLOJaTp8/mKz69/RpatVBas2OqWas7jrlaLGfHdBkt Hs6fxOzzAB7Wro=; - Received: from dsl-10.2.3.4.football.example.com [10.2.3.4] + Received: from client1.football.example.com [192.0.2.1] by submitserver.example.com with SUBMISSION; Fri, 11 Jul 2003 21:01:54 -0700 (PDT) From: Joe SixPack To: Suzie Q Subject: Is dinner ready? Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT) Message-ID: <20030712040037.46341.5F8J@football.example.com> Hi. We lost the game. Are you hungry yet? Joe. - The signing email server requires access to the private-key + The signing email server requires access to the private key associated with the "brisbane" Selector to generate this signature. A.3 The email signature is verified The signature is normally verified by an inbound SMTP server or possibly the final delivery agent. However, intervening MTAs can also perform this verification if they choose to do so. The verification process uses the domain "example.com" extracted from the "d=" tag and the Selector "brisbane" from the "s=" tag in the "DKIM- Signature" header field to form the DNS DKIM query for: @@ -2608,35 +2813,38 @@ by shopping.example.net with SMTP; Fri, 11 Jul 2003 21:01:59 -0700 (PDT) DKIM-Signature: a=rsa-sha256; s=brisbane; d=example.com; c=simple; q=dns/txt; i=joe@football.example.com; h=Received : From : To : Subject : Date : Message-ID; bh=jpltwNFTq83Bkjt/Y2ekyqr/+i296daNkFZSdaz8VCY=; b=bnUoMBPJ5wBigyZG2V4OG2JxLWJATkSkb9Ig+8OAu3cE2x/er+B 7Tp1a1kEwZKdOtlTHlvF4JKg6RZUbN5urRJoaiD4RiSbf8D6fmMHt zEn8/OHpTCcdLOJaTp8/mKz69/RpatVBas2OqWas7jrlaLGfHdBkt Hs6fxOzzAB7Wro=; - Received: from dsl-10.2.3.4.network.example.com [10.2.3.4] + Received: from client1.football.example.com [192.0.2.1] by submitserver.example.com with SUBMISSION; Fri, 11 Jul 2003 21:01:54 -0700 (PDT) From: Joe SixPack To: Suzie Q Subject: Is dinner ready? Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT) Message-ID: <20030712040037.46341.5F8J@football.example.com> Hi. We lost the game. Are you hungry yet? Joe. + INFORMATIVE NOTE: The key used to compute this signature is shown + in Appendix C. + Appendix B. Usage Examples (INFORMATIVE) DKIM signing and validating can be used in different ways, for different operational scenarios. This Appendix discusses some common examples. NOTE: Descriptions in this Appendix are for informational purposes only. They describe various ways that DKIM can be used, given particular constraints and needs. In no case are these examples intended to be taken as providing explanation or guidance @@ -2841,21 +3049,21 @@ address being used to sign the message. This practice will remove any preexisting Sender header field as required by [RFC2822]. The forwarder applies a new DKIM-Signature header field with the signature, public key, and related information of the forwarder. Appendix C. Creating a public key (INFORMATIVE) The default signature is an RSA signed SHA256 digest of the complete email. For ease of explanation, the openssl command is used to describe the mechanism by which keys and signatures are managed. One - way to generate a 1024 bit, unencrypted private-key suitable for + way to generate a 1024 bit, unencrypted private key suitable for DKIM, is to use openssl like this: $ openssl genrsa -out rsa.private 1024 For increased security, the "-passin" parameter can also be added to encrypt the private key. Use of this parameter will require entering a password for several of the following steps. Servers may prefer to use hardware cryptographic support. The "genrsa" step results in the file rsa.private containing the key @@ -2870,25 +3078,24 @@ gAYIaqlA9C0ZwM6i58lLlPadX/rtHb7pWzeNcZHjKrjM461ZAkEA+itss2nRlmyO n1/5yDyCluST4dQfO8kAB3toSEVc7DeFeDhnC1mZdjASZNvdHS4gbLIA1hUGEF9m 3hKsGUMMPwJBAPW5v/U+AWTADFCS22t72NUurgzeAbzb1HWMqO4y4+9Hpjk5wvL/ eVYizyuce3/fGke7aRYw/ADKygMJdW8H/OcCQQDz5OQb4j2QDpPZc0Nc4QlbvMsj 7p7otWRO5xRa6SzXqqV3+F0VpqvDmshEBkoCydaYwc2o6WQ5EBmExeV8124XAkEA qZzGsIxVP+sEVRWZmW6KNFSdVUpk3qzK0Tz/WjQMe5z0UunY9Ax9/4PVhp/j61bf eAYXunajbBSOLlx4D+TunwJBANkPI5S9iylsbLs6NkaMHV6k5ioHBBmgCak95JGX GMot/L2x0IYyMLAz6oLWh2hm7zwtb0CgOrPo1ke44hFYnfc= -----END RSA PRIVATE KEY----- - To extract the public-key component from the private-key, use openssl + To extract the public-key component from the private key, use openssl like this: $ openssl rsa -in rsa.private -out rsa.public -pubout -outform PEM - This results in the file rsa.public containing the key information similar to this: -----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDwIRP/UC3SBsEmGqZ9ZJW3/DkM oGeLnQg1fWn7/zYtIxN2SnFCjxOCKG9v3b4jYfcTNh5ijSsq631uBItLa7od+v/R tdC2UzJ1lWT947qR+Rcac2gbto/NMqJ0fzfVjH4OuKhitdY9tf6mcwGjaNBcWToI MmPSPDdQPNUYckcQ2QIDAQAB -----END PUBLIC KEY----- @@ -2893,27 +3100,27 @@ -----END PUBLIC KEY----- This public-key data (without the BEGIN and END tags) is placed in the DNS. With the signature, canonical email contents, and public key, a verifying system can test the validity of the signature. The openssl invocation to verify a signature looks like this: openssl dgst -verify rsa.public -sha256 -signature signature.file \