@@ -104,6 +104,9 @@ not required and a default ECDHE curve will be used. The `ecdhCurve` property
104104can be used when creating a TLS Server to specify the list of names of supported
105105curves to use, see [ ` tls.createServer() ` ] for more info.
106106
107+ Perfect Forward Secrecy was optional up to TLSv1.2, but it is not optional for
108+ TLSv1.3, because all TLSv1.3 cipher suites use ECDHE.
109+
107110### ALPN and SNI
108111
109112<!-- type=misc -->
@@ -136,6 +139,8 @@ threshold is exceeded. The limits are configurable:
136139The default renegotiation limits should not be modified without a full
137140understanding of the implications and risks.
138141
142+ TLSv1.3 does not support renegotiation.
143+
139144### Session Resumption
140145
141146Establishing a TLS session can be relatively slow. The process can be sped
@@ -176,6 +181,10 @@ as for resumption with session tickets. For debugging, if
176181[ ` tls.TLSSocket.getTLSTicket() ` ] [ ] returns a value, the session data contains a
177182ticket, otherwise it contains client-side session state.
178183
184+ With TLSv1.3, be aware that multiple tickets may be sent by the server,
185+ resulting in multiple ` 'session' ` events, see [ ` 'session' ` ] [ ] for more
186+ information.
187+
179188Single process servers need no specific implementation to use session tickets.
180189To use session tickets across server restarts or load balancers, servers must
181190all have the same ticket keys. There are three 16-byte keys internally, but the
@@ -230,6 +239,9 @@ Node.js is built with a default suite of enabled and disabled TLS ciphers.
230239Currently, the default cipher suite is:
231240
232241``` txt
242+ TLS_AES_256_GCM_SHA384:
243+ TLS_CHACHA20_POLY1305_SHA256:
244+ TLS_AES_128_GCM_SHA256:
233245ECDHE-RSA-AES128-GCM-SHA256:
234246ECDHE-ECDSA-AES128-GCM-SHA256:
235247ECDHE-RSA-AES256-GCM-SHA384:
@@ -270,7 +282,19 @@ The default can also be replaced on a per client or server basis using the
270282in [ ` tls.createServer() ` ] , [ ` tls.connect() ` ] , and when creating new
271283[ ` tls.TLSSocket ` ] s.
272284
273- Consult [ OpenSSL cipher list format documentation] [ ] for details on the format.
285+ The ciphers list can contain a mixture of TLSv1.3 cipher suite names, the ones
286+ that start with ` 'TLS_' ` , and specifications for TLSv1.2 and below cipher
287+ suites. The TLSv1.2 ciphers support a legacy specification format, consult
288+ the OpenSSL [ cipher list format] [ ] documentation for details, but those
289+ specifications do * not* apply to TLSv1.3 ciphers. The TLSv1.3 suites can only
290+ be enabled by including their full name in the cipher list. They cannot, for
291+ example, be enabled or disabled by using the legacy TLSv1.2 ` 'EECDH' ` or
292+ ` '!EECDH' ` specification.
293+
294+ Despite the relative order of TLSv1.3 and TLSv1.2 cipher suites, the TLSv1.3
295+ protocol is significantly more secure than TLSv1.2, and will always be chosen
296+ over TLSv1.2 if the handshake indicates it is supported, and if any TLSv1.3
297+ cipher suites are enabled.
274298
275299The default cipher suite included within Node.js has been carefully
276300selected to reflect current security best practices and risk mitigation.
@@ -289,7 +313,18 @@ Old clients that rely on insecure and deprecated RC4 or DES-based ciphers
289313(like Internet Explorer 6) cannot complete the handshaking process with
290314the default configuration. If these clients _ must_ be supported, the
291315[ TLS recommendations] may offer a compatible cipher suite. For more details
292- on the format, see the [ OpenSSL cipher list format documentation] .
316+ on the format, see the OpenSSL [ cipher list format] [ ] documentation.
317+
318+ There are only 5 TLSv1.3 cipher suites:
319+ - ` 'TLS_AES_256_GCM_SHA384' `
320+ - ` 'TLS_CHACHA20_POLY1305_SHA256' `
321+ - ` 'TLS_AES_128_GCM_SHA256' `
322+ - ` 'TLS_AES_128_CCM_SHA256' `
323+ - ` 'TLS_AES_128_CCM_8_SHA256' `
324+
325+ The first 3 are enabled by default. The last 2 ` CCM ` -based suites are supported
326+ by TLSv1.3 because they may be more performant on constrained systems, but they
327+ are not enabled by default since they offer less security.
293328
294329## Class: tls.Server
295330<!-- YAML
@@ -634,11 +669,11 @@ On the client, the `session` can be provided to the `session` option of
634669
635670See [ Session Resumption] [ ] for more information.
636671
637- Note: For TLS1 .2 and below, [ ` tls.TLSSocket.getSession() ` ] [ ] can be called once
638- the handshake is complete. For TLS1 .3, only ticket based resumption is allowed
672+ Note: For TLSv1 .2 and below, [ ` tls.TLSSocket.getSession() ` ] [ ] can be called once
673+ the handshake is complete. For TLSv1 .3, only ticket based resumption is allowed
639674by the protocol, multiple tickets are sent, and the tickets aren't sent until
640675later, after the handshake completes, so it is necessary to wait for the
641- ` 'session' ` event to get a resumable session. Future-proof applications are
676+ ` 'session' ` event to get a resumable session. Applications are
642677recommended to use the ` 'session' ` event instead of ` getSession() ` to ensure
643678they will work for all TLS protocol versions. Applications that only expect to
644679get or use 1 session should listen for this event only once:
@@ -724,7 +759,7 @@ added: v0.11.4
724759Returns an object representing the cipher name. The ` version ` key is a legacy
725760field which always contains the value ` 'TLSv1/SSLv3' ` .
726761
727- For example: ` { name: 'AES256-SHA', version: 'TLSv1/SSLv3 ' } ` .
762+ For example: ` { name: 'AES256-SHA', version: 'TLSv1.2 ' } ` .
728763
729764See ` SSL_CIPHER_get_name() ` in
730765< https://www.openssl.org/docs/man1.1.0/ssl/SSL_CIPHER_get_name.html > for more
@@ -897,12 +932,13 @@ be returned for server sockets or disconnected client sockets.
897932
898933Protocol versions are:
899934
935+ * ` 'SSLv3' `
900936* ` 'TLSv1' `
901937* ` 'TLSv1.1' `
902938* ` 'TLSv1.2' `
903- * ` 'SSLv3 ' `
939+ * ` 'TLSv1.3 ' `
904940
905- See < https://www.openssl.org/docs/man1.1.0/ssl /SSL_get_version.html > for more
941+ See < https://www.openssl.org/docs/man1.1.1/man3 /SSL_get_version.html > for more
906942information.
907943
908944### tlsSocket.getSession()
@@ -919,8 +955,8 @@ for debugging.
919955
920956See [ Session Resumption] [ ] for more information.
921957
922- Note: ` getSession() ` works only for TLS1 .2 and below. Future-proof applications
923- should use the [ ` 'session' ` ] [ ] event.
958+ Note: ` getSession() ` works only for TLSv1 .2 and below. For TLSv1.3, applications
959+ must use the [ ` 'session' ` ] [ ] event (it also works for TLSv1.2 and below) .
924960
925961### tlsSocket.getTLSTicket()
926962<!-- YAML
@@ -1002,8 +1038,12 @@ added: v0.11.8
10021038 verification fails; ` err.code ` contains the OpenSSL error code. ** Default:**
10031039 ` true ` .
10041040 * ` requestCert `
1005- * ` callback ` {Function} A function that will be called when the renegotiation
1006- request has been completed.
1041+ * ` callback ` {Function} If ` renegotiate() ` returned ` true ` , callback is
1042+ attached once to the ` 'secure' ` event. If it returned ` false ` , it will be
1043+ called in the next tick with ` ERR_TLS_RENEGOTIATE ` , unless the ` tlsSocket `
1044+ has been destroyed, in which case it will not be called at all.
1045+
1046+ * Returns: {boolean} ` true ` if renegotiation was initiated, ` false ` otherwise.
10071047
10081048The ` tlsSocket.renegotiate() ` method initiates a TLS renegotiation process.
10091049Upon completion, the ` callback ` function will be passed a single argument
@@ -1015,6 +1055,9 @@ connection has been established.
10151055When running as the server, the socket will be destroyed with an error after
10161056` handshakeTimeout ` timeout.
10171057
1058+ For TLSv1.3, renegotiation cannot be initiated, it is not supported by the
1059+ protocol.
1060+
10181061### tlsSocket.setMaxSendFragment(size)
10191062<!-- YAML
10201063added: v0.11.11
@@ -1213,6 +1256,9 @@ argument.
12131256<!-- YAML
12141257added: v0.11.13
12151258changes:
1259+ - version: REPLACEME
1260+ pr-url: https://github.com/nodejs/node/pull/26209
1261+ description: TLSv1.3 support added.
12161262 - version: v11.5.0
12171263 pr-url: https://github.com/nodejs/node/pull/24733
12181264 description: The `ca:` option now supports `BEGIN TRUSTED CERTIFICATE`.
@@ -1303,13 +1349,22 @@ changes:
13031349 ` object.passphrase ` is optional. Encrypted keys will be decrypted with
13041350 ` object.passphrase ` if provided, or ` options.passphrase ` if it is not.
13051351 * ` maxVersion ` {string} Optionally set the maximum TLS version to allow. One
1306- of ` TLSv1.2' ` , ` 'TLSv1.1' ` , or ` 'TLSv1' ` . Cannot be specified along with the
1307- ` secureProtocol ` option, use one or the other. ** Default:** ` 'TLSv1.2' ` .
1352+ of ` TLSv1.3 ` , ` TLSv1.2' ` , ` 'TLSv1.1' ` , or ` 'TLSv1' ` . Cannot be specified
1353+ along with the ` secureProtocol ` option, use one or the other.
1354+ ** Default:** ` 'TLSv1.3' ` , unless changed using CLI options. Using
1355+ ` --tls-max-v1.2 ` sets the default to ` 'TLSv1.2 ` '. Using ` --tls-max-v1.3 `
1356+ sets the default to ` 'TLSv1.3' ` . If multiple of the options are provided,
1357+ the highest maximum is used.
13081358 * ` minVersion ` {string} Optionally set the minimum TLS version to allow. One
1309- of ` TLSv1.2' ` , ` 'TLSv1.1' ` , or ` 'TLSv1' ` . Cannot be specified along with the
1310- ` secureProtocol ` option, use one or the other. It is not recommended to use
1311- less than TLSv1.2, but it may be required for interoperability.
1312- ** Default:** ` 'TLSv1' ` .
1359+ of ` TLSv1.3 ` , ` TLSv1.2' ` , ` 'TLSv1.1' ` , or ` 'TLSv1' ` . Cannot be specified
1360+ along with the ` secureProtocol ` option, use one or the other. It is not
1361+ recommended to use less than TLSv1.2, but it may be required for
1362+ interoperability.
1363+ ** Default:** ` 'TLSv1.2' ` , unless changed using CLI options. Using
1364+ ` --tls-min-v1.0 ` sets the default to ` 'TLSv1' ` . Using ` --tls-min-v1.1 ` sets
1365+ the default to ` 'TLSv1.1' ` . Using ` --tls-min-v1.3 ` sets the default to
1366+ ` 'TLSv1.3' ` . If multiple of the options are provided, the lowest minimum is
1367+ used.
13131368 * ` passphrase ` {string} Shared passphrase used for a single private key and/or
13141369 a PFX.
13151370 * ` pfx ` {string|string[ ] |Buffer|Buffer[ ] |Object[ ] } PFX or PKCS12 encoded
@@ -1325,12 +1380,15 @@ changes:
13251380 which is not usually necessary. This should be used carefully if at all!
13261381 Value is a numeric bitmask of the ` SSL_OP_* ` options from
13271382 [ OpenSSL Options] [ ] .
1328- * ` secureProtocol ` {string} The TLS protocol version to use. The possible
1329- values are listed as [ SSL_METHODS] [ ] , use the function names as strings. For
1330- example, use ` 'TLSv1_1_method' ` to force TLS version 1.1, or ` 'TLS_method' `
1331- to allow any TLS protocol version. It is not recommended to use TLS versions
1332- less than 1.2, but it may be required for interoperability. ** Default:**
1333- none, see ` minVersion ` .
1383+ * ` secureProtocol ` {string} Legacy mechanism to select the TLS protocol
1384+ version to use, it does not support independent control of the minimum and
1385+ maximum version, and does not support limiting the protocol to TLSv1.3. Use
1386+ ` minVersion ` and ` maxVersion ` instead. The possible values are listed as
1387+ [ SSL_METHODS] [ ] , use the function names as strings. For example, use
1388+ ` 'TLSv1_1_method' ` to force TLS version 1.1, or ` 'TLS_method' ` to allow any
1389+ TLS protocol version up to TLSv1.3. It is not recommended to use TLS
1390+ versions less than 1.2, but it may be required for interoperability.
1391+ ** Default:** none, see ` minVersion ` .
13341392 * ` sessionIdContext ` {string} Opaque identifier used by servers to ensure
13351393 session state is not shared between applications. Unused by clients.
13361394
@@ -1450,10 +1508,15 @@ added: v0.10.2
14501508
14511509* Returns: {string[ ] }
14521510
1453- Returns an array with the names of the supported SSL ciphers.
1511+ Returns an array with the names of the supported TLS ciphers. The names are
1512+ lower-case for historical reasons, but must be uppercased to be used in
1513+ the ` ciphers ` option of [ ` tls.createSecureContext() ` ] [ ] .
1514+
1515+ Cipher names that start with ` 'tls_' ` are for TLSv1.3, all the others are for
1516+ TLSv1.2 and below.
14541517
14551518``` js
1456- console .log (tls .getCiphers ()); // ['AES128-SHA ', 'AES256-SHA ', ...]
1519+ console .log (tls .getCiphers ()); // ['aes128-gcm-sha256 ', 'aes128-sha ', ...]
14571520```
14581521
14591522## tls.DEFAULT_ECDH_CURVE
@@ -1613,16 +1676,16 @@ where `secureSocket` has the same API as `pair.cleartext`.
16131676[ Forward secrecy ] : https://en.wikipedia.org/wiki/Perfect_forward_secrecy
16141677[ OCSP request ] : https://en.wikipedia.org/wiki/OCSP_stapling
16151678[ OpenSSL Options ] : crypto.html#crypto_openssl_options
1616- [ OpenSSL cipher list format documentation ] : https://www.openssl.org/docs/man1.1.0/apps/ciphers.html#CIPHER-LIST-FORMAT
16171679[ Perfect Forward Secrecy ] : #tls_perfect_forward_secrecy
16181680[ RFC 2246 ] : https://www.ietf.org/rfc/rfc2246.txt
16191681[ RFC 5077 ] : https://tools.ietf.org/html/rfc5077
16201682[ RFC 5929 ] : https://tools.ietf.org/html/rfc5929
1621- [ SSL_METHODS ] : https://www.openssl.org/docs/man1.1.0/ssl /ssl.html#Dealing-with-Protocol-Methods
1683+ [ SSL_METHODS ] : https://www.openssl.org/docs/man1.1.1/man7 /ssl.html#Dealing-with-Protocol-Methods
16221684[ Session Resumption ] : #tls_session_resumption
16231685[ Stream ] : stream.html#stream_stream
16241686[ TLS recommendations ] : https://wiki.mozilla.org/Security/Server_Side_TLS
16251687[ asn1.js ] : https://www.npmjs.com/package/asn1.js
16261688[ certificate object ] : #tls_certificate_object
1689+ [ cipher list format ] : https://www.openssl.org/docs/man1.1.1/man1/ciphers.html#CIPHER-LIST-FORMAT
16271690[ modifying the default cipher suite ] : #tls_modifying_the_default_tls_cipher_suite
16281691[ specific attacks affecting larger AES key sizes ] : https://www.schneier.com/blog/archives/2009/07/another_new_aes.html
0 commit comments