Skip to content

Commit 4477155

Browse files
ashanholtniessen
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 964beed commit 4477155

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
@@ -1206,13 +1207,14 @@ they are used in order to avoid the risk of IV reuse that causes
12061207
vulnerabilities. For the case when IV is reused in GCM, see [Nonce-Disrespecting
12071208
Adversaries][] for details.
12081209

1209-
### crypto.createCipheriv(algorithm, key, iv)
1210+
### crypto.createCipheriv(algorithm, key, iv[, options])
12101211
- `algorithm` {string}
12111212
- `key` {string | Buffer | TypedArray | DataView}
12121213
- `iv` {string | Buffer | TypedArray | DataView}
1214+
- `options` {Object} [`stream.transform` options][]
12131215

12141216
Creates and returns a `Cipher` object, with the given `algorithm`, `key` and
1215-
initialization vector (`iv`).
1217+
initialization vector (`iv`). Optional `options` argument controls stream behavior.
12161218

12171219
The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
12181220
recent OpenSSL releases, `openssl list-cipher-algorithms` will display the
@@ -1240,15 +1242,16 @@ value.
12401242
Returns a `tls.SecureContext`, as-if [`tls.createSecureContext()`][] had been
12411243
called.
12421244

1243-
### crypto.createDecipher(algorithm, password)
1245+
### crypto.createDecipher(algorithm, password[, options])
12441246
<!-- YAML
12451247
added: v0.1.94
12461248
-->
12471249
- `algorithm` {string}
12481250
- `password` {string | Buffer | TypedArray | DataView}
1251+
- `options` {Object} [`stream.transform` options][]
12491252

12501253
Creates and returns a `Decipher` object that uses the given `algorithm` and
1251-
`password` (key).
1254+
`password` (key). Optional `options` argument controls stream behavior.
12521255

12531256
The implementation of `crypto.createDecipher()` derives keys using the OpenSSL
12541257
function [`EVP_BytesToKey`][] with the digest algorithm set to MD5, one
@@ -1262,16 +1265,18 @@ In line with OpenSSL's recommendation to use pbkdf2 instead of
12621265
their own using [`crypto.pbkdf2()`][] and to use [`crypto.createDecipheriv()`][]
12631266
to create the `Decipher` object.
12641267

1265-
### crypto.createDecipheriv(algorithm, key, iv)
1268+
### crypto.createDecipheriv(algorithm, key, iv[, options])
12661269
<!-- YAML
12671270
added: v0.1.94
12681271
-->
12691272
- `algorithm` {string}
12701273
- `key` {string | Buffer | TypedArray | DataView}
12711274
- `iv` {string | Buffer | TypedArray | DataView}
1275+
- `options` {Object} [`stream.transform` options][]
12721276

12731277
Creates and returns a `Decipher` object that uses the given `algorithm`, `key`
1274-
and initialization vector (`iv`).
1278+
and initialization vector (`iv`). Optional `options` argument controls stream
1279+
behavior.
12751280

12761281
The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
12771282
recent OpenSSL releases, `openssl list-cipher-algorithms` will display the
@@ -1339,14 +1344,16 @@ predefined curve specified by the `curveName` string. Use
13391344
OpenSSL releases, `openssl ecparam -list_curves` will also display the name
13401345
and description of each available elliptic curve.
13411346

1342-
### crypto.createHash(algorithm)
1347+
### crypto.createHash(algorithm[, options])
13431348
<!-- YAML
13441349
added: v0.1.92
13451350
-->
13461351
- `algorithm` {string}
1352+
- `options` {Object} [`stream.transform` options][]
13471353

13481354
Creates and returns a `Hash` object that can be used to generate hash digests
1349-
using the given `algorithm`.
1355+
using the given `algorithm`. Optional `options` argument controls stream
1356+
behavior.
13501357

13511358
The `algorithm` is dependent on the available algorithms supported by the
13521359
version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
@@ -1373,14 +1380,16 @@ input.on('readable', () => {
13731380
});
13741381
```
13751382

1376-
### crypto.createHmac(algorithm, key)
1383+
### crypto.createHmac(algorithm, key[, options])
13771384
<!-- YAML
13781385
added: v0.1.94
13791386
-->
13801387
- `algorithm` {string}
13811388
- `key` {string | Buffer | TypedArray | DataView}
1389+
- `options` {Object} [`stream.transform` options][]
13821390

13831391
Creates and returns an `Hmac` object that uses the given `algorithm` and `key`.
1392+
Optional `options` argument controls stream behavior.
13841393

13851394
The `algorithm` is dependent on the available algorithms supported by the
13861395
version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
@@ -1409,25 +1418,29 @@ input.on('readable', () => {
14091418
});
14101419
```
14111420

1412-
### crypto.createSign(algorithm)
1421+
### crypto.createSign(algorithm[, options])
14131422
<!-- YAML
14141423
added: v0.1.92
14151424
-->
14161425
- `algorithm` {string}
1426+
- `options` {Object} [`stream.Writable` options][]
14171427

14181428
Creates and returns a `Sign` object that uses the given `algorithm`.
14191429
Use [`crypto.getHashes()`][] to obtain an array of names of the available
1420-
signing algorithms.
1430+
signing algorithms. Optional `options` argument controls the
1431+
`stream.Writable` behavior.
14211432

1422-
### crypto.createVerify(algorithm)
1433+
### crypto.createVerify(algorithm[, options])
14231434
<!-- YAML
14241435
added: v0.1.92
14251436
-->
14261437
- `algorithm` {string}
1438+
- `options` {Object} [`stream.Writable` options][]
14271439

14281440
Creates and returns a `Verify` object that uses the given algorithm.
14291441
Use [`crypto.getHashes()`][] to obtain an array of names of the available
1430-
signing algorithms.
1442+
signing algorithms. Optional `options` argument controls the
1443+
`stream.Writable` behavior.
14311444

14321445
### crypto.getCiphers()
14331446
<!-- YAML
@@ -2225,16 +2238,16 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
22252238
[`UV_THREADPOOL_SIZE`]: cli.html#cli_uv_threadpool_size_size
22262239
[`cipher.final()`]: #crypto_cipher_final_outputencoding
22272240
[`cipher.update()`]: #crypto_cipher_update_data_inputencoding_outputencoding
2228-
[`crypto.createCipher()`]: #crypto_crypto_createcipher_algorithm_password
2229-
[`crypto.createCipheriv()`]: #crypto_crypto_createcipheriv_algorithm_key_iv
2230-
[`crypto.createDecipher()`]: #crypto_crypto_createdecipher_algorithm_password
2231-
[`crypto.createDecipheriv()`]: #crypto_crypto_createdecipheriv_algorithm_key_iv
2241+
[`crypto.createCipher()`]: #crypto_crypto_createcipher_algorithm_password_options
2242+
[`crypto.createCipheriv()`]: #crypto_crypto_createcipheriv_algorithm_key_iv_options
2243+
[`crypto.createDecipher()`]: #crypto_crypto_createdecipher_algorithm_password_options
2244+
[`crypto.createDecipheriv()`]: #crypto_crypto_createdecipheriv_algorithm_key_iv_options
22322245
[`crypto.createDiffieHellman()`]: #crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding
22332246
[`crypto.createECDH()`]: #crypto_crypto_createecdh_curvename
2234-
[`crypto.createHash()`]: #crypto_crypto_createhash_algorithm
2235-
[`crypto.createHmac()`]: #crypto_crypto_createhmac_algorithm_key
2236-
[`crypto.createSign()`]: #crypto_crypto_createsign_algorithm
2237-
[`crypto.createVerify()`]: #crypto_crypto_createverify_algorithm
2247+
[`crypto.createHash()`]: #crypto_crypto_createhash_algorithm_options
2248+
[`crypto.createHmac()`]: #crypto_crypto_createhmac_algorithm_key_options
2249+
[`crypto.createSign()`]: #crypto_crypto_createsign_algorithm_options
2250+
[`crypto.createVerify()`]: #crypto_crypto_createverify_algorithm_options
22382251
[`crypto.getCurves()`]: #crypto_crypto_getcurves
22392252
[`crypto.getHashes()`]: #crypto_crypto_gethashes
22402253
[`crypto.pbkdf2()`]: #crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback
@@ -2252,6 +2265,8 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
22522265
[`hmac.update()`]: #crypto_hmac_update_data_inputencoding
22532266
[`sign.sign()`]: #crypto_sign_sign_privatekey_outputformat
22542267
[`sign.update()`]: #crypto_sign_update_data_inputencoding
2268+
[`stream.transform` options]: stream.html#stream_new_stream_transform_options
2269+
[`stream.Writable` options]: stream.html#stream_constructor_new_stream_writable_options
22552270
[`tls.createSecureContext()`]: tls.html#tls_tls_createsecurecontext_options
22562271
[`verify.update()`]: #crypto_verifier_update_data_inputencoding
22572272
[`verify.verify()`]: #crypto_verifier_verify_object_signature_signatureformat

0 commit comments

Comments
 (0)