[Docs] [txt|pdf|xml|html] [Tracker] [Email] [Diff1] [Diff2] [Nits]

Versions: 00 01 02 03 04

Network Working Group                                    A. Adamantiadis
Internet-Draft                                                    libssh
Intended status: Informational                              S. Josefsson
Expires: May 21, 2016                                             SJD AB
                                                       November 18, 2015


  Secure Shell (SSH) Key Exchange Method using Curve25519 and Curve448
                     draft-josefsson-ssh-curves-02

Abstract

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

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on May 21, 2016.

Copyright Notice

   Copyright (c) 2015 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.





Adamantiadis & Josefsson  Expires May 21, 2016                  [Page 1]


Internet-Draft           Curve25519/448 for SSH            November 2015


Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
   2.  Key Exchange Methods  . . . . . . . . . . . . . . . . . . . .   2
     2.1.  Shared Secret Encoding  . . . . . . . . . . . . . . . . .   3
   3.  Acknowledgements  . . . . . . . . . . . . . . . . . . . . . .   3
   4.  Security Considerations . . . . . . . . . . . . . . . . . . .   4
   5.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .   4
   6.  References  . . . . . . . . . . . . . . . . . . . . . . . . .   4
     6.1.  Normative References  . . . . . . . . . . . . . . . . . .   4
     6.2.  Informative References  . . . . . . . . . . . . . . . . .   5
   Appendix A.  Copying conditions . . . . . . . . . . . . . . . . .   5
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .   5

1.  Introduction

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

   Secure Shell (SSH) [RFC4251] is a secure remote login protocol.  The
   key exchange protocol described in [RFC4253] supports an extensible
   set of methods.  [RFC5656] describes how elliptic curves are
   integrated in SSH, and this document reuses those protocol messages.

   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.

   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 [RFC2119].

2.  Key Exchange Methods

   The key exchange procedure is similar to the ECDH method described in
   chapter 4 of [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.

   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 [RFC5656].



Adamantiadis & Josefsson  Expires May 21, 2016                  [Page 2]


Internet-Draft           Curve25519/448 for SSH            November 2015


   The method names registered by this document are "curve25519-sha256"
   and "curve448-sha256".

   The methods are based on Curve25519 and Curve448 scalar
   multiplication, as described in [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 [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 [I-D.irtf-cfrg-curves].

2.1.  Shared Secret Encoding

   The following step differs from [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.

   The shared secret, K, is defined in [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.

   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:

   o  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.

   o  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.

3.  Acknowledgements

   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.

   Thanks to the following people for review and comments: Denis Bider,
   Damien Miller, Niels Moeller, Matt Johnston.







Adamantiadis & Josefsson  Expires May 21, 2016                  [Page 3]


Internet-Draft           Curve25519/448 for SSH            November 2015


4.  Security Considerations

   The security considerations of [RFC4251], [RFC5656], and
   [I-D.irtf-cfrg-curves] are inherited.

   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.

5.  IANA Considerations

   IANA is requested to add "curve25519-sha256" and "curve448-sha256" to
   the "Key Exchange Method Names" registry for SSH that was created in
   RFC 4250 section 4.10 [RFC4250].

6.  References

6.1.  Normative References

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

   [RFC4250]  Lehtinen, S. and C. Lonvick, Ed., "The Secure Shell (SSH)
              Protocol Assigned Numbers", RFC 4250, DOI 10.17487/
              RFC4250, January 2006,
              <http://www.rfc-editor.org/info/rfc4250>.

   [RFC4251]  Ylonen, T. and C. Lonvick, "The Secure Shell (SSH)
              Protocol Architecture", RFC 4251, January 2006.

   [RFC4253]  Ylonen, T. and C. Lonvick, Ed., "The Secure Shell (SSH)
              Transport Layer Protocol", RFC 4253, DOI 10.17487/RFC4253,
              January 2006, <http://www.rfc-editor.org/info/rfc4253>.

   [RFC5656]  Stebila, D. and J. Green, "Elliptic Curve Algorithm
              Integration in the Secure Shell Transport Layer", RFC
              5656, DOI 10.17487/RFC5656, December 2009,
              <http://www.rfc-editor.org/info/rfc5656>.

   [I-D.irtf-cfrg-curves]
              Langley, A. and M. Hamburg, "Elliptic Curves for
              Security", draft-irtf-cfrg-curves-10 (work in progress),
              October 2015.





Adamantiadis & Josefsson  Expires May 21, 2016                  [Page 4]


Internet-Draft           Curve25519/448 for SSH            November 2015


6.2.  Informative References

   [Curve25519]
              Bernstein, J., "Curve25519: New Diffie-Hellman Speed
              Records", LNCS 3958, pp. 207-228, February 2006,
              <http://dx.doi.org/10.1007/11745853_14>.

   [Ed448-Goldilocks]
              Hamburg, , "Ed448-Goldilocks, a new elliptic curve", June
              2015, <https://eprint.iacr.org/2015/625>.

Appendix A.  Copying conditions

   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.

Authors' Addresses

   Aris Adamantiadis
   libssh

   Email: aris@badcode.be


   Simon Josefsson
   SJD AB

   Email: simon@josefsson.org

















Adamantiadis & Josefsson  Expires May 21, 2016                  [Page 5]


Html markup produced by rfcmarkup 1.129d, available from https://tools.ietf.org/tools/rfcmarkup/