diff --git a/benchmark/tls/secure-pair.js b/benchmark/tls/secure-pair.js index 1c5dd732d1ca9e..a253bbf0260733 100644 --- a/benchmark/tls/secure-pair.js +++ b/benchmark/tls/secure-pair.js @@ -2,7 +2,7 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { dur: [5], - securing: ['SecurePair', 'TLSSocket', 'clear'], + securing: ['TLSSocket', 'clear'], size: [100, 1024, 1024 * 1024], }, { flags: ['--no-warnings'], @@ -68,9 +68,6 @@ function main({ dur, size, securing }) { function onProxyConnection(conn) { const client = net.connect(REDIRECT_PORT, () => { switch (securing) { - case 'SecurePair': - securePair(conn, client); - break; case 'TLSSocket': secureTLSSocket(conn, client); break; @@ -83,17 +80,6 @@ function main({ dur, size, securing }) { }); } - function securePair(conn, client) { - const serverCtx = tls.createSecureContext(options); - const serverPair = tls.createSecurePair(serverCtx, true, true, false); - conn.pipe(serverPair.encrypted); - serverPair.encrypted.pipe(conn); - serverPair.on('error', (error) => { - throw new Error(`Pair error: ${error}`); - }); - serverPair.cleartext.pipe(client); - } - function secureTLSSocket(conn, client) { const serverSocket = new tls.TLSSocket(conn, options); serverSocket.on('error', (e) => { diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 84dc58cfc449df..9a96720d4d4b79 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -947,6 +947,9 @@ The [`tls.CryptoStream`][] class was removed. Please use -Type: Documentation-only +Type: End-of-Life -The [`tls.SecurePair`][] class is deprecated. Please use +The `tls.SecurePair` class is deprecated. Please use [`tls.TLSSocket`][] instead. ### DEP0044: `util.isArray()` @@ -1488,6 +1491,9 @@ officially supported API. -Type: Runtime +Type: End-of-Life The `tls.createSecurePair()` API was deprecated in documentation in Node.js 0.11.3. Users should use `tls.Socket` instead. diff --git a/doc/api/tls.md b/doc/api/tls.md index 86644cea76b6a3..cda3c2001d36f6 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -570,32 +570,6 @@ The `cryptoStream.bytesWritten` property returns the total number of bytes written to the underlying socket _including_ the bytes required for the implementation of the TLS protocol. -## Class: `tls.SecurePair` - - - -> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead. - -Returned by [`tls.createSecurePair()`][]. - -### Event: `'secure'` - - - -The `'secure'` event is emitted by the `SecurePair` object once a secure -connection has been established. - -As with checking for the server -[`'secureConnection'`][] -event, `pair.cleartext.authorized` should be inspected to confirm whether the -certificate used is properly authorized. - ## Class: `tls.Server` - -> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead. - -* `context` {Object} A secure context object as returned by - `tls.createSecureContext()` -* `isServer` {boolean} `true` to specify that this TLS connection should be - opened as a server. -* `requestCert` {boolean} `true` to specify whether a server should request a - certificate from a connecting client. Only applies when `isServer` is `true`. -* `rejectUnauthorized` {boolean} If not `false` a server automatically reject - clients with invalid certificates. Only applies when `isServer` is `true`. -* `options` - * `enableTrace`: See [`tls.createServer()`][] - * `secureContext`: A TLS context object from [`tls.createSecureContext()`][] - * `isServer`: If `true` the TLS socket will be instantiated in server-mode. - **Default:** `false`. - * `server` {net.Server} A [`net.Server`][] instance - * `requestCert`: See [`tls.createServer()`][] - * `rejectUnauthorized`: See [`tls.createServer()`][] - * `ALPNProtocols`: See [`tls.createServer()`][] - * `SNICallback`: See [`tls.createServer()`][] - * `session` {Buffer} A `Buffer` instance containing a TLS session. - * `requestOCSP` {boolean} If `true`, specifies that the OCSP status request - extension will be added to the client hello and an `'OCSPResponse'` event - will be emitted on the socket before establishing a secure communication. - -Creates a new secure pair object with two streams, one of which reads and writes -the encrypted data and the other of which reads and writes the cleartext data. -Generally, the encrypted stream is piped to/from an incoming encrypted data -stream and the cleartext one is used as a replacement for the initial encrypted -stream. - -`tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and -`encrypted` stream properties. - -Using `cleartext` has the same API as [`tls.TLSSocket`][]. - -The `tls.createSecurePair()` method is now deprecated in favor of -`tls.TLSSocket()`. For example, the code: - -```js -pair = tls.createSecurePair(/* ... */); -pair.encrypted.pipe(socket); -socket.pipe(pair.encrypted); -``` - -can be replaced by: - -```js -secureSocket = tls.TLSSocket(socket, options); -``` - -where `secureSocket` has the same API as `pair.cleartext`. - ## `tls.createServer([options][, secureConnectionListener])`