Skip to content

Commit ddbcc9e

Browse files
ashanholMylesBorins
authored andcommitted
doc: add options argument to crypto docs
PR-URL: #14846 Fixes: #14804 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]>
1 parent d18bb3d commit ddbcc9e

File tree

1 file changed

+38
-23
lines changed

1 file changed

+38
-23
lines changed

doc/api/crypto.md

+38-23
Original file line numberDiff line numberDiff line change
@@ -1172,15 +1172,16 @@ added: v6.0.0
11721172
Property for checking and controlling whether a FIPS compliant crypto provider is
11731173
currently in use. Setting to true requires a FIPS build of Node.js.
11741174

1175-
### crypto.createCipher(algorithm, password)
1175+
### crypto.createCipher(algorithm, password[, options])
11761176
<!-- YAML
11771177
added: v0.1.94
11781178
-->
11791179
- `algorithm` {string}
11801180
- `password` {string | Buffer | TypedArray | DataView}
1181+
- `options` {Object} [`stream.transform` options][]
11811182

11821183
Creates and returns a `Cipher` object that uses the given `algorithm` and
1183-
`password`.
1184+
`password`. Optional `options` argument controls stream behavior.
11841185

11851186
The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
11861187
recent OpenSSL releases, `openssl list-cipher-algorithms` will display the
@@ -1202,13 +1203,14 @@ In line with OpenSSL's recommendation to use pbkdf2 instead of
12021203
their own using [`crypto.pbkdf2()`][] and to use [`crypto.createCipheriv()`][]
12031204
to create the `Cipher` object.
12041205

1205-
### crypto.createCipheriv(algorithm, key, iv)
1206+
### crypto.createCipheriv(algorithm, key, iv[, options])
12061207
- `algorithm` {string}
12071208
- `key` {string | Buffer | TypedArray | DataView}
12081209
- `iv` {string | Buffer | TypedArray | DataView}
1210+
- `options` {Object} [`stream.transform` options][]
12091211

12101212
Creates and returns a `Cipher` object, with the given `algorithm`, `key` and
1211-
initialization vector (`iv`).
1213+
initialization vector (`iv`). Optional `options` argument controls stream behavior.
12121214

12131215
The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
12141216
recent OpenSSL releases, `openssl list-cipher-algorithms` will display the
@@ -1236,15 +1238,16 @@ value.
12361238
Returns a `tls.SecureContext`, as-if [`tls.createSecureContext()`][] had been
12371239
called.
12381240

1239-
### crypto.createDecipher(algorithm, password)
1241+
### crypto.createDecipher(algorithm, password[, options])
12401242
<!-- YAML
12411243
added: v0.1.94
12421244
-->
12431245
- `algorithm` {string}
12441246
- `password` {string | Buffer | TypedArray | DataView}
1247+
- `options` {Object} [`stream.transform` options][]
12451248

12461249
Creates and returns a `Decipher` object that uses the given `algorithm` and
1247-
`password` (key).
1250+
`password` (key). Optional `options` argument controls stream behavior.
12481251

12491252
The implementation of `crypto.createDecipher()` derives keys using the OpenSSL
12501253
function [`EVP_BytesToKey`][] with the digest algorithm set to MD5, one
@@ -1258,16 +1261,18 @@ In line with OpenSSL's recommendation to use pbkdf2 instead of
12581261
their own using [`crypto.pbkdf2()`][] and to use [`crypto.createDecipheriv()`][]
12591262
to create the `Decipher` object.
12601263

1261-
### crypto.createDecipheriv(algorithm, key, iv)
1264+
### crypto.createDecipheriv(algorithm, key, iv[, options])
12621265
<!-- YAML
12631266
added: v0.1.94
12641267
-->
12651268
- `algorithm` {string}
12661269
- `key` {string | Buffer | TypedArray | DataView}
12671270
- `iv` {string | Buffer | TypedArray | DataView}
1271+
- `options` {Object} [`stream.transform` options][]
12681272

12691273
Creates and returns a `Decipher` object that uses the given `algorithm`, `key`
1270-
and initialization vector (`iv`).
1274+
and initialization vector (`iv`). Optional `options` argument controls stream
1275+
behavior.
12711276

12721277
The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
12731278
recent OpenSSL releases, `openssl list-cipher-algorithms` will display the
@@ -1335,14 +1340,16 @@ predefined curve specified by the `curveName` string. Use
13351340
OpenSSL releases, `openssl ecparam -list_curves` will also display the name
13361341
and description of each available elliptic curve.
13371342

1338-
### crypto.createHash(algorithm)
1343+
### crypto.createHash(algorithm[, options])
13391344
<!-- YAML
13401345
added: v0.1.92
13411346
-->
13421347
- `algorithm` {string}
1348+
- `options` {Object} [`stream.transform` options][]
13431349

13441350
Creates and returns a `Hash` object that can be used to generate hash digests
1345-
using the given `algorithm`.
1351+
using the given `algorithm`. Optional `options` argument controls stream
1352+
behavior.
13461353

13471354
The `algorithm` is dependent on the available algorithms supported by the
13481355
version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
@@ -1369,14 +1376,16 @@ input.on('readable', () => {
13691376
});
13701377
```
13711378

1372-
### crypto.createHmac(algorithm, key)
1379+
### crypto.createHmac(algorithm, key[, options])
13731380
<!-- YAML
13741381
added: v0.1.94
13751382
-->
13761383
- `algorithm` {string}
13771384
- `key` {string | Buffer | TypedArray | DataView}
1385+
- `options` {Object} [`stream.transform` options][]
13781386

13791387
Creates and returns an `Hmac` object that uses the given `algorithm` and `key`.
1388+
Optional `options` argument controls stream behavior.
13801389

13811390
The `algorithm` is dependent on the available algorithms supported by the
13821391
version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
@@ -1405,25 +1414,29 @@ input.on('readable', () => {
14051414
});
14061415
```
14071416

1408-
### crypto.createSign(algorithm)
1417+
### crypto.createSign(algorithm[, options])
14091418
<!-- YAML
14101419
added: v0.1.92
14111420
-->
14121421
- `algorithm` {string}
1422+
- `options` {Object} [`stream.Writable` options][]
14131423

14141424
Creates and returns a `Sign` object that uses the given `algorithm`.
14151425
Use [`crypto.getHashes()`][] to obtain an array of names of the available
1416-
signing algorithms.
1426+
signing algorithms. Optional `options` argument controls the
1427+
`stream.Writable` behavior.
14171428

1418-
### crypto.createVerify(algorithm)
1429+
### crypto.createVerify(algorithm[, options])
14191430
<!-- YAML
14201431
added: v0.1.92
14211432
-->
14221433
- `algorithm` {string}
1434+
- `options` {Object} [`stream.Writable` options][]
14231435

14241436
Creates and returns a `Verify` object that uses the given algorithm.
14251437
Use [`crypto.getHashes()`][] to obtain an array of names of the available
1426-
signing algorithms.
1438+
signing algorithms. Optional `options` argument controls the
1439+
`stream.Writable` behavior.
14271440

14281441
### crypto.getCiphers()
14291442
<!-- YAML
@@ -2221,16 +2234,16 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
22212234
[`UV_THREADPOOL_SIZE`]: cli.html#cli_uv_threadpool_size_size
22222235
[`cipher.final()`]: #crypto_cipher_final_outputencoding
22232236
[`cipher.update()`]: #crypto_cipher_update_data_inputencoding_outputencoding
2224-
[`crypto.createCipher()`]: #crypto_crypto_createcipher_algorithm_password
2225-
[`crypto.createCipheriv()`]: #crypto_crypto_createcipheriv_algorithm_key_iv
2226-
[`crypto.createDecipher()`]: #crypto_crypto_createdecipher_algorithm_password
2227-
[`crypto.createDecipheriv()`]: #crypto_crypto_createdecipheriv_algorithm_key_iv
2237+
[`crypto.createCipher()`]: #crypto_crypto_createcipher_algorithm_password_options
2238+
[`crypto.createCipheriv()`]: #crypto_crypto_createcipheriv_algorithm_key_iv_options
2239+
[`crypto.createDecipher()`]: #crypto_crypto_createdecipher_algorithm_password_options
2240+
[`crypto.createDecipheriv()`]: #crypto_crypto_createdecipheriv_algorithm_key_iv_options
22282241
[`crypto.createDiffieHellman()`]: #crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding
22292242
[`crypto.createECDH()`]: #crypto_crypto_createecdh_curvename
2230-
[`crypto.createHash()`]: #crypto_crypto_createhash_algorithm
2231-
[`crypto.createHmac()`]: #crypto_crypto_createhmac_algorithm_key
2232-
[`crypto.createSign()`]: #crypto_crypto_createsign_algorithm
2233-
[`crypto.createVerify()`]: #crypto_crypto_createverify_algorithm
2243+
[`crypto.createHash()`]: #crypto_crypto_createhash_algorithm_options
2244+
[`crypto.createHmac()`]: #crypto_crypto_createhmac_algorithm_key_options
2245+
[`crypto.createSign()`]: #crypto_crypto_createsign_algorithm_options
2246+
[`crypto.createVerify()`]: #crypto_crypto_createverify_algorithm_options
22342247
[`crypto.getCurves()`]: #crypto_crypto_getcurves
22352248
[`crypto.getHashes()`]: #crypto_crypto_gethashes
22362249
[`crypto.pbkdf2()`]: #crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback
@@ -2248,6 +2261,8 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
22482261
[`hmac.update()`]: #crypto_hmac_update_data_inputencoding
22492262
[`sign.sign()`]: #crypto_sign_sign_privatekey_outputformat
22502263
[`sign.update()`]: #crypto_sign_update_data_inputencoding
2264+
[`stream.transform` options]: stream.html#stream_new_stream_transform_options
2265+
[`stream.Writable` options]: stream.html#stream_constructor_new_stream_writable_options
22512266
[`tls.createSecureContext()`]: tls.html#tls_tls_createsecurecontext_options
22522267
[`verify.update()`]: #crypto_verifier_update_data_inputencoding
22532268
[`verify.verify()`]: #crypto_verifier_verify_object_signature_signatureformat

0 commit comments

Comments
 (0)