@@ -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
@@ -1671,6 +1716,69 @@ A key is *required* for ciphers that make use of certificates. Either `key` or
1671
1716
If the ` ca ` option is not given, then Node.js will default to using
1672
1717
[ Mozilla's publicly trusted list of CAs] [ ] .
1673
1718
1719
+ ## ` tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options]) `
1720
+ <!-- YAML
1721
+ added: v0.3.2
1722
+ deprecated: v0.11.3
1723
+ changes:
1724
+ - version: v5.0.0
1725
+ pr-url: https://github.com/nodejs/node/pull/2564
1726
+ description: ALPN options are supported now.
1727
+ -->
1728
+
1729
+ > Stability: 0 - Deprecated: Use [ ` tls.TLSSocket ` ] [ ] instead.
1730
+
1731
+ * ` context ` {Object} A secure context object as returned by
1732
+ ` tls.createSecureContext() `
1733
+ * ` isServer ` {boolean} ` true ` to specify that this TLS connection should be
1734
+ opened as a server.
1735
+ * ` requestCert ` {boolean} ` true ` to specify whether a server should request a
1736
+ certificate from a connecting client. Only applies when ` isServer ` is ` true ` .
1737
+ * ` rejectUnauthorized ` {boolean} If not ` false ` a server automatically reject
1738
+ clients with invalid certificates. Only applies when ` isServer ` is ` true ` .
1739
+ * ` options `
1740
+ * ` enableTrace ` : See [ ` tls.createServer() ` ] [ ]
1741
+ * ` secureContext ` : A TLS context object from [ ` tls.createSecureContext() ` ] [ ]
1742
+ * ` isServer ` : If ` true ` the TLS socket will be instantiated in server-mode.
1743
+ ** Default:** ` false ` .
1744
+ * ` server ` {net.Server} A [ ` net.Server ` ] [ ] instance
1745
+ * ` requestCert ` : See [ ` tls.createServer() ` ] [ ]
1746
+ * ` rejectUnauthorized ` : See [ ` tls.createServer() ` ] [ ]
1747
+ * ` ALPNProtocols ` : See [ ` tls.createServer() ` ] [ ]
1748
+ * ` SNICallback ` : See [ ` tls.createServer() ` ] [ ]
1749
+ * ` session ` {Buffer} A ` Buffer ` instance containing a TLS session.
1750
+ * ` requestOCSP ` {boolean} If ` true ` , specifies that the OCSP status request
1751
+ extension will be added to the client hello and an ` 'OCSPResponse' ` event
1752
+ will be emitted on the socket before establishing a secure communication.
1753
+
1754
+ Creates a new secure pair object with two streams, one of which reads and writes
1755
+ the encrypted data and the other of which reads and writes the cleartext data.
1756
+ Generally, the encrypted stream is piped to/from an incoming encrypted data
1757
+ stream and the cleartext one is used as a replacement for the initial encrypted
1758
+ stream.
1759
+
1760
+ ` tls.createSecurePair() ` returns a ` tls.SecurePair ` object with ` cleartext ` and
1761
+ ` encrypted ` stream properties.
1762
+
1763
+ Using ` cleartext ` has the same API as [ ` tls.TLSSocket ` ] [ ] .
1764
+
1765
+ The ` tls.createSecurePair() ` method is now deprecated in favor of
1766
+ ` tls.TLSSocket() ` . For example, the code:
1767
+
1768
+ ``` js
1769
+ pair = tls .createSecurePair (/* ... */ );
1770
+ pair .encrypted .pipe (socket);
1771
+ socket .pipe (pair .encrypted );
1772
+ ```
1773
+
1774
+ can be replaced by:
1775
+
1776
+ ``` js
1777
+ secureSocket = tls .TLSSocket (socket, options);
1778
+ ```
1779
+
1780
+ where ` secureSocket ` has the same API as ` pair.cleartext ` .
1781
+
1674
1782
## ` tls.createServer([options][, secureConnectionListener]) `
1675
1783
<!-- YAML
1676
1784
added: v0.3.2
@@ -1867,116 +1975,6 @@ added: v11.4.0
1867
1975
` 'TLSv1.3' ` . If multiple of the options are provided, the lowest minimum is
1868
1976
used.
1869
1977
1870
- ## Deprecated APIs
1871
-
1872
- ### Class: ` CryptoStream `
1873
- <!-- YAML
1874
- added: v0.3.4
1875
- deprecated: v0.11.3
1876
- -->
1877
-
1878
- > Stability: 0 - Deprecated: Use [ ` tls.TLSSocket ` ] [ ] instead.
1879
-
1880
- The ` tls.CryptoStream ` class represents a stream of encrypted data. This class
1881
- is deprecated and should no longer be used.
1882
-
1883
- #### ` cryptoStream.bytesWritten `
1884
- <!-- YAML
1885
- added: v0.3.4
1886
- deprecated: v0.11.3
1887
- -->
1888
-
1889
- The ` cryptoStream.bytesWritten ` property returns the total number of bytes
1890
- written to the underlying socket * including* the bytes required for the
1891
- implementation of the TLS protocol.
1892
-
1893
- ### Class: ` SecurePair `
1894
- <!-- YAML
1895
- added: v0.3.2
1896
- deprecated: v0.11.3
1897
- -->
1898
-
1899
- > Stability: 0 - Deprecated: Use [ ` tls.TLSSocket ` ] [ ] instead.
1900
-
1901
- Returned by [ ` tls.createSecurePair() ` ] [ ] .
1902
-
1903
- #### Event: ` 'secure' `
1904
- <!-- YAML
1905
- added: v0.3.2
1906
- deprecated: v0.11.3
1907
- -->
1908
-
1909
- The ` 'secure' ` event is emitted by the ` SecurePair ` object once a secure
1910
- connection has been established.
1911
-
1912
- As with checking for the server
1913
- [ ` 'secureConnection' ` ] ( #tls_event_secureconnection )
1914
- event, ` pair.cleartext.authorized ` should be inspected to confirm whether the
1915
- certificate used is properly authorized.
1916
-
1917
- ### ` tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options]) `
1918
- <!-- YAML
1919
- added: v0.3.2
1920
- deprecated: v0.11.3
1921
- changes:
1922
- - version: v5.0.0
1923
- pr-url: https://github.com/nodejs/node/pull/2564
1924
- description: ALPN options are supported now.
1925
- -->
1926
-
1927
- > Stability: 0 - Deprecated: Use [ ` tls.TLSSocket ` ] [ ] instead.
1928
-
1929
- * ` context ` {Object} A secure context object as returned by
1930
- ` tls.createSecureContext() `
1931
- * ` isServer ` {boolean} ` true ` to specify that this TLS connection should be
1932
- opened as a server.
1933
- * ` requestCert ` {boolean} ` true ` to specify whether a server should request a
1934
- certificate from a connecting client. Only applies when ` isServer ` is ` true ` .
1935
- * ` rejectUnauthorized ` {boolean} If not ` false ` a server automatically reject
1936
- clients with invalid certificates. Only applies when ` isServer ` is ` true ` .
1937
- * ` options `
1938
- * ` enableTrace ` : See [ ` tls.createServer() ` ] [ ]
1939
- * ` secureContext ` : A TLS context object from [ ` tls.createSecureContext() ` ] [ ]
1940
- * ` isServer ` : If ` true ` the TLS socket will be instantiated in server-mode.
1941
- ** Default:** ` false ` .
1942
- * ` server ` {net.Server} A [ ` net.Server ` ] [ ] instance
1943
- * ` requestCert ` : See [ ` tls.createServer() ` ] [ ]
1944
- * ` rejectUnauthorized ` : See [ ` tls.createServer() ` ] [ ]
1945
- * ` ALPNProtocols ` : See [ ` tls.createServer() ` ] [ ]
1946
- * ` SNICallback ` : See [ ` tls.createServer() ` ] [ ]
1947
- * ` session ` {Buffer} A ` Buffer ` instance containing a TLS session.
1948
- * ` requestOCSP ` {boolean} If ` true ` , specifies that the OCSP status request
1949
- extension will be added to the client hello and an ` 'OCSPResponse' ` event
1950
- will be emitted on the socket before establishing a secure communication.
1951
-
1952
- Creates a new secure pair object with two streams, one of which reads and writes
1953
- the encrypted data and the other of which reads and writes the cleartext data.
1954
- Generally, the encrypted stream is piped to/from an incoming encrypted data
1955
- stream and the cleartext one is used as a replacement for the initial encrypted
1956
- stream.
1957
-
1958
- ` tls.createSecurePair() ` returns a ` tls.SecurePair ` object with ` cleartext ` and
1959
- ` encrypted ` stream properties.
1960
-
1961
- Using ` cleartext ` has the same API as [ ` tls.TLSSocket ` ] [ ] .
1962
-
1963
- The ` tls.createSecurePair() ` method is now deprecated in favor of
1964
- ` tls.TLSSocket() ` . For example, the code:
1965
-
1966
- ``` js
1967
- pair = tls .createSecurePair (/* ... */ );
1968
- pair .encrypted .pipe (socket);
1969
- socket .pipe (pair .encrypted );
1970
- ```
1971
-
1972
- can be replaced by:
1973
-
1974
- ``` js
1975
- secureSocket = tls .TLSSocket (socket, options);
1976
- ```
1977
-
1978
- where ` secureSocket ` has the same API as ` pair.cleartext ` .
1979
-
1980
1978
[ `'newSession'` ] : #tls_event_newsession
1981
1979
[ `'resumeSession'` ] : #tls_event_resumesession
1982
1980
[ `'secureConnect'` ] : #tls_event_secureconnect
0 commit comments