<?xml version='1.0' encoding='ascii'?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<rfc ipr="trust200902" category="info" updates="4880" docName="draft-koch-eddsa-for-openpgp-03" obsoletes="" submissionType="IETF" xml:lang="en">
  <?rfc toc="yes"?>
  <?rfc symrefs="yes"?>
  <?rfc sortrefs="yes"?>
  <?rfc subcompact="no"?>
  <?rfc compact="yes"?>
  <?rfc comments="yes"?>
  <front>
    <title>EdDSA for OpenPGP</title>
    <author initials="W." surname="Koch" fullname="Werner Koch">
      <organization>g10 Code</organization>
      <address>
        <email>wk@gnupg.org</email>
        <uri>https://g10code.com</uri>
      </address>
    </author>
    <date month="August" year="2015"/>
    <area>Security</area>
    <abstract><!--This document was prepared using Pandoc2rfc, https://github.com/miekg/pandoc2rfc --><t>This specification extends OpenPGP with the EdDSA public key algorithm and describes the use of curve Ed25519.  </t> </abstract>
  </front>
  <middle><!--This document was prepared using Pandoc2rfc, https://github.com/miekg/pandoc2rfc --><section title="Introduction" anchor="introduction" toc="default"><t>The OpenPGP specification in <xref target="RFC4880" pageno="false" format="default"/> defines the RSA, Elgamal, and DSA public key algorithms.  <xref target="RFC6637" pageno="false" format="default"/> adds support for Elliptic Curve Cryptography and specifies the ECDSA and ECDH algorithms. Due to patent reasons no point compression was defined.  </t><t>This document specifies how to use the EdDSA public key signature algorithm <xref target="I-D.josefsson-eddsa-ed25519" pageno="false" format="default"/> with the OpenPGP standard. It defines a new signature algorithm named EdDSA and specifies how to use the Ed25519 curve with EdDSA. This algorithm uses a custom point compression method. There are three main advantages of the EdDSA algorithm: It does not require the use of a unique random number for each signature, there are no padding or truncation issues as with ECDSA, and it is more resilient to side-channel attacks.  </t><t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in <xref target="RFC2119" pageno="false" format="default"/>.  </t></section><section title="Supported Curves" anchor="supported-curves" toc="default"><t>This document references the Curve "Ed25519" which is the Edwards form of "Curve25519" and specified in the same paper as the "EdDSA" algorithm (<xref target="ED25519" pageno="false" format="default"/>). For the full specification see <xref target="I-D.josefsson-eddsa-ed25519" pageno="false" format="default"/>.  </t><t>Other curves may be used by using a specific OID for the curve and its EdDSA parameters.  </t><t>The following public key algorithm IDs are added to expand section 9.1 of <xref target="RFC4880" pageno="false" format="default"/>, "Public-Key Algorithms": </t><texttable title="" suppress-title="false" align="center" style="full"><ttcol align="left">ID </ttcol><ttcol align="left">Description of Algorithm </ttcol><c>TBD1 </c><c>EdDSA public key algorithm </c></texttable><t>Compliant applications MUST support EdDSA with the curve Ed25519.  Applications MAY support other curves as long as a dedicated OID for using that curve with EdDSA is used.  </t></section><section title="Point Format" anchor="point-format" toc="default"><t>The EdDSA algorithm defines a specific point compression format. To indicate the use of this compression format and to make sure that the key can be represented in the Multiprecision Integer (MPI) format of <xref target="RFC4880" pageno="false" format="default"/> the octet string specifying the point is prefixed with the octet 0x40. This encoding is an extension of the encoding given in <xref target="RFC6637" pageno="false" format="default"/> which uses 0x04 to indicate an uncompressed point.  </t><t>For example, the length of a public key for the curve Ed25519 is 263 bit: 7 bit to represent the 0x40 prefix octet and 32 octets for the native value of the public key.  </t></section><section title="Encoding of Public and Private Keys" anchor="encoding-of-public-and-private-keys" toc="default"><t>The following algorithm specific packets are added to Section 5.5.2 of <xref target="RFC4880" pageno="false" format="default"/>, "Public-Key Packet Formats", to support EdDSA.  </t><t>Algorithm-Specific Fields for EdDSA keys: </t><t><list style="symbols"><t>a variable length field containing a curve OID, formatted as follows: <list style="symbols"><t>a one-octet size of the following field; values 0 and 0xFF are reserved for future extensions, </t><t>octets representing a curve OID, defined in Section 6.  </t></list> </t><t>MPI of an EC point representing a public key Q as described under Point Format above.  </t></list></t><t>The following algorithm specific packets are added to Section 5.5.3 of <xref target="RFC4880" pageno="false" format="default"/>, "Secret-Key Packet Formats", to support EdDSA.  </t><t>Algorithm-Specific Fields for EdDSA keys: </t><t><list style="symbols"><t>an MPI of an integer representing the secret key, which is a scalar of the public EC point.  </t></list></t><t>The version 4 packet format MUST be used.  </t></section><section title="Message Encoding" anchor="message-encoding" toc="default"><t>Section 5.2.3 of <xref target="RFC4880" pageno="false" format="default"/>, "Version 4 Signature Packet Format" specifies formats. To support EdDSA no change is required, the MPIs representing the R and S value are encoded as MPIs in the same way as done for the DSA and ECDSA algorithms; in particular the Algorithm-Specific Fields for an EdDSA signature are: </t><figure title="" suppress-title="false" align="left" alt="" width="" height=""><artwork xml:space="preserve" name="" type="" align="left" alt="" width="" height="">
 - MPI of EdDSA value r.

 - MPI of EdDSA value s.
</artwork></figure><t>Note that the compressed version of R and S as specified for EdDSA (<xref target="I-D.josefsson-eddsa-ed25519" pageno="false" format="default"/>) is used.  </t><t>The version 3 signature format MUST NOT be used with EdDSA.  </t><t>Although that algorithm allows arbitrary data as input, its use with OpenPGP requires that a digest of the message is used as input. See section 5.2.4 of <xref target="RFC4880" pageno="false" format="default"/>, "Computing Signatures" for details. Truncation of the resulting digest is never applied; the resulting digest value is used verbatim as input to the EdDSA algorithm.  </t></section><section title="Curve OID" anchor="curve-oid" toc="default"><t>The EdDSA key parameter curve OID is an array of octets that defines a named curve. The table below specifies the exact sequence of bytes for each named curve referenced in this document: </t><texttable title="" suppress-title="false" align="center" style="full"><ttcol align="left">OID </ttcol><ttcol align="left">Len </ttcol><ttcol align="left">Encoding in hex format </ttcol><ttcol align="left">Name </ttcol><c>1.3.6.1.4.1.11591.15.1 </c><c>9 </c><c>2B 06 01 04 01 DA 47 0F 01 </c><c>Ed25519 </c></texttable><t>See <xref target="RFC6637" pageno="false" format="default"/> for a description of the OID encoding given in the second and third columns.  </t></section><section title="Security Considerations" anchor="security-considerations" toc="default"><t>The security considerations of <xref target="RFC4880" pageno="false" format="default"/> apply accordingly.  </t><t>Although technically possible the use of EdDSA with digest algorithms weaker than SHA-256 (e.g. SHA-1) is not suggested.  </t></section><section title="IANA Considerations" anchor="iana-considerations" toc="default"><t>IANA is requested to assign an algorithm number from the OpenPGP Public-Key Algorithms range, or the "namespace" in the terminology of <xref target="RFC5226" pageno="false" format="default"/>, that was created by <xref target="RFC4880" pageno="false" format="default"/>. See section 2.  </t><texttable title="" suppress-title="false" align="center" style="full"><ttcol align="left">ID </ttcol><ttcol align="left">Algorithm </ttcol><ttcol align="left">Reference </ttcol><c>TBD1 </c><c>EdDSA public key algorithm </c><c>This doc </c></texttable><t>[Notes to RFC-Editor: Please remove the table above on publication.  It is desirable not to reuse old or reserved algorithms because some existing tools might print a wrong description. A higher number is also an indication for a newer algorithm. As of now 22 is the next free number.] </t></section><section title="Acknowledgments" anchor="acknowledgments" toc="default"><t>The author would like to acknowledge the help of the individuals who kindly voiced their opinions on the IETF OpenPGP and GnuPG mailing lists, in particular, the help of Andrey Jivsov, Jon Callas, and NIIBE Yutaka.  </t></section> </middle>
  <back><references title="Normative References"><reference anchor="I-D.josefsson-eddsa-ed25519"><front><title>EdDSA and Ed25519</title><author initials="S" surname="Josefsson" fullname="Simon Josefsson"><organization/></author><author initials="N" surname="Moller" fullname="Niels Moller"><organization/></author><date month="May" day="12" year="2015"/><abstract><t>The elliptic curve signature scheme EdDSA and one instance of it called Ed25519 is described.  An example implementation and test vectors are provided.</t></abstract></front><seriesInfo name="Internet-Draft" value="draft-josefsson-eddsa-ed25519-03"/><format type="TXT" target="http://www.ietf.org/internet-drafts/draft-josefsson-eddsa-ed25519-03.txt"/></reference> <reference anchor="RFC4880"><front><title>OpenPGP Message Format</title><author initials="J." surname="Callas" fullname="J. Callas"><organization/></author><author initials="L." surname="Donnerhacke" fullname="L. Donnerhacke"><organization/></author><author initials="H." surname="Finney" fullname="H. Finney"><organization/></author><author initials="D." surname="Shaw" fullname="D. Shaw"><organization/></author><author initials="R." surname="Thayer" fullname="R. Thayer"><organization/></author><date year="2007" month="November"/><abstract><t>This document is maintained in order to publish all necessary information needed to develop interoperable applications based on the OpenPGP format. It is not a step-by-step cookbook for writing an application. It describes only the format and methods needed to read, check, generate, and write conforming packets crossing any network. It does not deal with storage and implementation questions. It does, however, discuss implementation issues necessary to avoid security flaws.&lt;/t&gt;&lt;t&gt; OpenPGP software uses a combination of strong public-key and symmetric cryptography to provide security services for electronic communications and data storage. These services include confidentiality, key management, authentication, and digital signatures. This document specifies the message formats used in OpenPGP. [STANDARDS-TRACK]</t></abstract></front><seriesInfo name="RFC" value="4880"/><format type="TXT" octets="203706" target="http://www.rfc-editor.org/rfc/rfc4880.txt"/></reference> <reference anchor="RFC6637"><front><title>Elliptic Curve Cryptography (ECC) in OpenPGP</title><author initials="A." surname="Jivsov" fullname="A. Jivsov"><organization/></author><date year="2012" month="June"/><abstract><t>This document defines an Elliptic Curve Cryptography extension to the OpenPGP public key format and specifies three Elliptic Curves that enjoy broad support by other standards, including standards published by the US National Institute of Standards and Technology.  The document specifies the conventions for interoperability between compliant OpenPGP implementations that make use of this extension and these Elliptic Curves. [STANDARDS-TRACK]</t></abstract></front><seriesInfo name="RFC" value="6637"/><format type="TXT" octets="31532" target="http://www.rfc-editor.org/rfc/rfc6637.txt"/></reference> <reference anchor="RFC5226"><front><title>Guidelines for Writing an IANA Considerations Section in RFCs</title><author initials="T." surname="Narten" fullname="T. Narten"><organization/></author><author initials="H." surname="Alvestrand" fullname="H. Alvestrand"><organization/></author><date year="2008" month="May"/><abstract><t>Many protocols make use of identifiers consisting of constants and other well-known values. Even after a protocol has been defined and deployment has begun, new values may need to be assigned (e.g., for a new option type in DHCP, or a new encryption or authentication transform for IPsec). To ensure that such quantities have consistent values and interpretations across all implementations, their assignment must be administered by a central authority. For IETF protocols, that role is provided by the Internet Assigned Numbers Authority (IANA).&lt;/t&gt;&lt;t&gt; In order for IANA to manage a given namespace prudently, it needs guidelines describing the conditions under which new values can be assigned or when modifications to existing values can be made. If IANA is expected to play a role in the management of a namespace, IANA must be given clear and concise instructions describing that role. This document discusses issues that should be considered in formulating a policy for assigning values to a namespace and provides guidelines for authors on the specific text that must be included in documents that place demands on IANA.&lt;/t&gt;&lt;t&gt; This document obsoletes RFC 2434. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t></abstract></front><seriesInfo name="BCP" value="26"/><seriesInfo name="RFC" value="5226"/><format type="TXT" octets="66160" target="http://www.rfc-editor.org/rfc/rfc5226.txt"/></reference> <reference anchor="RFC2119"><front><title abbrev="RFC Key Words">Key words for use in RFCs to Indicate Requirement Levels</title><author initials="S." surname="Bradner" fullname="Scott Bradner"><organization>Harvard University</organization><address><postal><street>1350 Mass. Ave.</street><street>Cambridge</street><street>MA 02138</street></postal><phone>- +1 617 495 3864</phone><email>sob@harvard.edu</email></address></author><date year="1997" month="March"/><area>General</area><keyword>keyword</keyword><abstract><t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized.  This document defines these words as they should be interpreted in IETF documents.  Authors who follow these guidelines should incorporate this phrase near the beginning of their document: <list><t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED",  "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.  </t></list></t><t>Note that the force of these words is modified by the requirement level of the document in which they are used.  </t></abstract></front><seriesInfo name="BCP" value="14"/><seriesInfo name="RFC" value="2119"/><format type="TXT" octets="4723" target="http://www.rfc-editor.org/rfc/rfc2119.txt"/><format type="HTML" octets="17970" target="http://xml.resource.org/public/rfc/html/rfc2119.html"/><format type="XML" octets="5777" target="http://xml.resource.org/public/rfc/xml/rfc2119.xml"/></reference> </references><references title="Informative References"><reference anchor="ED25519" target="http://dx.doi.org/10.1007/s13389-012-0027-1"><front><title>High-speed high-security signatures</title><author fullname="Daniel J. Bernstein" surname="Bernstein" initials="D."/><author fullname="Niels Duif" surname="Duif" initials="N."/><author fullname="Tanja Lange" surname="Lange" initials="T."/><author fullname="Peter Schwabe" surname="Schwabe" initials="P."/><author fullname="Bo-Yin Yang" surname="Yang" initials="B."/><date year="2011" month="September"/><abstract><t>This paper shows that a $390 mass-market quad-core 2.4GHz Intel Westmere (Xeon E5620) CPU can create 109000 signatures per second and verify 71000 signatures per second on an elliptic curve at a 2128 security level. Public keys are 32 bytes, and signatures are 64 bytes.  These performance figures include strong defenses against software side- channel attacks: there is no data flow from secret keys to array indices, and there is no data flow from secret keys to branch conditions.</t></abstract></front><seriesInfo name="Journal of Cryptographic Engineering" value="Volume 2, Issue 2, pp. 77-89"/></reference> </references><!--This document was prepared using Pandoc2rfc, https://github.com/miekg/pandoc2rfc --><section title="Test vectors" anchor="test-vectors" toc="default"><t>For help implementing this specification a non-normative example is given. This example assumes that the algorithm id for EdDSA (TBD1) will be 22.  </t><section title="Sample key" anchor="sample-key" toc="default"><t>The secret key used for this example is: </t><t>D: 1a8b1ff05ded48e18bf50166c664ab023ea70003d78d9e41f5758a91d850f8d2 </t><t>Note that this is the raw secret key used as input to the EdDSA signing operation. The key was created on 2014-08-19 14:28:27 and thus the fingerprint of the OpenPGP key is: </t><figure title="" suppress-title="false" align="left" alt="" width="" height=""><artwork xml:space="preserve" name="" type="" align="left" alt="" width="" height="">
   C959 BDBA FA32 A2F8 9A15  3B67 8CFD E121 9796 5A9A
</artwork></figure><t>The algorithm specific input parameters without the MPI length headers are: </t><t>oid: 2b06010401da470f01 </t><t>q: 403f098994bdd916ed4053197934e4a87c80733a1280d62f8010992e43ee3b2406 </t><t>The entire public key packet is thus: </t><figure title="" suppress-title="false" align="left" alt="" width="" height=""><artwork xml:space="preserve" name="" type="" align="left" alt="" width="" height="">
   98 33 04 53 f3 5f 0b 16  09 2b 06 01 04 01 da 47
   0f 01 01 07 40 3f 09 89  94 bd d9 16 ed 40 53 19
   79 34 e4 a8 7c 80 73 3a  12 80 d6 2f 80 10 99 2e
   43 ee 3b 24 06
</artwork></figure></section><section title="Sample signature" anchor="sample-signature" toc="default"><t>The signature is created using the sample key over the input data "OpenPGP" on 2015-09-16 12:24:53 and thus the input to the hash function is: </t><t>m: 4f70656e504750040016080006050255f95f9504ff0000000c </t><t>Using the SHA-256 hash algorithm yields the digest: </t><t>d: f6220a3f757814f4c2176ffbb68b00249cd4ccdc059c4b34ad871f30b1740280 </t><t>Which is fed into the EdDSA signature function and yields this signature: </t><t>r: 56f90cca98e2102637bd983fdb16c131dfd27ed82bf4dde5606e0d756aed3366 </t><t>s: d09c4fa11527f038e0f57f2201d82f2ea2c9033265fa6ceb489e854bae61b404 </t><t>The entire signature packet is thus: </t><figure title="" suppress-title="false" align="left" alt="" width="" height=""><artwork xml:space="preserve" name="" type="" align="left" alt="" width="" height="">
   88 5e 04 00 16 08 00 06  05 02 55 f9 5f 95 00 0a
   09 10 8c fd e1 21 97 96  5a 9a f6 22 01 00 56 f9
   0c ca 98 e2 10 26 37 bd  98 3f db 16 c1 31 df d2
   7e d8 2b f4 dd e5 60 6e  0d 75 6a ed 33 66 01 00
   d0 9c 4f a1 15 27 f0 38  e0 f5 7f 22 01 d8 2f 2e
   a2 c9 03 32 65 fa 6c eb  48 9e 85 4b ae 61 b4 04
</artwork></figure></section></section><section title="Point compression flag bytes" anchor="point-compression-flag-bytes" toc="default"><t>This specification introduces the new flag byte 0x40 to indicate the point compression format. The value has been chosen so that the high bit is not cleared and thus to avoid accidental sign extension. Two other values might also be interesting for other ECC specifications: </t><figure title="" suppress-title="false" align="left" alt="" width="" height=""><artwork xml:space="preserve" name="" type="" align="left" alt="" width="" height="">
  Flag  Description
  ----  -----------
  0x04  Standard flag for uncompression format
  0x40  Native point format of the curve follows
  0x41  Only X coordinate follows.
  0x42  Only Y coordinate follows.
</artwork></figure></section><section title="Changes since -02" anchor="changes-since--02" toc="default"><t><list style="symbols"><t>Fixed decription in the test vectors regarding an extra 0x00 byte.  </t><t>Small gramar fixes.  </t><t>Reference Josefsson's EdDSA I-D instead of the original paper.  </t></list></t></section> </back>
</rfc>
