One document matched: draft-josefsson-ssh-curves-02.xml


<?xml version="1.0"?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY rfc2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY rfc4250 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4250.xml">
<!ENTITY rfc4251 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4251.xml">
<!ENTITY rfc4253 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4253.xml">
<!ENTITY rfc5656 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5656.xml">
<!ENTITY CURVES PUBLIC '' 'http://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.irtf-cfrg-curves.xml'>
]>

<?rfc compact="yes"?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>

<rfc category="info" ipr="trust200902"
     docName="draft-josefsson-ssh-curves-02">

  <front>

    <title abbrev="Curve25519/448 for SSH">
      Secure Shell (SSH) Key Exchange Method using Curve25519 and
      Curve448
    </title>
    
    <author initials="A." surname="Adamantiadis" fullname="Aris Adamantiadis">
      <organization>libssh</organization>
      <address>
	<email>aris@badcode.be</email>
      </address>
    </author>

    <author initials="S." surname="Josefsson" fullname="Simon Josefsson">
      <organization>SJD AB</organization>
      <address>
	<email>simon@josefsson.org</email>
      </address>
    </author>

    <date month="November" year="2015"/>

    <abstract>

      <t>
	How to implement the Curve25519 and Curve448 key exchange
	methods in the Secure Shell (SSH) protocol is described.
      </t>

    </abstract>

  </front>
  
  <middle>

    <section title="Introduction">

      <t>
	In <xref target="Curve25519" />, a new elliptic curve function
	for use in cryptographic applications was introduced.  In
	<xref target="Ed448-Goldilocks" /> the Ed448-Goldilocks curve
	(also known as Curve448) is described.  In <xref
	target="I-D.irtf-cfrg-curves"/>, the Diffie-Hellman functions
	using Curve25519 and Curve448 are specified.
      </t>

      <t>
	Secure Shell (SSH) <xref target="RFC4251"/> is a secure remote
	login protocol.  The key exchange protocol described in <xref
	target="RFC4253"/> supports an extensible set of methods.
	<xref target="RFC5656"/> describes how elliptic curves are
	integrated in SSH, and this document reuses those protocol
	messages.
      </t>

      <t>
	This document describes how to implement key exchange based on
	Curve25519 and Curve448 in SSH.  For Curve25519, the algorithm
	we describe is equivalent to the privately defined algorithm
	"curve25519-sha256@libssh.org", which is currently implemented
	and widely deployed in libssh and OpenSSH.  The Curve448 key
	exchange method is novel but similar in spirit.
      </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">RFC 2119</xref>.
      </t>

    </section>

    <section title="Key Exchange Methods">

      <t>
	The key exchange procedure is similar to the ECDH method
	described in chapter 4 of <xref target="RFC5656" />, though
	with a different wire encoding used for public values and the
	final shared secret.  Public ephemeral keys are encoded for
	transmission as standard SSH strings.
      </t>

      <t>
	The protocol flow, the SSH_MSG_KEX_ECDH_INIT and
	SSH_MSG_KEX_ECDH_REPLY messages, and the structure of the
	exchange hash are identical to chapter 4 of <xref
	target="RFC5656" />.
      </t>

      <t>
	The method names registered by this document are
	"curve25519-sha256" and "curve448-sha256".
      </t>

      <t>
	The methods are based on Curve25519 and Curve448 scalar
	multiplication, as described in <xref
	target="I-D.irtf-cfrg-curves"/>.  Private and public keys are
	generated as described therein.  Public keys are defined as
	strings of 32 bytes for Curve25519 and 56 bytes for Curve448.
	Clients and servers MUST verify the length of the received
	public keys, but no further validation is required beyond what
	is discussed in <xref target="I-D.irtf-cfrg-curves"/>.  The
	derived shared secret is 32 bytes when Curve25519 is used and
	56 bytes when Curve448 is used.  The encodings of all values
	are defined in <xref target="I-D.irtf-cfrg-curves"/>.
      </t>

      <section title="Shared Secret Encoding">

	<t>
          The following step differs from <xref target="RFC5656"/>,
          which uses a different conversion.  This is not intended to
          modify that text generally, but only to be applicable to the
          scope of this document.
	</t>

	<t>
	  The shared secret, K, is defined in <xref target="RFC4253"/>
	  as a multiple precision integer (mpint).  Curve25519/448
	  outputs a binary string X, which is the 32 or 56 byte point
	  obtained by scalar multiplication of the other side's public
	  key and the local private key scalar.  The 32 or 56 bytes of
	  X are converted into K by interpreting the bytes as an
	  unsigned fixed-length integer encoded in network byte order.
	</t>

	<t>
	  When K is encoded as mpint in order to calculate the
	  exchange hash, its encoding will often be identical to X,
	  but will vary as follows:
	
	  <list style="symbols">
	  
	    <t>
	      If the high bit of X is set, the mpint format requires a
	      zero byte to be prepended. In this case, encoded K is
	      larger than encoded X.
	    </t>
	  
	    <t>
	      If X has leading zero bytes, the mpint format requires
	      such bytes to be skipped. In this case, encoded K is
	      smaller than encoded X.
	    </t>
	  
	  </list>
	</t>
      
      </section>

    </section>

    <section title="Acknowledgements">

      <t>
	The "curve25519-sha256" key exchange method is identical to
	the "curve25519-sha256@libssh.org" key exchange method created
	by Aris Adamantiadis and implemented in libssh and OpenSSH.
      </t>

      <t>
	Thanks to the following people for review and comments: Denis
	Bider, Damien Miller, Niels Möller, Matt Johnston.
      </t>

    </section>

    <section title="Security Considerations">

      <t>
	The security considerations of <xref target="RFC4251"/>, <xref
	target="RFC5656"/>, and <xref target="I-D.irtf-cfrg-curves"/>
	are inherited.
      </t>

      <t>
	The way the derived binary secret string is encoded into a
	mpint before it is hashed (i.e., adding or removing zero-bytes
	for encoding) raises the potential for a side-channel attack
	which could determine the length of what is hashed.  This
	would leak the most significant bit of the derived secret,
	and/or allow detection of when the most significant bytes are
	zero.
      </t>
      
    </section>

    <section anchor="iana-considerations" title="IANA Considerations">

      <t>
	IANA is requested to add "curve25519-sha256" and
	"curve448-sha256" to the "Key Exchange Method Names" registry
	for SSH that was created in <xref target="RFC4250">RFC 4250
	section 4.10</xref>.
      </t>

    </section>

  </middle>

  <back>

    <references title="Normative References">

      &rfc2119;
      &rfc4250;
      &rfc4251;
      &rfc4253;
      &rfc5656;
      &CURVES;

    </references>

    <references title="Informative References">

     <reference anchor="Curve25519"
		target="http://dx.doi.org/10.1007/11745853_14">
       <front>
         <title>
           Curve25519: New Diffie-Hellman Speed Records
         </title>
         <author surname="Bernstein" initials="J."
                 fullname="Daniel J. Bernstein">
           <organization></organization>
         </author>
         <date month="February" year="2006"/>
       </front>
       <seriesInfo name="LNCS" value="3958, pp. 207-228" />
     </reference>

     <reference anchor="Ed448-Goldilocks"
		target="https://eprint.iacr.org/2015/625">
       <front>
         <title>
           Ed448-Goldilocks, a new elliptic curve
         </title>
         <author surname="Hamburg" fullname="Mike Hamburg">
           <organization></organization>
         </author>
         <date month="June" year="2015"/>
       </front>
     </reference>

    </references>

    <section title="Copying conditions">

      <t>
	Regarding this entire document or any portion of it, the
	authors make no guarantees and are not responsible for any
	damage resulting from its use.  The authors grant irrevocable
	permission to anyone to use, modify, and distribute it in any
	way that does not diminish the rights of anyone else to use,
	modify, and distribute it, provided that redistributed
	derivative works do not contain misleading author or version
	information.  Derivative works need not be licensed under
	similar terms.
      </t>

    </section>

  </back>

</rfc>

PAFTECH AB 2003-20262026-04-21 17:50:24