@@ -370,6 +370,51 @@ The first 3 are enabled by default. The last 2 `CCM`-based suites are supported
370
370
by TLSv1.3 because they may be more performant on constrained systems, but they
371
371
are not enabled by default since they offer less security.
372
372
373
+ ## Class: ` tls.CryptoStream `
374
+ <!-- YAML
375
+ added: v0.3.4
376
+ deprecated: v0.11.3
377
+ -->
378
+
379
+ > Stability: 0 - Deprecated: Use [ ` tls.TLSSocket ` ] [ ] instead.
380
+
381
+ The ` tls.CryptoStream ` class represents a stream of encrypted data. This class
382
+ is deprecated and should no longer be used.
383
+
384
+ ### ` cryptoStream.bytesWritten `
385
+ <!-- YAML
386
+ added: v0.3.4
387
+ deprecated: v0.11.3
388
+ -->
389
+
390
+ The ` cryptoStream.bytesWritten ` property returns the total number of bytes
391
+ written to the underlying socket * including* the bytes required for the
392
+ implementation of the TLS protocol.
393
+
394
+ ## Class: ` tls.SecurePair `
395
+ <!-- YAML
396
+ added: v0.3.2
397
+ deprecated: v0.11.3
398
+ -->
399
+
400
+ > Stability: 0 - Deprecated: Use [ ` tls.TLSSocket ` ] [ ] instead.
401
+
402
+ Returned by [ ` tls.createSecurePair() ` ] [ ] .
403
+
404
+ ### Event: ` 'secure' `
405
+ <!-- YAML
406
+ added: v0.3.2
407
+ deprecated: v0.11.3
408
+ -->
409
+
410
+ The ` 'secure' ` event is emitted by the ` SecurePair ` object once a secure
411
+ connection has been established.
412
+
413
+ As with checking for the server
414
+ [ ` 'secureConnection' ` ] ( #tls_event_secureconnection )
415
+ event, ` pair.cleartext.authorized ` should be inspected to confirm whether the
416
+ certificate used is properly authorized.
417
+
373
418
## Class: ` tls.Server `
374
419
<!-- YAML
375
420
added: v0.3.2
@@ -1657,6 +1702,69 @@ A key is *required* for ciphers that make use of certificates. Either `key` or
1657
1702
If the ` ca ` option is not given, then Node.js will default to using
1658
1703
[ Mozilla's publicly trusted list of CAs] [ ] .
1659
1704
1705
+ ## ` tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options]) `
1706
+ <!-- YAML
1707
+ added: v0.3.2
1708
+ deprecated: v0.11.3
1709
+ changes:
1710
+ - version: v5.0.0
1711
+ pr-url: https://github.com/nodejs/node/pull/2564
1712
+ description: ALPN options are supported now.
1713
+ -->
1714
+
1715
+ > Stability: 0 - Deprecated: Use [ ` tls.TLSSocket ` ] [ ] instead.
1716
+
1717
+ * ` context ` {Object} A secure context object as returned by
1718
+ ` tls.createSecureContext() `
1719
+ * ` isServer ` {boolean} ` true ` to specify that this TLS connection should be
1720
+ opened as a server.
1721
+ * ` requestCert ` {boolean} ` true ` to specify whether a server should request a
1722
+ certificate from a connecting client. Only applies when ` isServer ` is ` true ` .
1723
+ * ` rejectUnauthorized ` {boolean} If not ` false ` a server automatically reject
1724
+ clients with invalid certificates. Only applies when ` isServer ` is ` true ` .
1725
+ * ` options `
1726
+ * ` enableTrace ` : See [ ` tls.createServer() ` ] [ ]
1727
+ * ` secureContext ` : A TLS context object from [ ` tls.createSecureContext() ` ] [ ]
1728
+ * ` isServer ` : If ` true ` the TLS socket will be instantiated in server-mode.
1729
+ ** Default:** ` false ` .
1730
+ * ` server ` {net.Server} A [ ` net.Server ` ] [ ] instance
1731
+ * ` requestCert ` : See [ ` tls.createServer() ` ] [ ]
1732
+ * ` rejectUnauthorized ` : See [ ` tls.createServer() ` ] [ ]
1733
+ * ` ALPNProtocols ` : See [ ` tls.createServer() ` ] [ ]
1734
+ * ` SNICallback ` : See [ ` tls.createServer() ` ] [ ]
1735
+ * ` session ` {Buffer} A ` Buffer ` instance containing a TLS session.
1736
+ * ` requestOCSP ` {boolean} If ` true ` , specifies that the OCSP status request
1737
+ extension will be added to the client hello and an ` 'OCSPResponse' ` event
1738
+ will be emitted on the socket before establishing a secure communication.
1739
+
1740
+ Creates a new secure pair object with two streams, one of which reads and writes
1741
+ the encrypted data and the other of which reads and writes the cleartext data.
1742
+ Generally, the encrypted stream is piped to/from an incoming encrypted data
1743
+ stream and the cleartext one is used as a replacement for the initial encrypted
1744
+ stream.
1745
+
1746
+ ` tls.createSecurePair() ` returns a ` tls.SecurePair ` object with ` cleartext ` and
1747
+ ` encrypted ` stream properties.
1748
+
1749
+ Using ` cleartext ` has the same API as [ ` tls.TLSSocket ` ] [ ] .
1750
+
1751
+ The ` tls.createSecurePair() ` method is now deprecated in favor of
1752
+ ` tls.TLSSocket() ` . For example, the code:
1753
+
1754
+ ``` js
1755
+ pair = tls .createSecurePair (/* ... */ );
1756
+ pair .encrypted .pipe (socket);
1757
+ socket .pipe (pair .encrypted );
1758
+ ```
1759
+
1760
+ can be replaced by:
1761
+
1762
+ ``` js
1763
+ secureSocket = tls .TLSSocket (socket, options);
1764
+ ```
1765
+
1766
+ where ` secureSocket ` has the same API as ` pair.cleartext ` .
1767
+
1660
1768
## ` tls.createServer([options][, secureConnectionListener]) `
1661
1769
<!-- YAML
1662
1770
added: v0.3.2
@@ -1853,116 +1961,6 @@ added: v11.4.0
1853
1961
` 'TLSv1.3' ` . If multiple of the options are provided, the lowest minimum is
1854
1962
used.
1855
1963
1856
- ## Deprecated APIs
1857
-
1858
- ### Class: ` CryptoStream `
1859
- <!-- YAML
1860
- added: v0.3.4
1861
- deprecated: v0.11.3
1862
- -->
1863
-
1864
- > Stability: 0 - Deprecated: Use [ ` tls.TLSSocket ` ] [ ] instead.
1865
-
1866
- The ` tls.CryptoStream ` class represents a stream of encrypted data. This class
1867
- is deprecated and should no longer be used.
1868
-
1869
- #### ` cryptoStream.bytesWritten `
1870
- <!-- YAML
1871
- added: v0.3.4
1872
- deprecated: v0.11.3
1873
- -->
1874
-
1875
- The ` cryptoStream.bytesWritten ` property returns the total number of bytes
1876
- written to the underlying socket * including* the bytes required for the
1877
- implementation of the TLS protocol.
1878
-
1879
- ### Class: ` SecurePair `
1880
- <!-- YAML
1881
- added: v0.3.2
1882
- deprecated: v0.11.3
1883
- -->
1884
-
1885
- > Stability: 0 - Deprecated: Use [ ` tls.TLSSocket ` ] [ ] instead.
1886
-
1887
- Returned by [ ` tls.createSecurePair() ` ] [ ] .
1888
-
1889
- #### Event: ` 'secure' `
1890
- <!-- YAML
1891
- added: v0.3.2
1892
- deprecated: v0.11.3
1893
- -->
1894
-
1895
- The ` 'secure' ` event is emitted by the ` SecurePair ` object once a secure
1896
- connection has been established.
1897
-
1898
- As with checking for the server
1899
- [ ` 'secureConnection' ` ] ( #tls_event_secureconnection )
1900
- event, ` pair.cleartext.authorized ` should be inspected to confirm whether the
1901
- certificate used is properly authorized.
1902
-
1903
- ### ` tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options]) `
1904
- <!-- YAML
1905
- added: v0.3.2
1906
- deprecated: v0.11.3
1907
- changes:
1908
- - version: v5.0.0
1909
- pr-url: https://github.com/nodejs/node/pull/2564
1910
- description: ALPN options are supported now.
1911
- -->
1912
-
1913
- > Stability: 0 - Deprecated: Use [ ` tls.TLSSocket ` ] [ ] instead.
1914
-
1915
- * ` context ` {Object} A secure context object as returned by
1916
- ` tls.createSecureContext() `
1917
- * ` isServer ` {boolean} ` true ` to specify that this TLS connection should be
1918
- opened as a server.
1919
- * ` requestCert ` {boolean} ` true ` to specify whether a server should request a
1920
- certificate from a connecting client. Only applies when ` isServer ` is ` true ` .
1921
- * ` rejectUnauthorized ` {boolean} If not ` false ` a server automatically reject
1922
- clients with invalid certificates. Only applies when ` isServer ` is ` true ` .
1923
- * ` options `
1924
- * ` enableTrace ` : See [ ` tls.createServer() ` ] [ ]
1925
- * ` secureContext ` : A TLS context object from [ ` tls.createSecureContext() ` ] [ ]
1926
- * ` isServer ` : If ` true ` the TLS socket will be instantiated in server-mode.
1927
- ** Default:** ` false ` .
1928
- * ` server ` {net.Server} A [ ` net.Server ` ] [ ] instance
1929
- * ` requestCert ` : See [ ` tls.createServer() ` ] [ ]
1930
- * ` rejectUnauthorized ` : See [ ` tls.createServer() ` ] [ ]
1931
- * ` ALPNProtocols ` : See [ ` tls.createServer() ` ] [ ]
1932
- * ` SNICallback ` : See [ ` tls.createServer() ` ] [ ]
1933
- * ` session ` {Buffer} A ` Buffer ` instance containing a TLS session.
1934
- * ` requestOCSP ` {boolean} If ` true ` , specifies that the OCSP status request
1935
- extension will be added to the client hello and an ` 'OCSPResponse' ` event
1936
- will be emitted on the socket before establishing a secure communication.
1937
-
1938
- Creates a new secure pair object with two streams, one of which reads and writes
1939
- the encrypted data and the other of which reads and writes the cleartext data.
1940
- Generally, the encrypted stream is piped to/from an incoming encrypted data
1941
- stream and the cleartext one is used as a replacement for the initial encrypted
1942
- stream.
1943
-
1944
- ` tls.createSecurePair() ` returns a ` tls.SecurePair ` object with ` cleartext ` and
1945
- ` encrypted ` stream properties.
1946
-
1947
- Using ` cleartext ` has the same API as [ ` tls.TLSSocket ` ] [ ] .
1948
-
1949
- The ` tls.createSecurePair() ` method is now deprecated in favor of
1950
- ` tls.TLSSocket() ` . For example, the code:
1951
-
1952
- ``` js
1953
- pair = tls .createSecurePair (/* ... */ );
1954
- pair .encrypted .pipe (socket);
1955
- socket .pipe (pair .encrypted );
1956
- ```
1957
-
1958
- can be replaced by:
1959
-
1960
- ``` js
1961
- secureSocket = tls .TLSSocket (socket, options);
1962
- ```
1963
-
1964
- where ` secureSocket ` has the same API as ` pair.cleartext ` .
1965
-
1966
1964
[ `'newSession'` ] : #tls_event_newsession
1967
1965
[ `'resumeSession'` ] : #tls_event_resumesession
1968
1966
[ `'secureConnect'` ] : #tls_event_secureconnect
0 commit comments