Skip to content

Commit 7c3d280

Browse files
sam-githubitaloacasas
authored andcommitted
doc: rework tls for accuracy and clarity
Document all TLSSocket options: - All the secure context options are valid options to a secureContext - isServer modifies the default value of requestCert Describe all tls.connect() variants: - tls.connect(path) was undocumented - tls.connect(port) was underdocumented, and its relationship to tls.connect(options) was obscure Socket passed to tls.connect is user managed: - Replace #8996 Add documentation to: - describe and add tests for the pfx and key variants, and describe how and when passphrase is used. - describe tls cert and ca options - describe buffer forms of tls crl option - describe tls cipher option and defaults - fix link to Crypto Constants - describe that honorCipherOrder sets SSL_OP_CIPHER_SERVER_PREFERENCE. - describe tls ecdhCurve/dhparam options - describe tls secureProtocol option - describe tls secureOptions - describe tls sessionIdContext De-deduplicate secure context docs: The secure context options were documented 4 times, making it difficult to understand where the options come from, where they are supported, and under what conditions they are used. The multiple copies were inconsistent and contradictory in their descriptions of the options, and also inconsistent in whether the options would be documented at all. Cut through this gordian knot by linking all APIs that use the secureContext options to the single source of truth about the options. PR-URL: #9800 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 6b98906 commit 7c3d280

File tree

4 files changed

+346
-253
lines changed

4 files changed

+346
-253
lines changed

doc/api/crypto.md

+11-22
Original file line numberDiff line numberDiff line change
@@ -1082,26 +1082,15 @@ deprecated: v0.11.13
10821082

10831083
> Stability: 0 - Deprecated: Use [`tls.createSecureContext()`][] instead.
10841084
1085-
The `crypto.createCredentials()` method is a deprecated alias for creating
1086-
and returning a `tls.SecureContext` object. The `crypto.createCredentials()`
1087-
method should not be used.
1085+
- `details` {Object} Identical to [`tls.createSecureContext()`][].
10881086

1089-
The optional `details` argument is a hash object with keys:
1087+
The `crypto.createCredentials()` method is a deprecated function for creating
1088+
and returning a `tls.SecureContext`. It should not be used. Replace it with
1089+
[`tls.createSecureContext()`][] which has the exact same arguments and return
1090+
value.
10901091

1091-
* `pfx` : {String|Buffer} - PFX or PKCS12 encoded private
1092-
key, certificate and CA certificates
1093-
* `key` : {String} - PEM encoded private key
1094-
* `passphrase` : {String} - passphrase for the private key or PFX
1095-
* `cert` : {String} - PEM encoded certificate
1096-
* `ca` : {String|Array} - Either a string or array of strings of PEM encoded CA
1097-
certificates to trust.
1098-
* `crl` : {String|Array} - Either a string or array of strings of PEM encoded CRLs
1099-
(Certificate Revocation List)
1100-
* `ciphers`: {String} using the [OpenSSL cipher list format][] describing the
1101-
cipher algorithms to use or exclude.
1102-
1103-
If no 'ca' details are given, Node.js will use Mozilla's default
1104-
[publicly trusted list of CAs][].
1092+
Returns a `tls.SecureContext`, as-if [`tls.createSecureContext()`][] had been
1093+
called.
11051094

11061095
### crypto.createDecipher(algorithm, password)
11071096
<!-- YAML
@@ -1653,8 +1642,8 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
16531642
</tr>
16541643
<tr>
16551644
<td><code>SSL_OP_CIPHER_SERVER_PREFERENCE</code></td>
1656-
<td>Uses the server's preferences instead of the clients when selecting a
1657-
cipher. See
1645+
<td>Attempts to use the server's preferences instead of the client's when
1646+
selecting a cipher. Behaviour depends on protocol version. See
16581647
https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html.</td>
16591648
</tr>
16601649
<tr>
@@ -1682,7 +1671,7 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
16821671
</tr>
16831672
<tr>
16841673
<td><code>SSL_OP_LEGACY_SERVER_CONNECT</code></td>
1685-
<td>Allow initial connection to servers that do not support RI.</td>
1674+
<td>Allows initial connection to servers that do not support RI.</td>
16861675
</tr>
16871676
<tr>
16881677
<td><code>SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER</code></td>
@@ -1980,4 +1969,4 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
19801969
[RFC 3526]: https://www.rfc-editor.org/rfc/rfc3526.txt
19811970
[stream]: stream.html
19821971
[stream-writable-write]: stream.html#stream_writable_write_chunk_encoding_callback
1983-
[Crypto Constants]: #crypto_crypto_constants
1972+
[Crypto Constants]: #crypto_crypto_constants_1

0 commit comments

Comments
 (0)