Stability: 0 - Deprecated: Use [
tls.TLSSocket][] instead.
context{Object} A secure context object as returned bytls.createSecureContext()isServer{boolean}trueto specify that this TLS connection should be opened as a server.requestCert{boolean}trueto specify whether a server should request a certificate from a connecting client. Only applies whenisServeristrue.rejectUnauthorized{boolean} If notfalsea server automatically reject clients with invalid certificates. Only applies whenisServeristrue.optionsenableTrace: See [tls.createServer()][]secureContext: A TLS context object from [tls.createSecureContext()][]isServer: Iftruethe TLS socket will be instantiated in server-mode. Default:false.server{net.Server} A [net.Server][] instancerequestCert: See [tls.createServer()][]rejectUnauthorized: See [tls.createServer()][]ALPNProtocols: See [tls.createServer()][]SNICallback: See [tls.createServer()][]session{Buffer} ABufferinstance containing a TLS session.requestOCSP{boolean} Iftrue, 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:
pair = tls.createSecurePair(/* ... */);pair.encrypted.pipe(socket);socket.pipe(pair.encrypted);
can be replaced by:
secureSocket = tls.TLSSocket(socket, options);
where secureSocket has the same API as pair.cleartext.
