@@ -104,6 +104,9 @@ not required and a default ECDHE curve will be used. The `ecdhCurve` property
104
104
can be used when creating a TLS Server to specify the list of names of supported
105
105
curves to use, see [ ` tls.createServer() ` ] for more info.
106
106
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
+
107
110
### ALPN and SNI
108
111
109
112
<!-- type=misc -->
@@ -136,6 +139,8 @@ threshold is exceeded. The limits are configurable:
136
139
The default renegotiation limits should not be modified without a full
137
140
understanding of the implications and risks.
138
141
142
+ TLSv1.3 does not support renegotiation.
143
+
139
144
### Session Resumption
140
145
141
146
Establishing 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
176
181
[ ` tls.TLSSocket.getTLSTicket() ` ] [ ] returns a value, the session data contains a
177
182
ticket, otherwise it contains client-side session state.
178
183
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
+
179
188
Single process servers need no specific implementation to use session tickets.
180
189
To use session tickets across server restarts or load balancers, servers must
181
190
all 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.
230
239
Currently, the default cipher suite is:
231
240
232
241
``` txt
242
+ TLS_AES_256_GCM_SHA384:
243
+ TLS_CHACHA20_POLY1305_SHA256:
244
+ TLS_AES_128_GCM_SHA256:
233
245
ECDHE-RSA-AES128-GCM-SHA256:
234
246
ECDHE-ECDSA-AES128-GCM-SHA256:
235
247
ECDHE-RSA-AES256-GCM-SHA384:
@@ -270,7 +282,19 @@ The default can also be replaced on a per client or server basis using the
270
282
in [ ` tls.createServer() ` ] , [ ` tls.connect() ` ] , and when creating new
271
283
[ ` tls.TLSSocket ` ] s.
272
284
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.
274
298
275
299
The default cipher suite included within Node.js has been carefully
276
300
selected 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
289
313
(like Internet Explorer 6) cannot complete the handshaking process with
290
314
the default configuration. If these clients _ must_ be supported, the
291
315
[ 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.
293
328
294
329
## Class: tls.Server
295
330
<!-- YAML
@@ -634,11 +669,11 @@ On the client, the `session` can be provided to the `session` option of
634
669
635
670
See [ Session Resumption] [ ] for more information.
636
671
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
639
674
by the protocol, multiple tickets are sent, and the tickets aren't sent until
640
675
later, 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
642
677
recommended to use the ` 'session' ` event instead of ` getSession() ` to ensure
643
678
they will work for all TLS protocol versions. Applications that only expect to
644
679
get or use 1 session should listen for this event only once:
@@ -731,7 +766,7 @@ changes:
731
766
732
767
Returns an object containing information on the negotiated cipher suite.
733
768
734
- For example: ` { name: 'AES256-SHA', version: 'TLSv1/SSLv3 ' } ` .
769
+ For example: ` { name: 'AES256-SHA', version: 'TLSv1.2 ' } ` .
735
770
736
771
See
737
772
[ OpenSSL] ( https://www.openssl.org/docs/man1.1.1/man3/SSL_CIPHER_get_name.html )
@@ -904,12 +939,13 @@ be returned for server sockets or disconnected client sockets.
904
939
905
940
Protocol versions are:
906
941
942
+ * ` 'SSLv3' `
907
943
* ` 'TLSv1' `
908
944
* ` 'TLSv1.1' `
909
945
* ` 'TLSv1.2' `
910
- * ` 'SSLv3 ' `
946
+ * ` 'TLSv1.3 ' `
911
947
912
- See < https://www.openssl.org/docs/man1.1.0/ssl /SSL_get_version.html > for more
948
+ See < https://www.openssl.org/docs/man1.1.1/man3 /SSL_get_version.html > for more
913
949
information.
914
950
915
951
### tlsSocket.getSession()
@@ -926,8 +962,8 @@ for debugging.
926
962
927
963
See [ Session Resumption] [ ] for more information.
928
964
929
- Note: ` getSession() ` works only for TLS1 .2 and below. Future-proof applications
930
- should use the [ ` 'session' ` ] [ ] event.
965
+ Note: ` getSession() ` works only for TLSv1 .2 and below. For TLSv1.3, applications
966
+ must use the [ ` 'session' ` ] [ ] event (it also works for TLSv1.2 and below) .
931
967
932
968
### tlsSocket.getTLSTicket()
933
969
<!-- YAML
@@ -1009,8 +1045,12 @@ added: v0.11.8
1009
1045
verification fails; ` err.code ` contains the OpenSSL error code. ** Default:**
1010
1046
` true ` .
1011
1047
* ` requestCert `
1012
- * ` callback ` {Function} A function that will be called when the renegotiation
1013
- request has been completed.
1048
+ * ` callback ` {Function} If ` renegotiate() ` returned ` true ` , callback is
1049
+ attached once to the ` 'secure' ` event. If it returned ` false ` , it will be
1050
+ called in the next tick with ` ERR_TLS_RENEGOTIATE ` , unless the ` tlsSocket `
1051
+ has been destroyed, in which case it will not be called at all.
1052
+
1053
+ * Returns: {boolean} ` true ` if renegotiation was initiated, ` false ` otherwise.
1014
1054
1015
1055
The ` tlsSocket.renegotiate() ` method initiates a TLS renegotiation process.
1016
1056
Upon completion, the ` callback ` function will be passed a single argument
@@ -1022,6 +1062,9 @@ connection has been established.
1022
1062
When running as the server, the socket will be destroyed with an error after
1023
1063
` handshakeTimeout ` timeout.
1024
1064
1065
+ For TLSv1.3, renegotiation cannot be initiated, it is not supported by the
1066
+ protocol.
1067
+
1025
1068
### tlsSocket.setMaxSendFragment(size)
1026
1069
<!-- YAML
1027
1070
added: v0.11.11
@@ -1220,6 +1263,9 @@ argument.
1220
1263
<!-- YAML
1221
1264
added: v0.11.13
1222
1265
changes:
1266
+ - version: REPLACEME
1267
+ pr-url: https://github.com/nodejs/node/pull/26209
1268
+ description: TLSv1.3 support added.
1223
1269
- version: v11.5.0
1224
1270
pr-url: https://github.com/nodejs/node/pull/24733
1225
1271
description: The `ca:` option now supports `BEGIN TRUSTED CERTIFICATE`.
@@ -1310,15 +1356,22 @@ changes:
1310
1356
` object.passphrase ` is optional. Encrypted keys will be decrypted with
1311
1357
` object.passphrase ` if provided, or ` options.passphrase ` if it is not.
1312
1358
* ` maxVersion ` {string} Optionally set the maximum TLS version to allow. One
1313
- of ` TLSv1.2' ` , ` 'TLSv1.1' ` , or ` 'TLSv1' ` . Cannot be specified along with the
1314
- ` secureProtocol ` option, use one or the other. ** Default:** ` 'TLSv1.2' ` .
1359
+ of ` TLSv1.3 ` , ` TLSv1.2' ` , ` 'TLSv1.1' ` , or ` 'TLSv1' ` . Cannot be specified
1360
+ along with the ` secureProtocol ` option, use one or the other.
1361
+ ** Default:** ` 'TLSv1.3' ` , unless changed using CLI options. Using
1362
+ ` --tls-max-v1.2 ` sets the default to ` 'TLSv1.2 ` '. Using ` --tls-max-v1.3 `
1363
+ sets the default to ` 'TLSv1.3' ` . If multiple of the options are provided,
1364
+ the highest maximum is used.
1315
1365
* ` minVersion ` {string} Optionally set the minimum TLS version to allow. One
1316
- of ` TLSv1.2' ` , ` 'TLSv1.1' ` , or ` 'TLSv1' ` . Cannot be specified along with the
1317
- ` secureProtocol ` option, use one or the other. It is not recommended to use
1318
- less than TLSv1.2, but it may be required for interoperability.
1366
+ of ` TLSv1.3 ` , ` TLSv1.2' ` , ` 'TLSv1.1' ` , or ` 'TLSv1' ` . Cannot be specified
1367
+ along with the ` secureProtocol ` option, use one or the other. It is not
1368
+ recommended to use less than TLSv1.2, but it may be required for
1369
+ interoperability.
1319
1370
** Default:** ` 'TLSv1.2' ` , unless changed using CLI options. Using
1320
- ` --tls-v1.0 ` changes the default to ` 'TLSv1' ` . Using ` --tls-v1.1 ` changes
1321
- the default to ` 'TLSv1.1' ` .
1371
+ ` --tls-min-v1.0 ` sets the default to ` 'TLSv1' ` . Using ` --tls-min-v1.1 ` sets
1372
+ the default to ` 'TLSv1.1' ` . Using ` --tls-min-v1.3 ` sets the default to
1373
+ ` 'TLSv1.3' ` . If multiple of the options are provided, the lowest minimum is
1374
+ used.
1322
1375
* ` passphrase ` {string} Shared passphrase used for a single private key and/or
1323
1376
a PFX.
1324
1377
* ` pfx ` {string|string[ ] |Buffer|Buffer[ ] |Object[ ] } PFX or PKCS12 encoded
@@ -1334,12 +1387,15 @@ changes:
1334
1387
which is not usually necessary. This should be used carefully if at all!
1335
1388
Value is a numeric bitmask of the ` SSL_OP_* ` options from
1336
1389
[ OpenSSL Options] [ ] .
1337
- * ` secureProtocol ` {string} The TLS protocol version to use. The possible
1338
- values are listed as [ SSL_METHODS] [ ] , use the function names as strings. For
1339
- example, use ` 'TLSv1_1_method' ` to force TLS version 1.1, or ` 'TLS_method' `
1340
- to allow any TLS protocol version. It is not recommended to use TLS versions
1341
- less than 1.2, but it may be required for interoperability. ** Default:**
1342
- none, see ` minVersion ` .
1390
+ * ` secureProtocol ` {string} Legacy mechanism to select the TLS protocol
1391
+ version to use, it does not support independent control of the minimum and
1392
+ maximum version, and does not support limiting the protocol to TLSv1.3. Use
1393
+ ` minVersion ` and ` maxVersion ` instead. The possible values are listed as
1394
+ [ SSL_METHODS] [ ] , use the function names as strings. For example, use
1395
+ ` 'TLSv1_1_method' ` to force TLS version 1.1, or ` 'TLS_method' ` to allow any
1396
+ TLS protocol version up to TLSv1.3. It is not recommended to use TLS
1397
+ versions less than 1.2, but it may be required for interoperability.
1398
+ ** Default:** none, see ` minVersion ` .
1343
1399
* ` sessionIdContext ` {string} Opaque identifier used by servers to ensure
1344
1400
session state is not shared between applications. Unused by clients.
1345
1401
@@ -1457,10 +1513,15 @@ added: v0.10.2
1457
1513
1458
1514
* Returns: {string[ ] }
1459
1515
1460
- Returns an array with the names of the supported SSL ciphers.
1516
+ Returns an array with the names of the supported TLS ciphers. The names are
1517
+ lower-case for historical reasons, but must be uppercased to be used in
1518
+ the ` ciphers ` option of [ ` tls.createSecureContext() ` ] [ ] .
1519
+
1520
+ Cipher names that start with ` 'tls_' ` are for TLSv1.3, all the others are for
1521
+ TLSv1.2 and below.
1461
1522
1462
1523
``` js
1463
- console .log (tls .getCiphers ()); // ['AES128-SHA ', 'AES256-SHA ', ...]
1524
+ console .log (tls .getCiphers ()); // ['aes128-gcm-sha256 ', 'aes128-sha ', ...]
1464
1525
```
1465
1526
1466
1527
## tls.DEFAULT_ECDH_CURVE
@@ -1619,16 +1680,16 @@ where `secureSocket` has the same API as `pair.cleartext`.
1619
1680
[ Forward secrecy ] : https://en.wikipedia.org/wiki/Perfect_forward_secrecy
1620
1681
[ OCSP request ] : https://en.wikipedia.org/wiki/OCSP_stapling
1621
1682
[ OpenSSL Options ] : crypto.html#crypto_openssl_options
1622
- [ OpenSSL cipher list format documentation ] : https://www.openssl.org/docs/man1.1.0/apps/ciphers.html#CIPHER-LIST-FORMAT
1623
1683
[ Perfect Forward Secrecy ] : #tls_perfect_forward_secrecy
1624
1684
[ RFC 2246 ] : https://www.ietf.org/rfc/rfc2246.txt
1625
1685
[ RFC 5077 ] : https://tools.ietf.org/html/rfc5077
1626
1686
[ RFC 5929 ] : https://tools.ietf.org/html/rfc5929
1627
- [ SSL_METHODS ] : https://www.openssl.org/docs/man1.1.0/ssl /ssl.html#Dealing-with-Protocol-Methods
1687
+ [ SSL_METHODS ] : https://www.openssl.org/docs/man1.1.1/man7 /ssl.html#Dealing-with-Protocol-Methods
1628
1688
[ Session Resumption ] : #tls_session_resumption
1629
1689
[ Stream ] : stream.html#stream_stream
1630
1690
[ TLS recommendations ] : https://wiki.mozilla.org/Security/Server_Side_TLS
1631
1691
[ asn1.js ] : https://www.npmjs.com/package/asn1.js
1632
1692
[ certificate object ] : #tls_certificate_object
1693
+ [ cipher list format ] : https://www.openssl.org/docs/man1.1.1/man1/ciphers.html#CIPHER-LIST-FORMAT
1633
1694
[ modifying the default cipher suite ] : #tls_modifying_the_default_tls_cipher_suite
1634
1695
[ specific attacks affecting larger AES key sizes ] : https://www.schneier.com/blog/archives/2009/07/another_new_aes.html
0 commit comments