From ddbcc9e59d8abb8af8851b968f7a1ec981896bf7 Mon Sep 17 00:00:00 2001 From: Adina Shanholtz Date: Tue, 15 Aug 2017 16:16:14 -0400 Subject: [PATCH] doc: add options argument to crypto docs PR-URL: https://github.com/nodejs/node/pull/14846 Fixes: https://github.com/nodejs/node/issues/14804 Reviewed-By: Matteo Collina Reviewed-By: Refael Ackermann Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Benjamin Gruenbaum Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater Reviewed-By: Vse Mozhet Byt --- doc/api/crypto.md | 61 +++++++++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 8c7f3131c6bf3e..52c7ebe71cf64a 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1172,15 +1172,16 @@ added: v6.0.0 Property for checking and controlling whether a FIPS compliant crypto provider is currently in use. Setting to true requires a FIPS build of Node.js. -### crypto.createCipher(algorithm, password) +### crypto.createCipher(algorithm, password[, options]) - `algorithm` {string} - `password` {string | Buffer | TypedArray | DataView} +- `options` {Object} [`stream.transform` options][] Creates and returns a `Cipher` object that uses the given `algorithm` and -`password`. +`password`. Optional `options` argument controls stream behavior. The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On 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 their own using [`crypto.pbkdf2()`][] and to use [`crypto.createCipheriv()`][] to create the `Cipher` object. -### crypto.createCipheriv(algorithm, key, iv) +### crypto.createCipheriv(algorithm, key, iv[, options]) - `algorithm` {string} - `key` {string | Buffer | TypedArray | DataView} - `iv` {string | Buffer | TypedArray | DataView} +- `options` {Object} [`stream.transform` options][] Creates and returns a `Cipher` object, with the given `algorithm`, `key` and -initialization vector (`iv`). +initialization vector (`iv`). Optional `options` argument controls stream behavior. The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On recent OpenSSL releases, `openssl list-cipher-algorithms` will display the @@ -1236,15 +1238,16 @@ value. Returns a `tls.SecureContext`, as-if [`tls.createSecureContext()`][] had been called. -### crypto.createDecipher(algorithm, password) +### crypto.createDecipher(algorithm, password[, options]) - `algorithm` {string} - `password` {string | Buffer | TypedArray | DataView} +- `options` {Object} [`stream.transform` options][] Creates and returns a `Decipher` object that uses the given `algorithm` and -`password` (key). +`password` (key). Optional `options` argument controls stream behavior. The implementation of `crypto.createDecipher()` derives keys using the OpenSSL 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 their own using [`crypto.pbkdf2()`][] and to use [`crypto.createDecipheriv()`][] to create the `Decipher` object. -### crypto.createDecipheriv(algorithm, key, iv) +### crypto.createDecipheriv(algorithm, key, iv[, options]) - `algorithm` {string} - `key` {string | Buffer | TypedArray | DataView} - `iv` {string | Buffer | TypedArray | DataView} +- `options` {Object} [`stream.transform` options][] Creates and returns a `Decipher` object that uses the given `algorithm`, `key` -and initialization vector (`iv`). +and initialization vector (`iv`). Optional `options` argument controls stream +behavior. The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On recent OpenSSL releases, `openssl list-cipher-algorithms` will display the @@ -1335,14 +1340,16 @@ predefined curve specified by the `curveName` string. Use OpenSSL releases, `openssl ecparam -list_curves` will also display the name and description of each available elliptic curve. -### crypto.createHash(algorithm) +### crypto.createHash(algorithm[, options]) - `algorithm` {string} +- `options` {Object} [`stream.transform` options][] Creates and returns a `Hash` object that can be used to generate hash digests -using the given `algorithm`. +using the given `algorithm`. Optional `options` argument controls stream +behavior. The `algorithm` is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. @@ -1369,14 +1376,16 @@ input.on('readable', () => { }); ``` -### crypto.createHmac(algorithm, key) +### crypto.createHmac(algorithm, key[, options]) - `algorithm` {string} - `key` {string | Buffer | TypedArray | DataView} +- `options` {Object} [`stream.transform` options][] Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. +Optional `options` argument controls stream behavior. The `algorithm` is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. @@ -1405,25 +1414,29 @@ input.on('readable', () => { }); ``` -### crypto.createSign(algorithm) +### crypto.createSign(algorithm[, options]) - `algorithm` {string} +- `options` {Object} [`stream.Writable` options][] Creates and returns a `Sign` object that uses the given `algorithm`. Use [`crypto.getHashes()`][] to obtain an array of names of the available -signing algorithms. +signing algorithms. Optional `options` argument controls the +`stream.Writable` behavior. -### crypto.createVerify(algorithm) +### crypto.createVerify(algorithm[, options]) - `algorithm` {string} +- `options` {Object} [`stream.Writable` options][] Creates and returns a `Verify` object that uses the given algorithm. Use [`crypto.getHashes()`][] to obtain an array of names of the available -signing algorithms. +signing algorithms. Optional `options` argument controls the +`stream.Writable` behavior. ### crypto.getCiphers()