<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc toc="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>

<rfc category="std" ipr="trust200902" updates="6376" number="8463"
     submissionType="IETF" consensus="yes" >
 <front>
   <title abbrev="DKIM Crypto Update">A New Cryptographic Signature Method for DomainKeys&nbsp;Identified&nbsp;Mail&nbsp;(DKIM)</title>

   <author initials="J.R." surname="Levine"
	   fullname="John Levine">
      <organization>Taughannock Networks</organization>

      <address>
	 <postal>
	    <street>PO Box 727</street>
	    <city>Trumansburg</city>
	    <region>NY</region>
	    <code>14886</code>
	    <country>United States of America</country>
	 </postal>
	    
	 <phone>+883.5100.01196712</phone>
	 <email>standards@taugh.com</email>
      </address>
   </author>

   <date month="September" year="2018" />


<keyword>DKIM, ed25519, cryptography</keyword>


   <abstract>
     <t>This document adds a new signing algorithm, Ed25519-SHA256,
     to "DomainKeys Identified Mail (DKIM) Signatures" (RFC 6376).
     DKIM verifiers are required to implement this algorithm.</t>


   </abstract>
 </front>

 <middle>
   <section anchor="intro" title="Introduction">
     <t><xref target="RFC6376">DKIM</xref> signs email messages by creating hashes of selected message
	header fields and body and signing the header hash with a digital signature.
	Message recipients fetch the signature verification key from the DNS.
	

	The defining documents specify a single signing algorithm, <xref target="RFC3447">RSA</xref>
	(which has since been obsoleted by <xref target="RFC8017" />).
     </t>
     <t>
	This document adds a new, stronger signing algorithm, Edwards-Curve
	Digital Signature Algorithm, using the Curve25519 curve (Ed25519),
	which has much shorter keys than RSA for similar levels of security.
     </t>
   </section>
   
   <section title="Conventions Used in This Document">
        <t>
        </t>
        <t>
    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
    NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
    "MAY", and "OPTIONAL" in this document are to be interpreted as
    described in BCP&nbsp;14 <xref target="RFC2119"/> <xref target="RFC8174"/> 
    when, and only when, they appear in all capitals, as shown here.
        </t>

     <t>
	Syntax descriptions use <xref target="RFC5234">Augmented BNF (ABNF)</xref>.
	The ABNF tokens sig-a-tag-k and key-k-tag-type are imported from <xref target="RFC6376"/>.
     </t>
   </section>

   <section title="Ed25519-SHA256 Signing Algorithm">
      <t>
	 The Ed25519-SHA256 signing algorithm computes a message hash as defined in Section 3
	 of <xref target="RFC6376"/> using SHA-256 <xref
	 target="FIPS-180-4-2015"/> as the hash-alg. It signs the hash with
	 the PureEdDSA variant Ed25519, as defined in  <xref target="RFC8032">RFC 8032, Section 5.1</xref>.
	 Example keys and signatures in <xref target="signex" /> are based on the
	 test vectors in <xref target="RFC8032">RFC 8032, Section 7.1</xref>.
      </t><t>
	 The DNS record for the verification public key has a "k=ed25519" tag to indicate
	 that the key is an Ed25519 rather than an RSA key.
      </t><t>
	 This is an additional DKIM signature algorithm added to Section 3.3 of
	 <xref target="RFC6376"/> as envisioned in Section 3.3.4 of that document.
      </t><t>
	 Note: since Ed25519 public keys are 256 bits long, the base64-encoded key is only 44 octets, so
	 DNS key record data will generally fit in a single
	 255-byte TXT string and work even with DNS provisioning software that doesn't
	 handle multistring TXT records.
      </t>
   </section>

   <section title="Signature and Key Syntax">
      <t>The syntax of DKIM signatures and DKIM keys are updated as follows.</t>
   <section title="Signature Syntax">
      <t>
	 The syntax of DKIM algorithm tags in Section 3.5 of <xref target="RFC6376" />
	 is updated by adding this rule to the
	 existing rule for sig-a-tag-k:
      </t><t>
	 	      <figure>
          <artwork><![CDATA[
    ABNF:

    sig-a-tag-k =/ "ed25519"]]></artwork>
        </figure>
      </t>

   </section>
   <section title="Key Syntax">
      <t>
	 The syntax of DKIM key tags in Section 3.6.1 of <xref target="RFC6376"/>
	 is updated by adding this rule to the
	 existing rule for key-k-tag-type:
      </t><t>
	 	      <figure>
          <artwork><![CDATA[
    ABNF:

    key-k-tag-type  =/ "ed25519"]]></artwork>
        </figure>
      </t>
      <t>The p= value in the key record is the Ed25519 public key encoded in base64.
	 Since the key is 256 bits long, the base64 text is 44 octets long.
	 See <xref target="signexkey" /> for a sample
	 key record using the public key in <xref target="RFC8032"/>, Section 7.1, Test 1.
	</t>
   </section>
   </section>


   <section title="Choice and Strength of Keys and Algorithms">
      <t>
	 Section 3.3 of <xref target="RFC6376"/> describes DKIM's hash and signature algorithms.
	 It is updated as follows:
      </t><t>
	 Signers SHOULD implement and verifiers MUST implement the Ed25519-SHA256 algorithm.
      </t>
   </section>

   <section title="Transition Considerations">
      <t>
	 For backward compatibility, signers can add multiple signatures that use old and new signing
	 algorithms.
	 Since there can only be a single key record in the DNS for each selector, the signatures
	 have to use different selectors, although they can use the same d= and i= identifiers.
      </t><t>
	 The example message in <xref target="signex" /> has two signatures with
	 the same d= and i= identifiers but different a= algorithms and s= selectors.
      </t>
   </section>
   <section title="Security Considerations">
      <t>
	 All of the security advice in <xref target="RFC6376"/> continues to apply, except that
	 the security advice about Ed25519
	 in Section 8 of <xref target="RFC8032" /> supplants the advice about RSA threats.
      </t>
   </section>

   
   <section title="IANA Considerations">
     <t>IANA has updated a registry as follows.
     </t>
     <section title="&quot;DKIM Key Type&quot; Registry">
	<t>The following value has been added to the "DKIM Key Type" registry:</t>
      <texttable anchor="dkimkeytag"
                 title="Value Added to the &quot;DKIM Key Type&quot; Registry">
        <ttcol align="center">TYPE</ttcol>
        <ttcol align="left">REFERENCE</ttcol>
        <ttcol align="left">STATUS</ttcol>

	<c>ed25519</c>
        <c>[RFC8032]</c>
        <c>active</c>

      </texttable>
     </section>
   </section>
 </middle>

 <back>
   <references title="Normative References">
      <?rfc include="reference.RFC.2119" ?>
      <?rfc include="reference.RFC.8174" ?>
      <?rfc include="reference.RFC.5234" ?>
      <?rfc include="reference.RFC.6376" ?>
      <?rfc include="reference.RFC.8017" ?>
      <?rfc include="reference.RFC.8032" ?>
      <reference anchor="FIPS-180-4-2015" target="http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf">
	 <front>
	      <title>Secure Hash Standard (SHS)</title>
	      <author><organization>National Institute of Standards and Technology</organization></author>
	      <date month="August" year="2015" />
	 </front>
	 <seriesInfo name="FIPS PUB" value="180-4" />
	 <seriesInfo name="DOI" value="10.6028/NIST.FIPS.180-4" />
      </reference>


   </references>
   <references title="Informative References">
      <?rfc include="reference.RFC.3447" ?>
   </references>

   <section anchor="signex" title="Example of a Signed Message">
      <t>This is a small message with both RSA-SHA256 and Ed25519-SHA256 DKIM signatures.
      The signatures are independent of each other, so either signature would be valid
      if the other were not present.</t>
      <section title="Secret Keys">

	 <t>Ed25519 secret key in base64.  This is the secret key from <xref target="RFC8032" />,
	    Section 7.1, Test 1, converted from hex to base64.</t>
    <figure>
          <artwork><![CDATA[nWGxne/9WmC6hEr0kuwsxERJxWl7MmkZcDusAxyuf2A=]]></artwork></figure>

	  <t>RSA secret key in PEM format.</t>


	  
    <figure>
          <artwork><![CDATA[-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDkHlOQoBTzWRiGs5V6NpP3idY6Wk08a5qhdR6wy5bdOKb2jLQi
Y/J16JYi0Qvx/byYzCNb3W91y3FutACDfzwQ/BC/e/8uBsCR+yz1Lxj+PL6lHvqM
KrM3rG4hstT5QjvHO9PzoxZyVYLzBfO2EeC3Ip3G+2kryOTIKT+l/K4w3QIDAQAB
AoGAH0cxOhFZDgzXWhDhnAJDw5s4roOXN4OhjiXa8W7Y3rhX3FJqmJSPuC8N9vQm
6SVbaLAE4SG5mLMueHlh4KXffEpuLEiNp9Ss3O4YfLiQpbRqE7Tm5SxKjvvQoZZe
zHorimOaChRL2it47iuWxzxSiRMv4c+j70GiWdxXnxe4UoECQQDzJB/0U58W7RZy
6enGVj2kWF732CoWFZWzi1FicudrBFoy63QwcowpoCazKtvZGMNlPWnC7x/6o8Gc
uSe0ga2xAkEA8C7PipPm1/1fTRQvj1o/dDmZp243044ZNyxjg+/OPN0oWCbXIGxy
WvmZbXriOWoSALJTjExEgraHEgnXssuk7QJBALl5ICsYMu6hMxO73gnfNayNgPxd
WFV6Z7ULnKyV7HSVYF0hgYOHjeYe9gaMtiJYoo0zGN+L3AAtNP9huqkWlzECQE1a
licIeVlo1e+qJ6Mgqr0Q7Aa7falZ448ccbSFYEPD6oFxiOl9Y9se9iYHZKKfIcst
o7DUw1/hz2Ck4N5JrgUCQQCyKveNvjzkkd8HjYs0SwM0fPjK16//5qDZ2UiDGnOe
uEzxBDAr518Z8VFbR41in3W4Y3yCDgQlLlcETrS+zYcL
-----END RSA PRIVATE KEY-----]]></artwork></figure>
       </section>
       <section  anchor="signexkey" title="Public Key DNS Records">
	  <t>The public key p= value in the first record is the public key from
<xref target="RFC8032" />, Section 7.1, Test 1, converted from hex to base64.</t>	     
     <figure>
          <artwork><![CDATA[brisbane._domainkey.football.example.com. IN TXT (
 "v=DKIM1; k=ed25519; p=11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo=")

test._domainkey.football.example.com. IN TXT (
 "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDkHlOQoBTzWR"
 "iGs5V6NpP3idY6Wk08a5qhdR6wy5bdOKb2jLQiY/J16JYi0Qvx/byYzCNb3W91y3FutAC"
 "DfzwQ/BC/e/8uBsCR+yz1Lxj+PL6lHvqMKrM3rG4hstT5QjvHO9PzoxZyVYLzBfO2EeC3"
 "Ip3G+2kryOTIKT+l/K4w3QIDAQAB")]]></artwork>
        </figure>
	</section>
	<section title="Signed Message">
	   <t>The text in each line of the message starts at the first position except
	   for the continuation lines on the DKIM-Signature header fields,
	   which start with a single space.
	   A blank line follows the "Joe." line.
	   </t>

<!-- Editor: Please don't break this figure across a page boundary. -->

     <figure>
          <artwork><![CDATA[
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; 
 d=football.example.com; i=@football.example.com; 
 q=dns/txt; s=brisbane; t=1528637909; h=from : to : 
 subject : date : message-id : from : subject : date; 
 bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=; 
 b=/gCrinpcQOoIfuHNQIbq4pgh9kyIK3AQUdt9OdqQehSwhEIug4D11Bus
 Fa3bT3FY5OsU7ZbnKELq+eXdp1Q1Dw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; 
 d=football.example.com; i=@football.example.com; 
 q=dns/txt; s=test; t=1528637909; h=from : to : subject : 
 date : message-id : from : subject : date; 
 bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=; 
 b=F45dVWDfMbQDGHJFlXUNB2HKfbCeLRyhDXgFpEL8GwpsRe0IeIixNTe3
 DhCVlUrSjV4BwcVcOF6+FF3Zo9Rpo1tFOeS9mPYQTnGdaSGsgeefOsk2Jz
 dA+L10TeYt9BgDfQNZtKdN1WO//KgIqXP7OdEFE4LjFYNcUxZQ4FADY+8=
From: Joe SixPack <joe@football.example.com>
To: Suzie Q <suzie@shopping.example.net>
Subject: Is dinner ready?
Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT)
Message-ID: <20030712040037.46341.5F8J@football.example.com>

Hi.

We lost the game.  Are you hungry yet?

Joe.

]]></artwork>
     </figure>


	</section>
   </section>
 </back>
</rfc>
