tech-invite   World Map     

IETF     RFCs     Groups     SIP     ABNFs    |    3GPP     Specs     Gloss.     Arch.     IMS     UICC    |    Misc.    |    search     info

RFC 6376

 
 
 

DomainKeys Identified Mail (DKIM) Signatures

Part 3 of 4, p. 34 to 55
Prev RFC Part       Next RFC Part

 


prevText      Top      Up      ToC       Page 34 
4.  Semantics of Multiple Signatures

4.1.  Example Scenarios

   There are many reasons why a message might have multiple signatures.
   For example, suppose SHA-256 is in the future found to be
   insufficiently strong, and DKIM usage transitions to SHA-1024.  A
   Signer might immediately sign using the newer algorithm but also
   continue to sign using the older algorithm for interoperability with
   Verifiers that had not yet upgraded.  The Signer would do this by
   adding two DKIM-Signature header fields, one using each algorithm.
   Older Verifiers that did not recognize SHA-1024 as an acceptable
   algorithm would skip that signature and use the older algorithm;
   newer Verifiers could use either signature at their option and, all
   other things being equal, might not even attempt to verify the other
   signature.

   Similarly, a Signer might sign a message including all header fields
   and no "l=" tag (to satisfy strict Verifiers) and a second time with
   a limited set of header fields and an "l=" tag (in anticipation of
   possible message modifications en route to other Verifiers).
   Verifiers could then choose which signature they prefer.

   Of course, a message might also have multiple signatures because it
   passed through multiple Signers.  A common case is expected to be
   that of a signed message that passes through a mailing list that also

Top      Up      ToC       Page 35 
   signs all messages.  Assuming both of those signatures verify, a
   recipient might choose to accept the message if either of those
   signatures were known to come from trusted sources.

   In particular, recipients might choose to whitelist mailing lists to
   which they have subscribed and that have acceptable anti-abuse
   policies so as to accept messages sent to that list even from unknown
   authors.  They might also subscribe to less trusted mailing lists
   (e.g., those without anti-abuse protection) and be willing to accept
   all messages from specific authors but insist on doing additional
   abuse scanning for other messages.

   Another related example of multiple Signers might be forwarding
   services, such as those commonly associated with academic alumni
   sites.  For example, a recipient might have an address at
   members.example.org, a site that has anti-abuse protection that is
   somewhat less effective than the recipient would prefer.  Such a
   recipient might have specific authors whose messages would be trusted
   absolutely, but messages from unknown authors that had passed the
   forwarder's scrutiny would have only medium trust.

4.2.  Interpretation

   A Signer that is adding a signature to a message merely creates a new
   DKIM-Signature header, using the usual semantics of the "h=" option.
   A Signer MAY sign previously existing DKIM-Signature header fields
   using the method described in Section 5.4 to sign trace header
   fields.

   Note that Signers should be cognizant that signing DKIM-Signature
   header fields may result in signature failures with intermediaries
   that do not recognize that DKIM-Signature header fields are trace
   header fields and unwittingly reorder them, thus breaking such
   signatures.  For this reason, signing existing DKIM-Signature header
   fields is unadvised, albeit legal.

      INFORMATIVE NOTE: If a header field with multiple instances is
      signed, those header fields are always signed from the bottom up.
      Thus, it is not possible to sign only specific DKIM-Signature
      header fields.  For example, if the message being signed already
      contains three DKIM-Signature header fields A, B, and C, it is
      possible to sign all of them, B and C only, or C only, but not A
      only, B only, A and B only, or A and C only.

   A Signer MAY add more than one DKIM-Signature header field using
   different parameters.  For example, during a transition period, a
   Signer might want to produce signatures using two different hash
   algorithms.

Top      Up      ToC       Page 36 
   Signers SHOULD NOT remove any DKIM-Signature header fields from
   messages they are signing, even if they know that the signatures
   cannot be verified.

   When evaluating a message with multiple signatures, a Verifier SHOULD
   evaluate signatures independently and on their own merits.  For
   example, a Verifier that by policy chooses not to accept signatures
   with deprecated cryptographic algorithms would consider such
   signatures invalid.  Verifiers MAY process signatures in any order of
   their choice; for example, some Verifiers might choose to process
   signatures corresponding to the From field in the message header
   before other signatures.  See Section 6.1 for more information about
   signature choices.

      INFORMATIVE IMPLEMENTATION NOTE: Verifier attempts to correlate
      valid signatures with invalid signatures in an attempt to guess
      why a signature failed are ill-advised.  In particular, there is
      no general way that a Verifier can determine that an invalid
      signature was ever valid.

   Verifiers SHOULD continue to check signatures until a signature
   successfully verifies to the satisfaction of the Verifier.  To limit
   potential denial-of-service attacks, Verifiers MAY limit the total
   number of signatures they will attempt to verify.

   If a Verifier module reports signatures whose evaluations produced
   PERMFAIL results, Identity Assessors SHOULD ignore those signatures
   (see Section 6.1), acting as though they were not present in the
   message.

5.  Signer Actions

   The following steps are performed in order by Signers.

5.1.  Determine Whether the Email Should Be Signed and by Whom

   A Signer can obviously only sign email for domains for which it has a
   private key and the necessary knowledge of the corresponding public
   key and selector information.  However, there are a number of other
   reasons beyond the lack of a private key why a Signer could choose
   not to sign an email.

      INFORMATIVE NOTE: A Signer can be implemented as part of any
      portion of the mail system as deemed appropriate, including an
      MUA, a SUBMISSION server, or an MTA.  Wherever implemented,
      Signers should beware of signing (and thereby asserting
      responsibility for) messages that may be problematic.  In
      particular, within a trusted enclave, the signing domain might be

Top      Up      ToC       Page 37 
      derived from the header according to local policy; SUBMISSION
      servers might only sign messages from users that are properly
      authenticated and authorized.

      INFORMATIVE IMPLEMENTER ADVICE: SUBMISSION servers should not sign
      Received header fields if the outgoing gateway MTA obfuscates
      Received header fields, for example, to hide the details of
      internal topology.

   If an email cannot be signed for some reason, it is a local policy
   decision as to what to do with that email.

5.2.  Select a Private Key and Corresponding Selector Information

   This specification does not define the basis by which a Signer should
   choose which private key and selector information to use.  Currently,
   all selectors are equal as far as this specification is concerned, so
   the decision should largely be a matter of administrative
   convenience.  Distribution and management of private keys is also
   outside the scope of this document.

      INFORMATIVE OPERATIONS ADVICE: A Signer should not sign with a
      private key when the selector containing the corresponding public
      key is expected to be revoked or removed before the Verifier has
      an opportunity to validate the signature.  The Signer should
      anticipate that Verifiers can 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

   Some messages, particularly those using 8-bit characters, are subject
   to modification during transit, notably conversion to 7-bit form.
   Such conversions will break DKIM signatures.  In order to minimize
   the chances of such breakage, Signers SHOULD convert the message to a
   suitable MIME content-transfer encoding such as quoted-printable or
   base64 as described in [RFC2045] before signing.  Such conversion is
   outside the scope of DKIM; the actual message SHOULD be converted to
   7-bit MIME by an MUA or MSA prior to presentation to the DKIM
   algorithm.

   If the message is submitted to the Signer with any local encoding
   that will be modified before transmission, that modification to
   canonical [RFC5322] form MUST be done before signing.  In particular,
   bare CR or LF characters (used by some systems as a local line

Top      Up      ToC       Page 38 
   separator convention) MUST be converted to the SMTP-standard CRLF
   sequence before the message is signed.  Any conversion of this sort
   SHOULD be applied to the message actually sent to the recipient(s),
   not just to the version presented to the signing algorithm.

   More generally, the Signer MUST sign the message as it is expected to
   be received by the Verifier rather than in some local or internal
   form.

5.3.1.  Body Length Limits

   A body length count MAY be specified to limit the signature
   calculation to an initial prefix of the body text, measured in
   octets.  If the body length count is not specified, the entire
   message body is signed.

      INFORMATIVE RATIONALE: This capability is provided because it is
      very common for mailing lists to add trailers to messages (e.g.,
      instructions on how to get off the list).  Until those messages
      are also signed, the body length count is a useful tool for the
      Verifier since it can, as a matter of policy, accept messages
      having valid signatures with extraneous data.

   The length actually hashed should be inserted in the "l=" tag of the
   DKIM-Signature header field.  (See Section 3.5.)

   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
   length count MUST be calculated following the canonicalization
   algorithm; for example, any whitespace ignored by a canonicalization
   algorithm is not included as part of the body length count.

   A body length count of zero means that the body is completely
   unsigned.

   Signers wishing to ensure that no modification of any sort can occur
   should specify the "simple" canonicalization algorithm for both
   header and body and omit the body length count.

   See Section 8.2 for further discussion.

5.4.  Determine the Header Fields to Sign

   The From header field MUST be signed (that is, included in the "h="
   tag of the resulting DKIM-Signature header field).  Signers SHOULD
   NOT sign an existing header field likely to be legitimately modified
   or removed in transit.  In particular, [RFC5321] explicitly permits

Top      Up      ToC       Page 39 
   modification or removal of the Return-Path header field in transit.
   Signers MAY include any other header fields present at the time of
   signing at the discretion of the Signer.

      INFORMATIVE OPERATIONS NOTE: The choice of which header fields to
      sign is non-obvious.  One strategy is to sign all existing, non-
      repeatable header fields.  An alternative strategy is to sign only
      header fields that are likely to be displayed to or otherwise be
      likely to affect the processing of the message at the receiver.  A
      third strategy is to sign only "well-known" headers.  Note that
      Verifiers may treat unsigned header fields with extreme
      skepticism, including refusing to display them to the end user or
      even ignoring the signature if it does not cover certain header
      fields.  For this reason, signing fields present in the message
      such as Date, Subject, Reply-To, Sender, and all MIME header
      fields are highly advised.

   The DKIM-Signature header field is always implicitly signed and MUST
   NOT be included in the "h=" tag except to indicate that other
   preexisting signatures are also signed.

   Signers MAY claim to have signed header fields that do not exist
   (that is, Signers MAY include the header field name in the "h=" tag
   even if that header field does not exist in the message).  When
   computing the signature, the nonexisting header field MUST be treated
   as the null string (including the header field name, header field
   value, all punctuation, and the trailing CRLF).

      INFORMATIVE RATIONALE: This allows Signers to explicitly assert
      the absence of a header field; if that header field is added
      later, the signature will fail.

      INFORMATIVE NOTE: A header field name need only be listed once
      more than the actual number of that header field in a message at
      the time of signing in order to prevent any further additions.
      For example, if there is a single Comments header field at the
      time of signing, listing Comments twice in the "h=" tag is
      sufficient to prevent any number of Comments header fields from
      being appended; it is not necessary (but is legal) to list
      Comments three or more times in the "h=" tag.

   Refer to Section 5.4.2 for a discussion of the procedure to be
   followed when canonicalizing a header with more than one instance of
   a particular header field name.

   Signers need to be careful of signing header fields that might have
   additional instances added later in the delivery process, since such
   header fields might be inserted after the signed instance or

Top      Up      ToC       Page 40 
   otherwise reordered.  Trace header fields (such as Received) and
   Resent-* blocks are the only fields prohibited by [RFC5322] from
   being reordered.  In particular, since DKIM-Signature header fields
   may be reordered by some intermediate MTAs, signing existing DKIM-
   Signature header fields is error-prone.

      INFORMATIVE ADMONITION: Despite the fact that [RFC5322] does not
      prohibit the reordering of header fields, reordering of signed
      header fields with multiple instances by intermediate MTAs will
      cause DKIM signatures to be broken; such antisocial behavior
      should be avoided.

      INFORMATIVE IMPLEMENTER'S NOTE: Although not required by this
      specification, all end-user visible header fields should be signed
      to avoid possible "indirect spamming".  For example, if the
      Subject header field is not signed, a spammer can resend a
      previously signed mail, replacing the legitimate subject with a
      one-line spam.

5.4.1.  Recommended Signature Content

   The purpose of the DKIM cryptographic algorithm is to affix an
   identifier to the message in a way that is both robust against normal
   transit-related changes and resistant to kinds of replay attacks.  An
   essential aspect of satisfying these requirements is choosing what
   header fields to include in the hash and what fields to exclude.

   The basic rule for choosing fields to include is to select those
   fields that constitute the "core" of the message content.  Hence, any
   replay attack will have to include these in order to have the
   signature succeed; however, with these included, the core of the
   message is valid, even if sent on to new recipients.

   Common examples of fields with addresses and fields with textual
   content related to the body are:

   o  From (REQUIRED; see Section 5.4)

   o  Reply-To

   o  Subject

   o  Date

   o  To, Cc

   o  Resent-Date, Resent-From, Resent-To, Resent-Cc

Top      Up      ToC       Page 41 
   o  In-Reply-To, References

   o  List-Id, List-Help, List-Unsubscribe, List-Subscribe, List-Post,
      List-Owner, List-Archive

   If the "l=" signature tag is in use (see Section 3.5), the Content-
   Type field is also a candidate for being included as it could be
   replaced in a way that causes completely different content to be
   rendered to the receiving user.

   There are trade-offs in the decision of what constitutes the "core"
   of the message, which for some fields is a subjective concept.
   Including fields such as "Message-ID", for example, is useful if one
   considers a mechanism for being able to distinguish separate
   instances of the same message to be core content.  Similarly, "In-
   Reply-To" and "References" might be desirable to include if one
   considers message threading to be a core part of the message.

   Another class of fields that may be of interest are those that convey
   security-related information about the message, such as
   Authentication-Results [RFC5451].

   The basic rule for choosing fields to exclude is to select those
   fields for which there are multiple fields with the same name and
   fields that are modified in transit.  Examples of these are:

   o  Return-Path

   o  Received

   o  Comments, Keywords

   Note that the DKIM-Signature field is also excluded from the header
   hash because its handling is specified separately.

   Typically, it is better to exclude other optional fields because of
   the potential that additional fields of the same name will be
   legitimately added or reordered prior to verification.  There are
   likely to be legitimate exceptions to this rule because of the wide
   variety of application-specific header fields that might be applied
   to a message, some of which are unlikely to be duplicated, modified,
   or reordered.

   Signers SHOULD choose canonicalization algorithms based on the types
   of messages they process and their aversion to risk.  For example,
   e-commerce sites sending primarily purchase receipts, which are not
   expected to be processed by mailing lists or other software likely to
   modify messages, will generally prefer "simple" canonicalization.

Top      Up      ToC       Page 42 
   Sites sending primarily person-to-person email will likely prefer to
   be more resilient to modification during transport by using "relaxed"
   canonicalization.

   Unless mail is processed through intermediaries, such as mailing
   lists that might add "unsubscribe" instructions to the bottom of the
   message body, the "l=" tag is likely to convey no additional benefit
   while providing an avenue for unauthorized addition of text to a
   message.  The use of "l=0" takes this to the extreme, allowing
   complete alteration of the text of the message without invalidating
   the signature.  Moreover, a Verifier would be within its rights to
   consider a partly signed message body as unacceptable.  Judicious use
   is advised.

5.4.2.  Signatures Involving Multiple Instances of a Field

   Signers choosing to sign an existing header field that occurs more
   than once in the message (such as Received) MUST sign the physically
   last instance of that header field in the header block.  Signers
   wishing to sign multiple instances of such a header field MUST
   include the header field name multiple times in the "h=" tag of the
   DKIM-Signature header field and MUST sign such header fields in order
   from the bottom of the header field block to the top.  The Signer MAY
   include more instances of a header field name in "h=" than there are
   actual corresponding header fields so that the signature will not
   verify if additional header fields of that name are added.

      INFORMATIVE EXAMPLE:

      If the Signer wishes to sign two existing Received header fields,
      and the existing header contains:

      Received: <A>
      Received: <B>
      Received: <C>

      then the resulting DKIM-Signature header field should read:

      DKIM-Signature: ... h=Received : Received :...

      and Received header fields <C> and <B> will be signed in that
      order.

Top      Up      ToC       Page 43 
5.5.  Compute the Message Hash and Signature

   The Signer MUST compute the message hash as described in Section 3.7
   and then sign it using the selected public-key algorithm.  This will
   result in a DKIM-Signature header field that will include the body
   hash and a signature of the header hash, where that header includes
   the DKIM-Signature header field itself.

   Entities such as mailing list managers that implement DKIM and that
   modify the message or a header field (for example, inserting
   unsubscribe information) before retransmitting the message SHOULD
   check any existing signature on input and MUST make such
   modifications before re-signing the message.

5.6.  Insert the DKIM-Signature Header Field

   Finally, the Signer MUST insert the DKIM-Signature header field
   created in the previous step prior to transmitting the email.  The
   DKIM-Signature header field MUST be the same as used to compute the
   hash as described above, except that the value of the "b=" tag MUST
   be the appropriately signed hash computed in the previous step,
   signed using the algorithm specified in the "a=" tag of the DKIM-
   Signature header field and using the private key corresponding to the
   selector given in the "s=" tag of the DKIM-Signature header field, as
   chosen above in Section 5.2.

   The DKIM-Signature header field MUST be inserted before any other
   DKIM-Signature fields in the header block.

      INFORMATIVE IMPLEMENTATION NOTE: The easiest way to achieve this
      is to insert the DKIM-Signature header field at the beginning of
      the header block.  In particular, it may be placed before any
      existing Received header fields.  This is consistent with treating
      DKIM-Signature as a trace header field.

6.  Verifier Actions

   Since a Signer MAY remove or revoke a public key at any time, it is
   advised that verification occur in a timely manner.  In many
   configurations, the most timely place is during acceptance by the
   border MTA or shortly thereafter.  In particular, deferring
   verification until the message is accessed by the end user is
   discouraged.

   A border or intermediate MTA MAY verify the message signature(s).  An
   MTA who has performed verification MAY communicate the result of that
   verification by adding a verification header field to incoming
   messages.  This simplifies things considerably for the user, who can

Top      Up      ToC       Page 44 
   now use an existing mail user agent.  Most MUAs have the ability to
   filter messages based on message header fields or content; these
   filters would be used to implement whatever policy the user wishes
   with respect to unsigned mail.

   A verifying MTA MAY implement a policy with respect to unverifiable
   mail, regardless of whether or not it applies the verification header
   field to signed messages.

   Verifiers MUST produce a result that is semantically equivalent to
   applying the steps listed in Sections 6.1, 6.1.1, and 6.1.2 in order.
   In practice, several of these steps can be performed in parallel in
   order to improve performance.

6.1.  Extract Signatures from the Message

   The order in which Verifiers try DKIM-Signature header fields is not
   defined; Verifiers MAY try signatures in any order they like.  For
   example, one implementation might try the signatures in textual
   order, whereas another might try signatures by identities that match
   the contents of the From header field before trying other signatures.
   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
      (such as correlating the signing host with Received header fields)
      might also be considered.

   Survivability of signatures after transit is not guaranteed, and
   signatures can fail to verify through no fault of the Signer.
   Therefore, 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.

   When a signature successfully verifies, a Verifier will either stop
   processing or attempt to verify any other signatures, at the
   discretion of the implementation.  A Verifier MAY limit the number of
   signatures it tries, in order to avoid denial-of-service attacks (see
   Section 8.4 for further discussion).

   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 one

Top      Up      ToC       Page 45 
   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
   arrange to defer the message for later processing or try another
   signature; if no good signature is found and any of the signatures
   resulted in a TEMPFAIL status, the Verifier MAY arrange to defer the
   message for later processing.  The "(explanation)" is not normative
   text; it is provided solely for clarification.

   Verifiers that are prepared to validate multiple signature header
   fields SHOULD proceed to the next signature header field, if one
   exists.  However, Verifiers MAY make note of the fact that an invalid
   signature was present for consideration at a later step.

      INFORMATIVE NOTE: The rationale of this requirement is to permit
      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.

   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
   DKIM-Signature header field; any inconsistency or unexpected values
   MUST cause the header field to be completely ignored and the Verifier
   to return PERMFAIL (signature syntax error).  Being "liberal in what
   you accept" is definitely a bad strategy in this security context.
   Note, however, that this does not include the existence of unknown
   tags in a DKIM-Signature header field, which are explicitly
   permitted.  Verifiers MUST return PERMFAIL (incompatible version)
   when presented a DKIM-Signature header field with a "v=" tag that is
   inconsistent with this specification.

      INFORMATIVE IMPLEMENTATION NOTE: An implementation may, of course,
      choose to also verify signatures generated by older versions of
      this specification.

Top      Up      ToC       Page 46 
   If any tag listed as "required" in Section 3.5 is omitted from the
   DKIM-Signature header field, the Verifier MUST ignore the DKIM-
   Signature header field and return PERMFAIL (signature missing
   required tag).

      INFORMATIVE NOTE: The tags listed as required in Section 3.5 are
      "v=", "a=", "b=", "bh=", "d=", "h=", and "s=".  Should there be a
      conflict between this note and Section 3.5, Section 3.5 is
      normative.

   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", where
   "d" is the value from the "d=" tag.

   Verifiers MUST confirm that the domain specified in the "d=" tag is
   the same as or a parent domain of the domain part of the "i=" tag.
   If not, the DKIM-Signature header field MUST be ignored, and the
   Verifier should return PERMFAIL (domain mismatch).

   If the "h=" tag does not include the From header field, the Verifier
   MUST ignore the DKIM-Signature header field and return PERMFAIL (From
   field not signed).

   Verifiers MAY ignore the DKIM-Signature header field and return
   PERMFAIL (signature expired) if it contains an "x=" tag and the
   signature has expired.

   Verifiers MAY ignore the DKIM-Signature header field if the domain
   used by the Signer in the "d=" tag is not associated with a valid
   signing entity.  For example, signatures with "d=" values such as
   "com" and "co.uk" could be ignored.  The list of unacceptable domains
   SHOULD be configurable.

   Verifiers MAY ignore the DKIM-Signature header field and return
   PERMFAIL (unacceptable signature header) for any other reason, for
   example, if the signature does not sign header fields that the
   Verifier views to be essential.  As a case in point, if MIME header
   fields are not signed, certain attacks may be possible that the
   Verifier would prefer to avoid.

6.1.2.  Get the Public Key

   The public key for a signature is needed to complete the verification
   process.  The process of retrieving the public key depends on the
   query type as defined by the "q=" tag in the DKIM-Signature header
   field.  Obviously, a public key need only be retrieved if the process
   of extracting the signature information is completely successful.

Top      Up      ToC       Page 47 
   Details of key management and representation are described in
   Section 3.6.  The Verifier MUST validate the key record and MUST
   ignore any public-key records that are malformed.

      NOTE: The use of a wildcard TXT RR that covers a queried DKIM
      domain name will produce a response to a DKIM query that is
      unlikely to be a valid DKIM key record.  This problem is not
      specific to DKIM and applies to many other types of queries.
      Client software that processes DNS responses needs to take this
      problem into account.

   When validating a message, a Verifier MUST perform the following
   steps in a manner that is semantically the same as performing them in
   the order indicated; in some cases, the implementation may
   parallelize or reorder these steps, as long as the semantics remain
   unchanged:

   1.  The Verifier retrieves the public key as described in Section 3.6
       using the algorithm in the "q=" tag, the 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
       MAY seek a later verification attempt by returning TEMPFAIL (key
       unavailable).

   3.  If the query for the public key fails because the corresponding
       key record does not exist, the Verifier MUST immediately return
       PERMFAIL (no key for signature).

   4.  If the query for the public key returns multiple key records, the
       Verifier can choose one of the key records or may cycle through
       the key records, performing the remainder of these steps on each
       record at the discretion of the implementer.  The order of the
       key records is unspecified.  If the Verifier chooses to cycle
       through the key records, then the "return ..." wording in the
       remainder of this section means "try the next key record, if 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
       format defined in this specification, the Verifier MUST ignore
       the key record and return PERMFAIL (key syntax error).  Verifiers
       are urged to validate the syntax of key records carefully to
       avoid attempted attacks.  In particular, the Verifier MUST ignore
       keys with a version code ("v=" tag) that they do not implement.

Top      Up      ToC       Page 48 
   6.  If the "h=" tag exists in the public-key record and the hash
       algorithm implied by the "a=" tag in the DKIM-Signature header
       field is not included in the contents of the "h=" tag, the
       Verifier MUST ignore the key record and return PERMFAIL
       (inappropriate hash algorithm).

   7.  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
       signature check and return PERMFAIL (key revoked).  There is no
       defined semantic difference between a key that has been revoked
       and a key record that has been removed.

   8.  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-
       Signature header field, the Verifier MUST immediately return
       PERMFAIL (inappropriate key algorithm).

6.1.3.  Compute the Verification

   Given a Signer and a public key, verifying a signature consists of
   actions semantically equivalent to the following steps.

   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="
       tag, prepare a canonicalized version of the message as is
       described in Section 3.7 (note that this canonicalized version
       does not actually replace the original content).  When matching
       header field names in the "h=" tag against the actual message
       header field, comparisons MUST be case-insensitive.

   2.  Based on the algorithm indicated in the "a=" tag, compute the
       message hashes from the canonical copy as described in
       Section 3.7.

   3.  Verify that the hash of the canonicalized message body computed
       in the previous step matches the hash value conveyed in the "bh="
       tag.  If the hash does not match, the Verifier SHOULD ignore the
       signature and return PERMFAIL (body hash did not verify).

   4.  Using the signature conveyed in the "b=" tag, verify the
       signature against the header hash using the mechanism appropriate
       for the public-key algorithm described in the "a=" tag.  If the
       signature does not validate, the Verifier SHOULD ignore the
       signature and return PERMFAIL (signature did not verify).

Top      Up      ToC       Page 49 
   5.  Otherwise, the signature has correctly verified.

      INFORMATIVE IMPLEMENTER'S NOTE: Implementations might wish to
      initiate the public-key query in parallel with calculating the
      hash as the public key is not needed until the final decryption is
      calculated.  Implementations may also verify the signature on the
      message header before validating that the message hash listed in
      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 entire signature must be considered to have failed.

   A body length specified in the "l=" tag of the signature limits the
   number of bytes of the body passed to the verification algorithm.
   All data beyond that limit is not validated by DKIM.  Hence,
   Verifiers might treat a message that contains bytes beyond the
   indicated body length with suspicion and can choose to treat the
   signature as if it were invalid (e.g., by returning PERMFAIL
   (unsigned content)).

   Should the algorithm reach this point, the verification has
   succeeded, and DKIM reports SUCCESS for this signature.

6.2.  Communicate Verification Results

   Verifiers wishing to communicate the results of verification to other
   parts of the mail system may do so in whatever manner they see fit.
   For example, implementations might choose to add an email header
   field to the message before passing it on.  Any such header field
   SHOULD be inserted before any existing DKIM-Signature or preexisting
   authentication status header fields in the header field block.  The
   Authentication-Results: header field ([RFC5451]) MAY be used for this
   purpose.

      INFORMATIVE ADVICE to MUA filter writers: Patterns intended to
      search for results header fields to visibly mark authenticated
      mail for end users should verify that such a header field was
      added by the appropriate verifying domain and that the verified
      identity matches the author identity that will be displayed by the
      MUA.  In particular, MUA filters should not be influenced by bogus
      results header fields added by attackers.  To circumvent this
      attack, Verifiers MAY wish to request deletion of existing results
      header fields after verification and before arranging to add a new
      header field.

Top      Up      ToC       Page 50 
6.3.  Interpret Results/Apply Local Policy

   It is beyond the scope of this specification to describe what actions
   an Identity Assessor can make, but mail carrying a validated SDID
   presents an opportunity to an Identity Assessor that unauthenticated
   email does not.  Specifically, an authenticated email creates a
   predictable identifier by which other decisions can reliably be
   managed, such as trust and reputation.  Conversely, unauthenticated
   email lacks a reliable identifier that can be used to assign trust
   and reputation.  It is reasonable to treat unauthenticated email as
   lacking any trust and having no positive reputation.

   In general, modules that consume DKIM verification output SHOULD NOT
   determine message acceptability based solely on a lack of any
   signature or on an unverifiable signature; such rejection would cause
   severe interoperability problems.  If an MTA does wish to reject such
   messages during an SMTP session (for example, when communicating with
   a peer who, by prior agreement, agrees to only send signed messages),
   and a signature is missing or does not verify, the handling MTA
   SHOULD use a 550/5.7.x reply code.

   Where the Verifier is integrated within the MTA and it is not
   possible to fetch the public key, perhaps because the key server is
   not available, a temporary failure message MAY be generated using a
   451/4.7.5 reply code, such as:

   451 4.7.5 Unable to verify signature - key server unavailable

   Temporary failures such as inability to access the key server or
   other external service are the only conditions that SHOULD use a 4xx
   SMTP reply code.  In particular, cryptographic signature verification
   failures MUST NOT provoke 4xx SMTP replies.

   Once the signature has been verified, that information MUST be
   conveyed to the Identity Assessor (such as an explicit allow/
   whitelist and reputation system) and/or to the end user.  If the SDID
   is not the same as the address in the From: header field, the mail
   system SHOULD take pains to ensure that the actual SDID is clear to
   the reader.

   While the symptoms of a failed verification are obvious -- the
   signature doesn't verify -- establishing the exact cause can be more
   difficult.  If a selector cannot be found, is that because the
   selector has been removed, or was the value changed somehow in
   transit?  If the signature line is missing, is that because it was
   never there, or was it removed by an overzealous filter?  For
   diagnostic purposes, the exact reason why the verification fails
   SHOULD be made available and possibly recorded in the system logs.

Top      Up      ToC       Page 51 
   If the email cannot be verified, then it SHOULD be treated the same
   as all unverified email, regardless of whether or not it looks like
   it was signed.

   See Section 8.15 for additional discussion.

7.  IANA Considerations

   DKIM has registered namespaces with IANA.  In all cases, new values
   are assigned only for values that have been documented in a published
   RFC that has IETF Consensus [RFC5226].

   This memo updates these registries as described below.  Of note is
   the addition of a new "status" column.  All registrations into these
   namespaces MUST include the name being registered, the document in
   which it was registered or updated, and an indication of its current
   status, which MUST be one of "active" (in current use) or "historic"
   (no longer in current use).

   No new tags are defined in this specification compared to [RFC4871],
   but one has been designated as "historic".

   Also, the "Email Authentication Methods" registry is revised to refer
   to this update.

7.1.  Email Authentication Methods Registry

   The "Email Authentication Methods" registry is updated to indicate
   that "dkim" is defined in this memo.

7.2.  DKIM-Signature Tag Specifications

   A DKIM-Signature provides for a list of tag specifications.  IANA has
   established the "DKIM-Signature Tag Specifications" registry for tag
   specifications that can be used in DKIM-Signature fields.

Top      Up      ToC       Page 52 
                    +------+-----------------+--------+
                    | TYPE | REFERENCE       | STATUS |
                    +------+-----------------+--------+
                    |   v  | (this document) | active |
                    |   a  | (this document) | active |
                    |   b  | (this document) | active |
                    |  bh  | (this document) | active |
                    |   c  | (this document) | active |
                    |   d  | (this document) | active |
                    |   h  | (this document) | active |
                    |   i  | (this document) | active |
                    |   l  | (this document) | active |
                    |   q  | (this document) | active |
                    |   s  | (this document) | active |
                    |   t  | (this document) | active |
                    |   x  | (this document) | active |
                    |   z  | (this document) | active |
                    +------+-----------------+--------+

    Table 1: DKIM-Signature Tag Specifications Registry Updated Values

7.3.  DKIM-Signature Query Method Registry

   The "q=" tag-spec (specified in Section 3.5) provides for a list of
   query methods.

   IANA has established the "DKIM-Signature Query Method" registry for
   mechanisms that can be used to retrieve the key that will permit
   validation processing of a message signed using DKIM.

               +------+--------+-----------------+--------+
               | TYPE | OPTION | REFERENCE       | STATUS |
               +------+--------+-----------------+--------+
               |  dns |   txt  | (this document) | active |
               +------+--------+-----------------+--------+

       Table 2: DKIM-Signature Query Method Registry Updated Values

7.4.  DKIM-Signature Canonicalization Registry

   The "c=" tag-spec (specified in Section 3.5) provides for a specifier
   for canonicalization algorithms for the header and body of the
   message.

   IANA has established the "DKIM-Signature Canonicalization Header"
   Registry for algorithms for converting a message into a canonical
   form before signing or verifying using DKIM.

Top      Up      ToC       Page 53 
                  +---------+-----------------+--------+
                  |   TYPE  | REFERENCE       | STATUS |
                  +---------+-----------------+--------+
                  |  simple | (this document) | active |
                  | relaxed | (this document) | active |
                  +---------+-----------------+--------+

     Table 3: DKIM-Signature Canonicalization Header Registry Updated
                                  Values

                  +---------+-----------------+--------+
                  |   TYPE  | REFERENCE       | STATUS |
                  +---------+-----------------+--------+
                  |  simple | (this document) | active |
                  | relaxed | (this document) | active |
                  +---------+-----------------+--------+

   Table 4: DKIM-Signature Canonicalization Body Registry Updated Values

7.5.  _domainkey DNS TXT Resource Record Tag Specifications

   A _domainkey DNS TXT RR provides for a list of tag specifications.
   IANA has established the DKIM "_domainkey DNS TXT Record Tag
   Specifications" registry for tag specifications that can be used in
   DNS TXT resource records.

                   +------+-----------------+----------+
                   | TYPE | REFERENCE       | STATUS   |
                   +------+-----------------+----------+
                   |   v  | (this document) | active   |
                   |   g  | [RFC4871]       | historic |
                   |   h  | (this document) | active   |
                   |   k  | (this document) | active   |
                   |   n  | (this document) | active   |
                   |   p  | (this document) | active   |
                   |   s  | (this document) | active   |
                   |   t  | (this document) | active   |
                   +------+-----------------+----------+

      Table 5: _domainkey DNS TXT Record Tag Specifications Registry
                              Updated Values

7.6.  DKIM Key Type Registry

   The "k=" <key-k-tag> (specified in Section 3.6.1) and the "a=" <sig-
   a-tag-k> (specified in Section 3.5) tags provide for a list of
   mechanisms that can be used to decode a DKIM signature.

Top      Up      ToC       Page 54 
   IANA has established the "DKIM Key Type" registry for such
   mechanisms.

                       +------+-----------+--------+
                       | TYPE | REFERENCE | STATUS |
                       +------+-----------+--------+
                       |  rsa | [RFC3447] | active |
                       +------+-----------+--------+

              Table 6: DKIM Key Type Registry Updated Values

7.7.  DKIM Hash Algorithms Registry

   The "h=" <key-h-tag> (specified in Section 3.6.1) and the "a=" <sig-
   a-tag-h> (specified in Section 3.5) tags provide for a list of
   mechanisms that can be used to produce a digest of message data.

   IANA has established the "DKIM Hash Algorithms" registry for such
   mechanisms.

                  +--------+-------------------+--------+
                  |  TYPE  | REFERENCE         | STATUS |
                  +--------+-------------------+--------+
                  |  sha1  | [FIPS-180-3-2008] | active |
                  | sha256 | [FIPS-180-3-2008] | active |
                  +--------+-------------------+--------+

           Table 7: DKIM Hash Algorithms Registry Updated Values

7.8.  DKIM Service Types Registry

   The "s=" <key-s-tag> tag (specified in Section 3.6.1) provides for a
   list of service types to which this selector may apply.

   IANA has established the "DKIM Service Types" registry for service
   types.

                   +-------+-----------------+--------+
                   |  TYPE | REFERENCE       | STATUS |
                   +-------+-----------------+--------+
                   | email | (this document) | active |
                   |   *   | (this document) | active |
                   +-------+-----------------+--------+

            Table 8: DKIM Service Types Registry Updated Values

Top      Up      ToC       Page 55 
7.9.  DKIM Selector Flags Registry

   The "t=" <key-t-tag> tag (specified in Section 3.6.1) provides for a
   list of flags to modify interpretation of the selector.

   IANA has established the "DKIM Selector Flags" registry for
   additional flags.

                    +------+-----------------+--------+
                    | TYPE | REFERENCE       | STATUS |
                    +------+-----------------+--------+
                    |   y  | (this document) | active |
                    |   s  | (this document) | active |
                    +------+-----------------+--------+

           Table 9: DKIM Selector Flags Registry Updated Values

7.10.  DKIM-Signature Header Field

   IANA has added DKIM-Signature to the "Permanent Message Header Field
   Names" registry (see [RFC3864]) for the "mail" protocol, using this
   document as the reference.



(page 55 continued on part 4)

Next RFC Part