]>
Elliptic-Curve Algorithm Integration in the Secure Shell Transport LayerQueensland University of TechnologyInformation Security InstituteLevel 7, 126 Margaret StBrisbaneQueensland4000Australiadouglas@stebila.caQueen's UniversityParallel Processing Research LaboratoryDepartment of Electrical and Computer EngineeringRoom 614, Walter Light HallKingstonOntarioK7L 3N6Canadajon.green@ece.queensu.ca
Security
Secure Shell Working GroupI-DInternet-DraftElliptic Curve Cryptography (ECC)SSHThis document describes algorithms based on Elliptic Curve Cryptography (ECC) for use within the Secure Shell (SSH) transport protocol. In particular, it specifies: Elliptic Curve Diffie-Hellman (ECDH) key agreement, Elliptic Curve Menezes-Qu-Vanstone (ECMQV) key agreement and Elliptic Curve Digital Signature Algorithm (ECDSA) for use in the SSH Transport Layer protocol.Due to its inclusion in NSA's Suite B and its small key sizes elliptic curve cryptography (ECC) is becoming a widely utilized and attractive public-key cryptosystem.In the interest of adding Suite B algorithms to SSH this document adds three ECC Suite B algorithms to the Secure Shell arsenal: Elliptic Curve Menezes-Qu-Vanstone (ECMQV), Elliptic Curve Diffie-Hellman (ECDH), and Elliptic Curve Digital Signature Algorithm (ECDSA), as well as utilizing the SHA2 family of secure hash algorithms.Compared to cryptosystems such as RSA, DSA, and DH, ECC variations on these schemes offer equivalent security with smaller key sizes. This is illustrated in the following table, based on Section 5.6.1 of NIST 800-57 , which gives approximate comparable key sizes for symmetric- and asymmetric-key cryptosystems based on the best known algorithms for attacking them. L is field size and N is sub-field size.SymmetricDiscrete Log (eg. DSA, DH)RSAECC80L = 1024 N = 1601024160-223112L = 2048 N = 2562048224-255128L = 3072 N = 2563072256-383192L = 7680 N = 3847680384-511256L = 15360 N = 51215360512+Implementation of this specification requires familiarity with both SSH and ECC .This document is concerned with SSH implementation details; specification of the underlying cryptographic algorithms is left to other standards documents.Comments on this draft are solicited and should be addressed to Douglas Stebila <douglas@stebila.ca>.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 .The data types boolean, uint32, uint64, string, and mpint are to be interpreted in this document as described in .The size of a set of elliptic curve domain parameters on a prime curve is defined as the number of bits in the binary representation of the field order, commonly denoted p. Size on a characteristic-2 curve is defined as the number of bits in the binary representation of the field, commonly denoted m. A set of elliptic curve domain parameters defines a group of order n generated by a base point P.The ECC public key algorithm is defined by its key format, corresponding signature algorithm ECDSA, signature encoding and algorithm identifiers.This section defines the family of "ecdsa-sha2-*" public key formats and corresponding signature formats. Every compliant SSH ECC implementation MUST implement this public key format.The "ecdsa-sha2-*" key formats all have the following encoding:The ecc_key_blob value has the following specific encoding:The string [identifier] is the identifier of the elliptic curve domain parameters. The format of this string is specified in . Information on the required and recommended sets of elliptic curve domain parameters for use with this algorithm can be found in .Q is the public key encoded from an elliptic curve point into an octet string as defined in Section 2.3.3 of ; point compression MUST NOT be used.The algorithm for ECC key generation can be found in Section 3.2 of . Given some elliptic curve domain parameters, an ECC key pair can be generated containing a private key, an integer d, and a public key, an elliptic curve point Q.Signing and verifying is done using the Elliptic Curve Digital Signature Algorithm (ECDSA). ECDSA is specified in and in . The message hashing algorithm must be from the SHA2 family of hash functions and is chosen according to the curve size as specified in .Signatures are encoded as follows:The string [identifier] is the identifier of the elliptic curve domain parameters. The format of this string is specified in . Information on the required and recommended sets of elliptic curve domain parameters for use with this algorithm can be found in .The ecdsa_signature_blob value has the following specific encoding:The integers r and s are the output of the ECDSA algorithm.The width of the integer fields is determined by the curve being used. Note that the integers r and s are integers modulo the order of the curve, which may be larger than the size of the finite field. Thus, the integers r and s are encoded as octet strings each of length ciel(log[2](n)/8) using Section 2.3.7 of , where n is the order of the elliptic curve group.The Elliptic Curve Diffie-Hellman (ECDH) key exchange method generates a shared secret from an ephemeral local elliptic curve private key and ephemeral remote elliptic curve public key. This key exchange method provides explicit server authentication as defined in using a signature on the exchange hash. Every compliant SSH ECC implementation MUST implement ECDH Key Exchange.The primitive used for shared key generation is ECDH with cofactor multiplication, the full specification of which can be found in Section 3.3.2 of . The algorithm for key pair generation can be found in Section 3.2 of .The family of key exchange method names defined for use with this key exchange can be found in . Algorithm negotiation chooses the public key algorithm to be used for signing and the method name of the key exchange. The method name of the key exchange chosen determines the elliptic curve domain parameters and hash function to be used in the remainder of this section.Information on the required and recommended elliptic curve domain parameters for use with this method can be found in .All elliptic curve public keys MUST be validated after they are received. An example of a validation algorithm can be found in A.16.10 of . If a key fails validation the key exchange MUST fail.The elliptic curve public keys (points) that must be transmitted are encoded into octet strings before they are transmitted. The transformation between elliptic curve points and octet strings is specified in Sections 2.3.3 and 2.3.4 of ; point compression MUST NOT be used. The output of shared key generation is a field element xp. The ssh framework requires that the shared key be an integer. The conversion between a field element and an integer is specified in Section 2.3.9 of .Specification of the message numbers SSH_MSG_KEX_ECDH_INIT and SSH_MSG_KEX_ECDH_REPLY are found in .*It is recommended that the client verify that the host key sent is the server's host key (using certificates or a local database). The client is allowed to accept the host key without verification, but doing so will render the protocol insecure against active attacks; see the discussion in Section 4.1 of .This is implemented using the following messages.The Elliptic Curve Menezes-Qu-Vanstone (ECMQV) key exchange algorithm generates a shared secret from two local elliptic curve key pairs and two remote public keys. This key exchange method provides implicit server authentication as defined in . The ECMQV key exchange method is OPTIONAL.The key exchange method name defined for use with this key exchange is "ecmqv-sha2". This method name gives a hashing algorithm that is to be used for the HMAC below. Future RFCs may define new method names specifying new hash algorithms for use with ECMQV. More information about the method name and HMAC can be found in .In general the ECMQV key exchange is performed using the ephemeral and long term key pair of both the client and server, a total of 4 keys. Within the framework of SSH the client does not have a long term key pair that needs to be authenticated. Therefore we generate an ephemeral key and use that as both the clients keys. This is more efficient than using two different ephemeral keys and does not adversely affect security (it is analogous to the one-pass protocol in Section 6.1 of ).A full description of the ECMQV primitive can be found in Section 3.4 of . The algorithm for key pair generation can be found in Section 3.2 of .During algorithm negotiation with the SSH_MSG_KEXINIT messages the ECMQV key exchange method can only be chosen if a Public Key Algorithm supporting ECC host keys can also be chosen. This is due to the use of implicit server authentication in this key exchange method. This case is handled the same way that key exchange methods requiring encryption/signature capable public key algorithms are handled in Section 7.1 of . If ECMQV key exchange is chosen then the Public Key Algorithm supporting ECC host keys MUST also be chosen.ECMQV requires that all the keys used to generate a shared secret are generated over the same elliptic curve domain parameters. Since the host key is used in the generation of the shared secret, allowing for implicit server authentication, the domain parameters associated with the host key are used throughout this section.All elliptic curve public keys MUST be validated after they are received. An example of a validation algorithm can be found in A.16.10 of . If a key fails validation the key exchange MUST fail.The elliptic curve public keys (points) that must be transmitted are encoded into octet strings before they are transmitted. The transformation between elliptic curve points and octet strings is specified in Sections 2.3.3 and 2.3.4 of ; point compression MAY be used. The output of shared key generation is a field element xp. The ssh framework requires that the shared key be an integer. The conversion between a field element and an integer is specified in Section 2.3.9 of .*It is recommended that the client verify that the host key sent is the server's host key (Using certificates or a local database). The client is allowed to accept the host key without verification, but doing so will render the protocol insecure against active attacks.The specification of the message numbers SSH_MSG_ECMQV_INIT and SSH_MSG_ECMQV_REPLY can be found in .This key exchange algorithm is implemented with the following messages.This document defines a new family of key exchange method names, a new key exchange method name, and a new family of public key algorithm names in the SSH name registry. These additions to the SSH name space will have to be approved the IANA.This section specifies identifiers encoding named elliptic curve domain parameters. These identifiers are used in this document to identify the curve used in the ECC public key format, the ECDSA signature blob, and the ECDH method name.For the REQUIRED elliptic curves nistp256, nistp384, and nistp521, the elliptic curve domain parameter identifiers are the strings "nistp256", "nistp384", and "nistp521".For all other elliptic curves, including all other NIST curves and all other RECOMMENDED An elliptic curve domain parameter identifier is the ASCII representation of the ASN.1 Object Identifier (OID) of the named curve domain parameters that are associated with the server's ECC host keys, provided that the concatenation of the public key format identifier and the elliptic curve domain parameter identifer (or the method name and the elliptic curve domain parameter identifier) does not exceed the maximum specified by the SSH Protocol Architecture , namely 64 characters; otherwise the identifier for that curve is undefined.A list of the REQUIRED and RECOMMENDED curves and their OIDs can be found in .Note that implementations MUST use the string identifiers for the three REQUIRED NIST curves, even when an OID exists for that curve.The ECC Public Key Algorithm is specified by a family of public key format identifiers. Each identifer is the concatenation of the string "ecdsa-sha2-" with the elliptic curve domain parameter identifier as defined in . A list of the required and recommended curves and their OIDs can be found in .For example: The method name for ECDH key exchange with ephemeral keys generated on the nistp256 curve would be "ecdsa-sha2-nistp256".The Elliptic Curve Digital Signature Algorithm (ECDSA) is specified for use with the ECC Public Key Algorithm.The hashing algorithm defined by this family of method names is the SHA2 family of hashing algorithms . The algorithm from the SHA2 family that will be used is chosen based on the size of the named curve specified in the public key:Curve SizeHash Algorithmb <= 256SHA-256256 < b <= 384SHA-384384 < bSHA-512The Elliptic Curve Diffie-Hellman key exchange is defined by a family of method names. Each method name is the concatenation of the string "ecdh-sha2-" with the elliptic curve domain parameter identifier as defined in . A list of the required and recommended curves and their OIDs can be found in .For example: The method name for ECDH key exchange with ephemeral keys generated on the sect409k1 curve would be "ecdh-sha2-1.3.132.0.36".The hashing algorithm defined by this family of method names is the SHA2 family of hashing algorithms . The hashing algorithm is defined in the method name to allow room for other algorithms to be defined in future documents. The algorithm from the SHA2 family that will be used is chosen based on the size of the named curve specified in the method name according to the table in .The concatenation of any so encoded ASN.1 OID specifying a set of elliptic curve domain parameters with "ecdh-sha2-" is implicitly registered under this specification.The Elliptic Curve Menezes-Qu-Vanstone key exchange is defined by the method name "ecmqv-sha2". Unlike the ECDH key exchange method, ECMQV relies on a public key algorithm that uses ECC keys: it does not need a family of method names because the curve information can be gained from the public key algorithm.The hashing and message authentication code algorithms are defined by the method name to allow room for other algorithms to be defined for use with ECMQV in future documents.The hashing algorithm defined by this method name is the SHA2 family of hashing algorithms . The algorithm from the SHA2 family that will be used is chosen based on the size of the named curve specified for use with ECMQV by the chosen public key algorithm according to the table in .The keyed-hash message authentication code that is used to identify the server and verify communications is based on the hash chosen above. The information on implementing the HMAC based on the chosen hash algorithm can be found in .The message numbers 30-49 are key exchange-specific and in a private namespace defined in that may be redefined by any key exchange method without being granted IANA permission.The following message numbers have been defined in this document:The Elliptic Curve Diffie-Hellman key agreement algorithm is defined in , and . The appropriate security considerations of those documents apply.The Elliptic Curve Menezes-Qu-Vanstone key agreement algorithm is defined in . The security considerations raised in that document also apply. A more detailed discussion of security considerations can be found in Section 4.7 of the Guide to Elliptic Curve Cryptography .The server's host key is used in the ECMQV key exchange algorithm. This means that the strength of the server's ECC host key determines the strength of the ECMQV key exchange algorithm. This should be taken into consideration when generating ECC keys for a server.The methods defined in rely on the SHA2 family of hashing functions as defined in . The appropriate security considerations of that document apply.The hashing algorithms defined for use with ECDH and ECMQV are defined by their method names so that if security problems are found with the SHA2 family of hashing algorithms or more secure hashing algorithms become the standard then future documents can extend this document to include new hashing algorithms by defining new method names.Additionally a good general discussion of the security considerations that must be taken into account when creating an ECC implementation can be found in Section 5 of the Guide to Elliptic Curve Cryptography .Since ECDH and ECMQV allow for elliptic curves of arbitrary sizes and thus arbitrary security strength, it is important that the size of elliptic curve be chosen to match the security strength of other elements of the SSH handshake. In particular, host key sizes, hashing algorithms and bulk encryption algorithms must be chosen appropriately. Information regarding estimated equivalence of key sizes is available in . We note in particular that when ECDSA is used as the signature algorithm and ECDH is used as the key exchange method, if curves of different sizes are used, then it is possible that different hash functions from the SHA2 family could be used.Implementations MAY support any ASN.1 object identifier (OID) in the ASN.1 object tree that defines a set of elliptic curve domain parameters .Every SSH ECC implementation MUST support the named curves below. These curves are defined in . These curves should always be enabled unless specifically disabled by local security policy.NIST*SECOIDnistp256secp256r11.2.840.10045.3.1.7nistp384secp384r11.3.132.0.34nistp521secp521r11.3.132.0.35* For these three REQUIRED curves, the elliptic curve domain parameter identifier is the string in the first column of the table, the NIST name of the curve. (See .)It is RECOMMENDED that SSH ECC implementations also support the following curves. These curves are defined in .NISTSECOID*nistk163sect163k11.3.132.0.1nistp192secp192r11.2.840.10045.3.1.1nistp224secp224r11.3.132.0.33nistk233sect233k11.3.132.0.26nistb233sect233r11.3.132.0.27nistk283sect283k11.3.132.0.16nistk409sect409k11.3.132.0.36nistb409sect409r11.3.132.0.37nistt571sect571k11.3.132.0.38* For these RECOMMENDED curves, the elliptic curve domain parameter identifier is the string in the third column of the table, the ASCII representation of the OID of the curve. (See .)Abstract Syntax Notation One (ASN.1): Specification of basic notationInternational Telecommunications UnionSecure Hash StandardNational Institute of Standards and Technology
&rfc2104;
&rfc2119;
&rfc4251;
&rfc4250;
&rfc4253;
Elliptic Curve CryptographyStandards for Efficient Cryptography GroupRecommended Elliptic Curve Domain ParametersStandards for Efficient Cryptography GroupPublic Key Cryptography For The Financial Services Industry: The Elliptic Curve Digital Signature Algorithm (ECDSA)American National Standards InstitutePublic Key Cryptography For The Financial Services Industry: Key Agreement and Key Transport Using Elliptic Curve CryptographyAmerican National Standards InstituteGuide to Elliptic Curve CryptographySpringer, ISBN 038795273XStandard Specifications for Public Key CryptographyInstitute of Electrical and Electronics EngineersAn Efficient Protocol for Authenticated Key AgreementRecommendation for Key Management - Part 1: General (Revised)National Institute of Standards and TechnologyRecommended Elliptic Curves for Federal Government UseNational Institute of Standards and TechnologyThe authors acknowledge helpful comments from James Blaisdell, Alfred Hoenes, Russ Housley, Jeffrey Hutzelman, Rob Lambert, Jan Pechanek, Tim Polk, and members of the ietf-ssh@netbsd.org mailing list.