chunk_id
large_stringlengths
36
36
doc_type
large_stringclasses
2 values
category
large_stringclasses
17 values
document
large_stringclasses
50 values
version_raw
large_stringclasses
590 values
chunk_index
int64
0
262
text
large_stringlengths
11
5.69k
file_path
large_stringclasses
882 values
f4141962-ea67-5921-bb29-b10a712b3751
docs
nodejs
nodejs_tls
4x
6
### Event: 'secure'[#](#tls_event_secure) The event is emitted from the SecurePair once the pair has successfully established a secure connection. Similarly to the checking for the server `'secureConnection'` event, pair.cleartext.authorized should be checked to confirm whether the certificate used properly authorize...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
41cba78c-17eb-5312-84dd-21e97fa23c27
docs
nodejs
nodejs_tls
4x
7
### Event: 'newSession'[#](#tls_event_newsession) Added in: v0.9.2 `function (sessionId, sessionData, callback) { }` Emitted on creation of TLS session. May be used to store sessions in external storage. `callback` must be invoked eventually, otherwise no data will be sent or received from secure connection. NOTE: ...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
8ee57824-5632-51f3-8abf-e0992bdcfe85
docs
nodejs
nodejs_tls
4x
8
Alternatively, `callback(null, null)` could be called, meaning that there is no OCSP response. Calling `callback(err)` will result in a `socket.destroy(err)` call. Typical flow: 1. Client connects to server and sends `'OCSPRequest'` to it (via status info extension in ClientHello.) 2. Server receives request and ...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
6f094a76-a550-5fb2-b586-61df45c252e7
docs
nodejs
nodejs_tls
4x
9
NOTE: you may want to use some npm module like [asn1.js](https://npmjs.org/package/asn1.js) to parse the certificates. ### Event: 'resumeSession'[#](#tls_event_resumesession) Added in: v0.9.2 `function (sessionId, callback) { }` Emitted when client wants to resume previous TLS session. Event listener may perform lo...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
518fe481-d99e-5a60-966f-3a00b7de989a
docs
nodejs
nodejs_tls
4x
10
### Event: 'secureConnection'[#](#tls_event_secureconnection) Added in: v0.3.2 `function (tlsSocket) {}` This event is emitted after a new connection has been successfully handshaked. The argument is an instance of [`tls.TLSSocket`](#tls_class_tls_tlssocket). It has all the common stream methods and events. `socket...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
42f34e82-3d0f-5327-b64a-7c0fdc7a175f
docs
nodejs
nodejs_tls
4x
11
`socket.servername` is a string containing servername requested with SNI. ### server.addContext(hostname, context)[#](#tls_server_addcontext_hostname_context) Added in: v0.5.3 Add secure context that will be used if client request's SNI hostname is matching passed `hostname` (wildcards can be used). `context` can co...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
249ea9c4-3df4-5a58-8035-d5a6f3bc99b8
docs
nodejs
nodejs_tls
4x
12
### server.connections[#](#tls_server_connections) Added in: v0.3.2 The number of concurrent connections on the server. ### server.getTicketKeys()[#](#tls_server_getticketkeys) Added in: v3.0.0 Returns `Buffer` instance holding the keys currently used for encryption/decryption of the [TLS Session Tickets](https://...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
da22a5e3-9d6d-552b-a63d-4492d7b277b3
docs
nodejs
nodejs_tls
4x
13
### server.maxConnections[#](#tls_server_maxconnections) Added in: v0.2.0 Set this property to reject connections when the server's connection count gets high. ### server.setTicketKeys(keys)[#](#tls_server_setticketkeys_keys) Added in: v3.0.0 Updates the keys for encryption/decryption of the [TLS Session Tickets](...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
80a14eeb-95b7-5275-bbf5-7c920874fa3f
docs
nodejs
nodejs_tls
4x
14
Methods that return TLS connection meta data (e.g. [`tls.TLSSocket.getPeerCertificate()`](#tls_tlssocket_getpeercertificate_detailed) will only return data while the connection is open. ## new tls.TLSSocket(socket[, options])[#](#tls_new_tls_tlssocket_socket_options) Added in: v0.11.4 Construct a new TLSSocket objec...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
096b0ed5-d47e-5cd7-a013-ad987695105e
docs
nodejs
nodejs_tls
4x
15
* `rejectUnauthorized`: Optional, see [`tls.createSecurePair()`](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) * `NPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) * `ALPNProtocols`: Optional, see [tls.createServer][] * `SNIC...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
bafffdc9-214c-5504-a7a4-e59c7bc2178f
docs
nodejs
nodejs_tls
4x
16
contains information about server's certificate revocation status. ### Event: 'secureConnect'[#](#tls_event_secureconnect) Added in: v0.11.4 This event is emitted after a new connection has been successfully handshaked. The listener will be called no matter if the server's certificate was authorized or not. It is up...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
e2f65b2f-0619-5449-89be-7ab68bb3380f
docs
nodejs
nodejs_tls
4x
17
### tlsSocket.authorized[#](#tls_tlssocket_authorized) Added in: v0.11.4 A boolean that is `true` if the peer certificate was signed by one of the specified CAs, otherwise `false` ### tlsSocket.authorizationError[#](#tls_tlssocket_authorizationerror) Added in: v0.11.4 The reason why the peer's certificate has not ...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
82171460-9345-5598-b746-3d8d51528722
docs
nodejs
nodejs_tls
4x
18
### tlsSocket.getPeerCertificate([ detailed ])[#](#tls_tlssocket_getpeercertificate_detailed) Added in: v0.11.4 Returns an object representing the peer's certificate. The returned object has some properties corresponding to the field of the certificate. If `detailed` argument is `true` the full chain with `issuer` pr...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
bc3e391b-2ef9-5377-882a-4fba757bdfd8
docs
nodejs
nodejs_tls
4x
19
If the peer does not provide a certificate, it returns `null` or an empty object. ### tlsSocket.getSession()[#](#tls_tlssocket_getsession) Added in: v0.11.4 Return ASN.1 encoded TLS session or `undefined` if none was negotiated. Could be used to speed up handshake establishment when reconnecting to the server. ### ...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
4e3a96d7-bf4a-51cd-a2d5-757e70687576
docs
nodejs
nodejs_tls
4x
20
### tlsSocket.remoteAddress[#](#tls_tlssocket_remoteaddress) Added in: v0.11.4 The string representation of the remote IP address. For example, `'74.125.127.100'` or `'2001:4860:a005::68'`. ### tlsSocket.remoteFamily[#](#tls_tlssocket_remotefamily) Added in: v0.11.4 The string representation of the remote IP famil...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
b8955444-0289-5433-86d3-fef1090e4b02
docs
nodejs
nodejs_tls
4x
21
ANOTHER NOTE: When running as the server, socket will be destroyed with an error after `handshakeTimeout` timeout. ### tlsSocket.setMaxSendFragment(size)[#](#tls_tlssocket_setmaxsendfragment_size) Added in: v0.11.11 Set maximum TLS fragment size (default and maximum value is: `16384`, minimum is: `512`). Returns `tr...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
0708bae2-c886-5798-a82d-7f1c9711d472
docs
nodejs
nodejs_tls
4x
22
## tls.connect(port[, host][, options][, callback])[#](#tls_tls_connect_port_host_options_callback) Added in: v0.11.3 Creates a new client connection to the given `port` and `host` (old API) or `options.port` and `options.host`. (If `host` is omitted, it defaults to `localhost`.) `options` should be an object which s...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
2d34f1f4-920c-51e8-83a8-4f1b84e8f808
docs
nodejs
nodejs_tls
4x
23
* `cert`: A string or `Buffer` containing the certificate key of the client in PEM format. (Could be an array of certs). * `ca`: A string, `Buffer` or array of strings or `Buffer`s of trusted certificates in PEM format. If this is omitted several well known "root" CAs will be used, like VeriSign. These are used t...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
5263a140-2766-5bb8-9cec-3d084d03d631
docs
nodejs
nodejs_tls
4x
24
usually be much simpler: `['hello', 'world']`.) * `ALPNProtocols`: An array of strings or `Buffer`s containing supported ALPN protocols. `Buffer`s should have following format: `0x05hello0x05world`, where the first byte is the next protocol name's length. (Passing array should usually be much simpler: `['hell...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
096e6c8b-ac5e-5b62-b1c3-13cf8c46c3ff
docs
nodejs
nodejs_tls
4x
25
certificates, key, and CA certificates. * `session`: A `Buffer` instance, containing TLS session. The `callback` parameter will be added as a listener for the [`'secureConnect'`](#tls_event_secureconnect) event. `tls.connect()` returns a [`tls.TLSSocket`](#tls_class_tls_tlssocket) object. Here is an example of a c...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
a43515de-eb20-5ab9-9474-9bbacc72539b
docs
nodejs
nodejs_tls
4x
26
}); socket.on('end', () => { server.close(); }); ``` Or ```None const tls = require('tls'); const fs = require('fs'); const options = { pfx: fs.readFileSync('client.pfx') }; var socket = tls.connect(8000, options, () => { console.log('client connected', socket.authorized ? 'authorized' : 'unauth...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
66907541-72ea-5c38-b963-9d4541335278
docs
nodejs
nodejs_tls
4x
27
can be provided. It can either be a plain array of keys, or an array of objects in the format `{pem: key, passphrase: passphrase}`. (Required) * `passphrase` : A string of passphrase for the private key or pfx * `cert` : A string holding the PEM encoded certificate * `ca`: A string, `Buffer` or array of strings or ...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
4a38a449-bf06-5a5f-9259-8b0f3324458a
docs
nodejs
nodejs_tls
4x
28
publicly trusted list of CAs as given in <http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt>. ## tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options])[#](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) Creates a n...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
f2aa48bc-f642-577b-84ca-68d16b7f6604
docs
nodejs
nodejs_tls
4x
29
automatically reject clients with invalid certificates. Only applies to servers with `requestCert` enabled. * `options`: An object with common SSL options. See [`tls.TLSSocket`](#tls_class_tls_tlssocket). `tls.createSecurePair()` returns a SecurePair object with `cleartext` and `encrypted` stream properties. NOTE...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
3540566f-f382-5618-987f-752ce612fa2e
docs
nodejs
nodejs_tls
4x
30
* `key`: A string or `Buffer` containing the private key of the server in PEM format. To support multiple keys using different algorithms, an array can be provided. It can either be a plain array of keys, or an array of objects in the format `{pem: key, passphrase: passphrase}`. (Required) * `passphrase`: A strin...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
2587b4ce-c4c8-5170-80f6-dcaa40cc540e
docs
nodejs
nodejs_tls
4x
31
ECDHE-RSA-AES256-GCM-SHA384: ECDHE-ECDSA-AES256-GCM-SHA384: DHE-RSA-AES128-GCM-SHA256: ECDHE-RSA-AES128-SHA256: DHE-RSA-AES128-SHA256: ECDHE-RSA-AES256-SHA384: DHE-RSA-AES256-SHA384: ECDHE-RSA-AES256-SHA256: DHE-RSA-AES256-SHA256: HIGH: !aNULL: !eNULL: !EXPORT: !DES: !RC4: !MD5: !PSK: ...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
57cd158c-786c-5c6e-ac40-e4fd8c86285e
docs
nodejs
nodejs_tls
4x
32
configuration. If you absolutely must support these clients, the [TLS recommendations](https://wiki.mozilla.org/Security/Server_Side_TLS) may offer a compatible cipher suite. For more details on the format, see the [OpenSSL cipher list format documentation](https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
e1ec3c9f-4a0a-53bc-b588-4adbc2d66551
docs
nodejs
nodejs_tls
4x
33
more for stronger security. If omitted or invalid, it is silently discarded and DHE ciphers won't be available. * `handshakeTimeout`: Abort the connection if the SSL/TLS handshake does not finish in this many milliseconds. The default is 120 seconds. A `'clientError'` is emitted on the `tls.Server` object when...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
3025931a-49b9-534a-a1ff-06a0846cbc38
docs
nodejs
nodejs_tls
4x
34
protocols. (Protocols should be ordered by their priority). When the server receives both NPN and ALPN extensions from the client, ALPN takes precedence over NPN and the server does not send an NPN extension to the client. * `SNICallback(servername, cb)`: A function that will be called if client supports SNI ...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
c754754a-af87-53fe-aeaf-c28a5cc6e9ac
docs
nodejs
nodejs_tls
4x
35
16-byte hmac key, 16-byte AES key. You could use it to accept tls session tickets on multiple instances of tls server. NOTE: Automatically shared between `cluster` module workers. * `sessionIdContext`: A string containing an opaque identifier for session resumption. If `requestCert` is `true`, the default is M...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
f0b280b6-43a1-595f-8a2f-ad7c2deed372
docs
nodejs
nodejs_tls
4x
36
requestCert: true, // This is necessary only if the client uses the self-signed certificate. ca: [ fs.readFileSync('client-cert.pem') ] }; var server = tls.createServer(options, (socket) => { console.log('server connected', socket.authorized ? 'authorized' : 'unauthorized'); socket.write('welc...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
e99c508e-3640-5ad4-a18a-e03e0e206918
docs
nodejs
nodejs_tls
4x
37
You can test this server by connecting to it with `openssl s_client`: ```None openssl s_client -connect 127.0.0.1:8000 ``` ## tls.getCiphers()[#](#tls_tls_getciphers) Added in: v0.10.2 Returns an array with the names of the supported SSL ciphers. Example: ```None var ciphers = tls.getCiphers(); console.log(cipher...
large_dataset/raw/docs/nodejs/tls/tls_4x.md
47f4f0a5-f1f1-52b3-bac9-13be0321ad56
docs
nodejs
nodejs_tls
5x
0
# TLS (SSL)# Source: https://nodejs.org/docs/latest-v5.x/api/tls.html Version: 5.x ```None Stability: 2 - Stable ``` Use `require('tls')` to access this module. The `tls` module uses OpenSSL to provide Transport Layer Security and/or Secure Socket Layer: encrypted stream communication. TLS/SSL is a public/private ...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
cce039f2-83e6-5cd2-bc6f-ec2fafdb1aac
docs
nodejs
nodejs_tls
5x
1
Alternatively you can send the CSR to a Certificate Authority for signing. For Perfect Forward Secrecy, it is required to generate Diffie-Hellman parameters: ```None openssl dhparam -outform PEM -out dhparam.pem 2048 ``` To create a .pfx or .p12, do this: ```None openssl pkcs12 -export -in agent5-cert.pem -inkey ag...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
a975aaf9-d781-5d5b-86ab-37f35e44984f
docs
nodejs
nodejs_tls
5x
2
## Client-initiated renegotiation attack mitigation[#](#tls_client_initiated_renegotiation_attack_mitigation) The TLS protocol lets the client renegotiate certain aspects of the TLS session. Unfortunately, session renegotiation requires a disproportionate amount of server-side resources, which makes it a potential vec...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
b4dfe970-571f-5f78-9c16-6f8932762bba
docs
nodejs
nodejs_tls
5x
3
## Modifying the Default TLS Cipher suite[#](#tls_modifying_the_default_tls_cipher_suite) Node.js is built with a default suite of enabled and disabled TLS ciphers. Currently, the default cipher suite is: ```None ECDHE-RSA-AES128-GCM-SHA256: ECDHE-ECDSA-AES128-GCM-SHA256: ECDHE-RSA-AES256-GCM-SHA384: ECDHE-ECDSA-AES2...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
da3c625f-4375-5003-a0a0-f123dc13eafb
docs
nodejs
nodejs_tls
5x
4
Changing the default cipher suite can have a significant impact on the security of an application. The `--tls-cipher-list` switch should by used only if absolutely necessary. ## Perfect Forward Secrecy[#](#tls_perfect_forward_secrecy) The term "[Forward Secrecy](https://en.wikipedia.org/wiki/Perfect_forward_secrecy)"...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
4e50024d-1daf-5c7e-9776-887ce96f4212
docs
nodejs
nodejs_tls
5x
5
* [DHE](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) - An ephemeral version of the Diffie Hellman key-agreement protocol. * [ECDHE](https://en.wikipedia.org/wiki/Elliptic_curve_Diffie%E2%80%93Hellman) - An ephemeral version of the Elliptic Curve Diffie Hellman key-agreement protocol. Ephemeral ...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
d8d52ba9-5d81-51ea-b3f4-59e6dbb2fba4
docs
nodejs
nodejs_tls
5x
6
### Event: 'secure'[#](#tls_event_secure) This event is emitted from the SecurePair once the pair has successfully established a secure connection. As with checking for the server [`secureConnection`](#tls_event_secureconnection) event, `pair.cleartext.authorized` should be inspected to confirm whether the certificat...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
898bcac3-e4ce-5fb2-b77d-e629e98df78c
docs
nodejs
nodejs_tls
5x
7
### Event: 'newSession'[#](#tls_event_newsession) `function (sessionId, sessionData, callback) { }` Emitted on creation of a TLS session. May be used to store sessions in external storage. `callback` must be invoked eventually, otherwise no data will be sent or received from the secure connection. NOTE: adding this ...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
c3105533-2569-58d4-b45c-138dc4c65913
docs
nodejs
nodejs_tls
5x
8
Alternatively, `callback(null, null)` may be called, meaning that there was no OCSP response. Calling `callback(err)` will result in a `socket.destroy(err)` call. Typical flow: 1. Client connects to the server and sends an `'OCSPRequest'` to it (via status info extension in ClientHello). 2. Server receives the re...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
24057c90-b122-5a74-81c4-d22cc74fba29
docs
nodejs
nodejs_tls
5x
9
established after the addition of the event listener. NOTE: An npm module like [asn1.js](https://npmjs.org/package/asn1.js) may be used to parse the certificates. ### Event: 'resumeSession'[#](#tls_event_resumesession) `function (sessionId, callback) { }` Emitted when the client wants to resume the previous TLS ses...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
0fdeb486-9b1d-5ca3-b03e-9de7ecb83911
docs
nodejs
nodejs_tls
5x
10
cb(null, tlsSessionStore[id.toString('hex')] || null); }); ``` ### Event: 'secureConnection'[#](#tls_event_secureconnection) `function (tlsSocket) {}` This event is emitted after the handshaking process for a new connection has successfully completed. The argument is an instance of [`tls.TLSSocket`](#tls_class_tls...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
db8f3465-af41-56fb-9911-9ce6579b96ef
docs
nodejs
nodejs_tls
5x
11
precedence over NPN and the next protocol is selected by ALPN. When ALPN has no selected protocol, this returns false. `socket.servername` is a string containing the server name requested with SNI. ### server.addContext(hostname, context)[#](#tls_server_addcontext_hostname_context) Add secure context that will be us...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
db7c2a9b-28af-5968-9284-a04c1510f322
docs
nodejs
nodejs_tls
5x
12
### server.close([callback])[#](#tls_server_close_callback) Stops the server from accepting new connections. This function is asynchronous, the server is finally closed when the server emits a `'close'` event. Optionally, you can pass a callback to listen for the `'close'` event. ### server.connections[#](#tls_server...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
c314f03f-b147-55ef-9965-517d02cd9760
docs
nodejs
nodejs_tls
5x
13
This function is asynchronous. The last parameter `callback` will be called when the server has been bound. See `net.Server` for more information. ### server.setTicketKeys(keys)[#](#tls_server_setticketkeys_keys) Updates the keys for encryption/decryption of the [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
9ddfc523-b203-520c-9e6b-24232ade45ff
docs
nodejs
nodejs_tls
5x
14
## Class: tls.TLSSocket[#](#tls_class_tls_tlssocket) This is a wrapped version of [`net.Socket`](net.html#net_class_net_socket) that does transparent encryption of written data and all required TLS negotiation. This instance implements the duplex [Stream](stream.html#stream_stream) interface. It has all the common st...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
1974e373-b11b-5f86-a81e-b973804a215d
docs
nodejs
nodejs_tls
5x
15
* `isServer`: If `true` the TLS socket will be instantiated in server-mode. Default: `false` * `server`: An optional [`net.Server`](net.html#net_class_net_server) instance * `requestCert`: Optional, see [`tls.createSecurePair()`](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) * `re...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
be13ed81-0944-5a91-a4f6-8fef6128982a
docs
nodejs
nodejs_tls
5x
16
on the socket before establishing a secure communication ### Event: 'OCSPResponse'[#](#tls_event_ocspresponse) `function (response) { }` This event will be emitted if the `requestOCSP` option was set. `response` is a `Buffer` containing the server's OCSP response. Traditionally, the `response` is a signed object ...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
6a2dc8b5-d221-5b18-b474-20fc5391da84
docs
nodejs
nodejs_tls
5x
17
negotiated protocol. ### tlsSocket.address()[#](#tls_tlssocket_address) Returns the bound address, the address family name, and port of the underlying socket as reported by the operating system. Returns an object with three properties, e.g., `{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` ### tlsSocket.autho...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
338a8fa4-0f27-5019-bbcd-f386ed4a88f5
docs
nodejs
nodejs_tls
5x
18
### tlsSocket.getCipher()[#](#tls_tlssocket_getcipher) Returns an object representing the cipher name and the SSL/TLS protocol version that first defined the cipher. Example: `{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' }` See SSL\_CIPHER\_get\_name() and SSL\_CIPHER\_get\_version() in <https://www.openssl.org/docs...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
a8e52592-ff9c-59a1-806f-f4c1cccf3784
docs
nodejs
nodejs_tls
5x
19
### tlsSocket.getPeerCertificate([ detailed ])[#](#tls_tlssocket_getpeercertificate_detailed) Returns an object representing the peer's certificate. The returned object has some properties corresponding to the fields of the certificate. If the `detailed` argument is `true` the full chain with the `issuer` property wil...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
09fbd485-2aad-5763-93f8-166d972b715a
docs
nodejs
nodejs_tls
5x
20
If the peer does not provide a certificate, it returns `null` or an empty object. ### tlsSocket.getProtocol()[#](#tls_tlssocket_getprotocol) Returns a string containing the negotiated SSL/TLS protocol version of the current connection. `'unknown'` will be returned for connected sockets that have not completed the han...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
12863a2b-0101-566a-a0c8-25cd2d124140
docs
nodejs
nodejs_tls
5x
21
session reuse provide `session` option to [`tls.connect()`](#tls_tls_connect_options_callback). Returns the TLS session ticket or `undefined` if none was negotiated. ### tlsSocket.localAddress[#](#tls_tlssocket_localaddress) The string representation of the local IP address. ### tlsSocket.localPort[#](#tls_tlssocke...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
3bf3605c-3713-5a98-857e-90e33a66e346
docs
nodejs
nodejs_tls
5x
22
### tlsSocket.renegotiate(options, callback)[#](#tls_tlssocket_renegotiate_options_callback) Initiate TLS renegotiation process. The `options` object may contain the following fields: `rejectUnauthorized`, `requestCert`. (See [`tls.createServer ()`][] for details.) `callback(err)` will be executed with `null` as `err`...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
6ab1ecb4-bd2e-5545-9c34-e5b2eb0c1fd7
docs
nodejs
nodejs_tls
5x
23
and its integrity is verified; large fragments can span multiple roundtrips and their processing can be delayed due to packet loss or reordering. However, smaller fragments add extra TLS framing bytes and CPU overhead, which may decrease overall server throughput. ## tls.connect(options[, callback])[#](#tls_tls_connec...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
20738e13-6e7d-56ec-824c-7f763db04654
docs
nodejs
nodejs_tls
5x
24
* `pfx`: A string or `Buffer` containing the private key, certificate, and CA certs of the client in PFX or PKCS12 format. * `key`: A string, `Buffer`, array of strings, or array of `Buffer`s containing the private key of the client in PEM format. * `passphrase`: A string containing the passphrase for the private k...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
23f0e3a4-65c0-509c-9ffe-d9ddee625f8c
docs
nodejs
nodejs_tls
5x
25
the list of supplied CAs. An `'error'` event is emitted if verification fails; `err.code` contains the OpenSSL error code. Default: `true`. * `NPNProtocols`: An array of strings or `Buffer`s containing supported NPN protocols. `Buffer`s should have the following format: `0x05hello0x05world`, where the first byt...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
276fb531-61ca-5746-871c-2ace2c850c19
docs
nodejs
nodejs_tls
5x
26
* `secureProtocol`: The SSL method to use, e.g., `SSLv3_method` to force SSL version 3. The possible values depend on the version of OpenSSL installed in the environment and are defined in the constant [SSL\_METHODS](https://www.openssl.org/docs/ssl/ssl.html#DEALING_WITH_PROTOCOL_METHODS). * `secureContext`: An o...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
90178087-75eb-5242-9f29-177538d713f7
docs
nodejs
nodejs_tls
5x
27
const tls = require('tls'); const fs = require('fs'); const options = { // These are necessary only if using the client certificate authentication key: fs.readFileSync('client-key.pem'), cert: fs.readFileSync('client-cert.pem'), // This is necessary only if the server uses the self-signed certificate ca: [ ...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
21553b8d-86bf-52f7-942b-24f912aa045a
docs
nodejs
nodejs_tls
5x
28
process.stdin.resume(); }); socket.setEncoding('utf8'); socket.on('data', (data) => { console.log(data); }); socket.on('end', () => { server.close(); }); ``` ## tls.createSecureContext(options)[#](#tls_tls_createsecurecontext_options) Creates a credentials object; the `options` object may contain the following ...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
214abe89-415b-5cc8-a5b5-b50fcbe97e43
docs
nodejs
nodejs_tls
5x
29
certificates in PEM format. If this is omitted several well known "root" CAs (like VeriSign) will be used. These are used to authorize connections. * `crl` : Either a string or list of strings of PEM encoded CRLs (Certificate Revocation List). * `ciphers`: A string describing the ciphers to use or exclude. Cons...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
bd0d2f01-aa91-5634-a068-f7d409171ee9
docs
nodejs
nodejs_tls
5x
30
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 stre...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
edca6002-dc86-5f5c-8d8f-2f9a6c6fb919
docs
nodejs
nodejs_tls
5x
31
`encrypted` stream properties. NOTE: `cleartext` has the same API as [`tls.TLSSocket`](#tls_class_tls_tlssocket) ## tls.createServer(options[, secureConnectionListener])[#](#tls_tls_createserver_options_secureconnectionlistener) Creates a new [tls.Server](#tls_class_tls_server). The `connectionListener` argument is ...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
6e44a363-66fc-5cb1-9b2e-e03e9fadcd53
docs
nodejs
nodejs_tls
5x
32
* `passphrase`: A string containing the passphrase for the private key or pfx. * `cert`: A string, `Buffer`, array of strings, or array of `Buffer`s containing the certificate key of the server in PEM format. (Required) * `ca`: A string, `Buffer`, array of strings, or array of `Buffer`s of trusted certificates in P...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
54c527eb-f292-539f-9e55-3920c0e5f22f
docs
nodejs
nodejs_tls
5x
33
!EXPORT: !DES: !RC4: !MD5: !PSK: !SRP: !CAMELLIA ``` The default cipher suite prefers GCM ciphers for [Chrome's 'modern cryptography' setting](https://www.chromium.org/Home/chromium-security/education/tls#TOC-Deprecation-of-TLS-Features-Algorithms-in-Chrome) and also prefers ECDHE and DHE ciphers f...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
e4cc5cf4-729e-52c9-bb02-43417dea48d5
docs
nodejs
nodejs_tls
5x
34
on the format, see the [OpenSSL cipher list format documentation](https://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT). * `ecdhCurve`: A string describing a named curve to use for ECDH key agreement or false to disable ECDH. Defaults to `prime256v1` (NIST P-256). Use [`crypto.getCurves()`](crypto.h...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
cc2c4a6e-9a7d-5b8e-bb3e-96fed9a4778e
docs
nodejs
nodejs_tls
5x
35
finish in the specified number of milliseconds. The default is 120 seconds. A `'clientError'` is emitted on the `tls.Server` object whenever a handshake times out. * `honorCipherOrder` : When choosing a cipher, use the server's preferences instead of the client preferences. Default: `true`. * `requestCert`: If...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
0f923393-4f6f-5145-9b52-2a981a36563c
docs
nodejs
nodejs_tls
5x
36
ALPN takes precedence over NPN and the server does not send an NPN extension to the client. * `SNICallback(servername, cb)`: A function that will be called if the client supports SNI TLS extension. Two arguments will be passed to it: `servername` and `cb`. `SNICallback` should invoke `cb(null, ctx)`, where `c...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
5ceb9c8b-d87c-5295-82a0-0fc5077fa212
docs
nodejs
nodejs_tls
5x
37
NOTE: Automatically shared between `cluster` module workers. * `sessionIdContext`: A string containing an opaque identifier for session resumption. If `requestCert` is `true`, the default is a MD5 hash value generated from the command-line. (In FIPS mode a truncated SHA1 hash is used instead.) Otherwise, a defa...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
8c038202-5d91-540e-b81e-ccf7e0cf6b61
docs
nodejs
nodejs_tls
5x
38
ca: [ fs.readFileSync('client-cert.pem') ] }; var server = tls.createServer(options, (socket) => { console.log('server connected', socket.authorized ? 'authorized' : 'unauthorized'); socket.write('welcome!\n'); socket.setEncoding('utf8'); socket.pipe(socket); }); server.listen(8000, () => { c...
large_dataset/raw/docs/nodejs/tls/tls_5x.md
9c95e946-a676-5db9-8e93-b85db8dfcf90
docs
nodejs
nodejs_tls
5x
39
## tls.getCiphers()[#](#tls_tls_getciphers) Returns an array with the names of the supported SSL ciphers. Example: ```None var ciphers = tls.getCiphers(); console.log(ciphers); // ['AES128-SHA', 'AES256-SHA', ...] ```
large_dataset/raw/docs/nodejs/tls/tls_5x.md
9357dfa2-9924-5a3e-bc3c-ca167b3ee650
docs
nodejs
nodejs_tls
6x
0
# TLS (SSL)# Source: https://nodejs.org/docs/latest-v6.x/api/tls.html Version: 6.x [Stability: 2](documentation.html#documentation_stability_index) - Stable The `tls` module provides an implementation of the Transport Layer Security (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. The m...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
59cc2b40-258a-5095-afc9-2c9a0f39f1c9
docs
nodejs
nodejs_tls
6x
1
private key (such certificates are referred to as "self-signed"). The first step to obtaining a certificate is to create a *Certificate Signing Request* (CSR) file. The OpenSSL command-line interface can be used to generate a CSR for a private key: ```None openssl req -new -sha256 -key ryans-key.pem -out ryans-csr.pe...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
927bd64c-b975-548c-9d09-169072ce3ad8
docs
nodejs
nodejs_tls
6x
2
* `certfile`: is a concatenation of all Certificate Authority (CA) certs into a single file, e.g. `cat ca1-cert.pem ca2-cert.pem > ca-cert.pem` ### Perfect Forward Secrecy[#](#tls_perfect_forward_secrecy) The term "[Forward Secrecy](https://en.wikipedia.org/wiki/Perfect_forward_secrecy)" or "Perfect Forward Secrecy...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
7c88bbd0-7bb9-5b47-89e0-44245d0da1fc
docs
nodejs
nodejs_tls
6x
3
Currently two methods are commonly used to achieve Perfect Forward Secrecy (note the character "E" appended to the traditional abbreviations): * [DHE](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) - An ephemeral version of the Diffie Hellman key-agreement protocol. * [ECDHE](https://en.wikipedia.o...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
0d9c5925-3e84-5d28-b30b-7c84de96782d
docs
nodejs
nodejs_tls
6x
4
not required and a default ECDHE curve will be used. The `ecdhCurve` property can be used when creating a TLS Server to specify the name of an alternative curve to use, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) for more info. ### ALPN, NPN and SNI[#](#tls_alpn_npn_and_sni) ALP...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
4c3abf1e-0374-5555-a78b-29ec21f5884b
docs
nodejs
nodejs_tls
6x
5
### Client-initiated renegotiation attack mitigation[#](#tls_client_initiated_renegotiation_attack_mitigation) The TLS protocol allows clients to renegotiate certain aspects of the TLS session. Unfortunately, session renegotiation requires a disproportionate amount of server-side resources, making it a potential vecto...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
ed525cd2-8244-5e8e-bbe8-03f0f91a5a61
docs
nodejs
nodejs_tls
6x
6
*Note*: The default renegotiation limits should not be modified without a full understanding of the implications and risks. To test the renegotiation limits on a server, connect to it using the OpenSSL command-line client (`openssl s_client -connect address:port`) then input `R<CR>` (i.e., the letter `R` followed by a...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
0d4d5f1f-8ef0-5090-a4db-420d907bf61a
docs
nodejs
nodejs_tls
6x
7
line switch. For instance, the following makes `ECDHE-RSA-AES128-GCM-SHA256:!RC4` the default TLS cipher suite: ```None node --tls-cipher-list="ECDHE-RSA-AES128-GCM-SHA256:!RC4" ``` The default can also be replaced on a per client or server basis using the `ciphers` option from [`tls.createSecureContext()`](#tls_tls_...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
0e996e47-ffef-5af8-b57b-09fbdd1bd34d
docs
nodejs
nodejs_tls
6x
8
of an application. The `--tls-cipher-list` switch and `ciphers` option should by used only if absolutely necessary. The default cipher suite prefers GCM ciphers for [Chrome's 'modern cryptography' setting](https://www.chromium.org/Home/chromium-security/education/tls#TOC-Cipher-Suites) and also prefers ECDHE and DHE c...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
362fb598-5edb-5b62-8d8c-93b88c739f8f
docs
nodejs
nodejs_tls
6x
9
on the format, see the [OpenSSL cipher list format documentation](https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#CIPHER-LIST-FORMAT). ## Class: tls.Server[#](#tls_class_tls_server) Added in: v0.3.2 The `tls.Server` class is a subclass of `net.Server` that accepts encrypted connections using TLS or SSL. ###...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
529e2d4c-db03-5d74-81d0-800152d927a0
docs
nodejs
nodejs_tls
6x
10
### Event: 'newSession'[#](#tls_event_newsession) Added in: v0.9.2 The `'newSession'` event is emitted upon creation of a new TLS session. This may be used to store sessions in external storage. The listener callback is passed three arguments when called: * `sessionId` - The TLS session identifier * `sessionData` - ...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
f7a6eb15-4d18-5aa9-bc0f-579729285908
docs
nodejs
nodejs_tls
6x
11
* `certificate` [<Buffer>](buffer.html#buffer_class_buffer) The server certificate * `issuer` [<Buffer>](buffer.html#buffer_class_buffer) The issuer's certificate * `callback` [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that must be invoked...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
8879730d-f440-530f-afa2-bfe9f820df23
docs
nodejs
nodejs_tls
6x
12
1. Client connects to the server and sends an `'OCSPRequest'` (via the status info extension in ClientHello). 2. Server receives the request and emits the `'OCSPRequest'` event, calling the listener if registered. 3. Server extracts the OCSP URL from either the `certificate` or `issuer` and performs an [OCSP r...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
8885d912-287f-5943-b1c2-b4d3772e21ef
docs
nodejs
nodejs_tls
6x
13
*Note*: An npm module like [asn1.js](https://npmjs.org/package/asn1.js) may be used to parse the certificates. ### Event: 'resumeSession'[#](#tls_event_resumesession) Added in: v0.9.2 The `'resumeSession'` event is emitted when the client requests to resume a previous TLS session. The listener callback is passed two...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
1fb8e655-12aa-5916-be43-805de7f28e4a
docs
nodejs
nodejs_tls
6x
14
*Note*: Listening for this event will have an effect only on connections established after the addition of the event listener. The following illustrates resuming a TLS session: ```None const tlsSessionStore = {}; server.on('newSession', (id, data, cb) => { tlsSessionStore[id.toString('hex')] = data; cb(); }); ser...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
aaee8889-abff-5199-8a5e-7d26dc4f271d
docs
nodejs
nodejs_tls
6x
15
is set to describe how authorization failed. Note that depending on the settings of the TLS server, unauthorized connections may still be accepted. The `tlsSocket.npnProtocol` and `tlsSocket.alpnProtocol` properties are strings that contain the selected NPN and ALPN protocols, respectively. When both NPN and ALPN exte...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
69edd30e-64e9-5b41-b181-152e6bdcf7ed
docs
nodejs
nodejs_tls
6x
16
from the [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) `options` arguments (e.g. `key`, `cert`, `ca`, etc). The `server.addContext()` method adds a secure context that will be used if the client request's SNI hostname matches the supplied `hostname` (or wildcard). ### server.address()[#](#tl...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
521777b6-b659-555f-a133-564513b5ca59
docs
nodejs
nodejs_tls
6x
17
when the server has no more open connections. ### server.connections[#](#tls_server_connections) Added in: v0.3.2 Returns the current number of concurrent connections on the server. ### server.getTicketKeys()[#](#tls_server_getticketkeys) Added in: v3.0.0 Returns a `Buffer` instance holding the keys currently use...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
c2c3e6e5-4390-505e-bc4a-15cdd142b0c1
docs
nodejs
nodejs_tls
6x
18
on any IPv6 address (`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. * `callback` [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function to be invoked when the server has begun listening on the `port` and `hostname`. Th...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
8bfffea5-1701-5a96-a140-bbbc3d74e204
docs
nodejs
nodejs_tls
6x
19
*Note*: The key's `Buffer` should be 48 bytes long. See `ticketKeys` option in [tls.createServer](#tls_tls_createserver_options_secureconnectionlistener) for more information on how it is used. *Note*: Changes to the ticket keys are effective only for future server connections. Existing or currently pending server con...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
973a89d4-8b83-5468-a5ec-3c95964f9c3e
docs
nodejs
nodejs_tls
6x
20
### new tls.TLSSocket(socket[, options])[#](#tls_new_tls_tlssocket_socket_options) Added in: v0.11.4 * `socket` [<net.Socket>](net.html#net_class_net_socket) | [<stream.Duplex>](stream.html#stream_class_stream_duplex) On the server side, any `Duplex` stream. On the client side, any instance of [`net.Socket`](net....
large_dataset/raw/docs/nodejs/tls/tls_6x.md
d4b47143-aa26-56c0-9d24-a7ea993f5a6b
docs
nodejs
nodejs_tls
6x
21
certificate. Clients always request a server certificate. Servers (`isServer` is true) may optionally set `requestCert` to true to request a client certificate. + `rejectUnauthorized`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + `NPNProtocols`: Optional...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
cbc64f5c-a159-5669-87b7-4f65991ede20
docs
nodejs
nodejs_tls
6x
22
will be emitted on the socket before establishing a secure communication + `secureContext`: Optional TLS context object created with [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). If a `secureContext` is *not* provided, one will be created by passing the entire `options` object to ...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
fac2e826-e8ec-58db-bea3-ffd8039d8cc1
docs
nodejs
nodejs_tls
6x
23
The listener callback is passed a single argument when called: * `response` [<Buffer>](buffer.html#buffer_class_buffer) The server's OCSP response Typically, the `response` is a digitally signed object from the server's CA that contains information about server's certificate revocation status. ### Event: 'secureConn...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
7839f28d-80ab-50e5-b70c-d839a026e89b
docs
nodejs
nodejs_tls
6x
24
checked to determine the negotiated protocol. ### tlsSocket.address()[#](#tls_tlssocket_address) Added in: v0.11.4 Returns the bound address, the address family name, and port of the underlying socket as reported by the operating system. Returns an object with three properties, e.g., `{ port: 12346, family: 'IPv4', ...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
c2fad7f5-34f1-5086-9554-871dd0a30e49
docs
nodejs
nodejs_tls
6x
25
### tlsSocket.getCipher()[#](#tls_tlssocket_getcipher) Added in: v0.11.4 Returns an object representing the cipher name and the SSL/TLS protocol version that first defined the cipher. For example: `{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' }` See `SSL_CIPHER_get_name()` and `SSL_CIPHER_get_version()` in <https:/...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
e9170397-04f4-5998-8c68-e27f5a16801b
docs
nodejs
nodejs_tls
6x
26
### tlsSocket.getPeerCertificate([ detailed ])[#](#tls_tlssocket_getpeercertificate_detailed) Added in: v0.11.4 * `detailed` [<boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Include the full certificate chain if `true`, otherwise include just the peer's certificate. ...
large_dataset/raw/docs/nodejs/tls/tls_6x.md
80f8cb29-6d98-5eec-89cf-c97c3b92360e
docs
nodejs
nodejs_tls
6x
27
{ ... another certificate, possibly with a .issuerCertificate ... }, raw: < RAW DER buffer >, valid_from: 'Nov 11 09:52:22 2009 GMT', valid_to: 'Nov 6 09:52:22 2029 GMT', fingerprint: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF', serialNumber: 'B9B0D332A1AA5635' } ``` If the peer does not...
large_dataset/raw/docs/nodejs/tls/tls_6x.md