idnits 2.17.1 draft-ietf-curdle-ssh-curves-12.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (September 4, 2019) is 1668 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Possible downref: Non-RFC (?) normative reference: ref. 'SHS' Summary: 0 errors (**), 0 flaws (~~), 1 warning (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Internet Engineering Task Force A. Adamantiadis 3 Internet-Draft libssh 4 Intended status: Standards Track S. Josefsson 5 Expires: March 7, 2020 SJD AB 6 M. Baushke 7 Juniper Networks, Inc. 8 September 4, 2019 10 Secure Shell (SSH) Key Exchange Method using Curve25519 and Curve448 11 draft-ietf-curdle-ssh-curves-12 13 Abstract 15 This document describes the specification for using Curve25519 and 16 Curve448 key exchange methods in the Secure Shell (SSH) protocol. 18 Status of This Memo 20 This Internet-Draft is submitted in full conformance with the 21 provisions of BCP 78 and BCP 79. 23 Internet-Drafts are working documents of the Internet Engineering 24 Task Force (IETF). Note that other groups may also distribute 25 working documents as Internet-Drafts. The list of current Internet- 26 Drafts is at https://datatracker.ietf.org/drafts/current/. 28 Internet-Drafts are draft documents valid for a maximum of six months 29 and may be updated, replaced, or obsoleted by other documents at any 30 time. It is inappropriate to use Internet-Drafts as reference 31 material or to cite them other than as "work in progress." 33 This Internet-Draft will expire on March 7, 2020. 35 Copyright Notice 37 Copyright (c) 2019 IETF Trust and the persons identified as the 38 document authors. All rights reserved. 40 This document is subject to BCP 78 and the IETF Trust's Legal 41 Provisions Relating to IETF Documents 42 (https://trustee.ietf.org/license-info) in effect on the date of 43 publication of this document. Please review these documents 44 carefully, as they describe your rights and restrictions with respect 45 to this document. Code Components extracted from this document must 46 include Simplified BSD License text as described in Section 4.e of 47 the Trust Legal Provisions and are provided without warranty as 48 described in the Simplified BSD License. 50 Table of Contents 52 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 53 2. Requirements Language . . . . . . . . . . . . . . . . . . . . 2 54 3. Key Exchange Methods . . . . . . . . . . . . . . . . . . . . 2 55 3.1. Shared Secret Encoding . . . . . . . . . . . . . . . . . 3 56 4. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 4 57 5. Security Considerations . . . . . . . . . . . . . . . . . . . 4 58 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 5 59 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 5 60 7.1. Normative References . . . . . . . . . . . . . . . . . . 5 61 7.2. Informative References . . . . . . . . . . . . . . . . . 6 62 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 6 64 1. Introduction 66 Secure Shell (SSH) [RFC4251] is a secure remote login protocol. The 67 key exchange protocol described in [RFC4253] supports an extensible 68 set of methods. [RFC5656] defines how elliptic curves are integrated 69 into this extensible SSH framework, and this document reuses the 70 Elliptic Curve Diffie-Hellman (ECDH) key exchange protocol messages 71 defined in section 7.1 "ECDH Message Numbers" [RFC5656]. Other parts 72 of [RFC5656], such as Elliptic Curve Menezes-Qu-Vanstone (ECMQV) key 73 agreement, and Elliptic Curve Digital Signature Algorithm (ECDSA) are 74 not considered in this document. 76 This document describes how to implement key exchange based on 77 Curve25519 and Curve448 [RFC7748] in SSH. For Curve25519 with 78 SHA-256 [RFC6234] and [SHS], the algorithm described is equivalent to 79 the privately defined algorithm "curve25519-sha256@libssh.org", which 80 at the time of publication was implemented and widely deployed in 81 libssh [libssh] and OpenSSH [OpenSSH]. The Curve448 key exchange 82 method is similar but uses SHA-512 [RFC6234] and [SHS]. 84 2. Requirements Language 86 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 87 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 88 "OPTIONAL" in this document are to be interpreted as described in 89 BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all 90 capitals, as shown here. 92 3. Key Exchange Methods 94 The key exchange procedure is similar to the ECDH method described in 95 chapter 4 of [RFC5656], though with a different wire encoding used 96 for public values and the final shared secret. Public ephemeral keys 97 are encoded for transmission as standard SSH strings. 99 The protocol flow, the SSH_MSG_KEX_ECDH_INIT and 100 SSH_MSG_KEX_ECDH_REPLY messages, and the structure of the exchange 101 hash are identical to chapter 4 of [RFC5656]. 103 The method names registered by this document are "curve25519-sha256" 104 and "curve448-sha512". 106 The methods are based on Curve25519 and Curve448 scalar 107 multiplication, as described in [RFC7748]. Private and public keys 108 are generated as described therein. Public keys are defined as 109 strings of 32 bytes for Curve25519 and 56 bytes for Curve448. 111 Key-agreement schemes "curve25519-sha256" and "curve448-sha512" 112 perform the Diffie-Hellman protocol using the functions X25519 and 113 X448, respectively. Implementations SHOULD compute these functions 114 using the algorithms described in [RFC7748]. When they do so, 115 implementations MUST check whether the computed Diffie-Hellman shared 116 secret is the all-zero value and abort if so, as described in 117 Section 6 of [RFC7748]. Alternative implementations of these 118 functions SHOULD abort when either input forces the shared secret to 119 one of a small set of values, as described in Section 7 of [RFC7748]. 120 Clients and servers MUST also abort if the length of the received 121 public keys are not the expected lengths. An abort for these 122 purposes is defined as a disconnect (SSH_MSG_DISCONNECT) of the 123 session and SHOULD use the SSH_DISCONNECT_KEY_EXCHANGE_FAILED reason 124 for the message [IANA-REASON]. No further validation is required 125 beyond what is described in [RFC7748]. The derived shared secret is 126 32 bytes when "curve25519-sha256" is used and 56 bytes when 127 "curve448-sha512" is used. The encodings of all values are defined 128 in [RFC7748]. The hash used is SHA-256 for "curve25519-sha256" and 129 SHA-512 for "curve448-sha512". 131 3.1. Shared Secret Encoding 133 The following step differs from [RFC5656], which uses a different 134 conversion. This is not intended to modify that text generally, but 135 only to be applicable to the scope of the mechanism described in this 136 document. 138 The shared secret, K, is defined in [RFC4253] and [RFC5656] as an 139 integer encoded as a multiple precision integer (mpint). 140 Curve25519/448 outputs a binary string X, which is the 32 or 56 byte 141 point obtained by scalar multiplication of the other side's public 142 key and the local private key scalar. The 32 or 56 bytes of X are 143 converted into K by interpreting the octets as an unsigned fixed- 144 length integer encoded in network byte order. 146 The integer K is then encoded as an mpint using the process described 147 in section 5 of [RFC4251] and the resulting bytes are fed as 148 described in [RFC4253] to the key exchange method's hash function to 149 generate encryption keys. 151 When performing the X25519 or X448 operations, the integer values 152 there will be encoded into byte strings by doing a fixed-length 153 unsigned little-endian conversion, per [RFC7748]. It is only later 154 when these byte strings are then passed to the ECDH function in SSH 155 that the bytes are re-interpreted as a fixed-length unsigned big- 156 endian integer value K, and then later that K value is encoded as a 157 variable-length signed "mpint" before being fed to the hash algorithm 158 used for key generation. The mpint K is then fed along with other 159 data to the key exchange method's hash function to generate 160 encryption keys. 162 4. Acknowledgements 164 The "curve25519-sha256" key exchange method is identical to the 165 "curve25519-sha256@libssh.org" key exchange method created by Aris 166 Adamantiadis and implemented in libssh and OpenSSH. 168 Thanks to the following people for review and comments: Denis Bider, 169 Damien Miller, Niels Moeller, Matt Johnston, Eric Rescorla, Ron 170 Frederick, Stefan Buehler. 172 5. Security Considerations 174 The security considerations of [RFC4251], [RFC5656], and [RFC7748] 175 are inherited. 177 Curve25519 with SHA-256 provides strong (~128 bits) security and is 178 efficient on a wide range of architectures, and has properties that 179 allows better implementation properties compared to traditional 180 elliptic curves. Curve448 with SHA-512 provides stronger (~224 bits) 181 security with similar implementation properties, but has not received 182 the same cryptographic review as Curve25519, and is slower (larger 183 key material and larger secure hash algorithm), but it is provided as 184 a hedge to combat unforeseen analytical advances against Curve25519 185 and SHA-256 due to the larger number of security bits. 187 The way the derived binary secret string is encoded into a mpint 188 before it is hashed (i.e., adding or removing zero-bytes for 189 encoding) raises the potential for a side-channel attack which could 190 determine the length of what is hashed. This would leak the most 191 significant bit of the derived secret, and/or allow detection of when 192 the most significant bytes are zero. For backwards compatibility 193 reasons it was decided not to address this potential problem. 195 This document provides "curve25519-sha256" as the preferred choice, 196 but suggests that the "curve448-sha512" is implemented to provide 197 more than 128 bits of security strength should that become a 198 requirement. 200 6. IANA Considerations 202 IANA is requested to add "curve25519-sha256" and "curve448-sha512" to 203 the "Key Exchange Method Names" registry for SSH [IANA-KEX] that was 204 created in RFC 4250 section 4.10 [RFC4250]. 206 7. References 208 7.1. Normative References 210 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 211 Requirement Levels", BCP 14, RFC 2119, 212 DOI 10.17487/RFC2119, March 1997, 213 . 215 [RFC4250] Lehtinen, S. and C. Lonvick, Ed., "The Secure Shell (SSH) 216 Protocol Assigned Numbers", RFC 4250, 217 DOI 10.17487/RFC4250, January 2006, 218 . 220 [RFC4251] Ylonen, T. and C. Lonvick, Ed., "The Secure Shell (SSH) 221 Protocol Architecture", RFC 4251, DOI 10.17487/RFC4251, 222 January 2006, . 224 [RFC4253] Ylonen, T. and C. Lonvick, Ed., "The Secure Shell (SSH) 225 Transport Layer Protocol", RFC 4253, DOI 10.17487/RFC4253, 226 January 2006, . 228 [RFC5656] Stebila, D. and J. Green, "Elliptic Curve Algorithm 229 Integration in the Secure Shell Transport Layer", 230 RFC 5656, DOI 10.17487/RFC5656, December 2009, 231 . 233 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 234 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 235 May 2017, . 237 [SHS] Information Technology Laboratory National Institute of 238 Standards and Technology, "Secure Hash Standard (SHS)", 239 August 2015, . 241 7.2. Informative References 243 [IANA-KEX] 244 Internet Assigned Numbers Authority (IANA), "Secure Shell 245 (SSH) Protocol Parameters: Key Exchange Method Names", 246 August 2019, . 249 [IANA-REASON] 250 Internet Assigned Numbers Authority (IANA), "Secure Shell 251 (SSH) Protocol Parameters: Disconnection Messages Reason 252 Codes and Descriptions", August 2019, 253 . 256 [libssh] libssh, "The SSH Library", September 2019, 257 . 259 [OpenSSH] OpenSSH group of OpenBSD, "The OpenSSH Project", September 260 2019, . 262 [RFC6234] Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms 263 (SHA and SHA-based HMAC and HKDF)", RFC 6234, 264 DOI 10.17487/RFC6234, May 2011, 265 . 267 [RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves 268 for Security", RFC 7748, DOI 10.17487/RFC7748, January 269 2016, . 271 Authors' Addresses 273 Aris Adamantiadis 274 libssh 276 Email: aris@badcode.be 278 Simon Josefsson 279 SJD AB 281 Email: simon@josefsson.org 283 Mark D. Baushke 284 Juniper Networks, Inc. 286 Email: mdb@juniper.net