draft-ietf-dkim-base-02.txt   draft-ietf-dkim-base-03.txt 
DKIM E. Allman DKIM E. Allman
Internet-Draft Sendmail, Inc. Internet-Draft Sendmail, Inc.
Expires: November 23, 2006 J. Callas Expires: December 27, 2006 J. Callas
PGP Corporation PGP Corporation
M. Delany M. Delany
M. Libbey M. Libbey
Yahoo! Inc Yahoo! Inc
J. Fenton J. Fenton
M. Thomas M. Thomas
Cisco Systems, Inc. Cisco Systems, Inc.
May 22, 2006 June 25, 2006
DomainKeys Identified Mail Signatures (DKIM) DomainKeys Identified Mail (DKIM) Signatures
draft-ietf-dkim-base-02 draft-ietf-dkim-base-03
Status of this Memo Status of this Memo
By submitting this Internet-Draft, each author represents that any By submitting this Internet-Draft, each author represents that any
applicable patent or other IPR claims of which he or she is aware 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 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. aware will be disclosed, in accordance with Section 6 of BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF), its areas, and its working groups. Note that Task Force (IETF), its areas, and its working groups. Note that
skipping to change at page 1, line 41 skipping to change at page 1, line 41
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
The list of current Internet-Drafts can be accessed at The list of current Internet-Drafts can be accessed at
http://www.ietf.org/ietf/1id-abstracts.txt. http://www.ietf.org/ietf/1id-abstracts.txt.
The list of Internet-Draft Shadow Directories can be accessed at The list of Internet-Draft Shadow Directories can be accessed at
http://www.ietf.org/shadow.html. http://www.ietf.org/shadow.html.
This Internet-Draft will expire on November 23, 2006. This Internet-Draft will expire on December 27, 2006.
Copyright Notice Copyright Notice
Copyright (C) The Internet Society (2006). Copyright (C) The Internet Society (2006).
Abstract Abstract
DomainKeys Identified Mail (DKIM) defines a domain-level DomainKeys Identified Mail (DKIM) defines a domain-level
authentication framework for email using public-key cryptography and authentication framework for email using public-key cryptography and
key server technology to permit verification of the source and key server technology to permit verification of the source and
contents of messages by either Mail Transfer Agents (MTAs) or Mail contents of messages by either Mail Transfer Agents (MTAs) or Mail
User Agents (MUAs). The ultimate goal of this framework is to permit User Agents (MUAs). The ultimate goal of this framework is to permit
a signing domain to assert responsibility for a message, thus proving a signing domain to assert responsibility for a message, thus proving
and protecting message sender identity and the integrity of the and protecting message signer identity and the integrity of the
messages they convey while retaining the functionality of Internet messages they convey while retaining the functionality of Internet
email as it is known today. Proof and protection of email identity, email as it is known today. Proof and protection of email identity,
including repudiation and non-repudiation, may assist in the global including repudiation and non-repudiation, may assist in the global
control of "spam" and "phishing". control of "spam" and "phishing".
Requirements Language Requirements Language
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119]. document are to be interpreted as described in [RFC2119].
skipping to change at page 3, line 18 skipping to change at page 3, line 18
1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 Signing Identity . . . . . . . . . . . . . . . . . . . . . 6 1.2 Signing Identity . . . . . . . . . . . . . . . . . . . . . 6
1.3 Scalability . . . . . . . . . . . . . . . . . . . . . . . 6 1.3 Scalability . . . . . . . . . . . . . . . . . . . . . . . 6
1.4 Simple Key Management . . . . . . . . . . . . . . . . . . 6 1.4 Simple Key Management . . . . . . . . . . . . . . . . . . 6
2. Terminology and Definitions . . . . . . . . . . . . . . . . 6 2. Terminology and Definitions . . . . . . . . . . . . . . . . 6
2.1 Signers . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1 Signers . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Verifiers . . . . . . . . . . . . . . . . . . . . . . . . 7 2.2 Verifiers . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 White Space . . . . . . . . . . . . . . . . . . . . . . . 7 2.3 White Space . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 Common ABNF Tokens . . . . . . . . . . . . . . . . . . . . 7 2.4 Common ABNF Tokens . . . . . . . . . . . . . . . . . . . . 7
2.5 Imported ABNF Tokens . . . . . . . . . . . . . . . . . . . 8 2.5 Imported ABNF Tokens . . . . . . . . . . . . . . . . . . . 8
3. Protocol Elements . . . . . . . . . . . . . . . . . . . . . 8 2.6 DKIM-Quoted-Printable . . . . . . . . . . . . . . . . . . 8
3.1 Selectors . . . . . . . . . . . . . . . . . . . . . . . . 8 3. Protocol Elements . . . . . . . . . . . . . . . . . . . . . 9
3.2 Tag=Value Lists . . . . . . . . . . . . . . . . . . . . . 10 3.1 Selectors . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3 Signing and Verification Algorithms . . . . . . . . . . . 11 3.2 Tag=Value Lists . . . . . . . . . . . . . . . . . . . . . 11
3.4 Canonicalization . . . . . . . . . . . . . . . . . . . . . 12 3.3 Signing and Verification Algorithms . . . . . . . . . . . 12
3.5 The DKIM-Signature header field . . . . . . . . . . . . . 17 3.4 Canonicalization . . . . . . . . . . . . . . . . . . . . . 13
3.6 Key Management and Representation . . . . . . . . . . . . 24 3.5 The DKIM-Signature header field . . . . . . . . . . . . . 18
3.7 Computing the Message Hashes . . . . . . . . . . . . . . . 28 3.6 Key Management and Representation . . . . . . . . . . . . 25
4. Semantics of Multiple Signatures . . . . . . . . . . . . . . 29 3.7 Computing the Message Hashes . . . . . . . . . . . . . . . 30
5. Signer Actions . . . . . . . . . . . . . . . . . . . . . . . 30 4. Semantics of Multiple Signatures . . . . . . . . . . . . . . 31
5.1 Determine if the Email Should be Signed and by Whom . . . 30 5. Signer Actions . . . . . . . . . . . . . . . . . . . . . . . 32
5.1 Determine if the Email Should be Signed and by Whom . . . 32
5.2 Select a private-key and corresponding selector 5.2 Select a private-key and corresponding selector
information . . . . . . . . . . . . . . . . . . . . . . . 30 information . . . . . . . . . . . . . . . . . . . . . . . 32
5.3 Normalize the Message to Prevent Transport Conversions . . 31 5.3 Normalize the Message to Prevent Transport Conversions . . 33
5.4 Determine the header fields to Sign . . . . . . . . . . . 31 5.4 Determine the header fields to Sign . . . . . . . . . . . 33
5.5 Compute the Message Hash and Signature . . . . . . . . . . 33 5.5 Compute the Message Hash and Signature . . . . . . . . . . 35
5.6 Insert the DKIM-Signature header field . . . . . . . . . . 34 5.6 Insert the DKIM-Signature header field . . . . . . . . . . 36
6. Verifier Actions . . . . . . . . . . . . . . . . . . . . . . 35 6. Verifier Actions . . . . . . . . . . . . . . . . . . . . . . 37
6.1 Extract the Signature from the Message . . . . . . . . . . 36 6.1 Extract Signatures from the Message . . . . . . . . . . . 37
6.2 Get the Public Key . . . . . . . . . . . . . . . . . . . . 37 6.2 Communicate Verification Results . . . . . . . . . . . . . 42
6.3 Compute the Verification . . . . . . . . . . . . . . . . . 38 6.3 Interpret Results/Apply Local Policy . . . . . . . . . . . 42
6.4 Communicate Verification Results . . . . . . . . . . . . . 40 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . 44
6.5 Interpret Results/Apply Local Policy . . . . . . . . . . . 40 8. Security Considerations . . . . . . . . . . . . . . . . . . 44
6.6 MUA Considerations . . . . . . . . . . . . . . . . . . . . 41 8.1 Misuse of Body Length Limits ("l=" Tag) . . . . . . . . . 44
7. IANA Considerations . . . . . . . . . . . . . . . . . . . . 42 8.2 Misappropriated Private Key . . . . . . . . . . . . . . . 45
8. Security Considerations . . . . . . . . . . . . . . . . . . 42 8.3 Key Server Denial-of-Service Attacks . . . . . . . . . . . 45
8.1 Misuse of Body Length Limits ("l=" Tag) . . . . . . . . . 43 8.4 Attacks Against DNS . . . . . . . . . . . . . . . . . . . 46
8.2 Misappropriated Private Key . . . . . . . . . . . . . . . 43 8.5 Replay Attacks . . . . . . . . . . . . . . . . . . . . . . 46
8.3 Key Server Denial-of-Service Attacks . . . . . . . . . . . 44 8.6 Limits on Revoking Keys . . . . . . . . . . . . . . . . . 47
8.4 Attacks Against DNS . . . . . . . . . . . . . . . . . . . 44 8.7 Intentionally malformed Key Records . . . . . . . . . . . 47
8.5 Replay Attacks . . . . . . . . . . . . . . . . . . . . . . 45 8.8 Intentionally Malformed DKIM-Signature header fields . . . 47
8.6 Limits on Revoking Keys . . . . . . . . . . . . . . . . . 46 8.9 Information Leakage . . . . . . . . . . . . . . . . . . . 48
8.7 Intentionally malformed Key Records . . . . . . . . . . . 46 8.10 Remote Timing Attacks . . . . . . . . . . . . . . . . . 48
8.8 Intentionally Malformed DKIM-Signature header fields . . . 46 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 48
8.9 Information Leakage . . . . . . . . . . . . . . . . . . . 46 9.1 Normative References . . . . . . . . . . . . . . . . . . . 48
8.10 Remote Timing Attacks . . . . . . . . . . . . . . . . . 46 9.2 Informative References . . . . . . . . . . . . . . . . . . 49
9. References . . . . . . . . . . . . . . . . . . . . . . . . . 47 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . 50
9.1 Normative References . . . . . . . . . . . . . . . . . . . 47 A. Example of Use (INFORMATIVE) . . . . . . . . . . . . . . . . 51
9.2 Informative References . . . . . . . . . . . . . . . . . . 47 A.1 The user composes an email . . . . . . . . . . . . . . . . 51
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . 48 A.2 The email is signed . . . . . . . . . . . . . . . . . . . 51
A. Example of Use (INFORMATIVE) . . . . . . . . . . . . . . . . 49 A.3 The email signature is verified . . . . . . . . . . . . . 52
A.1 The user composes an email . . . . . . . . . . . . . . . . 50 B. Usage Examples (INFORMATIVE) . . . . . . . . . . . . . . . . 53
A.2 The email is signed . . . . . . . . . . . . . . . . . . . 50 B.1 Simple Message Forwarding . . . . . . . . . . . . . . . . 53
A.3 The email signature is verified . . . . . . . . . . . . . 51 B.2 Outsourced Business Functions . . . . . . . . . . . . . . 53
B. Usage Examples (INFORMATIVE) . . . . . . . . . . . . . . . . 52 B.3 PDAs and Similar Devices . . . . . . . . . . . . . . . . . 54
B.1 Simple Message Forwarding . . . . . . . . . . . . . . . . 52 B.4 Mailing Lists . . . . . . . . . . . . . . . . . . . . . . 54
B.2 Outsourced Business Functions . . . . . . . . . . . . . . 52 B.5 Affinity Addresses . . . . . . . . . . . . . . . . . . . . 55
B.3 PDAs and Similar Devices . . . . . . . . . . . . . . . . . 52 B.6 Third-party Message Transmission . . . . . . . . . . . . . 55
B.4 Mailing Lists . . . . . . . . . . . . . . . . . . . . . . 53 C. Creating a public key (INFORMATIVE) . . . . . . . . . . . . 56
B.5 Affinity Addresses . . . . . . . . . . . . . . . . . . . . 53 D. MUA Considerations . . . . . . . . . . . . . . . . . . . . . 57
B.6 Third-party Message Transmission . . . . . . . . . . . . . 54 E. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 58
C. Creating a public key (INFORMATIVE) . . . . . . . . . . . . 54 F. Edit History . . . . . . . . . . . . . . . . . . . . . . . . 58
D. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 56 F.1 Changes since -ietf-02 version . . . . . . . . . . . . . . 58
E. Edit History . . . . . . . . . . . . . . . . . . . . . . . . 56 F.2 Changes since -ietf-01 version . . . . . . . . . . . . . . 59
E.1 Changes since -ietf-01 version . . . . . . . . . . . . . . 56 F.3 Changes since -ietf-00 version . . . . . . . . . . . . . . 60
E.2 Changes since -ietf-00 version . . . . . . . . . . . . . . 57 F.4 Changes since -allman-01 version . . . . . . . . . . . . . 60
E.3 Changes since -allman-01 version . . . . . . . . . . . . . 57 F.5 Changes since -allman-00 version . . . . . . . . . . . . . 61
E.4 Changes since -allman-00 version . . . . . . . . . . . . . 58 Intellectual Property and Copyright Statements . . . . . . . 62
Intellectual Property and Copyright Statements . . . . . . . 59
1. Introduction 1. Introduction
[[Note: text in double square brackets (such as this text) will be [[Note: text in double square brackets (such as this text) will be
deleted before publication.]] deleted before publication.]]
1.1 Overview 1.1 Overview
DomainKeys Identified Mail (DKIM) defines a mechanism by which email DomainKeys Identified Mail (DKIM) defines a mechanism by which email
messages can be cryptographically signed, permitting a signing domain messages can be cryptographically signed, permitting a signing domain
skipping to change at page 6, line 18 skipping to change at page 6, line 18
A "selector" mechanism allows multiple keys per domain, including A "selector" mechanism allows multiple keys per domain, including
delegation of the right to authenticate a portion of the namespace to delegation of the right to authenticate a portion of the namespace to
a trusted third party. a trusted third party.
1.2 Signing Identity 1.2 Signing Identity
DKIM separates the question of the identity of the signer of the DKIM separates the question of the identity of the signer of the
message from the purported author of the message. In particular, a message from the purported author of the message. In particular, a
signature includes the identity of the signer. Verifiers can use the signature includes the identity of the signer. Verifiers can use the
signing information to decide how they want to process the message. signing information to decide how they want to process the message.
The signing identity is included as part of the signature header
field.
INFORMATIVE RATIONALE: The signing address associated with a DKIM INFORMATIVE RATIONALE: The signing identity associated with a
signature is not required to match a particular header field DKIM signature is not required to match an address in any
because of the broad methods of interpretation by recipient mail particular header field because of the broad methods of
systems, including MUAs. interpretation by recipient mail systems, including MUAs.
1.3 Scalability 1.3 Scalability
DKIM is designed to support the extreme scalability requirements DKIM is designed to support the extreme scalability requirements
which characterize the email identification problem. There are which characterize the email identification problem. There are
currently over 70 million domains and a much larger number of currently over 70 million domains and a much larger number of
individual addresses. DKIM seeks to preserve the positive aspects of individual addresses. DKIM seeks to preserve the positive aspects of
the current email infrastructure, such as the ability for anyone to the current email infrastructure, such as the ability for anyone to
communicate with anyone else without introduction. communicate with anyone else without introduction.
skipping to change at page 7, line 30 skipping to change at page 7, line 30
user (reader) of the message or some consuming agent such as a user (reader) of the message or some consuming agent such as a
mailing list exploder. mailing list exploder.
2.3 White Space 2.3 White Space
There are three forms of white space: There are three forms of white space:
o WSP represents simple white space, i.e., a space or a tab o WSP represents simple white space, i.e., a space or a tab
character, and is inherited from[RFC2822]. character, and is inherited from[RFC2822].
o SWSP is streaming white space; it adds the CR and LF characters. o SWSP is streaming white space, defined as WSP plus the CR and LF
characters.
o FWS, also from [RFC2822], is folding white space. It allows o FWS, also from [RFC2822], is folding white space. It allows
multiple lines separated by CRLF followed by at least one white multiple lines separated by CRLF followed by at least one white
space, to be joined. space, to be joined.
The formal ABNF for SWSP is: The formal ABNF for SWSP is:
SWSP = CR / LF / WSP ; streaming white space SWSP = CR / LF / WSP ; streaming white space
2.4 Common ABNF Tokens 2.4 Common ABNF Tokens
skipping to change at page 8, line 15 skipping to change at page 8, line 15
2.5 Imported ABNF Tokens 2.5 Imported ABNF Tokens
The following tokens are imported from other RFCs as noted. Those The following tokens are imported from other RFCs as noted. Those
RFCs should be considered definitive. However, all tokens having RFCs should be considered definitive. However, all tokens having
names beginning with "obs-" should be excluded from this import, as names beginning with "obs-" should be excluded from this import, as
they have been obsoleted and are expected to go away in future they have been obsoleted and are expected to go away in future
editions of those RFCs. editions of those RFCs.
The following tokens are imported from [RFC2821]: The following tokens are imported from [RFC2821]:
o Local-part (implementation warning: this permits quoted strings) o "Local-part" (implementation warning: this permits quoted
strings)
o Domain (implementation warning: this permits address-literals)
o sub-domain o "sub-domain"
The following definitions are imported from [RFC2822]: The following definitions are imported from [RFC2822]:
o WSP (space or tab) o "WSP" (space or tab)
o FWS (folding white space) o "FWS" (folding white space)
o field-name (name of a header field) o "field-name" (name of a header field)
o dot-atom (in the local-part of an email address) o "dot-atom" (in the local-part of an email address)
The following tokens are imported from [RFC2045]: The following tokens are imported from [RFC2045]:
o qp-section (a single line of quoted-printable-encoded text) o "qp-section" (a single line of quoted-printable-encoded text)
o "hex-octet" (a quoted-printable encoded octet)
INFORMATIVE NOTE: Be aware that the ABNF in RFC 2045 does not
obey the rules of RFC 4234 and must be interpreted accordingly,
particularly as regards case folding.
Other tokens not defined herein are imported from [RFC4234]. These Other tokens not defined herein are imported from [RFC4234]. These
are intuitive primitives such as SP, ALPHA, CRLF, etc. are intuitive primitives such as SP, ALPHA, CRLF, etc.
2.6 DKIM-Quoted-Printable
The DKIM-Quoted-Printable encoding syntax resembles that described in
Quoted-Printable [RFC2045] section 6.7: any character MAY be encoded
as an "=" followed by two hexadecimal digits from the alphabet
"0123456789ABCDEF" (no lower case characters permitted) representing
the hexadecimal-encoded integer value of that character. All control
characters (those with values < %x20), eight-bit characters (values >
%x7F), and the characters DEL (%x7F), SPACE (%x20), and semicolon
(";", %x3B) MUST be encoded. Note that all white space, including
SPACE, CR and LF characters, MUST be encoded. After encoding, FWS
MAY be added at arbitrary locations in order to avoid excessively
long lines; such white space is NOT part of the value, and MUST be
removed before decoding.
ABNF:
dkim-quoted-printable =
*(FWS / hex-octet / dkim-safe-char)
; hex-octet is from RFC 2045
dkim-safe-char = %x21-3A / %x3C / %x3E-7E
; '!' - ':', '<', '>' - '~'
; Characters not listed as "mail-safe" in
; RFC 2049 are also not recommended.
INFORMATIVE NOTE: DKIM-Quoted-Printable differs from Quoted-
Printable as defined in RFC 2045 in several important ways:
1. White space in the input text, including CR and LF, must be
encoded. RFC 2045 does not require such encoding, and does
not permit encoded of CR or LF characters that are part of a
CRLF line break.
2. White space in the encoded text is ignored. This is to allow
DKIM-Quoted-Printable to be wrapped as needed in headers. In
particular, RFC 2045 requires that line breaks in the input be
represented as physical line breaks; that is not the case
here.
3. The "soft line break" syntax ("=" as the last non-white-space
character on the line) does not apply.
4. DKIM-Quoted-Printable does not require that encoded lines be
no more than 76 characters long (although there may be other
requirements depending on the context in which the encoded
text is being used).
3. Protocol Elements 3. Protocol Elements
Protocol Elements are conceptual parts of the protocol that are not Protocol Elements are conceptual parts of the protocol that are not
specific to either signers or verifiers. The protocol descriptions specific to either signers or verifiers. The protocol descriptions
for signers and verifiers are described in later sections (Signer for signers and verifiers are described in later sections (Signer
Actions (Section 5) and Verifier Actions (Section 6)). NOTE: This Actions (Section 5) and Verifier Actions (Section 6)). NOTE: This
section must be read in the context of those sections. section must be read in the context of those sections.
3.1 Selectors 3.1 Selectors
skipping to change at page 9, line 51 skipping to change at page 11, line 7
transition period during which email may be in transit prior to transition period during which email may be in transit prior to
verification. At the start of the transition period, the outbound 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. At the end of the transition period, the "january2005" public
key is removed from the public-key repository. key is removed from the public-key repository.
While some domains may wish to make selector values well known, 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 others will want to take care not to allocate selector names in a way
that allows harvesting of data by outside parties. E.g., if per-user that allows harvesting of data by outside parties. E.g., if per-user
keys are issued, the domain owner will need to make the decision as keys are issued, the domain owner will need to make the decision as
to whether to make this selector associated directly with the user to whether to associate this selector directly with the user name, or
name, or make it some unassociated random value, such as a make it some unassociated random value, such as a fingerprint of the
fingerprint of the public key. public key.
INFORMATIVE IMPLEMENTERS' NOTE: reusing a selector with a new key INFORMATIVE IMPLEMENTERS' NOTE: reusing a selector with a new key
(for example, changing the key associated with a user's name) (for example, changing the key associated with a user's name)
makes it impossible to tell the difference between a message that makes it impossible to tell the difference between a message that
didn't verify because the key is no longer valid versus a message didn't verify because the key is no longer valid versus a message
that is actually forged. Signers should not change the key that is actually forged. Signers should not change the key
associated with a selector. When creating a new key, signers associated with a selector. When creating a new key, signers
should associate it with a new selector. should associate it with a new selector.
3.2 Tag=Value Lists 3.2 Tag=Value Lists
DKIM uses a simple "tag=value" syntax in several contexts, including DKIM uses a simple "tag=value" syntax in several contexts, including
in messages, domain signature records, and policy records. in messages and domain signature records.
Values are a series of strings containing either base64 text, plain Values are a series of strings containing either plain text, base64
text, or quoted printable text, as defined in [RFC2045], section 6.7. text (as defined in [RFC2045], section 6.8), qp-section (ibid,
The name of the tag will determine the encoding of each value; section 6.7), or dkim-quoted-printable (as defined above). The name
however, no encoding may include the semicolon (";") character, since of the tag will determine the encoding of each value; however, no
that separates tag-specs. encoding may include the semicolon (";") character, since that
separates tag-specs.
Formally, the syntax rules are: Formally, the syntax rules are:
tag-list = tag-spec 0*( ";" tag-spec ) [ ";" ] tag-list = tag-spec 0*( ";" tag-spec ) [ ";" ]
tag-spec = [FWS] tag-name [FWS] "=" [FWS] tag-value [FWS] tag-spec = [FWS] tag-name [FWS] "=" [FWS] tag-value [FWS]
tag-name = ALPHA 0*ALNUMPUNC tag-name = ALPHA 0*ALNUMPUNC
tag-value = 0*VALCHAR ; SWSP prohibited at beginning and end tag-value = [ 1*VALCHAR 0*( 1*(WSP / FWS) 1*VALCHAR ) ]
VALCHAR = %9 / %d32 - %d58 / %d60 - %d126 ; WSP and FWS prohibited at beginning and end
; HTAB and SP to TILDE except SEMICOLON VALCHAR = %x21-3A / %x3C-7E
; EXCLAMATION to TILDE except SEMICOLON
ALNUMPUNC = ALPHA / DIGIT / "_" ALNUMPUNC = ALPHA / DIGIT / "_"
Note that WSP is allowed anywhere around tags; in particular, WSP Note that WSP is allowed anywhere around tags; in particular, any WSP
between the tag-name and the "=", and any WSP before the terminating after the "=" and any WSP before the terminating ";" is not part of
";" is not part of the value. the value; however, WSP inside the value is significant.
Tags MUST be interpreted in a case-sensitive manner. Values MUST be Tags MUST be interpreted in a case-sensitive manner. Values MUST be
processed as case sensitive unless the specific tag description of processed as case sensitive unless the specific tag description of
semantics specifies case insensitivity. semantics specifies case insensitivity.
Tags with duplicate names MUST NOT be specified within a single tag- Tags with duplicate names MUST NOT be specified within a single tag-
list. list.
Whitespace within a value MUST be retained unless explicitly excluded Whitespace within a value MUST be retained unless explicitly excluded
by the specific tag description. by the specific tag description.
skipping to change at page 14, line 50 skipping to change at page 16, line 8
leave the "relaxed" body canonicalization algorithm in to the leave the "relaxed" body canonicalization algorithm in to the
specification or delete it entirely. We believe that for the vast specification or delete it entirely. We believe that for the vast
majority of cases, the "simple" body canonicalization algorithm majority of cases, the "simple" body canonicalization algorithm
should be sufficient. We simply do not have enough data to know should be sufficient. We simply do not have enough data to know
whether to retain the "relaxed" body canonicalization algorithm or whether to retain the "relaxed" body canonicalization algorithm or
not.]] not.]]
3.4.5 Body Length Limits 3.4.5 Body Length Limits
A body length count MAY be specified to limit the signature A body length count MAY be specified to limit the signature
calculation to an initial prefix of the body text. If the body calculation to an initial prefix of the body text, measured in
length count is not specified then the entire message body is signed octets. If the body length count is not specified then the entire
and verified. message body is signed and verified.
INFORMATIVE IMPLEMENTATION NOTE: Body length limits could be INFORMATIVE IMPLEMENTATION NOTE: Body length limits could be
useful in increasing signature robustness when sending to a useful in increasing signature robustness when sending to a
mailing list that both appends to content sent to it and does not mailing list that both appends to content sent to it and does not
sign its messages. However, using such limits enables an attack sign its messages. However, using such limits enables an attack
in which a sender with malicious intent modifies a message to in which an attacker modifies a message to include content that
include content that solely benefits the attacker. It is possible solely benefits the attacker. It is possible for the appended
for the appended content to completely replace the original content to completely replace the original content in the end
content in the end recipient's eyes and to defeat duplicate recipient's eyes and to defeat duplicate message detection
message detection algorithms. To avoid this attack, signers algorithms. To avoid this attack, signers should be wary of using
should be wary of using this tag, and verifiers might wish to this tag, and verifiers might wish to ignore the tag or remove
ignore the tag or remove text that appears after the specified text that appears after the specified content length, perhaps
content length, perhaps based on other criteria. based on other criteria.
The body length count allows the signer of a message to permit data The body length count allows the signer of a message to permit data
to be appended to the end of the body of a signed message. The body to be appended to the end of the body of a signed message. The body
length count is made following the canonicalization algorithm; for length count is made following the canonicalization algorithm; for
example, any white space ignored by a canonicalization algorithm is example, any white space ignored by a canonicalization algorithm is
not included as part of the body length count. not included as part of the body length count.
INFORMATIVE RATIONALE: This capability is provided because it is INFORMATIVE RATIONALE: This capability is provided because it is
very common for mailing lists to add trailers to messages (e.g., very common for mailing lists to add trailers to messages (e.g.,
instructions how to get off the list). Until those messages are instructions how to get off the list). Until those messages are
skipping to change at page 15, line 47 skipping to change at page 17, line 5
the only acceptable modifications are to add to the MIME postlude the only acceptable modifications are to add to the MIME postlude
would use a body length count encompassing the entire final MIME would use a body length count encompassing the entire final MIME
boundary string, including the final "--CRLF". A signer wishing boundary string, including the final "--CRLF". A signer wishing
to allow additional MIME parts but not modification of existing to allow additional MIME parts but not modification of existing
parts would use a body length count extending through the final 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".
A body length count of zero means that the body is completely A body length count of zero means that the body is completely
unsigned. unsigned.
Note that verifiers MAY choose to truncate messages that have body INFORMATIVE IMPLEMENTATION NOTE: Note that verifiers may choose
content beyond that specified by the body length count. to modify their interpretation of messages with unsigned content,
Alternatively, verifiers MAY ignore signatures that do not cover the including truncating the unsigned part, refusing to display the
entire message body. unsigned part to the user, or simply treating the signature as
invalid.
Signers wishing to ensure that no modification of any sort can occur Signers wishing to ensure that no modification of any sort can occur
should specify the "simple" algorithm and omit the body length count. should specify the "simple" algorithm and omit the body length count.
3.4.6 Example 3.4.6 Canonicalization Examples (INFORMATIVE)
(In the following examples, actual white space is used only for (In the following examples, actual white space is used only for
clarity. The actual input and output text is designated using clarity. The actual input and output text is designated using
bracketed descriptors: "<SP>" for a space character, "<TAB>" for a bracketed descriptors: "<SP>" for a space character, "<TAB>" for a
tab character, and "<CRLF>" for a carriage-return/line-feed sequence. tab character, and "<CRLF>" for a carriage-return/line-feed sequence.
For example, "X <SP> Y" and "X<SP>Y" represent the same three For example, "X <SP> Y" and "X<SP>Y" represent the same three
characters.) characters.)
Example 1: A message reading: Example 1: A message reading:
A: <SP> X <CRLF> A: <SP> X <CRLF>
skipping to change at page 16, line 43 skipping to change at page 18, line 4
<SP> C <CRLF> <SP> C <CRLF>
D <SP> E <CRLF> D <SP> E <CRLF>
(postamble) (postamble)
Example 2: The same message canonicalized using simple Example 2: The same message canonicalized using simple
canonicalization for both header and body results in a header canonicalization for both header and body results in a header
reading: reading:
A: <SP> X <CRLF> A: <SP> X <CRLF>
B <SP> : <SP> Y <TAB><CRLF> B <SP> : <SP> Y <TAB><CRLF>
<TAB> Z <SP><SP><CRLF> <TAB> Z <SP><SP><CRLF>
and a body reading: and a body reading:
<SP> C <SP><CRLF> <SP> C <SP><CRLF>
D <SP><TAB><SP> E <CRLF> D <SP><TAB><SP> E <CRLF>
(postamble) (postamble)
Example 3: When processed using relaxed header canonicalization and Example 3: When processed using relaxed header canonicalization and
simple body canoniccalization, the canonicalized version has a header simple body canonicalization, the canonicalized version has a header
of: of:
a:X <CRLF> a:X <CRLF>
b:Y <SP> Z <CRLF> b:Y <SP> Z <CRLF>
and a body reading: and a body reading:
<SP> C <SP><CRLF> <SP> C <SP><CRLF>
D <SP><TAB><SP> E <CRLF> D <SP><TAB><SP> E <CRLF>
(postamble) (postamble)
3.5 The DKIM-Signature header field 3.5 The DKIM-Signature header field
skipping to change at page 17, line 27 skipping to change at page 18, line 34
fetching data. The DKIM-Signature value is a tag-list as described fetching data. The DKIM-Signature value is a tag-list as described
in Section 3.2. in Section 3.2.
The "DKIM-Signature:" header field SHOULD be treated as though it The "DKIM-Signature:" header field SHOULD be treated as though it
were a trace header field as defined in section 3.6 of [RFC2822], and were a trace header field as defined in section 3.6 of [RFC2822], and
hence SHOULD NOT be reordered and SHOULD be prepended to the message. hence SHOULD NOT be reordered and SHOULD be prepended to the message.
In particular, the "DKIM-Signature" header field SHOULD precede the In particular, the "DKIM-Signature" header field SHOULD precede the
original email header fields presented to the canonicalization and original email header fields presented to the canonicalization and
signature algorithms. signature algorithms.
The "DKIM-Signature:" header field is always included in the The "DKIM-Signature:" header field being created or verified is
signature calculation, after the body of the message; however, when always included in the signature calculation, after the body of the
calculating or verifying the signature, the value of the b= tag message; however, when calculating or verifying the signature, the
(signature value) MUST be treated as though it were the null string. value of the b= tag (signature value) of that DKIM-Signature header
Unknown tags MUST be signed and verified but MUST be otherwise field MUST be treated as though it were the null string. Unknown
ignored by verifiers. tags in the "DKIM-Signature:" header field MUST be included in the
signature calculation but MUST be otherwise ignored by verifiers.
Other "DKIM-Signature:" header fields that are included in the
signature should be treated as normal header fields; in particular,
the b= tag is not treated specially.
The encodings for each field type are listed below. Tags described The encodings for each field type are listed below. Tags described
as quoted-printable are as described in section 6.7 of MIME Part One as qp-section are as described in section 6.7 of MIME Part One
[RFC2045], with the additional conversion of semicolon characters to [RFC2045], with the additional conversion of semicolon characters to
"=3B". "=3B"; intuitively, this is one line of quoted-printable encoded
text. Tags described as dkim-quoted-printable are as defined above.
Tags on the DKIM-Signature header field along with their type and Tags on the DKIM-Signature header field along with their type and
requirement status are shown below. Defined tags are described requirement status are shown below. Defined tags are described
below. Unrecognized tags MUST be ignored. below. Unrecognized tags MUST be ignored.
v= Version (MUST be included). This tag defines the version of v= Version (MUST be included). This tag defines the version of
this specification that applies to the signature record. It MUST this specification that applies to the signature record. It MUST
have the value 0.2. have the value 0.3.
ABNF: ABNF:
sig-v-tag = %x76 [FWS] "=" [FWS] "0.2" sig-v-tag = %x76 [FWS] "=" [FWS] "0.3"
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.]]
a= The algorithm used to generate the signature (plain-text; a= The algorithm used to generate the signature (plain-text;
REQUIRED). Verifiers MUST support "rsa-sha1" and "rsa-sha256"; REQUIRED). Verifiers MUST support "rsa-sha1" and "rsa-sha256";
signers SHOULD sign using "rsa-sha256". See Section 3.3 for a signers SHOULD sign using "rsa-sha256". See Section 3.3 for a
description of algorithms. description of algorithms.
ABNF: ABNF:
sig-a-tag = %x61 [FWS] "=" [FWS] sig-a-tag-alg sig-a-tag = %x61 [FWS] "=" [FWS] sig-a-tag-alg
sig-a-tag-alg = "rsa-sha1" / "rsa-sha256" / x-sig-a-tag-alg sig-a-tag-alg = sig-a-tag-k "-" sig-a-tag-h
x-sig-a-tag-alg = hyphenated-word ; for later extension sig-a-tag-k = "rsa" / x-sig-a-tag-k
sig-a-tag-h = "sha1" / "sha256" / x-sig-a-tag-h
x-sig-a-tag-k = ALPHA *(ALPHA / DIGIT) ; for later extension
x-sig-a-tag-h = ALPHA *(ALPHA / DIGIT) ; for later extension
b= The signature data (base64; REQUIRED). Whitespace is ignored in b= The signature data (base64; REQUIRED). Whitespace is ignored in
this value and MUST be ignored when re-assembling tthe original this value and MUST be ignored when re-assembling the original
signature. In particular, the signing process can safely insert signature. In particular, the signing process can safely insert
FWS in this value in arbitrary places to conform to line-length FWS in this value in arbitrary places to conform to line-length
limits. See Signer Actions (Section 5) for how the signature is limits. See Signer Actions (Section 5) for how the signature is
computed. computed.
ABNF: ABNF:
sig-b-tag = %x62 [FWS] "=" [FWS] sig-b-tag-data sig-b-tag = %x62 [FWS] "=" [FWS] sig-b-tag-data
sig-b-tag-data = base64string sig-b-tag-data = base64string
bh= The hash of the body part of the message (base64; REQUIRED). bh= The hash of the body part of the message (base64; REQUIRED).
Whitespace is ignored in this value and MUST be ignored when re- Whitespace is ignored in this value and MUST be ignored when re-
assembling the original signature. In particular, the signing assembling the original signature. In particular, the signing
process can safely insert FWS in this value in arbitrary places process can safely insert FWS in this value in arbitrary places
to conform to line-length limits. See Section 3.7 for how the to conform to line-length limits. See Section 3.7 for how the
body hash is computed. body hash is computed.
ABNF:
sig-bh-tag = %x62 %x68 [FWS] "=" [FWS] sig-bh-tag-data
sig-bh-tag-data = base64string
c= Message canonicalization (plain-text; OPTIONAL, default is c= Message canonicalization (plain-text; OPTIONAL, default is
"simple/simple"). This tag informs the verifier of the type of "simple/simple"). This tag informs the verifier of the type of
canonicalization used to prepare the message for signing. It canonicalization used to prepare the message for signing. It
consists of two names separated by a "slash" (%d47) character, consists of two names separated by a "slash" (%d47) character,
corresponding to the header and body canonicalization algorithms corresponding to the header and body canonicalization algorithms
respectively. These algorithms are described in Section 3.4. If respectively. These algorithms are described in Section 3.4. If
only one algorithm is named, that algorithm is used for the only one algorithm is named, that algorithm is used for the
header and "simple" is used for the body. For example, header and "simple" is used for the body. For example,
"c=relaxed" is treated the same as "c=relaxed/simple". "c=relaxed" is treated the same as "c=relaxed/simple".
ABNF: ABNF:
sig-c-tag = %x63 [FWS] "=" [FWS] sig-c-tag-alg sig-c-tag = %x63 [FWS] "=" [FWS] sig-c-tag-alg
["/" sig-c-tag-alg] ["/" sig-c-tag-alg]
sig-c-tag-alg = "simple" / "relaxed" / x-sig-c-tag-alg sig-c-tag-alg = "simple" / "relaxed" / x-sig-c-tag-alg
x-sig-c-tag-alg = hyphenated-word ; for later extension x-sig-c-tag-alg = hyphenated-word ; for later extension
d= The domain of the signing entity (plain-text; REQUIRED). This d= The domain of the signing entity (plain-text; REQUIRED). This
is the domain that will be queried for the public key. This is the domain that will be queried for the public key. This
domain MUST be the same as or a parent domain of the "i=" tag domain MUST be the same as or a parent domain of the "i=" tag
(the signing identity, as described below). When presented with (the signing identity, as described below). If the "t=s" tag is
a signature that does not meet this requirement, verifiers MUST specified in the key record referenced by the selector in the
"s=" tag, then the domain in the "d=" tag must be identical to
the domain specified in the "i=" tag. When presented with a
signature that does not meet these requirement, verifiers MUST
consider the signature invalid. consider the signature invalid.
Internationalized domain names MUST be punycode-encoded
[RFC3492].
ABNF: ABNF:
sig-d-tag = %x64 [FWS] "=" [FWS] Domain sig-d-tag = %x64 [FWS] "=" [FWS] domain-name
domain-name = sub-domain 1*("." sub-domain)
; from RFC 2821 Domain, but excluding address-literal
h= Signed header fields (plain-text, but see description; h= Signed header fields (plain-text, but see description;
REQUIRED). A colon-separated list of header field names that REQUIRED). A colon-separated list of header field names that
identify the header fields presented to the signing algorithm. identify the header fields presented to the signing algorithm.
The field MUST contain the complete list of header fields in the The field MUST contain the complete list of header fields in the
order presented to the signing algorithm. The field MAY contain order presented to the signing algorithm. The field MAY contain
names of header fields that do not exist when signed; nonexistent names of header fields that do not exist when signed; nonexistent
header fields do not contribute to the signature computation header fields do not contribute to the signature computation
(that is, they are treated as the null input, includiing the (that is, they are treated as the null input, including the
header field name, the separating colon, the header field value, header field name, the separating colon, the header field value,
and any CRLF terminator). The field MUST NOT include the DKIM- and any CRLF terminator). The field MUST NOT include the DKIM-
Signature header field that is being created or verified. Signature header field that is being created or verified, but may
Folding white space (FWS) MAY be included on either side of the include others. Folding white space (FWS) MAY be included on
colon separator. Header field names MUST be compared against either side of the colon separator. Header field names MUST be
actual header field names in a case insensitive manner. This compared against actual header field names in a case insensitive
list MUST NOT be empty. See Section 5.4 for a discussion of manner. This list MUST NOT be empty. See Section 5.4 for a
choosing header fields to sign. discussion of choosing header fields to sign.
ABNF: ABNF:
sig-h-tag = %x68 [FWS] "=" [FWS] hdr-name sig-h-tag = %x68 [FWS] "=" [FWS] hdr-name
0*( *FWS ":" *FWS hdr-name ) 0*( *FWS ":" *FWS hdr-name )
hdr-name = field-name hdr-name = field-name
INFORMATIVE EXPLANATION: By "signing" header fields that do INFORMATIVE EXPLANATION: By "signing" header fields that do
not actually exist, a signer can prevent insertion of those not actually exist, a signer can prevent insertion of those
header fields before verification. However, since a sender header fields before verification. However, since a signer
cannot possibly know what header fields might be created in cannot possibly know what header fields might be created in
the future, and that some MUAs might present header fields the future, and that some MUAs might present header fields
that are embedded inside a message (e.g., as a message/rfc822 that are embedded inside a message (e.g., as a message/rfc822
content type), the security of this solution is not total. content type), the security of this solution is not total.
INFORMATIVE EXPLANATION: The exclusion of the header field INFORMATIVE EXPLANATION: The exclusion of the header field
name and colon as well as the header field value for non- name and colon as well as the header field value for non-
existent header fields prevents an attacker from inserting an existent header fields prevents an attacker from inserting an
actual header field with a null value. actual header field with a null value.
i= Identity of the user or agent (e.g., a mailing list manager) on i= Identity of the user or agent (e.g., a mailing list manager) on
behalf of which this message is signed (quoted-printable; behalf of which this message is signed (dkim-quoted-printable;
OPTIONAL, default is an empty local-part followed by an "@" OPTIONAL, default is an empty local-part followed by an "@"
followed by the domain from the "d=" tag). The syntax is a followed by the domain from the "d=" tag). The syntax is a
standard email address where the local-part MAY be omitted. The standard email address where the local-part MAY be omitted. The
domain part of the address MUST be the same as or a subdomain of domain part of the address MUST be the same as or a subdomain of
the value of the "d=" tag. the value of the "d=" tag.
ABNF: ABNF:
sig-i-tag = %x69 [FWS] "=" [FWS] [ Local-part ] "@" Domain sig-i-tag = %x69 [FWS] "=" [FWS] [ Local-part ] "@" domain-name
INFORMATIVE NOTE: The local-part of the "i=" tag is optional INFORMATIVE NOTE: The local-part of the "i=" tag is optional
because in some cases a signer may not be able to establish a because in some cases a signer may not be able to establish a
verified individual identity. In such cases, the signer may verified individual identity. In such cases, the signer may
wish to assert that although it is willing to go as far as wish to assert that although it is willing to go as far as
signing for the domain, it is unable or unwilling to commit signing for the domain, it is unable or unwilling to commit
to an individual user name within their domain. It can do so to an individual user name within their domain. It can do so
by including the domain part but not the local-part of the by including the domain part but not the local-part of the
identity. identity.
skipping to change at page 21, line 5 skipping to change at page 22, line 35
complex topic and trust mechanisms are subject to highly complex topic and trust mechanisms are subject to highly
creative attacks. The real-world efficacy of any but the creative attacks. The real-world efficacy of any but the
most basic bindings between the "i=" value and other most basic bindings between the "i=" value and other
identities is not well established, nor is its vulnerability identities is not well established, nor is its vulnerability
to subversion by an attacker. Hence reliance on the use of to subversion by an attacker. Hence reliance on the use of
these options should be strictly limited. In particular it these options should be strictly limited. In particular it
is not at all clear to what extent a typical end-user is not at all clear to what extent a typical end-user
recipient can rely on any assurances that might be made by recipient can rely on any assurances that might be made by
successful use of the "i=" options. successful use of the "i=" options.
l= Body count (plain-text decimal integer; OPTIONAL, default is l= Body length count (plain-text unsigned decimal integer;
entire body). This tag informs the verifier of the number of OPTIONAL, default is entire body). This tag informs the verifier
bytes in the body of the email after canonicalization included in of the number of octets in the body of the email after
the cryptographic hash, starting from 0 immediately following the canonicalization included in the cryptographic hash, starting
CRLF preceding the body. from 0 immediately following the CRLF preceding the body. This
value MUST NOT be larger than the actual number of octets in the
canonicalized message body.
INFORMATIVE IMPLEMENTATION WARNING: Use of the l= tag might INFORMATIVE IMPLEMENTATION WARNING: Use of the l= tag might
allow display of fraudulent content without appropriate allow display of fraudulent content without appropriate
warning to end users. The l= tag is intended for increasing warning to end users. The l= tag is intended for increasing
signature robustness when sending to mailing lists that both signature robustness when sending to mailing lists that both
modify their content and do not sign their messages. modify their content and do not sign their messages.
However, using the l= tag enables man-in-the-middle attacks However, using the l= tag enables attacks in which an
in which an intermediary with malicious intent modifies a intermediary with malicious intent modifies a message to
message to include content that solely benefits the attacker. include content that solely benefits the attacker. It is
It is possible for the appended content to completely replace possible for the appended content to completely replace the
the original content in the end recipient's eyes and to original content in the end recipient's eyes and to defeat
defeat duplicate message detection algorithms. Examples are duplicate message detection algorithms. Examples are
described in Security Considerations (Section 8). 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.
To avoid this attack, signers should be extremely wary of INFORMATIVE NOTE: The value of the l= tag is constrained to
using this tag, and verifiers might wish to ignore the tag or 76 decimal digits, which will fit in a 256-bit binary integer
remove text that appears after the specified content length. 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.
ABNF: ABNF:
sig-l-tag = %x6c [FWS] "=" [FWS] 1*DIGIT sig-l-tag = %x6c [FWS] "=" [FWS] 1*76DIGIT
q= A colon-separated list of query methods used to retrieve the q= A colon-separated list of query methods used to retrieve the
public key (plain-text; OPTIONAL, default is "dns/txt"). Each public key (plain-text; OPTIONAL, default is "dns/txt"). Each
query method is of the form "type[/options]", where the syntax query method is of the form "type[/options]", where the syntax
and semantics of the options depends on the type and specified and semantics of the options depends on the type and specified
options. If there are multiple query mechanisms listed, the options. If there are multiple query mechanisms listed, the
choice of query mechanism MUST NOT change the interpretation of choice of query mechanism MUST NOT change the interpretation of
the signature. Implementations MUST use the recognized query the signature. Implementations MUST use the recognized query
mechanisms in the order presented. mechanisms in the order presented.
Currently the only valid value is "dns/txt" which defines the DNS Currently the only valid value is "dns/txt" which defines the DNS
TXT record lookup algorithm described elsewhere in this document. TXT record lookup algorithm described elsewhere in this document.
The only option defined for the "dns" query type is "txt", which The only option defined for the "dns" query type is "txt", which
MUST be included. Verifiers and signers MUST support "dns/txt". MUST be included. Verifiers and signers MUST support "dns/txt".
ABNF: ABNF:
sig-q-tag = %x71 [FWS] "=" [FWS] sig-q-tag-method sig-q-tag = %x71 [FWS] "=" [FWS] sig-q-tag-method
*([FWS] ":" [FWS] sig-q-tag-method) *([FWS] ":" [FWS] sig-q-tag-method)
sig-q-tag-method = sig-q-tag-type ["/" sig-q-tag-args] sig-q-tag-method = "txt/dns" / x-sig-q-tag-type ["/" x-sig-q-tag-args]
sig-q-tag-type = "dns" / x-sig-q-tag-type
x-sig-q-tag-type = hyphenated-word ; for future extension x-sig-q-tag-type = hyphenated-word ; for future extension
x-sig-q-tag-args = qp-hdr-value x-sig-q-tag-args = qp-hdr-value
s= The selector subdividing the namespace for the "d=" (domain) tag s= The selector subdividing the namespace for the "d=" (domain) tag
(plain-text; REQUIRED). (plain-text; REQUIRED).
ABNF: ABNF:
sig-s-tag = %x73 [FWS] "=" [FWS] subdomain *( "." sub-domain ) sig-s-tag = %x73 [FWS] "=" [FWS] subdomain *( "." sub-domain )
t= Signature Timestamp (pplain-text; RECOMMENDED, default is an t= Signature Timestamp (plain-text unsigned decimal integer;
unknown creation time). The time that this signature was RECOMMENDED, default is an unknown creation time). The time that
created. The format is the number of seconds since 00:00:00 on this signature was created. The format is the number of seconds
January 1, 1970 in the UTC time zone. The value is expressed as since 00:00:00 on January 1, 1970 in the UTC time zone. The
an unsigned integer in decimal ASCII. This value is not value is expressed as an unsigned integer in decimal ASCII. This
constrained to fit into a 31- or 32-bit integer. Implementations value is not constrained to fit into a 31- or 32-bit integer.
SHOULD be prepared to handle values up to at least 10^12 (until Implementations SHOULD be prepared to handle values up to at
approximately AD 200,000; this fits into 40 bits). To avoid least 10^12 (until approximately AD 200,000; this fits into 40
denial of service attacks, implementations MAY consider any value bits). To avoid denial of service attacks, implementations MAY
longer than 12 digits to be infinite. consider any value longer than 12 digits to be infinite.
ABNF: ABNF:
sig-t-tag = %x74 [FWS] "=" [FWS] 1*12DIGIT sig-t-tag = %x74 [FWS] "=" [FWS] 1*12DIGIT
x= Signature Expiration (plain-text; RECOMMENDED, default is no x= Signature Expiration (plain-text unsigned decimal integer;
expiration). The format is the same as in the "t=" tag, RECOMMENDED, default is no expiration). The format is the same
represented as an absolute date, not as a time delta from the as in the "t=" tag, represented as an absolute date, not as a
signing timestamp. The value is expressed as an unsigned integer time delta from the signing timestamp. The value is expressed as
in decimal ASCII, with the same contraints on the value in the an unsigned integer in decimal ASCII, with the same contraints on
"t=" tag. Signatures MAY be considered invalid if the the value in the "t=" tag. Signatures MAY be considered invalid
verification time at the verifier is past the expiration date. if the verification time at the verifier is past the expiration
The verification time should be the time that the message was date. The verification time should be the time that the message
first received at the administrative domain of the verifier if was first received at the administrative domain of the verifier
that time is reliably available; otherwise the current time if that time is reliably available; otherwise the current time
should be used. The value of the "x=" tag MUST be greater than should be used. The value of the "x=" tag MUST be greater than
the value of the "t=" tag if both are present. the value of the "t=" tag if both are present.
INFORMATIVE NOTE: The x= tag is not intended as an anti- INFORMATIVE NOTE: The x= tag is not intended as an anti-
replay defense. replay defense.
ABNF: ABNF:
sig-x-tag = %x78 [FWS] "=" [FWS] 1*12DIGIT sig-x-tag = %x78 [FWS] "=" [FWS] 1*12DIGIT
z= Copied header fields (dkim-quoted-printable, but see
z= Copied header fields (plain-text, but see description; OPTIONAL, description; OPTIONAL, default is null). A vertical-bar-
default is null). A vertical-bar-separated list of selected separated list of selected header fields present when the message
header field names and copies of header field values present when was signed, including both the field name and value. It is not
the message was signed. It is not required to include all header required to include all header fields present at the time of
fields present at the time of signing. This field need not signing. This field need not contain the same header fields
contain the same header fields listed in the "h=" tag. Copied listed in the "h=" tag. The header field text itself must encode
header field values MUST immediately follow the header field name the vertical bar ("|", %x7C) character (i.e., vertical bars in
with a colon separator (no white space permitted). Header field the z= text are metacharacters, and any actual vertical bar
values MUST be represented as Quoted-Printable [RFC2045] with characters in a copied header field must be encoded). Note that
vertical bars, colons, semicolons, and white space encoded in all white space must be encoded, including white space between
addition to the usual requirements. the colon and the header field value. After encoding, SWSP 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 Verifiers MUST NOT use the header field names or copied values
for checking the signature in any way. Copied header field for checking the signature in any way. Copied header field
values are for diagnostic use onnly. values are for diagnostic use only.
Header fields with characters requiring conversion (perhaps from Header fields with characters requiring conversion (perhaps from
legacy MTAs which are not [RFC2822] compliant) SHOULD be legacy MTAs which are not [RFC2822] compliant) SHOULD be
converted as described in MIME Part Three [RFC2047]. converted as described in MIME Part Three [RFC2047].
ABNF: ABNF:
sig-z-tag = %x7A [FWS] "=" [FWS] sig-z-tag-copy sig-z-tag = %x7A [FWS] "=" [FWS] sig-z-tag-copy
*( [FWS] "|" sig-z-tag-copy ) *( [FWS] "|" sig-z-tag-copy )
sig-z-tag-copy = hdr-name ":" [FWS] qp-hdr-value sig-z-tag-copy = hdr-name ":" qp-hdr-value
qp-hdr-value = <quoted-printable text with WS, "|", ":", qp-hdr-value = dkim-quoted-printable ; with "|" encoded
and ";" encoded>
; needs to be updated with real definition
; (could be messy)
INFORMATIVE EXAMPLE of a signature header field spread across INFORMATIVE EXAMPLE of a signature header field spread across
multiple continuation lines: multiple continuation lines:
DKIM-Signature: a=rsa-sha1; d=example.net; s=brisbane DKIM-Signature: a=rsa-sha256; d=example.net; s=brisbane;
c=simple; q=dns; i=@eng.example.net; t=1117574938; x=1118006938; c=simple; q=dns/txt; i=@eng.example.net; t=1117574938; x=1118006938;
h=from:to:subject:date; h=from:to:subject:date;
z=From:foo@eng.example.net|To:joe@example.com| z=From:foo@eng.example.net|To:joe@example.com|
Subject:demo=20run|Date:July=205,=202005=203:44:08=20PM=20-0700 Subject:demo=20run|Date:July=205,=202005=203:44:08=20PM=20-0700
b=dzdVyOfAKCdLXdJOc9G2q8LoXSlEniSbav+yuU4zGeeruD00lszZ b=dzdVyOfAKCdLXdJOc9G2q8LoXSlEniSbav+yuU4zGeeruD00lszZ
VoG4ZHRNiYzR VoG4ZHRNiYzR
3.6 Key Management and Representation 3.6 Key Management and Representation
Signature applications require some level of assurance that the Signature applications require some level of assurance that the
verification public key is associated with the claimed signer. Many verification public key is associated with the claimed signer. Many
skipping to change at page 24, line 21 skipping to change at page 26, line 14
of security, with significantly enhanced scalability, by simply of security, with significantly enhanced scalability, by simply
having the verifier query the purported signer's DNS entry (or some having the verifier query the purported signer's DNS entry (or some
security-equivalent) in order to retrieve the public key. security-equivalent) in order to retrieve the public key.
DKIM keys can potentially be stored in multiple types of key servers DKIM keys can potentially be stored in multiple types of key servers
and in multiple formats. The storage and format of keys are and in multiple formats. The storage and format of keys are
irrelevant to the remainder of the DKIM algorithm. irrelevant to the remainder of the DKIM algorithm.
Parameters to the key lookup algorithm are the type of the lookup 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 "q=" tag), the domain of the responsible signer (the "d=" tag of
the DKIM-Signature header field), the signing identity (the "i=" the DKIM-Signature header field), and the selector (the "s=" tag).
tag), and the selector (the "s=" tag). The "i=" tag value could be
ignored by some key services.
public_key = dkim_find_key(q_val, d_val, i_val, s_val) public_key = dkim_find_key(q_val, d_val, s_val)
This document defines a single binding, using DNS TXT records to This document defines a single binding, using DNS TXT records to
distribute the keys. Other bindings may be defined in the future. distribute the keys. Other bindings may be defined in the future.
3.6.1 Textual Representation 3.6.1 Textual Representation
It is expected that many key servers will choose to present the keys It is expected that many key servers will choose to present the keys
in an otherwise unstructured text format (for example, an XML form in an otherwise unstructured text format (for example, an XML form
would not be considered to be unstructured text for this purpose). would not be considered to be unstructured text for this purpose).
The following definition MMUST be used for any DKIM key represented in The following definition MUST be used for any DKIM key represented in
an otherwise unstructured textual form. an otherwise unstructured textual form.
The overall syntax is a key-value-list as described in Section 3.2. The overall syntax is a key-value-list as described in Section 3.2.
The current valid tags are described below. Other tags MAY be The current valid tags are described below. Other tags MAY be
present and MUST be ignored by any implementation that does not present and MUST be ignored by any implementation that does not
understand them. understand them.
v= Version of the DKIM key record (plain-text; RECOMMENDED, default v= Version of the DKIM key record (plain-text; RECOMMENDED, default
is "DKIM1"). If specified, this tag MUST be set to "DKIM1" is "DKIM1"). If specified, this tag MUST be set to "DKIM1"
(without the quotes). This tag MUST be the first tag in the (without the quotes). This tag MUST be the first tag in the
response. Responses beginning with a "v=" tag with any other response. Responses beginning with a "v=" tag with any other
value MUST be discarded. value MUST be discarded.
ABNF: ABNF:
key-v-tag = %x76 [FWS] "=" [FWS] "DKIM1" key-v-tag = %x76 [FWS] "=" [FWS] "DKIM1"
g= granularity of the key (plain-text; OPTIONAL, default is "*"). g= granularity of the key (plain-text; OPTIONAL, default is "*").
This value MUST match the local part of the signing address, with This value MUST match the Local-part of the "i=" tag of the DKIM-
a "*" character acting as a wildcard. The intent of this tag is Signature header field (or its default value of the empty string
to constrain which signing address can legitimately use this if "i=" is not specified), with a "*" character matching a
selector. An email with a signing address that does not match sequence of zero or more arbitrary characters ("wildcarding").
the value of this tag constitutes a failed verification. The intent of this tag is to constrain which signing address can
Wildcarding allows matching for addresses such as "user+*". An legitimately use this selector. An email with a signing address
empty "g=" value never matches any addresses. 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.
ABNF: ABNF:
key-g-tag = %x67 [FWS] "=" [FWS] key-g-tag-lpart key-g-tag = %x67 [FWS] "=" [FWS] key-g-tag-lpart
key-g-tag-lpart = [dot-atom] ["*"] [dot-atom] key-g-tag-lpart = [dot-atom] ["*"] [dot-atom]
[[NON-NORMATIVE DISCUSSION POINT: "*" is legal in a dot- [[NON-NORMATIVE DISCUSSION POINT: "*" is legal in a dot-
atom. This should probably use a different character for atom. This should probably use a different character for
wildcarding. Unfortunately, the options are non-mnemonic wildcarding. Unfortunately, the options are non-mnemonic
(e.g., "@", "(", ":"). Alternatively we could insist on (e.g., "@", "(", ":"). Alternatively we could insist on
skipping to change at page 26, line 13 skipping to change at page 28, line 4
ABNF: ABNF:
key-k-tag = %x76 [FWS] "=" [FWS] key-k-tag-type key-k-tag = %x76 [FWS] "=" [FWS] key-k-tag-type
key-k-tag-type = "rsa" / x-key-k-tag-type key-k-tag-type = "rsa" / x-key-k-tag-type
x-key-k-tag-type = hyphenated-word ; for future extension x-key-k-tag-type = hyphenated-word ; for future extension
[[NON-NORMATIVE DISCUSSION NOTE: In some cases it can be [[NON-NORMATIVE DISCUSSION NOTE: In some cases it can be
hard to separate h= and k=; for example DSA implies that hard to separate h= and k=; for example DSA implies that
SHA-1 will be used. This might be an actual change to the SHA-1 will be used. This might be an actual change to the
spec depending on how we decide to fix this.]] spec depending on how we decide to fix this.]]
n= Notes that might be of interest to a human (qp-section;
n= Notes that might be of interest to a human (quoted-printable;
OPTIONAL, default is empty). No interpretation is made by any OPTIONAL, default is empty). No interpretation is made by any
program. This tag should be used sparingly in any key server program. This tag should be used sparingly in any key server
mechanism that has space limitations (notably DNS). mechanism that has space limitations (notably DNS).
ABNF: ABNF:
key-n-tag = %x6e [FWS] "=" [FWS] qp-section key-n-tag = %x6e [FWS] "=" [FWS] qp-section
p= Public-key data (base64; REQUIRED). An empty value means that p= Public-key data (base64; REQUIRED). An empty value means that
this public key has been revoked. The syntax and semantics of this public key has been revoked. The syntax and semantics of
skipping to change at page 26, line 42 skipping to change at page 28, line 32
s= Service Type (plain-text; OPTIONAL; default is "*"). A colon- s= Service Type (plain-text; OPTIONAL; default is "*"). A colon-
separated list of service types to which this record applies. separated list of service types to which this record applies.
Verifiers for a given service type MUST ignore this record if the Verifiers for a given service type MUST ignore this record if the
appropriate type is not listed. Currently defined service types appropriate type is not listed. Currently defined service types
are: are:
* matches all service types * matches all service types
email electronic mail (not necessarily limited to SMTP) email electronic mail (not necessarily limited to SMTP)
This tag is intended to permit senders to constrain the use of This tag is intended to permit signers to constrain the use of
delegated keys, e.g., where a company is willing to delegate the 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 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 send IM or make VoIP calls. (This of course presumes that these
keys are used in other services in the future.) keys are used in other services in the future.)
ABNF: ABNF:
key-s-tag = %x73 [FWS] "=" [FWS] key-s-tag-type 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 key-s-tag-type = "email" / "*" / x-key-s-tag-type
x-key-s-tag-type = hyphenated-word ; for future extension x-key-s-tag-type = hyphenated-word ; for future extension
t= Flags, represented as a colon-separated list of names (plain- t= Flags, represented as a colon-separated list of names (plain-
text; OPTIONAL, default is no flags set). The defined flags are: text; OPTIONAL, default is no flags set). The defined flags are:
y This domain is testing DKIM. Verifiers MUST NOT treat y This domain is testing DKIM. Verifiers MUST NOT treat
messages from signers in testing mode differently from messages from signers in testing mode differently from
unsigned email, even should the signature fail to verify. unsigned email, even should the signature fail to verify.
Verifiers MAY wish to track testing modee results to assist Verifiers MAY wish to track testing mode results to assist
the signer. the signer.
s Any DKIM-Signature header fields using the "i=" tag MUST have
the same domain value on the right hand side of the "@" in
the "i=" tag and the value of the "d=" tag. That is, the
"i=" domain MUST NOT be a subdomain of "d=".
ABNF: ABNF:
key-t-tag = %x74 [FWS] "=" [FWS] key-t-tag-flag key-t-tag = %x74 [FWS] "=" [FWS] key-t-tag-flag
0*( [FWS] ":" [FWS] key-t-tag-flag ) 0*( [FWS] ":" [FWS] key-t-tag-flag )
key-t-tag-flag = "y" / x-key-t-tag-flag key-t-tag-flag = "y" / "s" / x-key-t-tag-flag
x-key-t-tag-flag = hyphenated-word ; for future extension x-key-t-tag-flag = hyphenated-word ; for future extension
Unrecognized flags MUST be ignored. Unrecognized flags MUST be ignored.
3.6.2 DNS binding 3.6.2 DNS binding
A binding using DNS TXT records as a key service is hereby defined. A binding using DNS TXT records as a key service is hereby defined.
All implementations MUST support this binding. All implementations MUST support this binding.
3.6.2.1 Name Space 3.6.2.1 Name Space
skipping to change at page 27, line 47 skipping to change at page 29, line 45
a DKIM-Signature field with a "d=" tag of ""example.com"" and an "s=" a DKIM-Signature field with a "d=" tag of ""example.com"" and an "s="
tag of ""sample"", the DNS query will be for tag of ""sample"", the DNS query will be for
""sample._domainkey.example.com"". ""sample._domainkey.example.com"".
The value of the "i=" tag is not used by the DNS binding. The value of the "i=" tag is not used by the DNS binding.
3.6.2.2 Resource Record Types for Key Storage 3.6.2.2 Resource Record Types for Key Storage
The DNS Resource Record type used is specified by an option to the The DNS Resource Record type used is specified by an option to the
query-type ("q=") tag. The only option defined in this base query-type ("q=") tag. The only option defined in this base
specification is "/txt", indicating the use of a TXT RR record. A specification is "txt", indicating the use of a TXT RR record. A
later extension of this standard may define another Resource Record later extension of this standard may define another Resource Record
type, tentatively dubbed "DKK". type, tentatively dubbed "DKK".
TXT records are encoded as described in Section 3.6.1. TXT records are encoded as described in Section 3.6.1.
3.7 Computing the Message Hashes 3.7 Computing the Message Hashes
Both signing and verifying message signatures starts with a step of Both signing and verifying message signatures starts with a step of
computing two cryptographic hashes over the message. Signers will computing two cryptographic hashes over the message. Signers will
choose the parameters of the signature as described in Signer Actions choose the parameters of the signature as described in Signer Actions
(Section 5); verifiers will use the parameters specified in the (Section 5); verifiers will use the parameters specified in the
"DKIM-Signature" header field being verified. In the following "DKIM-Signature" header field being verified. In the following
discussion, the names of the tags in the "DKIM-Signature" header discussion, the names of the tags in the "DKIM-Signature" header
field which either exists (when verifying) or will be created (when field which either exists (when verifying) or will be created (when
signing) are used. Note that canonicalization (Section 3.4) is only signing) are used. Note that canonicalization (Section 3.4) is only
used to prepare the email for signing or verifying; it does not used to prepare the email for signing or verifying; it does not
affect the transmitted email in any way. affect the transmitted email in any way.
The signer or verifier must compute two hashes, one over the body of The signer or verifier must compute two hashes, one over the body of
the message and one over the header of the message. Signers MUST the message and one over the selected header fields of the message.
compute them in the order shown. Verifiers MAY compute them in any Signers MUST compute them in the order shown. Verifiers MAY compute
order convenient to the verifier, provided that the result is them in any order convenient to the verifier, provided that the
semantically identical to the semantics that would be the case had result is semantically identical to the semantics that would be the
they been computed in this order. 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 or verifier MUST hash the message body,
canonicalized using the body canonicalization algorithm specified in canonicalized using the body canonicalization algorithm specified in
the "c=" tag and truncated to the length specified in the "l=" tag. 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 That hash value is then converted to base64 form and inserted into
the "bh=" tag of the DKIMM-Signature: header field. 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 or verifier MUST pass the following to the
hash algorithm in the indicated order. hash algorithm in the indicated order.
1. The header fields specified by the "h=" tag, in the order 1. The header fields specified by the "h=" tag, in the order
specified in that tag, and canonicalized using the header specified in that tag, and canonicalized using the header
canonicalization algorithm specified in the "c=" tag. Each canonicalization algorithm specified in the "c=" tag. Each
header field must be terminated with a single CRLF. header field must be terminated with a single CRLF.
2. The "DKIM-Signature" header field that exists (verifying) or will 2. The "DKIM-Signature" header field that exists (verifying) or will
skipping to change at page 29, line 7 skipping to change at page 30, line 52
using the header canonicalization algorithm specified in the "c=" using the header canonicalization algorithm specified in the "c="
tag, and without a trailing CRLF. tag, and without a trailing CRLF.
All tags and their values in the DKIM-Signature header field are All tags and their values in the DKIM-Signature header field are
included in the cryptographic hash with the sole exception of the included in the cryptographic hash with the sole exception of the
value portion of the "b=" (signature) tag, which MUST be treated as value portion of the "b=" (signature) tag, which MUST be treated as
the null string. All tags MUST be included even if they might not be the null string. All tags MUST be included even if they might not be
understood by the verifier. The header field MUST be presented to understood by the verifier. The header field MUST be presented to
the hash algorithm after the body of the message rather than with the the hash algorithm after the body of the message rather than with the
rest of the header fields and MUST be canonicalized as specified in rest of the header fields and MUST be canonicalized as specified in
the "c=" (canonicalization) tag. The DKIM-Signature header field the "c=" (canonicalization) tag. The DKIM-Signature header field
MUST NOT be included in its own h= tag. MUST NOT be included in its own h= tag.
When calculating the hash on messages that will be transmitted using When calculating the hash on messages that will be transmitted using
base64 or quoted-printable encoding, signers MUST compute the hash base64 or quoted-printable encoding, signers MUST compute the hash
after the encoding. Likewise, the verifier MUST incorporate the after the encoding. Likewise, the verifier MUST incorporate the
values into the hash before decoding the base64 or quoted-printable values into the hash before decoding the base64 or quoted-printable
text. However, the hash MUST be computed before transport level text. However, the hash MUST be computed before transport level
encodings such as SMTP "dot-stuffing." encodings such as SMTP "dot-stuffing."
With the exception of the canonicalization procedure described in With the exception of the canonicalization procedure described in
Section 3.4, the DKIM signing process treats the body of messages as Section 3.4, the DKIM signing process treats the body of messages as
simply a string of characters. DKIM messages MAY be either in plain- simply a string of characters. DKIM messages MAY be either in plain-
text or in MIME format; no special treatment is afforded to MIME text or in MIME format; no special treatment is afforded to MIME
content. Message attachments in MIME format MUST be included in the content. Message attachments in MIME format MUST be included in the
content which is signed. content which is signed.
More formally, the algorithm for the signature is: More formally, the algorithm for the signature is:
body-hash = hash-alg(canon_body) body-hash = hash-alg(canon_body)
header-hash = hash-alg(canon_header || DKIM-SIG) header-hash = hash-alg(canon_header || DKIM-SIG)
signature = crypt-alg(header-hash, key) signature = sig-alg(header-hash, key)
where crypt-alg is the encryption algorithm specified by the "a=" where sig-alg is the signature algorithm specified by the "a=" tag,
tag, hash-alg is the hash algorithm specified by the "a=" tag, hash-alg is the hash algorithm specified by the "a=" tag,
canon_header and canon_body are the canonicalized message header and canon_header and canon_body are the canonicalized message header and
body (respectively) as defined in Section 3.4 (excluding the DKIM- body (respectively) as defined in Section 3.4 (excluding the DKIM-
Signature header field), and DKIM-SIG is the canonicalized DKIM- Signature header field), and DKIM-SIG is the canonicalized DKIM-
Signature header field sans the signature value itself, but with Signature header field sans the signature value itself, but with
body-hash included as the "bh=" tag. body-hash included as the "bh=" tag.
4. Semantics of Multiple Signatures 4. Semantics of Multiple Signatures
A signer that is adding a signature to a message merely creates a new 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 DKIM-Signature header, using the usual semantics of the h= option. A
signer MAY sign previously existing DKIM-Signature headers using the signer MAY sign previously existing DKIM-Signature headers using the
method described in section Section 5.4 to sign trace headers. method described in section Section 5.4 to sign trace headers.
Signers should be cognizant that signing DKIM-Signature headers may Signers should be cognizant that signing DKIM-Signature headers may
result in signature failures with intermediaries that do not result in signature failures with intermediaries that do not
recognize that DKIM-Signature's are trace headers and unwittingly recognize that DKIM-Signature's are trace headers and unwittingly
reorder them. reorder them.
When evaluating a message with multiple signatures, a receiver should When evaluating a message with multiple signatures, a verifier should
evaluate signatures independently and on their own merits. For evaluate signatures independently and on their own merits. For
example, a receiver that by policy chooses not to accept signatures example, a verifier that by policy chooses not to accept signatures
with deprecated crypto algorithms should consider such signatures with deprecated cryptographic algorithms should consider such
invalid. As with messages with a single signature, receievers are at signatures invalid. As with messages with a single signature,
liberty to use the presence of valid signatures as an input to local verifiers are at liberty to use the presence of valid signatures as
policy; likewise, the interpretation of multiple valid signatures in an input to local policy; likewise, the interpretation of multiple
combination is a local policy decision of the receiver. valid signatures in combination is a local policy decision of the
verifier.
Signers SHOULD NOT remove any DKIM-Signature header fields from Signers SHOULD NOT remove any DKIM-Signature header fields from
messages they are signing, even if they know that the signatures messages they are signing, even if they know that the signatures
cannot be verified. cannot be verified.
5. Signer Actions 5. Signer Actions
The following steps are performed in order by signers. The following steps are performed in order by signers.
5.1 Determine if the Email Should be Signed and by Whom 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 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 key and selector information. However there are a number of other
reasons beyond the lack of a private key why a signer could choose reasons beyond the lack of a private key why a signer could choose
not to sign an email. not to sign an email.
A SUBMISSION server MAY sign if the sender is authenticated by some A SUBMISSION server MAY sign if the submitter is authenticated by
secure means, e.g., SMTP AUTH. Within a trusted enclave the signing some secure means, e.g., SMTP AUTH. Within a trusted enclave the
address MAY be derived from the header field according to local signing address MAY be derived from the header field according to
signer policy. Within a trusted enclave an MTA MAY do the signing. local signer policy. Within a trusted enclave an MTA MAY do the
signing.
INFORMATIVE IMPLEMENTER ADVICE: SUBMISSION servers should not INFORMATIVE IMPLEMENTER ADVICE: SUBMISSION servers should not
sign Received header fields if the outgoing gateway MTA obfuscates sign Received header fields if the outgoing gateway MTA obfuscates
Received header fields, for example to hide the details of Received header fields, for example to hide the details of
internal topology. internal topology.
A signer MUST NOT sign an email if it is unwilling to be held A signer MUST NOT sign an email if it is unwilling to be held
responsible for the message; in particular, the signer SHOULD ensure responsible for the message; in particular, the signer SHOULD ensure
that the submitter has a bona fide relationship with the signer and that the submitter has a bona fide relationship with the signer and
that the submitter has tthe right to use the address being claimed. that the submitter has the right to use the address being claimed.
If an email cannot be signed for some reason, it is a local policy If an email cannot be signed for some reason, it is a local policy
decision as to what to do with that email. 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 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 all selectors are equal as far as this specification is concerned, so
the decision should largely be a matter of administrative 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. outside the scope of this document.
A signer SHOULD NOT sign with a key that is expected to expire within INFORMATIVE OPERATIONS ADVICE: A signer should not sign with a
seven days; that is, when rotating to a new key, signing should private key when the selector containing the corresponding public
immediately commence with the new key and the old key SHOULD be key is expected to be removed before the verifier has an
retained for at least seven days before being removed from the key opportunity to validate the signature. The signer should
server. 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
key should be retained for a reasonable validation interval before
being removed from the key server.
5.3 Normalize the Message to Prevent Transport Conversions 5.3 Normalize the Message to Prevent Transport Conversions
Some messages, particularly those using 8-bit characters, are subject Some messages, particularly those using 8-bit characters, are subject
to modification during transit, notably conversion to 7-bit form. to modification during transit, notably conversion to 7-bit form.
Such conversions will break DKIM signatures. In order to minimize Such conversions will break DKIM signatures. In order to minimize
the chances of such breakage, signers SHOULD convert the message to a the chances of such breakage, signers SHOULD convert the message to a
suitable MIME content transfer encoding such as quoted-printable or suitable MIME content transfer encoding such as quoted-printable or
base64 as described in MIME Part One [RFC2045] before signing. Such base64 as described in MIME Part One [RFC2045] before signing. Such
conversion is outside the scope of DKIM; the actual message SHOULD be conversion is outside the scope of DKIM; the actual message SHOULD be
skipping to change at page 31, line 42 skipping to change at page 33, line 44
received by the verifier rather than in some local or internal form. 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 The From header field MUST be signed (that is, included in the h= tag
of the resulting DKIM-Signature header field); any header field that of the resulting DKIM-Signature header field); any header field that
describes the role of the signer (for example, the Sender or Resent- describes the role of the signer (for example, the Sender or Resent-
From header field if the signature is on behalf of the corresponding From header field if the signature is on behalf of the corresponding
address and that address is different from the From address) MUST address and that address is different from the From address) MUST
also be included. The signed header fields SHOULD also include the also be included. The signed header fields SHOULD also include the
Subjectt and Date header fields as well as all MIME header fields. Subject and Date header fields as well as all MIME header fields.
Signers SHOULD NOT sign an existing header field likely to be Signers SHOULD NOT sign an existing header field likely to be
legitimately modified or removed in transit. In particular, legitimately modified or removed in transit. In particular,
[RFC2821] explicitly permits modification or removal of the "Return- [RFC2821] explicitly permits modification or removal of the "Return-
Path" header field in transit. Signers MAY include any other header Path" header field in transit. Signers MAY include any other header
fields present at the time of signing at the discretion of the fields present at the time of signing at the discretion of the
signer. It is RECOMMENDED that all other existing, non-repeatable signer. It is RECOMMENDED that all other existing, non-repeatable
header fields be signed. header fields be signed.
The DKIM-Signature header field is always implicitly signed and MUST The DKIM-Signature header field is always implicitly signed and MUST
NOT be included in the h= tag except to indicate that other NOT be included in the h= tag except to indicate that other
skipping to change at page 35, line 25 skipping to change at page 37, line 29
considerably simplifies things for the user, who can now use an considerably simplifies things for the user, who can now use an
existing mail user agent. Most MUAs have the ability to filter existing mail user agent. Most MUAs have the ability to filter
messages based on message header fields or content; these filters messages based on message header fields or content; these filters
would be used to implement whatever policy the user wishes with would be used to implement whatever policy the user wishes with
respect to unsigned mail. respect to unsigned mail.
A verifying MTA MAY implement a policy with respect to unverifiable A verifying MTA MAY implement a policy with respect to unverifiable
mail, regardless of whether or not it applies the verification header mail, regardless of whether or not it applies the verification header
field to signed messages. field to signed messages.
In the following description, text reading "return with Verifiers MUST produce a result that is semantically equivalent to
DKIM_STAT_something" means that the verifier MUST immediately cease applying the following steps in the order listed. In practice,
processing that signature. The verifier SHOULD proceed to the next several of these steps can be performed in parallel in order to
signature, if any is present, and completely ignore the bad improve performance.
signature. There are two special cases: DKIM_STAT_PARTIALSIG
indicates that only a portion of the message was actually signed, and
DKIM_STAT_TEMPFAIL means that the signature could not be verified at
this time but should be tried again later. In the former case, the
action a verifier takes is a matter of local policy. In the latter
case, a verifier MAY either defer the message for later processing,
perhaps by queueing it local or issuing a 451/4.7.5 SMTP reply, or
try another signature; if no good signature is found and any of the
signatures resulted in a DKIM_STAT_TEMPFAIL status, the verifier
SHOULD save the message for later processing. Note that an
implementation is not constrained to use these status codes; these
are for explanatory purposes only, and an implementation may define
fewer or more status codes.
The order in which signatures are tried is a matter of local policy 6.1 Extract Signatures from the Message
for the verifier and is not defined here. A verifier SHOULD NOT
treat a message that has one or more bad signatures and no good The order in which verifiers try DKIM-Signature header fields is not
signatures differently from a message with no signature at all; defined; verifiers MAY try signatures in any order they would like.
again, this is local policy and is beyond the scope of this document. For example, one implementation might prefer to try the signatures in
textual order, whereas another might want to prefer signatures by
identities that match the contents of the "From" header field over
other identities. Verifiers MUST NOT attribute ultimate meaning to
the order of multiple DKIM-Signature header fields. In particular,
there is reason to believe that some relays will reorder the header
fields in potentially arbitrary ways.
INFORMATIVE IMPLEMENTATION NOTE: Verifiers might use the order as
a clue to signing order in the absence of any other information.
However, other clues as to the semantics of multiple signatures
must be considered before using ordering.
A verifier SHOULD NOT treat a message that has one or more bad
signatures and no good signatures differently from a message with no
signature at all; this is local policy and is beyond the scope of
this document.
When a signature successfully verifies, a verifier will either stop When a signature successfully verifies, a verifier will either stop
processing or attempt to verify any other signatures, at the processing or attempt to verify any other signatures, at the
discretion of the implementation. discretion of the implementation.
Verifiers MUST apply the following steps in the order listed. In the following description, text reading "return status
(explanation)" (where "status" is one of "PERMFAIL" or "TEMPFAIL")
means that the verifier MUST immediately cease processing that
signature. The verifier SHOULD proceed to the next signature, if any
is present, and completely ignore the bad signature. If the status
is "PERMFAIL", the signature failed and should not be reconsidered.
If the status is "TEMPFAIL", the signature could not be verified at
this time but may be tried again later. A verifier MAY either defer
the message for later processing, perhaps by queueing it locally or
issuing a 451/4.7.5 SMTP reply, or try another signature; if no good
signature is found and any of the signatures resulted in a TEMPFAIL
status, the verifier MAY save the message for later processing. The
"(explanation)" is not normative text; it is provided solely for
clarification.
6.1 Extract the Signature from the Message Verifiers SHOULD ignore any DKIM-Signature header fields where the
signature does not validate. Verifiers that are prepared to validate
multiple signature header fields SHOULD proceed to the next signature
header field, should it exist. However, verifiers MAY make note of
the fact that an invalid signature was present for consideration at a
later step.
The signature and associated signing identity is included in the INFORMATIVE NOTE: The rationale of this requirement is to permit
value of the DKIM-Signature header field. The order in which messages that have invalid signatures but also a valid signature
verifiers try DKIM-Signature header fields is not defined; verifiers to work. For example, a mailing list exploder might opt to leave
MAY try signatures in any order they would like. For example, one the original submitter signature in place even though the exploder
implementation might prefer to try the signatures in textual order, knows that it is modifying the message in some way that will break
whereas another might want to prefer signatures by identities that that signature, and the exploder inserts its own signature. In
match the contents of the "From" header field over other identities. this case the message should succeed even in the presence of the
known-broken signature.
For each signature to be validated, the following steps should be
performed in such a manner as to produce a result that is
semantically equivalent to performing them in the indicated order.
6.1.1 Validate the Signature Header Field
Implementers MUST meticulously validate the format and values in the Implementers MUST meticulously validate the format and values in the
DKIM-Signature header field; any inconsistency or unexpected values DKIM-Signature header field; any inconsistency or unexpected values
MUST cause the header field to be completely ignored and the verifier MUST cause the header field to be completely ignored and the verifier
to return with DKIM_STAT_SYNTAX. Being "liberal in what you accept" to return PERMFAIL (signature syntax error). Being "liberal in what
is definitely a bad strategy in this security context. Note however you accept" is definitely a bad strategy in this security context.
that this does not include the existence of unknown tags in a DKIM- Note however that this does not include the existence of unknown tags
Signature header field, which are explicitly permitted. in a DKIM-Signature header field, which are explicitly permitted.
Verifiers MUST ignore DKIM-Signature header fields with a "v=" tag Verifiers MUST ignore DKIM-Signature header fields with a "v=" tag
that is inconsistent with this specification and return with that is inconsistent with this specification and return PERMFAIL
DKIM_STAT_INCOMPAT. (incompatible version).
INFORMATIVE IMPLEMENTATION NOTE: An implementation may, of INFORMATIVE IMPLEMENTATION NOTE: An implementation may, of
course, choose to also verify signatures generated by older course, choose to also verify signatures generated by older
versions of this specification. versions of this specification.
If the DKIM-Signature header field does not contain any of the tags If the DKIM-Signature header field does not contain any of the tags
listed as required in Section 3.5 the verifier MUST ignore the DKIM- listed as required in Section 3.5 the verifier MUST ignore the DKIM-
Signature header field and return with DKIM_STAT_SYNTAX. Signature header field and return PERMFAIL (signature missing
required tag).
If the "DKIM-Signature" header field does not contain the "i=" tag, If the "DKIM-Signature" header field does not contain the "i=" tag,
the verifier MUST behave as though the value of that tag were "@d", the verifier MUST behave as though the value of that tag were "@d",
where "d" is the value from the "d=" tag. where "d" is the value from the "d=" tag.
Verifiers MUST confirm that the domain specified in the "d=" tag is Verifiers MUST confirm that the domain specified in the "d=" tag is
the same as or a superdomain of the domain part of the "i=" tag. If the same as or a superdomain of the domain part of the "i=" tag. If
not, the DKIM-Signature header field MUST be ignored and the verifier not, the DKIM-Signature header field MUST be ignored and the verifier
should return with DKIM_STAT_SYNTAX. should return PERMFAIL (domain mismatch).
Verifiers MAY ignore the DKIM-Signature header field and return with
DKIM_STAT_EXPIRED if it contains an "x=" tag and the signature has
expired.
Verifiers MUST NOT attribute ultimate meaning to the order of
multiple DKIM-Signature header fields. In particular, there is
reason to believe that some relays will reorder the header fields in
potentially arbitrary ways.
INFORMATIVE IMPLEMENTATION NOTE: Verifiers might use the order as
a clue to signing order in the absence of any other informaation.
However, other clues as to the semantics of multiple signatures
must be considered before using ordering.
If there are no valid signatures remaining after this step, a Verifiers MAY ignore the DKIM-Signature header field and return
verifier MUST NOT proceed to the next step. PERMFAIL (signature expired) if it contains an "x=" tag and the
signature has expired.
6.2 Get the Public Key 6.1.2 Get the Public Key
The public key is needed to complete the verification process. The The public key for a signature is needed to complete the verification
process of retrieving the public key depends on the query type as process. The process of retrieving the public key depends on the
defined by the "q=" tag in the "DKIM-Signature:" header field. query type as defined by the "q=" tag in the "DKIM-Signature:" header
Obviously, a public key should only be retrieved if the process of field. Obviously, a public key need only be retrieved if the process
extracting the signature information is completely successful. of extracting the signature information is completely successful.
Details of key management and representation are described in Details of key management and representation are described in
Section 3.6. The verifier MUST validate the key record and MUST Section 3.6. The verifier MUST validate the key record and MUST
ignore any public key records that are malformed. ignore any public key records that are malformed.
When validating a message, a verifier MUST perform the following When validating a message, a verifier MUST perform the following
steps in a manner that is semantically the same as performing them in steps in a manner that is semantically the same as performing them in
the order indicated (in some cases the implementation may parallelize the order indicated (in some cases the implementation may parallelize
or reorder these steps, as long as the semantics remain unchanged): or reorder these steps, as long as the semantics remain unchanged):
1. Retrieve the public key as described in (Section 3.6) using the 1. Retrieve the public key as described in (Section 3.6) using the
domain from the "d=" tag and the selector from the "s=" tag. domain from the "d=" tag and the selector from the "s=" tag.
2. If the query for the public key fails to respond, the verifier 2. If the query for the public key fails to respond, the verifier
SHOULD defer acceptance of this email and return with MAY defer acceptance of this email and return TEMPFAIL (key
DKIM_STAT_TEMPFAIL. If verification is occuring during the unavailable). If verification is occuring during the incoming
incoming SMTP session, this MAY be achieved with a 451/4.7.5 SMTP SMTP session, this MAY be achieved with a 451/4.7.5 SMTP reply
reply code. Alternatively, the verifier MAY store the message in code. Alternatively, the verifier MAY store the message in the
the local queue for later trial or ignore the signature. Note local queue for later trial or ignore the signature. Note that
that storing a message in the local queue is subject to denial- storing a message in the local queue is subject to denial-of-
of-service attacks. service attacks.
3. If the query for the public key fails because the corresponding 3. If the query for the public key fails because the corresponding
key record does not exist, the verifier MUST immediately return key record does not exist, the verifier MUST immediately return
with DKIM_STAT_NOKEY. PERMFAIL (no key for signature).
4. If the query for the public key returns multiple key records, the 4. If the query for the public key returns multiple key records, the
verifier may choose one of the key records or may cycle through verifier may choose one of the key records or may cycle through
the key records performing the remainder of these steps on each the key records performing the remainder of these steps on each
record at the discretion of the implementer. The order of the record at the discretion of the implementer. The order of the
key records is unspecified. If the verifier chooses to cycle key records is unspecified. If the verifier chooses to cycle
through the key records, then the "return with ..." wording in through the key records, then the "return with ..." wording in
the remainder of this section means "try the next key record, if the remainder of this section means "try the next key record, if
any; if none, try the next DKIM-Signature header field." any; if none, return to try another signature in the usual way."
5. If the result returned from the query does not adhere to the 5. If the result returned from the query does not adhere to the
format defined in this specification, the verifier MUST ignore format defined in this specification, the verifier MUST ignore
the key record aand return with DKIM_STAT_NOKEY. Verifiers are the key record and return PERMFAIL (key syntax error). Verifiers
urged to validate the syntax of key records carefully to avoid are urged to validate the syntax of key records carefully to
attempted attacks. avoid attempted attacks.
6. If the "g=" tag in the public key does not match the local part 6. If the "g=" tag in the public key does not match the Local-part
of the "i=" tag on the message signature, the verifier MUST of the "i=" tag in the message signature header field, the
ignore the key record and return with DKIM_STAT_INAPPLICABLE. If verifier MUST ignore the key record and return PERMFAIL
the local part of the "i=" tag on the message signature is not (inapplicable key). If the Local-part of the "i=" tag on the
present, the g= tag must be * (valid for all addresses in the message signature is not present, the g= tag must be * (valid for
domain) or not present (which defaults to *), otherwise the all addresses in the domain) or the entire g= tag must be omitted
verifier MUST ignore the key record and return with (which defaults to "g=*"), otherwise the verifier MUST ignore the
DKIM_STAT_INAPPLICABLE. Other than this test, verifiers SHOULD key record and return PERMFAIL (inapplicable key). Other than
NOT treat a message signed with a key record having a g= tag any this test, verifiers SHOULD NOT treat a message signed with a key
differently than one without; in particular, verifiers SHOULD NOT record having a g= tag any differently than one without; in
prefer messages that seem to have an individual signature by particular, verifiers SHOULD NOT prefer messages that seem to
virtue of a g= tag vs. a domain signature. have an individual signature by virtue of a g= tag versus a
domain signature.
7. If the "h=" tag exists in the public key record and the hash 7. If the "h=" tag exists in the public key record and the hash
algorithm implied by the a= tag in the DKIM-Signature header is algorithm implied by the a= tag in the DKIM-Signature header is
not included in the contents of the "h=" tag, the verifier MUST not included in the contents of the "h=" tag, the verifier MUST
ignore the key record and return with DKIM_STAT_INAPPLICABLE. ignore the key record and return PERMFAIL (inappropriate hash
algorithm).
8. If the public key data (the "p=" tag) is empty then this key has 8. If the public key data (the "p=" tag) is empty then this key has
been revoked and the verifier MUST treat this as a failed been revoked and the verifier MUST treat this as a failed
signature check and return with DKIM_STAT_REVOKED. signature check and return PERMFAIL (key revoked).
9. If the public key data is not suitable for use with the algorithm 9. If the public key data is not suitable for use with the algorithm
and key types defined by the "a=" and "k=" tags in the "DKIM- and key types defined by the "a=" and "k=" tags in the "DKIM-
Signature" header field, the verifier MUST immediately return Signature" header field, the verifier MUST immediately return
with DKIM_STAT_INAPPLICABLE. PERMFAIL (inappropriate key algorithm).
6.3 Compute the Verification 6.1.3 Compute the Verification
Given a signer and a public key, verifying a signature consists of Given a signer and a public key, verifying a signature consists of
the following steps. the following steps.
1. Based on the algorithm defined in the "c=" tag, the body length 1. Based on the algorithm defined in the "c=" tag, the body length
specified in the "l=" tag, and the header field names in the "h=" specified in the "l=" tag, and the header field names in the "h="
tag, create a canonicalized copy of the email as is described in tag, create a canonicalized copy of the email as is described in
Section 3.7. When matching header field names in the "h=" tag Section 3.7. When matching header field names in the "h=" tag
against the actual message header field, comparisons MUST be against the actual message header field, comparisons MUST be
case-insensitive. case-insensitive.
2. Based on the algorithm indicated in the "a=" tag, compute the 2. Based on the algorithm indicated in the "a=" tag, compute the
message hashes from the canonical copy as described in message hashes from the canonical copy as described in
Section 3.7. Section 3.7.
3. Using the signature conveyed in the "b=" tag, verify the 3. Verify that the hash of the canonicalized message body computed
in the previous step matches the hash value conveyed in the "bh="
tag.
4. Using the signature conveyed in the "b=" tag, verify the
signature against the header hash using the mechanism appropriate signature against the header hash using the mechanism appropriate
for the public key algorithm described in the "a=" tag. If the for the public key algorithm described in the "a=" tag. If the
signature does not validatee, the verifier SHOULD ignore the signature does not validate, the verifier SHOULD ignore the
signature and return with DKIM_STAT_INVALIDSIG. signature and return PERMFAIL (signature did not verify).
5. Otherwise, the signature has correctly verified.
INFORMATIVE IMPLEMENTER'S NOTE: Implementations might wish to INFORMATIVE IMPLEMENTER'S NOTE: Implementations might wish to
initiate the public-key query in parallel with calculating the initiate the public-key query in parallel with calculating the
hash as the public key is not needed until the final decryption is hash as the public key is not needed until the final decryption is
calculated. Implementations may also verify the signature on the calculated. Implementations may also verify the signature on the
message header before validating that the message hash listed in message header before validating that the message hash listed in
the "bh=" tag in the DKIM-Signature header field matches that of the "bh=" tag in the DKIM-Signature header field matches that of
the actual message body; however, if the body hash does not match, the actual message body; however, if the body hash does not match,
the entire signature must be considered to have failed. the entire signature must be considered to have failed.
Verifiers SHOULD ignore any DKIM-Signature header fields where the A body length specified in the "l=" tag of the signature limits the
signature does not validate. Verifiers that are prepared to validate number of bytes of the body passed to the verification algorithm.
multiple signature header fields SHOULD proceed to the next signature All data beyond that limit is not validated by DKIM. Hence,
header field, should it exist. However, verifiers MAY make note of verifiers might treat a message that contains bytes beyond the
the fact that an invalid signature was present for consideration at a indicated body length with suspicion, such as by truncating the
later step. message at the indicated body length, declaring the signature invalid
(e.g., by returning PERMFAIL (unsigned content)), or conveying the
INFORMATIVE NOTE: The rationale of this requirement is to permit partial verification to the policy module.
messages that have invalid signatures but also a valid signature
to work. For example, a mailing list exploder might opt to leave
the original submitter signature in place even though the exploder
knows that it is modifying the message in some way that will break
that signature, and the exploder inserts its own signature. In
this case the message should succeed even in the presence of the
known-broken signature.
If a body length is specified in the "l=" tag of the signature,
verifiers MUST only verify the number of bytes indicated in the body
length. Verifiers MAY decide to treat a message containing bytes
beyond the indicated body length with suspicion. Verifiers MAY
truncate the message at the indicated body length, reject the
signature outright, or convey the partial verification to the policy
module using DKIM_STAT_PARTIALSIG.
INFORMATIVE IMPLEMENTATION NOTE: Verifiers that truncate the body INFORMATIVE IMPLEMENTATION NOTE: Verifiers that truncate the body
at the indicated body length might pass on a malformed MIME at the indicated body length might pass on a malformed MIME
message if the signer used the "N-4" trick described in the message if the signer used the "N-4" trick described in the
informative note in Section 5.5. Such verifiers may wish to check informative note in Section 5.5. Such verifiers may wish to check
for this case and include a trailing "--CRLF" to avoid breaking for this case and include a trailing "--CRLF" to avoid breaking
the MIME structure. A simple way to achieve this might be to the MIME structure. A simple way to achieve this might be to
append "--CRLF" to any "multipart" message with a body length; if append "--CRLF" to any "multipart" message with a body length; if
the MIME structure is already correctly formed, this will appear the MIME structure is already correctly formed, this will appear
in the postlude and will not be displayeed to the end user. in the postlude and will not be displayed to the end user.
6.4 Communicate Verification Results 6.2 Communicate Verification Results
Verifiers wishing to communicate the results of verification to other Verifiers wishing to communicate the results of verification to other
parts of the mail system may do so in whatever manner they see fit. parts of the mail system may do so in whatever manner they see fit.
For example, implementations might choose to add an email header For example, implementations might choose to add an email header
field to the message before passing it on. An example proposal for a field to the message before passing it on. An example proposal for a
header field is the Authentication-Results header field [ID-AUTH- header field is the Authentication-Results header field [ID-AUTH-
RES]. Any such header field SHOULD be inserted before any existing RES]. Any such header field SHOULD be inserted before any existing
DKIM-Signature or preexisting authentication status header fields in DKIM-Signature or preexisting authentication status header fields in
the header field block. the header field block.
INFORMATIVE ADVICE to MUA filter writers: Patterns intended to INFORMATIVE ADVICE to MUA filter writers: Patterns intended to
search for results header fields to visibly mark authenticated search for results header fields to visibly mark authenticated
mail for end users should verify that such header field was added mail for end users should verify that such header field was added
by the appropriate verifying domain and that the verified identity by the appropriate verifying domain and that the verified identity
matches the sender identity that will be displayed by the MUA. In matches the author identity that will be displayed by the MUA. In
particular, MUA filters should not be influenced by bogus results particular, MUA filters should not be influenced by bogus results
header fields added by attackers. header fields added by attackers.
6.5 Interpret Results/Apply Local Policy 6.3 Interpret Results/Apply Local Policy
It is beyond the scope of this specification to describe what actions It is beyond the scope of this specification to describe what actions
a verifier system should make, but an authenticated email presents an a verifier system should make, but an authenticated email presents an
opportunity to a receiving system that unauthenticated email cannot. opportunity to a receiving system that unauthenticated email cannot.
Specifically, an authenticated email creates a predictable identifier Specifically, an authenticated email creates a predictable identifier
by which other decisions can reliably be managed, such as trust and by which other decisions can reliably be managed, such as trust and
reputation. Conversely, unauthenticated email lacks a reliable reputation. Conversely, unauthenticated email lacks a reliable
identifier that can be used to assign trust and reputation. It is identifier that can be used to assign trust and reputation. It is
reasonable to treat unauthenticated email as lacking any trust and reasonable to treat unauthenticated email as lacking any trust and
having no positive reputation. having no positive reputation.
skipping to change at page 41, line 20 skipping to change at page 43, line 32
key server is not available, a temporary failure message MAY be key server is not available, a temporary failure message MAY be
generated, such as: generated, such as:
451 4.7.5 Unable to verify signature - key server unavailable 451 4.7.5 Unable to verify signature - key server unavailable
A temporary failure of the key server or other external service is A temporary failure of the key server or other external service is
the only condition that should use a 4xx SMTP reply code. In the only condition that should use a 4xx SMTP reply code. In
particular, signature verification failures MUST NOT return 4xx SMTP particular, signature verification failures MUST NOT return 4xx SMTP
replies. replies.
Oncee the signature has been verified, that information MUST be Once the signature has been verified, that information MUST be
conveyed to higher level systems (such as explicit allow/white lists conveyed to higher level systems (such as explicit allow/white lists
and reputation systems) and/or to the end user. If the message is and reputation systems) and/or to the end user. If the message is
signed on behalf of any address other than that in the From: header signed on behalf of any address other than that in the From: header
field, the mail system SHOULD take pains to ensure that the actual field, the mail system SHOULD take pains to ensure that the actual
signing identity is clear to the reader. signing identity is clear to the reader.
INFORMATIVE NOTE: If the authentication status is to be stored in
the message header field, the Authentication-Results header field
[ID-AUTH-RES] may be used to convey this information.
The verifier MAY treat unsigned header fields with extreme The verifier MAY treat unsigned header fields with extreme
skepticism, including marking them as untrusted or even deleting them skepticism, including marking them as untrusted or even deleting them
before display to the end user. before display to the end user.
While the symptoms of a failed verification are obvious -- the While the symptoms of a failed verification are obvious -- the
signature doesn't verify -- establishing the exact cause can be more signature doesn't verify -- establishing the exact cause can be more
difficult. If a selector cannot be found, is that because the difficult. If a selector cannot be found, is that because the
selector has been removed or was the value changed somehow in selector has been removed or was the value changed somehow in
transit? If the signature line is missing is that because it was transit? If the signature line is missing is that because it was
never there, or was it removed by an over-zealous filter? For never there, or was it removed by an over-zealous filter? For
diagnostic purposes, the exact reason why the verification fails diagnostic purposes, the exact reason why the verification fails
SHOULD be recorded in the "Authentication-Results" header field and SHOULD be made available to the policy module and possibly recorded
possibly the system logs. However in terms of presentation to the in the system logs. However in terms of presentation to the end
end user, the result SHOULD be presented as a simple binary result: 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 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 verified, then it SHOULD be rendered the same as all unverified email
regardless of whether it looks like it was signed or not. regardless of whether it looks like it was signed or not.
6.6 MUA Considerations
In order to retain the current semantics and visibility of the From
header field, verifying mail agents SHOULD take steps to ensure that
the signing address is prominently visible to the user if it is
different from the From address. MUAs MAY visually mark the
unverified part of the body in a distinctive font or color to the end
user.
If MUA implementations that highlight the signed address are not
available, this MAY be done by the validating MTA or MDA by rewriting
the From address in a manner which remains compliant with [RFC2822].
Such modifications MUST be performed after the final verification
step since they will break the signature. If performed, the
rewriting SHOULD include the name of the signer in the address. For
example:
From: John Q. User <user@example.com>
might be converted to
From: "John Q. User via <asrg-admin@ietf.org>" <user@example.com>
This sort of addrress inconsistency is expected for mailing lists, but
might be otherwise used to mislead the verifier, for example if a
message supposedly from administration@your-bank.com had a Sender
address of fraud@badguy.com.
Under no circumstances should an unsigned header field be displayed
in any context that might be construed by the end user as having been
signed. Notably, unsigned header fields SHOULD be hidden from the
end user to the extent possible.
The MUA MAY hide or mark portions of the message body that are not
signed when using the "l=" tag.
7. IANA Considerations 7. IANA Considerations
To avoid conflicts, tag names for the DKIM-Signature header and key To avoid conflicts, tag names for the DKIM-Signature header and key
records should be registered with IANA. records should be registered with IANA.
Tag values for the "a=", "c=", and "q=" tags in the DKIM-Signature Tag values for the "a=", "c=", and "q=" tags in the DKIM-Signature
header field, and the "h=", "k=", "s=", and "t" tags in key records header field, and the "h=", "k=", "s=", and "t" tags in key records
should be registered with IANA for the same reason. should be registered with IANA for the same reason.
The DKK RR type must be registered by IANA.
8. Security Considerations 8. Security Considerations
It has been observed that any mechanism that is introduced which It has been observed that any mechanism that is introduced which
attempts to stem the flow of spam is subject to intensive attack. attempts to stem the flow of spam is subject to intensive attack.
DKIM needs to be carefully scrutinized to identify potential attack DKIM needs to be carefully scrutinized to identify potential attack
vectors and the vulnerability to each. See also [ID-DKIM-THREATS]. vectors and the vulnerability to each. See also [ID-DKIM-THREATS].
8.1 Misuse of Body Length Limits ("l=" Tag) 8.1 Misuse of Body Length Limits ("l=" Tag)
Body length limits (in the form of the "l=" tag) are subject to Body length limits (in the form of the "l=" tag) are subject to
skipping to change at page 43, line 34 skipping to change at page 45, line 4
8.1.2 Addition of new HTML content to existing content 8.1.2 Addition of new HTML content to existing content
Several receiving MUA implementations do not cease display after a Several receiving MUA implementations do not cease display after a
""</html>"" tag. In particular, this allows attacks involving ""</html>"" tag. In particular, this allows attacks involving
overlaying images on top of existing text. overlaying images on top of existing text.
INFORMATIVE EXAMPLE: Appending the following text to an existing, INFORMATIVE EXAMPLE: Appending the following text to an existing,
properly closed message will in many MUAs result in inappropriate properly closed message will in many MUAs result in inappropriate
data being rendered on top of existing, correct data: data being rendered on top of existing, correct data:
<div style="position: relative; bottom: 350px; z-index: 2;"> <div style="position: relative; bottom: 350px; z-index: 2;">
<img src="http://www.ietf.org/images/ietflogo2e.gif" <img src="http://www.ietf.org/images/ietflogo2e.gif"
width=578 height=370> width=578 height=370>
</div> </div>
8.2 Misappropriateed Private Key 8.2 Misappropriated Private Key
If the private key for a user is resident on their computer and is If the private key for a user is resident on their computer and is
not protected by an appropriately secure mechanism, it is possible not protected by an appropriately secure mechanism, it is possible
for malware to send mail as that user and any other user sharing the for malware to send mail as that user and any other user sharing the
same private key. The malware would, however, not be able to same private key. The malware would, however, not be able to
generate signed spoofs of other signers' addresses, which would aid generate signed spoofs of other signers' addresses, which would aid
in identification of the infected user and would limit the in identification of the infected user and would limit the
possibilities for certain types of attacks involving socially- possibilities for certain types of attacks involving socially-
engineered messages. engineered messages.
skipping to change at page 44, line 39 skipping to change at page 46, line 9
generate bulk email. generate bulk email.
8.3 Key Server Denial-of-Service Attacks 8.3 Key Server Denial-of-Service Attacks
Since the key servers are distributed (potentially separate for each Since the key servers are distributed (potentially separate for each
domain), the number of servers that would need to be attacked to domain), the number of servers that would need to be attacked to
defeat this mechanism on an Internet-wide basis is very large. defeat this mechanism on an Internet-wide basis is very large.
Nevertheless, key servers for individual domains could be attacked, Nevertheless, key servers for individual domains could be attacked,
impeding the verification of messages from that domain. This is not impeding the verification of messages from that domain. This is not
significantly different from the ability of an attacker to deny significantly different from the ability of an attacker to deny
service to the mail exchangers for a given domain, aalthough it service to the mail exchangers for a given domain, although it
affects outgoing, not incoming, mail. affects outgoing, not incoming, mail.
A variation on this attack is that if a very large amount of mail A variation on this attack is that if a very large amount of mail
were to be sent using spoofed addresses from a given domain, the key were to be sent using spoofed addresses from a given domain, the key
servers for that domain could be overwhelmed with requests. However, servers for that domain could be overwhelmed with requests. However,
given the low overhead of verification compared with handling of the given the low overhead of verification compared with handling of the
email message itself, such an attack would be difficult to mount. email message itself, such an attack would be difficult to mount.
8.4 Attacks Against DNS 8.4 Attacks Against DNS
skipping to change at page 45, line 44 skipping to change at page 47, line 14
accomplice, which results in the message being signed by the accomplice, which results in the message being signed by the
originating MTA. The accomplice resends the message, including the originating MTA. The accomplice resends the message, including the
original signature, to a large number of recipients, possibly by original signature, to a large number of recipients, possibly by
sending the message to many compromised machines that act as MTAs. sending the message to many compromised machines that act as MTAs.
The messages, not having been modified by the accomplice, have valid The messages, not having been modified by the accomplice, have valid
signatures. signatures.
Partial solutions to this problem involve the use of reputation Partial solutions to this problem involve the use of reputation
services to convey the fact that the specific email address is being 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 used for spam, and that messages from that signer are likely to be
spam. This requires a real-time detection mechanissm in order to spam. This requires a real-time detection mechanism in order to
react quickly enough. However, such measures might be prone to react quickly enough. However, such measures might be prone to
abuse, if for example an attacker resent a large number of messages 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. received from a victim in order to make them appear to be a spammer.
Large verifiers might be able to detect unusually large volumes of Large verifiers might be able to detect unusually large volumes of
mails with the same signature in a short time period. Smaller mails with the same signature in a short time period. Smaller
verifiers can get substantially the same volume information via verifiers can get substantially the same volume information via
existing collaborative systems. existing collaborative systems.
8.6 Limits on Revoking Keys 8.6 Limits on Revoking Keys
skipping to change at page 47, line 28 skipping to change at page 48, line 44
[RFC2821] Klensin, J., "Simple Mail Transfer Protocol", RFC 2821, [RFC2821] Klensin, J., "Simple Mail Transfer Protocol", RFC 2821,
April 2001. April 2001.
[RFC2822] Resnick, P., "Internet Message Format", RFC 2822, [RFC2822] Resnick, P., "Internet Message Format", RFC 2822,
April 2001. April 2001.
[RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography [RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography
Standards (PKCS) #1: RSA Cryptography Specifications Standards (PKCS) #1: RSA Cryptography Specifications
Version 2.1", RFC 3447, February 2003. Version 2.1", RFC 3447, February 2003.
[RFC3492] Costello, A., "Punycode: A Bootstring encoding of Unicode
for Internationalized Domain Names in Application(IDNA)",
March 2003.
[RFC4234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax [RFC4234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
Specifications: ABNF", RFC 4234, October 2005. Specifications: ABNF", RFC 4234, October 2005.
9.2 Informative References 9.2 Informative References
[BONEH03] Proc. 12th USENIX Security Symposium, "Remote Timing [BONEH03] Proc. 12th USENIX Security Symposium, "Remote Timing
Attacks are Practical", 2003, <http://www.usenix.org/ Attacks are Practical", 2003, <http://www.usenix.org/
publications/library/proceedings/sec03/tech/brumley.html>. publications/library/proceedings/sec03/tech/brumley.html>.
[ID-AUTH-RES] [ID-AUTH-RES]
skipping to change at page 50, line 25 skipping to change at page 52, line 6
We lost the game. Are you hungry yet? We lost the game. Are you hungry yet?
Joe. Joe.
A.2 The email is signed A.2 The email is signed
This email is signed by the example.com outbound email server and now This email is signed by the example.com outbound email server and now
looks like this: looks like this:
DKIM-Signature: a=rsa-sha1; s=brisbane; d=example.com; DKIM-Signature: a=rsa-sha1; s=brisbane; d=example.com;
c=simple; q=dns; i=joe@football.example.com; c=simple; q=dns/txt; i=joe@football.example.com;
h=Received : From : To : Subject : Date : Message-ID; h=Received : From : To : Subject : Date : Message-ID;
b=dzdVyOfAKCdLXdJOc9G2q8LoXSlEniSbav+yuU4zGeeruD00lszZ b=dzdVyOfAKCdLXdJOc9G2q8LoXSlEniSbav+yuU4zGeeruD00lszZ
VoG4ZHRNiYzR; VoG4ZHRNiYzR;
Received: from dsl-10.2.3.4.football.example.com [10.2.3.4] Received: from dsl-10.2.3.4.football.example.com [10.2.3.4]
by submitserver.example.com with SUBMISSION; by submitserver.example.com with SUBMISSION;
Fri, 11 Jul 2003 21:01:54 -0700 (PDT) Fri, 11 Jul 2003 21:01:54 -0700 (PDT)
From: Joe SixPack <joe@football.example.com> From: Joe SixPack <joe@football.example.com>
To: Suzie Q <suzie@shopping.example.net> To: Suzie Q <suzie@shopping.example.net>
Subject: Is dinner ready? Subject: Is dinner ready?
Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT) Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT)
Message-ID: <20030712040037.46341.5F8J@football.example.com> Message-ID: <20030712040037.46341.5F8J@football.example.com>
Hi. Hi.
We lost the game. Are you hungry yet? We lost the game. Are you hungry yet?
Joe. Joe.
The signing email server requires access to thhe private-key The signing email server requires access to the private-key
associated with the "brisbane" selector to generate this signature. associated with the "brisbane" selector to generate this signature.
A.3 The email signature is verified A.3 The email signature is verified
The signature is normally verified by an inbound SMTP server or The signature is normally verified by an inbound SMTP server or
possibly the final delivery agent. However, intervening MTAs can possibly the final delivery agent. However, intervening MTAs can
also perform this verification if they choose to do so. The also perform this verification if they choose to do so. The
verification process uses the domain "example.com" extracted from the verification process uses the domain "example.com" extracted from the
"d=" tag and the selector "brisbane" from the "s=" tag in the "DKIM- "d=" tag and the selector "brisbane" from the "s=" tag in the "DKIM-
Signature" header field to form the DNS DKIM query for: Signature" header field to form the DNS DKIM query for:
skipping to change at page 51, line 31 skipping to change at page 53, line 11
query and subsequent verification of the signature is stored in the query and subsequent verification of the signature is stored in the
"Authentication-Results" header field line. After successful "Authentication-Results" header field line. After successful
verification, the email looks like this: verification, the email looks like this:
Authentication-Results: shopping.example.net Authentication-Results: shopping.example.net
header.from=joe@football.example.com; dkim=pass header.from=joe@football.example.com; dkim=pass
Received: from mout23.football.example.com (192.168.1.1) Received: from mout23.football.example.com (192.168.1.1)
by shopping.example.net with SMTP; by shopping.example.net with SMTP;
Fri, 11 Jul 2003 21:01:59 -0700 (PDT) Fri, 11 Jul 2003 21:01:59 -0700 (PDT)
DKIM-Signature: a=rsa-sha1; s=brisbane; d=example.com; DKIM-Signature: a=rsa-sha1; s=brisbane; d=example.com;
c=simple; q=dns; i=joe@football.example.com; c=simple; q=dns/txt; i=joe@football.example.com;
h=Received : From : To : Subject : Date : Message-ID; h=Received : From : To : Subject : Date : Message-ID;
b=dzdVyOfAKCdLXdJOc9G2q8LoXSlEniSbav+yuU4zGeeruD00lszZ b=dzdVyOfAKCdLXdJOc9G2q8LoXSlEniSbav+yuU4zGeeruD00lszZ
VoG4ZHRNiYzR VoG4ZHRNiYzR
Received: from dsl-10.2.3.4.network.example.com [10.2.3.4] Received: from dsl-10.2.3.4.network.example.com [10.2.3.4]
by submitserver.example.com with SUBMISSION; by submitserver.example.com with SUBMISSION;
Fri, 11 Jul 2003 21:01:54 -0700 (PDT) Fri, 11 Jul 2003 21:01:54 -0700 (PDT)
From: Joe SixPack <joe@football.example.com> From: Joe SixPack <joe@football.example.com>
To: Suzie Q <suzie@shopping.example.net> To: Suzie Q <suzie@shopping.example.net>
Subject: Is dinner ready? Subject: Is dinner ready?
Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT) Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT)
skipping to change at page 52, line 14 skipping to change at page 53, line 39
Appendix B. Usage Examples (INFORMATIVE) Appendix B. Usage Examples (INFORMATIVE)
Studies in this appendix are for informational purposes only. In no Studies in this appendix are for informational purposes only. In no
case should these examples be used as guidance when creating an case should these examples be used as guidance when creating an
implementation. implementation.
B.1 Simple Message Forwarding B.1 Simple Message Forwarding
In some cases the recipient may request forwarding of email messages In some cases the recipient may request forwarding of email messages
from the original address tto another, through the use of a Unix from the original address to another, through the use of a Unix
.forward file or equivalent. In this case messages are typically .forward file or equivalent. In this case messages are typically
forwarded without modification, except for the addition of a Received forwarded without modification, except for the addition of a Received
header field to the message and a change in the Envelope-to address. header field to the message and a change in the Envelope-to address.
In this case, the eventual recipient should be able to verify the In this case, the eventual recipient should be able to verify the
original signature since the signed content has not changed, and original signature since the signed content has not changed, and
attribute the message correctly. attribute the message correctly.
B.2 Outsourced Business Functions B.2 Outsourced Business Functions
Outsourced business functions represent a use case that motivates the Outsourced business functions represent a use case that motivates the
skipping to change at page 53, line 15 skipping to change at page 54, line 41
B.4 Mailing Lists B.4 Mailing Lists
There is a wide range of behavior in forwarders and mailing lists There is a wide range of behavior in forwarders and mailing lists
(collectively called "forwarders" below), ranging from those which (collectively called "forwarders" below), ranging from those which
make no modification to the message itself (other than to add a make no modification to the message itself (other than to add a
Received header field and change the envelope information) to those Received header field and change the envelope information) to those
which may add header fields, change the Subject header field, add which may add header fields, change the Subject header field, add
content to the body (typically at the end), or reformat the body in content to the body (typically at the end), or reformat the body in
some manner. some manner.
Forwarders which do noot modify the body or signed header fields of a Forwarders which do not modify the body or signed header fields of a
message with a valid signature may re-sign the message as described message with a valid signature may re-sign the message as described
below. below.
Forwarders which make any modification to a message that could result Forwarders which make any modification to a message that could result
in its signature becoming invalid should sign or re-sign using an in its signature becoming invalid should sign or re-sign using an
appropriate identification (e.g., mailing-list-name@example.net). appropriate identification (e.g., mailing-list-name@example.net).
Since in so doing the (re-)signer is taking responsibility for the Since in so doing the (re-)signer is taking responsibility for the
content of the message, modifying forwarders may elect to forward or content of the message, modifying forwarders may elect to forward or
re-sign only for messages which were received with valid signatures re-sign only for messages which were received with valid signatures
or other indications that the messages being signed are not spoofed. or other indications that the messages being signed are not spoofed.
skipping to change at page 54, line 20 skipping to change at page 55, line 47
Third-party message transmission refers to the authorized sending of Third-party message transmission refers to the authorized sending of
mail by an Internet application on behalf of a user. For example, a mail by an Internet application on behalf of a user. For example, a
website providing news may allow the reader to forward a copy of the website providing news may allow the reader to forward a copy of the
message to a friend; this is typically done using the reader's email message to a friend; this is typically done using the reader's email
address. This is sometimes referred to as the "Evite problem", named address. This is sometimes referred to as the "Evite problem", named
after the website of the same name that allows a user to send after the website of the same name that allows a user to send
invitations to friends. invitations to friends.
One way this can be handled is to continue to put the reader's email One way this can be handled is to continue to put the reader's email
address in the From field of the message, but put an address owned by address in the From header field of the message, but put an address
the site into the Sender field, and sign the message on behalf of the owned by the site into the Sender header field, and sign the message
Sender. A verifying MTA should accept this and rewrite the From on behalf of that address. A verifying MTA could accept this and
field to indicate the address that was verified, i.e., From: John rewrite the From header field to indicate the address that was
Doe via news@news-site.com <jdoe@example.com>. verified, i.e., From: John Doe via news@news-site.com
<jdoe@example.com>. (However, such rewriting must be done after the
verification pass is complete, and will break any later attempts to
re-verify.)
Appendix C. Creating a public key (INFORMATIVE) Appendix C. Creating a public key (INFORMATIVE)
XXX Update to 1024 bit key and SHA-256 and adjust examples The default signature is an RSA signed SHA256 digest of the complete
accordingly. XXX
The default signature is an RSA signed SHA1 digest of the complete
email. For ease of explanation, the openssl command is used to email. For ease of explanation, the openssl command is used to
describe the mechanism by which keys and signatures are managed. One describe the mechanism by which keys and signatures are managed. One
way to generate a 768 bit private-key suitable for DKIM, is to use way to generate a 768 bit private-key suitable for DKIM, is to use
openssl like this: openssl like this:
$ openssl genrsa -out rsa.private 768 $ openssl genrsa -out rsa.private 1024
This results in the file rsa.private containing the key information This results in the file rsa.private containing the key information
similar to this: similar to this:
-----BEGIN RSA PRIVATE KEY----- -----BEGIN RSA PRIVATE KEY-----
MIIByQIBAAJhAKJ2lzDLZ8XlVambQfMXn3LRGKOD5o6lMIgulclWjZwP56LRqdg5 MIICXwIBAAKBgQDwIRP/UC3SBsEmGqZ9ZJW3/DkMoGeLnQg1fWn7/zYtIxN2SnFC
ZX15bhc/GsvW8xW/R5Sh1NnkJNyL/cqY1a+GzzL47t7EXzVc+nRLWT1kwTvFNGIo jxOCKG9v3b4jYfcTNh5ijSsq631uBItLa7od+v/RtdC2UzJ1lWT947qR+Rcac2gb
AUsFUq+J6+OprwIDAQABAmBOX0UaLdWWusYzNol++nNZ0RLAtr1/LKMX3tk1MkLH to/NMqJ0fzfVjH4OuKhitdY9tf6mcwGjaNBcWToIMmPSPDdQPNUYckcQ2QIDAQAB
+Ug13EzB2RZjjDOWlUOY98yxW9/hX05Uc9V5MPo+q2Lzg8wBtyRLqlORd7pfxYCn AoGBALmn+XwWk7akvkUlqb+dOxyLB9i5VBVfje89Teolwc9YJT36BGN/l4e0l6QX
Kapi2RPMcR1CxEJdXOkLCFECMQDTO0fzuShRvL8q0m5sitIHlLA/L+0+r9KaSRM/ /1//6DWUTB3KI6wFcm7TWJcxbS0tcKZX7FsJvUz1SbQnkS54DJck1EZO/BLa5ckJ
3WQrmUpV+fAC3C31XGjhHv2EuAkCMQDE5U2nP2ZWVlSbxOKBqX724amoL7rrkUew gAYIaqlA9C0ZwM6i58lLlPadX/rtHb7pWzeNcZHjKrjM461ZAkEA+itss2nRlmyO
ti9TEjfaBndGKF2yYF7/+g53ZowRkfcCME/xOJr58VN17pejSl1T8Icj88wGNHCs n1/5yDyCluST4dQfO8kAB3toSEVc7DeFeDhnC1mZdjASZNvdHS4gbLIA1hUGEF9m
FDWGAH4EKNwDSMnfLMG4WMBqd9rzYpkvGQIwLhAHDq2CX4hq2tZAt1zT2yYH7tTb 3hKsGUMMPwJBAPW5v/U+AWTADFCS22t72NUurgzeAbzb1HWMqO4y4+9Hpjk5wvL/
weiHAQxeHe0RK+x/UuZ2pRhuoSv63mwbMLEZAjAP2vy6Yn+f9SKw2mKuj1zLjEhG eVYizyuce3/fGke7aRYw/ADKygMJdW8H/OcCQQDz5OQb4j2QDpPZc0Nc4QlbvMsj
6ppw+nKD50ncnPoP322UMxVNG4Eah0GYJ4DLP0U= 7p7otWRO5xRa6SzXqqV3+F0VpqvDmshEBkoCydaYwc2o6WQ5EBmExeV8124XAkEA
qZzGsIxVP+sEVRWZmW6KNFSdVUpk3qzK0Tz/WjQMe5z0UunY9Ax9/4PVhp/j61bf
eAYXunajbBSOLlx4D+TunwJBANkPI5S9iylsbLs6NkaMHV6k5ioHBBmgCak95JGX
GMot/L2x0IYyMLAz6oLWh2hm7zwtb0CgOrPo1ke44hFYnfc=
-----END RSA PRIVATE KEY----- -----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: like this:
$ openssl rsa -in rsa.private -out rsa.public -pubout -outform PEM $ openssl rsa -in rsa.private -out rsa.public -pubout -outform PEM
This results in the file rsa.public containing the key information This results in the file rsa.public containing the key information
similar to this: similar to this:
-----BEGIN PUBLIC KEY----- -----BEGIN PUBLIC KEY-----
MHwwDQYJKoZIhvcNAQEBBQADawAwaAJhAKJ2lzDLZ8XlVambQfMXn3LRGKOD5o6l MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDwIRP/UC3SBsEmGqZ9ZJW3/DkM
MIgulclWjZwP56LRqdg5ZX15bhc/GsvW8xW/R5Sh1NnkJNyL/cqY1a+GzzL47t7E oGeLnQg1fWn7/zYtIxN2SnFCjxOCKG9v3b4jYfcTNh5ijSsq631uBItLa7od+v/R
XzVc+nRLWT1kwTvFNGIoAUsFUq+J6+OprwIDAQAB tdC2UzJ1lWT947qR+Rcac2gbto/NMqJ0fzfVjH4OuKhitdY9tf6mcwGjaNBcWToI
MmPSPDdQPNUYckcQ2QIDAQAB
-----END PUBLIC KEY----- -----END PUBLIC KEY-----
This public-key data (without the BEGIN and END tags) is placed in This public-key data (without the BEGIN and END tags) is placed in
the DNS. With the signature, canonical email contents and puublic the DNS. With the signature, canonical email contents, and public
key, a verifying system can test the validity of the signature. The key, a verifying system can test the validity of the signature. The
openssl invocation to verify a signature looks like this: openssl invocation to verify a signature looks like this:
openssl dgst -verify rsa.public -sha1 -signature signature.file \ openssl dgst -verify rsa.public -sha256 -signature signature.file \
<input.file <input.file
Once a private-key has been generated, the openssl command can be Once a private-key has been generated, the openssl command can be
used to sign an appropriately prepared email, like this: used to sign an appropriately prepared email, like this:
$ openssl dgst -sign rsa.private -sha1 <input.file $ openssl dgst -sign rsa.private -sha256 <input.file
This results in signature data similar to this when represented in This results in signature data similar to this when represented in
Base64 [MIME] format: Base64 [MIME] format:
aoiDeX42BB/gP4ScqTdIQJcpAObYr+54yvctqc4rSEFYby9+omKD3pJ/TVxATeTz aoiDeX42BB/gP4ScqTdIQJcpAObYr+54yvctqc4rSEFYby9+omKD3pJ/TVxATeTz
msybuW3WZiamb+mvn7f3rhmnozHJ0yORQbnn4qJQhPbbPbWEQKW09AMJbyz/0lsl msybuW3WZiamb+mvn7f3rhmnozHJ0yORQbnn4qJQhPbbPbWEQKW09AMJbyz/0lsl
How this signature is added to the email is discussed elsewhere in How this signature is added to the email is discussed elsewhere in
this document. this document.
Appendix D. Acknowledgements Appendix D. MUA Considerations
When a DKIM signature is verified, one of the results is a validated
signing identity. MUAs might highlight the address associated with
this identity in some way to show the user the address from which the
mail is sent. An MUA might do this with visual cues such as
graphics, or it might include the address in an alternate views, or
it might even rewrite the original "From:" address using the verified
information. Some MUAs might want to indicate which headers were
covered in a validated DKIM signature. This might be done with a
positive indication on the signed headers, it might be done with a
negative indication on the unsigned headers or visually hiding the
unsigned headers, or some combination of both. If an MUA uses visual
indications for signed headers, the MUA needs to be careful not to
display unsigned headers in a way that might be construed by the end
user as having been signed. If the message has an l= tag whose value
does not extend to the end of the message, he MUA might also hide or
mark the portion of the message body that is not signed.
The aforementioned information is not intended to be exhaustive. The
MUA may choose to highlight, accentuate, hide, or otherwise display
any other information that may, in the opinion of the MUA author, be
deemed important to the end user.
Appendix E. Acknowledgements
The authors wish to thank Russ Allbery, Edwin Aoki, Claus Assmann, The authors wish to thank Russ Allbery, Edwin Aoki, Claus Assmann,
Steve Atkins, Fred Baker, Mark Baugher, Nathaniel Borenstein, Dave Steve Atkins, Fred Baker, Mark Baugher, Nathaniel Borenstein, Dave
Crocker, Michael Cudahy, Dennis Dayman, Jutta Degener, Patrik Crocker, Michael Cudahy, Dennis Dayman, Jutta Degener, Patrik
Faltstrom, Duncan Findlay, Elliot Gillum, Phillip Hallam-Baker, Tony Faltstrom, Duncan Findlay, Elliot Gillum, Phillip Hallam-Baker, Tony
Hansen, Arvel Hathcock, Amir Herzberg, Craig Hughes, Don Johnsen, Hansen, Arvel Hathcock, Amir Herzberg, Paul Hoffman, Craig Hughes,
Harry Katz, Murray S. Kucherawy, Barry Leiba, John Levine, Simon Don Johnsen, Harry Katz, Murray S. Kucherawy, Barry Leiba, John
Longsdale, David Margrave, Justin Mason, David Mayne, Steve Murphy, Levine, Simon Longsdale, David Margrave, Justin Mason, David Mayne,
Russell€ Nelson, Dave Oran, Doug Otis, Shamim Pirzada, Juan Altmayer Steve Murphy, Russell Nelson, Dave Oran, Doug Otis, Shamim Pirzada,
Pizzorno, Sanjay Pol, Blake Ramsdell, Christian Renaud, Scott Renfro, Juan Altmayer Pizzorno, Sanjay Pol, Blake Ramsdell, Christian Renaud,
Eric Rescorla, Dave Rossetti, Hector Santos, the Spamhaus.org team, Scott Renfro, Eric Rescorla, Dave Rossetti, Hector Santos, the
Malte S. Stretz, Robert Sanders, Rand Wacker, and Dan Wing for their Spamhaus.org team, Malte S. Stretz, Robert Sanders, Rand Wacker, and
valuable suggestions and constructive criticism. Dan Wing for their valuable suggestions and constructive criticism.
The DomainKeys specification was a primary source from which this The DomainKeys specification was a primary source from which this
specification has been derived. Further information about DomainKeys specification has been derived. Further information about DomainKeys
is at is at
<http://domainkeys.sourceforge.net/license/patentlicense1-1.html>. <http://domainkeys.sourceforge.net/license/patentlicense1-1.html>.
Appendix E. Edit History Appendix F. Edit History
[[This section to be removed before publication.]] [[This section to be removed before publication.]]
E.1 Changes since -ietf-01 version F.1 Changes since -ietf-02 version
The following changes were made between draft-ietf-dkim-base-02 and
draft-ietf-dkim-base-03:
o Section 5.2: changed key expiration text to be informational;
drop "seven day" wording in favor of something vaguer.
o Don't indicate that the "i=" tag value should be passed to the key
lookup service; this can be added as an extension if required.
o Move Section 6.6 (MUA Considerations) to be Appendix D and modify
it to avoid any hint of normative language.
o Soften the DKIM_STAT_ language in section 6 so that it doesn't
appear normative. This involved using only PERMFAIL and TEMPFAIL
as status, with parenthetical explanations.
o Restructured section 6 to make it clearer which steps apply on a
per-signature basis versus a per-message basis.
o Clarification of "signing identity" in several places.
o Clarification that DKIM-Signature header fields being signed by
another DKIM-Signature header field should be treated as a normal
header field (i.e., their "b=" field is unchanged).
o Change ABNF on a= tag to separate the public key algorithm from
the hash algorithm.
o Add t=s flag in key record to disallow subdomains in the i= tag
relative to the d= tag of the DKIM-Signature header field.
o Add a new definition for "dkim-quoted-printable", which is a
simple case of quoted-printable from RFC2045. dkim-quoted-
printable requires that all white space in the original text be
escaped, and all unescaped white space in the encoded field should
be ignored to allow arbitrary wrapping of the header fields which
may contain the content.
o Use dkim-quoted-printable as the encoding used in z= rather than
referring to RFC2045, since they are different.
o Rewrite description of g= tag in the key record.
o Deleted use of Domain in ABNF, which permits address-literals;
define domain-name to act in stead.
F.2 Changes since -ietf-01 version
The following changes were made between draft-ietf-dkim-base-01 and The following changes were made between draft-ietf-dkim-base-01 and
draft-ietf-dkim-base-02: draft-ietf-dkim-base-02:
o Change wording on "x=" tag in DKIM-Signature header field o Change wording on "x=" tag in DKIM-Signature header field
regarding verifier handling of expired signatures from MUST to MAY regarding verifier handling of expired signatures from MUST to MAY
(per 20 April Jabber session). Also, make it clear that received (per 20 April Jabber session). Also, make it clear that received
time is to be preferred over current time if reliably available. time is to be preferred over current time if reliably available.
o Several changes to limit wording that would intrude into verifier o Several changes to limit wording that would intrude into verifier
skipping to change at page 57, line 19 skipping to change at page 60, line 21
o Change "q=dns" query access method to "q=dnstxt" to emphasize the o Change "q=dns" query access method to "q=dnstxt" to emphasize the
use of the TXT record. The expectation is that a later extension use of the TXT record. The expectation is that a later extension
will define "q=dnsdkk" to indicate use of a DKK record. (Per 18 will define "q=dnsdkk" to indicate use of a DKK record. (Per 18
May Jabber session.) May Jabber session.)
o Several typos fixed, including removing a paragraph that implied o Several typos fixed, including removing a paragraph that implied
that the DKIM-Signature header field should be hashed with the that the DKIM-Signature header field should be hashed with the
body (it should not). body (it should not).
E.2 Changes since -ietf-00 version F.3 Changes since -ietf-00 version
The following changes were made between draft-ietf-dkim-base-00 and The following changes were made between draft-ietf-dkim-base-00 and
draft-ietf-dkim-base-01: draft-ietf-dkim-base-01:
o Added section 8.9 (Information Leakage). o Added section 8.9 (Information Leakage).
o Replace section 4 (Multiple Signatures) with much less vague text. o Replace section 4 (Multiple Signatures) with much less vague text.
o Fixed ABNF for base64string. o Fixed ABNF for base64string.
skipping to change at page 57, line 43 skipping to change at page 60, line 45
o Changed signing algorithm to use separate hash of the body of the o Changed signing algorithm to use separate hash of the body of the
message; this is represented as the "bh=" tag in the DKIM- message; this is represented as the "bh=" tag in the DKIM-
Signature header field. Signature header field.
o Changed "z=" tag so that it need not have the same header field o Changed "z=" tag so that it need not have the same header field
names as the "h=" tag. names as the "h=" tag.
o Significant wordsmithing. o Significant wordsmithing.
E.3 Changes since -allman-01 version F.4 Changes since -allman-01 version
The following changes were made between draft-allman-dkim-base-01 and The following changes were made between draft-allman-dkim-base-01 and
draft-ietf-dkim-base-00: draft-ietf-dkim-base-00:
o Remove references to Sender Signing Policy document. Such o Remove references to Sender Signing Policy document. Such
consideration is implicitly included in Section 6.5. consideration is implicitly included in Section 6.3.
o Added ABNF for all tags. o Added ABNF for all tags.
o Updated references (still includes some references to expired o Updated references (still includes some references to expired
drafts, notably [ID-AUTH-RES]. drafts, notably [ID-AUTH-RES].
o Significant wordsmithing. o Significant wordsmithing.
E.4 Changes since -allman-00 version F.5 Changes since -allman-00 version
The following changes were made between draft-allman-dkim-base-00 and The following changes were made between draft-allman-dkim-base-00 and
draft-allman-dkim-base-01: draft-allman-dkim-base-01:
o Changed "c=" tag to separate out header from body o Changed "c=" tag to separate out header from body
canonicalization. canonicalization.
o Eliminated "nowsp" canonicalization in favor of "relaxed", which o Eliminated "nowsp" canonicalization in favor of "relaxed", which
is somewhat less relaxed (but more secure) than "nowsp". is somewhat less relaxed (but more secure) than "nowsp".
 End of changes. 141 change blocks. 
459 lines changed or deleted 609 lines changed or added

This html diff was produced by rfcdiff 1.32. The latest version is available from http://www.levkowetz.com/ietf/tools/rfcdiff/