Was this page helpful?
SslOptions¶
SslOptions()
SSL/TLS options for secure connections. Based on Node.js tls.ConnectionOptions which extends SecureContextOptions and CommonConnectionOptions.
Constructor¶
new SslOptions()
Members¶
(nullable) ca :string|Buffer|Array:.<(string:|Buffer:)>
Optionally override the trusted CA certificates. When not provided, uses OpenSSL defaults (which in most cases means system trusted certificates). Setting this option replaces the default CA certificates, rather than adding to them.
Corresponds to SSL_CTX_set_cert_store
Warning: Behavior when this option is unset differs from Node.js defaults.
Type:
(nullable) cert :string|Buffer
Cert chains in PEM format. One cert chain should be provided per private key. Each cert chain should consist of the PEM formatted certificate for a provided private key, followed by the PEM formatted intermediate certificates (if any), in order, and not including the root CA (the root CA must be pre-known to the peer, see ca). If the intermediate certificates are not provided, the peer will not be able to validate the certificate, and the handshake will fail.
Only a single cert chain is currently supported by the driver.
Corresponds to SSL_CTX_use_certificate for the first certificate in the chain and SSL_CTX_add_extra_chain_cert for the subsequent certificates in the chain.
Type:
- string | Buffer
(nullable) ciphers :string
Cipher suite specification, replacing the default. For more information, see modifying the default cipher suite. Permitted ciphers can be obtained via tls.getCiphers(). Cipher names must be uppercased in order for OpenSSL to accept them.
Corresponds to SSL_set_ciphersuites for ciphers with TLS_ prefix SSL_CTX_set_cipher_list for remaining ciphers.
Type:
- string
(nullable) ecdhCurve :string
A string describing a named curve or a colon separated list of curve NIDs or names, for example P-521:P-384:P-256, to use for ECDH key agreement. Set to auto to select the curve automatically. Use crypto.getCurves() to obtain a list of available curve names. On recent releases, openssl ecparam -list_curves will also display the name and description of each available elliptic curve. Default: tls.DEFAULT_ECDH_CURVE.
corresponds to SSL_CTX_set1_curves
Type:
- string
(nullable) honorCipherOrder :boolean
Attempt to use the server's cipher suite preferences instead of the client's. When true, causes SSL_OP_CIPHER_SERVER_PREFERENCE to be set in secureOptions.
Type:
- boolean
(nullable) key :string|Buffer
Private keys in PEM format. PEM allows the option of private keys being encrypted. Encrypted keys will be decrypted with options.passphrase.
Only a single cert chain, and as a result a single private key is currently supported by the driver.
Corresponds to SSL_CTX_use_PrivateKey
Type:
- string | Buffer
(nullable) maxVersion :'TLSv1.3'|'TLSv1.2'|'TLSv1.1'|'TLSv1'
Optionally set the maximum TLS version to allow. One
of 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'.
Default: 'TLSv1.3'
Warning: In Node.js it was possible to modify default values using CLI options. This is not possible here.
Type:
- 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1'
(nullable) minVersion :'TLSv1.3'|'TLSv1.2'|'TLSv1.1'|'TLSv1'
Optionally set the minimum TLS version to allow. One
of 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. It is not recommended to use
less than TLSv1.2, but it may be required for interoperability.
Default: 'TLSv1.2'
Warning: In Node.js it was possible to modify default values using CLI options.
Type:
- 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1'
(nullable) passphrase :string
Shared passphrase used for a single private key and/or a PFX.
Type:
- string
(nullable) pfx :string|Buffer
PFX or PKCS12 encoded private key and certificate chain. pfx is an alternative to providing key and cert individually. PFX is usually encrypted, if it is, passphrase will be used to decrypt it.
Only a single cert chain is currently supported by the driver.
This is equivalent to setting both cert and key fields
Type:
- string | Buffer
(nullable) rejectUnauthorized :boolean
If true the server will reject any connection which is not authorized with the list of supplied CAs. This option only has an effect if requestCert is true.
Corresponds to SSL_CTX_set_verify
Type:
- boolean
- Default Value:
- true
(nullable) secureOptions :number
Optionally affect the OpenSSL protocol behavior, which is not usually necessary.
This should be used carefully if at all!
Value is a numeric bitmask of the SSL_OP_* options from OpenSSL Options.
Corresponds to the options parameter in SSL_CTX_set_options
Type:
- number
(nullable) sigalgs :string
Colon-separated list of supported signature algorithms. The list can contain digest algorithms (SHA256, MD5 etc.), public key algorithms (RSA-PSS, ECDSA etc.), combination of both (e.g 'RSA+SHA384') or TLS v1.3 scheme names (e.g. rsa_pss_pss_sha512).
Corresponds to SSL_CTX_set1_sigalgs
Type:
- string