@@ -319,7 +319,7 @@ used in one of two ways:
319319* Using the [ ` cipher.update() ` ] [ ] and [ ` cipher.final() ` ] [ ] methods to produce
320320 the encrypted data.
321321
322- The [ ` crypto.createCipher() ` ] [ ] or [ ` crypto. createCipheriv()` ] [ ] methods are
322+ The [ ` crypto.createCipheriv() ` ] [ ] method is
323323used to create ` Cipher ` instances. ` Cipher ` objects are not to be created
324324directly using the ` new ` keyword.
325325
@@ -651,7 +651,7 @@ used in one of two ways:
651651* Using the [ ` decipher.update() ` ] [ ] and [ ` decipher.final() ` ] [ ] methods to
652652 produce the unencrypted data.
653653
654- The [ ` crypto.createDecipher() ` ] [ ] or [ ` crypto. createDecipheriv()` ] [ ] methods are
654+ The [ ` crypto.createDecipheriv() ` ] [ ] method is
655655used to create ` Decipher ` instances. ` Decipher ` objects are not to be created
656656directly using the ` new ` keyword.
657657
@@ -2954,77 +2954,6 @@ added: v15.8.0
29542954
29552955Checks the primality of the ` candidate ` .
29562956
2957- ### ` crypto.createCipher(algorithm, password[, options]) `
2958-
2959- <!-- YAML
2960- added: v0.1.94
2961- deprecated: v10.0.0
2962- changes:
2963- - version:
2964- - v17.9.0
2965- - v16.17.0
2966- pr-url: https://github.com/nodejs/node/pull/42427
2967- description: The `authTagLength` option is now optional when using the
2968- `chacha20-poly1305` cipher and defaults to 16 bytes.
2969- - version: v15.0.0
2970- pr-url: https://github.com/nodejs/node/pull/35093
2971- description: The password argument can be an ArrayBuffer and is limited to
2972- a maximum of 2 ** 31 - 1 bytes.
2973- - version: v10.10.0
2974- pr-url: https://github.com/nodejs/node/pull/21447
2975- description: Ciphers in OCB mode are now supported.
2976- - version: v10.2.0
2977- pr-url: https://github.com/nodejs/node/pull/20235
2978- description: The `authTagLength` option can now be used to produce shorter
2979- authentication tags in GCM mode and defaults to 16 bytes.
2980- -->
2981-
2982- > Stability: 0 - Deprecated: Use [ ` crypto.createCipheriv() ` ] [ ] instead.
2983-
2984- * ` algorithm ` {string}
2985- * ` password ` {string|ArrayBuffer|Buffer|TypedArray|DataView}
2986- * ` options ` {Object} [ ` stream.transform ` options] [ ]
2987- * Returns: {Cipher}
2988-
2989- Creates and returns a ` Cipher ` object that uses the given ` algorithm ` and
2990- ` password ` .
2991-
2992- The ` options ` argument controls stream behavior and is optional except when a
2993- cipher in CCM or OCB mode (e.g. ` 'aes-128-ccm' ` ) is used. In that case, the
2994- ` authTagLength ` option is required and specifies the length of the
2995- authentication tag in bytes, see [ CCM mode] [ ] . In GCM mode, the ` authTagLength `
2996- option is not required but can be used to set the length of the authentication
2997- tag that will be returned by ` getAuthTag() ` and defaults to 16 bytes.
2998- For ` chacha20-poly1305 ` , the ` authTagLength ` option defaults to 16 bytes.
2999-
3000- The ` algorithm ` is dependent on OpenSSL, examples are ` 'aes192' ` , etc. On
3001- recent OpenSSL releases, ` openssl list -cipher-algorithms ` will
3002- display the available cipher algorithms.
3003-
3004- The ` password ` is used to derive the cipher key and initialization vector (IV).
3005- The value must be either a ` 'latin1' ` encoded string, a [ ` Buffer ` ] [ ] , a
3006- ` TypedArray ` , or a ` DataView ` .
3007-
3008- <strong class =" critical " >This function is semantically insecure for all
3009- supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,
3010- GCM, or CCM).</strong >
3011-
3012- The implementation of ` crypto.createCipher() ` derives keys using the OpenSSL
3013- function [ ` EVP_BytesToKey ` ] [ ] with the digest algorithm set to MD5, one
3014- iteration, and no salt. The lack of salt allows dictionary attacks as the same
3015- password always creates the same key. The low iteration count and
3016- non-cryptographically secure hash algorithm allow passwords to be tested very
3017- rapidly.
3018-
3019- In line with OpenSSL's recommendation to use a more modern algorithm instead of
3020- [ ` EVP_BytesToKey ` ] [ ] it is recommended that developers derive a key and IV on
3021- their own using [ ` crypto.scrypt() ` ] [ ] and to use [ ` crypto.createCipheriv() ` ] [ ]
3022- to create the ` Cipher ` object. Users should not use ciphers with counter mode
3023- (e.g. CTR, GCM, or CCM) in ` crypto.createCipher() ` . A warning is emitted when
3024- they are used in order to avoid the risk of IV reuse that causes
3025- vulnerabilities. For the case when IV is reused in GCM, see [ Nonce-Disrespecting
3026- Adversaries] [ ] for details.
3027-
30282957### ` crypto.createCipheriv(algorithm, key, iv[, options]) `
30292958
30302959<!-- YAML
@@ -3099,55 +3028,6 @@ something has to be unpredictable and unique, but does not have to be secret;
30993028remember that an attacker must not be able to predict ahead of time what a
31003029given IV will be.
31013030
3102- ### ` crypto.createDecipher(algorithm, password[, options]) `
3103-
3104- <!-- YAML
3105- added: v0.1.94
3106- deprecated: v10.0.0
3107- changes:
3108- - version:
3109- - v17.9.0
3110- - v16.17.0
3111- pr-url: https://github.com/nodejs/node/pull/42427
3112- description: The `authTagLength` option is now optional when using the
3113- `chacha20-poly1305` cipher and defaults to 16 bytes.
3114- - version: v10.10.0
3115- pr-url: https://github.com/nodejs/node/pull/21447
3116- description: Ciphers in OCB mode are now supported.
3117- -->
3118-
3119- > Stability: 0 - Deprecated: Use [ ` crypto.createDecipheriv() ` ] [ ] instead.
3120-
3121- * ` algorithm ` {string}
3122- * ` password ` {string|ArrayBuffer|Buffer|TypedArray|DataView}
3123- * ` options ` {Object} [ ` stream.transform ` options] [ ]
3124- * Returns: {Decipher}
3125-
3126- Creates and returns a ` Decipher ` object that uses the given ` algorithm ` and
3127- ` password ` (key).
3128-
3129- The ` options ` argument controls stream behavior and is optional except when a
3130- cipher in CCM or OCB mode (e.g. ` 'aes-128-ccm' ` ) is used. In that case, the
3131- ` authTagLength ` option is required and specifies the length of the
3132- authentication tag in bytes, see [ CCM mode] [ ] .
3133- For ` chacha20-poly1305 ` , the ` authTagLength ` option defaults to 16 bytes.
3134-
3135- <strong class =" critical " >This function is semantically insecure for all
3136- supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,
3137- GCM, or CCM).</strong >
3138-
3139- The implementation of ` crypto.createDecipher() ` derives keys using the OpenSSL
3140- function [ ` EVP_BytesToKey ` ] [ ] with the digest algorithm set to MD5, one
3141- iteration, and no salt. The lack of salt allows dictionary attacks as the same
3142- password always creates the same key. The low iteration count and
3143- non-cryptographically secure hash algorithm allow passwords to be tested very
3144- rapidly.
3145-
3146- In line with OpenSSL's recommendation to use a more modern algorithm instead of
3147- [ ` EVP_BytesToKey ` ] [ ] it is recommended that developers derive a key and IV on
3148- their own using [ ` crypto.scrypt() ` ] [ ] and to use [ ` crypto.createDecipheriv() ` ] [ ]
3149- to create the ` Decipher ` object.
3150-
31513031### ` crypto.createDecipheriv(algorithm, key, iv[, options]) `
31523032
31533033<!-- YAML
@@ -6096,7 +5976,6 @@ See the [list of SSL OP Flags][] for details.
60965976[ NIST SP 800-131A ] : https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar2.pdf
60975977[ NIST SP 800-132 ] : https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf
60985978[ NIST SP 800-38D ] : https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
6099- [ Nonce-Disrespecting Adversaries ] : https://github.com/nonce-disrespect/nonce-disrespect
61005979[ OpenSSL's FIPS README file ] : https://github.com/openssl/openssl/blob/openssl-3.0/README-FIPS.md
61015980[ OpenSSL's SPKAC implementation ] : https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html
61025981[ RFC 1421 ] : https://www.rfc-editor.org/rfc/rfc1421.txt
@@ -6113,17 +5992,14 @@ See the [list of SSL OP Flags][] for details.
61135992[ `Buffer` ] : buffer.md
61145993[ `DH_generate_key()` ] : https://www.openssl.org/docs/man3.0/man3/DH_generate_key.html
61155994[ `DiffieHellmanGroup` ] : #class-diffiehellmangroup
6116- [ `EVP_BytesToKey` ] : https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html
61175995[ `KeyObject` ] : #class-keyobject
61185996[ `Sign` ] : #class-sign
61195997[ `String.prototype.normalize()` ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
61205998[ `UV_THREADPOOL_SIZE` ] : cli.md#uv_threadpool_sizesize
61215999[ `Verify` ] : #class-verify
61226000[ `cipher.final()` ] : #cipherfinaloutputencoding
61236001[ `cipher.update()` ] : #cipherupdatedata-inputencoding-outputencoding
6124- [ `crypto.createCipher()` ] : #cryptocreatecipheralgorithm-password-options
61256002[ `crypto.createCipheriv()` ] : #cryptocreatecipherivalgorithm-key-iv-options
6126- [ `crypto.createDecipher()` ] : #cryptocreatedecipheralgorithm-password-options
61276003[ `crypto.createDecipheriv()` ] : #cryptocreatedecipherivalgorithm-key-iv-options
61286004[ `crypto.createDiffieHellman()` ] : #cryptocreatediffiehellmanprime-primeencoding-generator-generatorencoding
61296005[ `crypto.createECDH()` ] : #cryptocreateecdhcurvename
@@ -6144,7 +6020,6 @@ See the [list of SSL OP Flags][] for details.
61446020[ `crypto.publicEncrypt()` ] : #cryptopublicencryptkey-buffer
61456021[ `crypto.randomBytes()` ] : #cryptorandombytessize-callback
61466022[ `crypto.randomFill()` ] : #cryptorandomfillbuffer-offset-size-callback
6147- [ `crypto.scrypt()` ] : #cryptoscryptpassword-salt-keylen-options-callback
61486023[ `crypto.webcrypto.getRandomValues()` ] : webcrypto.md#cryptogetrandomvaluestypedarray
61496024[ `crypto.webcrypto.subtle` ] : webcrypto.md#class-subtlecrypto
61506025[ `decipher.final()` ] : #decipherfinaloutputencoding
0 commit comments