@@ -122,24 +122,65 @@ Perfect forward secrecy is achieved by randomly generating a key pair for
122122key-agreement on every TLS/SSL handshake (in contrast to using the same key for
123123all sessions). Methods implementing this technique are called "ephemeral".
124124
125- Currently two methods are commonly used to achieve perfect forward secrecy (note
126- the character "E" appended to the traditional abbreviations):
125+ The following key-agreement methods provide perfect forward secrecy (note the
126+ character "E" appended to the traditional abbreviations):
127127
128128* [ ECDHE] [ ] : An ephemeral version of the Elliptic Curve Diffie-Hellman
129129 key-agreement protocol.
130130* [ DHE] [ ] : An ephemeral version of the Diffie-Hellman key-agreement protocol.
131+ * Hybrid post-quantum key exchange: TLSv1.3 groups such as ` X25519MLKEM768 `
132+ that combine ECDHE with the ML-KEM key-encapsulation mechanism. The session
133+ keys stay secret as long as either component is unbroken, which protects
134+ recorded traffic against later decryption by a quantum computer.
135+
136+ Perfect forward secrecy is enabled by default. With TLSv1.3, the default group
137+ list prefers ` X25519MLKEM768 ` . With TLSv1.2, which does not support the
138+ post-quantum groups, ECDHE is used. The ` ecdhCurve ` option can be used to
139+ customize the list of supported ECDH curves for TLSv1.2 and below, and the list
140+ of supported TLS groups for TLSv1.3. See [ ` tls.createSecureContext() ` ] [ ] for
141+ more info.
142+
143+ DHE is used with TLSv1.2 when the client offers one of the [ RFC 7919] [ ] FFDHE
144+ groups, such as ` ffdhe2048 ` , in its supported groups. It can also be enabled for
145+ other clients by setting the ` dhparam ` option to ` 'auto' ` . Custom DHE
146+ parameters are also supported but discouraged in favor of automatically
147+ selected, well-known parameters.
148+
149+ Perfect forward secrecy was optional up to TLSv1.2. The default cipher list
150+ still includes TLSv1.2 cipher suites with RSA key exchange, which do not
151+ provide it. As of TLSv1.3, (EC)DHE or a hybrid post-quantum group is always
152+ used (with the exception of PSK-only connections).
153+
154+ #### Requiring post-quantum key exchange
155+
156+ To accept only connections that use a hybrid post-quantum group, require
157+ TLSv1.3 and limit ` ecdhCurve ` to post-quantum groups. Peers that support only
158+ TLSv1.2 or only classical groups fail the handshake.
131159
132- Perfect forward secrecy using ECDHE is enabled by default. The ` ecdhCurve `
133- option can be used when creating a TLS server to customize the list of supported
134- ECDH curves for TLSv1.2 and below, and the list of supported TLS groups for
135- TLSv1.3. See [ ` tls.createServer() ` ] [ ] for more info.
160+ ``` mjs
161+ import { createServer } from ' node:tls' ;
162+
163+ const server = createServer ({
164+ key,
165+ cert,
166+ minVersion: ' TLSv1.3' ,
167+ ecdhCurve: ' X25519MLKEM768:SecP256r1MLKEM768:SecP384r1MLKEM1024' ,
168+ });
169+ ```
136170
137- DHE is disabled by default but can be enabled alongside ECDHE by setting the
138- ` dhparam ` option to ` 'auto' ` . Custom DHE parameters are also supported but
139- discouraged in favor of automatically selected, well-known parameters.
171+ ``` cjs
172+ const { createServer } = require (' node:tls' );
173+
174+ const server = createServer ({
175+ key,
176+ cert,
177+ minVersion: ' TLSv1.3' ,
178+ ecdhCurve: ' X25519MLKEM768:SecP256r1MLKEM768:SecP384r1MLKEM1024' ,
179+ });
180+ ```
140181
141- Perfect forward secrecy was optional up to TLSv1.2. As of TLSv1.3, (EC)DHE is
142- always used (with the exception of PSK-only connections) .
182+ The same options can be passed to [ ` tls.connect() ` ] [ ] to require post-quantum
183+ key exchange on the client .
143184
144185### ALPN and SNI
145186
@@ -2151,17 +2192,24 @@ changes:
21512192 * ` crl ` {string|string\[ ] |Buffer|Buffer\[ ] } PEM formatted CRLs (Certificate
21522193 Revocation Lists).
21532194 * ` dhparam ` {string|Buffer} ` 'auto' ` or custom Diffie-Hellman parameters,
2154- required for non-ECDHE [ perfect forward secrecy] [ ] . If omitted or invalid,
2155- the parameters are silently discarded and DHE ciphers will not be available.
2156- [ ECDHE] [ ] -based [ perfect forward secrecy] [ ] will still be available.
2195+ used for DHE [ perfect forward secrecy] [ ] with TLSv1.2 clients that do not
2196+ offer an [ RFC 7919] [ ] FFDHE group. If omitted or invalid, the parameters
2197+ are silently discarded and DHE ciphers are only available to clients that
2198+ offer an FFDHE group. [ ECDHE] [ ] -based [ perfect forward secrecy] [ ] will
2199+ still be available.
21572200 * ` ecdhCurve ` {string} A string describing a named curve, TLS group, or
21582201 colon-separated list of named curves or TLS groups to use for key agreement,
2159- for example ` P-521:P-384:P-256 ` , ` X25519 ` , or ` X25519MLKEM768 ` . The
2202+ for example ` X25519MLKEM768:X25519 ` , ` X25519 ` , or ` P-521:P-384:P-256 ` . The
21602203 historical name of this option refers to ECDH key agreement in TLSv1.2 and
21612204 below. In TLSv1.3, this option configures the TLS Supported Groups and
21622205 key share groups offered or accepted by the TLS stack. Set to ` auto ` to
2163- select the group automatically. Use [ ` crypto.getCurves() ` ] [ ] to obtain a
2164- list of available elliptic curve names. For TLS group names, use
2206+ use the OpenSSL default list, which prefers the ` X25519MLKEM768 ` hybrid
2207+ post-quantum group. A list replaces the default list, so a list without a
2208+ post-quantum group disables post-quantum key exchange. The ` DEFAULT `
2209+ keyword stands for the default list within a list, for example
2210+ ` DEFAULT:SecP384r1MLKEM1024 ` . See [ perfect forward secrecy] [ ] . Use
2211+ [ ` crypto.getCurves() ` ] [ ] to obtain a list of available elliptic curve
2212+ names. For TLS group names, use
21652213 ` openssl list -tls-groups ` or consult the [ IANA TLS Supported Groups
21662214 registry] [ ] .
21672215 ** Default:** [ ` tls.DEFAULT_ECDH_CURVE ` ] [ ] .
@@ -2614,9 +2662,11 @@ changes:
26142662 description: Default value changed to `'auto'`.
26152663-->
26162664
2617- The default named curve or TLS group list to use for key agreement in a TLS
2618- server. The default value is ` 'auto' ` , or the value of the [ ` --tls-groups ` ] [ ]
2619- command-line option. See [ ` tls.createSecureContext() ` ] [ ] for further
2665+ The default named curve or TLS group list to use for key agreement in TLS
2666+ clients and servers. The default value is ` 'auto' ` , or the value of the
2667+ [ ` --tls-groups ` ] [ ] command-line option. ` 'auto' ` uses the OpenSSL default list.
2668+ With the bundled OpenSSL, that list prefers the ` X25519MLKEM768 ` hybrid
2669+ post-quantum group for TLSv1.3. See [ ` tls.createSecureContext() ` ] [ ] for further
26202670information.
26212671
26222672## ` tls.DEFAULT_MAX_VERSION `
@@ -2680,6 +2730,7 @@ added: v0.11.3
26802730[ RFC 4279 ] : https://tools.ietf.org/html/rfc4279
26812731[ RFC 5077 ] : https://tools.ietf.org/html/rfc5077
26822732[ RFC 5929 ] : https://tools.ietf.org/html/rfc5929
2733+ [ RFC 7919 ] : https://tools.ietf.org/html/rfc7919
26832734[ RFC 8879 ] : https://tools.ietf.org/html/rfc8879
26842735[ SSL_METHODS ] : https://www.openssl.org/docs/man3.0/man7/ssl.html#Dealing-with-Protocol-Methods
26852736[ Session Resumption ] : #session-resumption
0 commit comments