Curve25519 and Curve448 for the Internet Key Exchange Protocol Version 2 (IKEv2) Key AgreementCheck Point Software Technologies Ltd.5 Hasolelim st.Tel Aviv6789735Israelynir.ietf@gmail.comSJD ABsimon@josefsson.org
Security Area
This document describes the use of Curve25519 and Curve448
for ephemeral key exchange in the Internet Key Exchange Protocol Version
2 (IKEv2).The "Elliptic Curves for Security" document
describes two elliptic curves, Curve25519 and Curve448, as well as the X25519
and X448 functions for performing key agreement using Diffie-Hellman operations
with these curves. The curves and functions are designed for both performance
and security.Elliptic curve Diffie-Hellman has been specified
for the Internet Key Exchange Protocol Version 2 (IKEv2) for almost
ten years. RFC 5903 and its predecessor specified the so-called NIST curves. The state of the
art has advanced since then.
More modern curves allow faster implementations
while making it much easier to write constant-time implementations that
are resilient to
time-based side-channel attacks. This document defines two such curves for
use in IKEv2. See for details about the speed and
security of the Curve25519 function.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 .Implementations of Curve25519 and Curve448 in IKEv2 SHALL follow the steps
described in this section. All cryptographic computations are done using the
X25519 and X448
functions defined in . All related parameters
(for example, the base point) and the encoding (in particular, pruning
the least/most significant bits and using little-endian encoding) are
compliant with .An ephemeral Diffie-Hellman key exchange using Curve25519 or Curve448
is performed as follows: each party picks a secret key d uniformly at random and
computes the corresponding public key. "X" is used below to denote either
X25519 or X448, and "G" is used to denote the corresponding base point:Parties exchange their public keys (see )
and compute a shared secret: This shared secret is used directly as the value denoted g^ir in
Section 2.14 of RFC 7296. It is 32 octets when Curve25519 is used and 56
octets when Curve448 is used. The use of Curve25519 and Curve448 in IKEv2 is negotiated using a
Transform Type 4 (Diffie-Hellman group) in the Security Association (SA) payload of either an
IKE_SA_INIT or a CREATE_CHILD_SA exchange. The value 31 is used for
the group defined by Curve25519 and the value 32 is used for the group
defined by Curve448. The diagram for the Key Exchange payload from Section 3.4 of
RFC 7296 is copied below for convenience: Payload Length - For Curve25519, the public key is 32 octets, so
the Payload Length field will be 40. For Curve448, the public key
is 56 octets, so the Payload Length field will be 64. The Diffie-Hellman Group Num is 31 for Curve25519 or 32 for
Curve448. The Key Exchange Data is the 32
or 56 octets as described in Section 6 of .
Receiving and handling of incompatible point formats MUST follow the
considerations described in Section 5 of . In
particular, receiving entities MUST mask the most-significant bit in
the final byte for X25519 (but not X448), and implementations MUST
accept noncanonical values.Curve25519 and Curve448 are designed to facilitate the production of
high-performance constant-time implementations. Implementors are
encouraged to use a constant-time implementation of the functions. This
point is of crucial importance, especially if the implementation chooses to
reuse its ephemeral key pair in many key exchanges for performance reasons.Curve25519 is intended for the ~128-bit security level, comparable to
the 256-bit random ECP Groups
(group 19) defined in RFC 5903, also known
as NIST P-256 or secp256r1. Curve448 is intended for the ~224-bit
security level.While the NIST curves are advertised as being chosen verifiably at
random, there is no explanation for the seeds used to generate them. In
contrast, the process used to pick Curve25519 and Curve448 is fully documented and
rigid enough so that independent verification can and has been done. This is
widely seen as a security advantage because it prevents the generating
party from maliciously manipulating the parameters.Another family of curves available in IKE that were generated in a fully
verifiable way is the Brainpool curves . For
example, brainpoolP256 (group 28) is expected to provide a level of
security comparable to Curve25519 and NIST P-256. However, due to the
use of pseudorandom prime, it is significantly slower than NIST P-256,
which is itself slower than Curve25519. IANA has assigned two values for the names "Curve25519"
and "Curve448" in the IKEv2 "Transform Type 4 -
Diffie-Hellman Group Transform IDs" and has listed this document as the
reference. The Recipient Tests field
should also point to this document:NumberNameRecipient TestsReference31Curve25519RFC 8031, RFC 803132Curve448RFC 8031, RFC 8031Key words for use in RFCs to Indicate Requirement LevelsInternet Key Exchange Protocol Version 2 (IKEv2)Elliptic Curves for SecurityElliptic Curve Groups modulo a Prime (ECP Groups) for IKE and IKEv2Curve25519: New Diffie-Hellman Speed RecordsUsing the Elliptic Curve Cryptography (ECC) Brainpool Curves for the Internet Key Exchange Protocol Version 2 (IKEv2) Suppose we have both the initiator and the responder generating private keys
by generating 32 random octets. As usual in IKEv2 and its extension, we will
denote Initiator values with the suffix _i and responder values with the
suffix _r: These numbers need to be fixed by unsetting some bits as described in
Section 5 of RFC 7748. This affects only the first and last octets of each
value: The actual private keys are considered to be encoded in little-endian
format: The public keys are generated from this using the formula in : And this is the value of the Key Exchange Data field in the Key Exchange
payload described in . The shared value is
calculated as in :Curve25519 was designed by D. J. Bernstein and the parameters for
Curve448 ("Goldilocks") were defined by Mike Hamburg. The specification of
algorithms, wire format, and other considerations are documented in RFC 7748
by Adam Langley, Mike Hamburg, and Sean Turner.The example in was calculated using the
master version of OpenSSL, retrieved on August 4th, 2016.