@@ -319,7 +319,7 @@ used in one of two ways:
319
319
* Using the [ ` cipher.update() ` ] [ ] and [ ` cipher.final() ` ] [ ] methods to produce
320
320
the encrypted data.
321
321
322
- The [ ` crypto.createCipher() ` ] [ ] or [ ` crypto. createCipheriv()` ] [ ] methods are
322
+ The [ ` crypto.createCipheriv() ` ] [ ] method is
323
323
used to create ` Cipher ` instances. ` Cipher ` objects are not to be created
324
324
directly using the ` new ` keyword.
325
325
@@ -651,7 +651,7 @@ used in one of two ways:
651
651
* Using the [ ` decipher.update() ` ] [ ] and [ ` decipher.final() ` ] [ ] methods to
652
652
produce the unencrypted data.
653
653
654
- The [ ` crypto.createDecipher() ` ] [ ] or [ ` crypto. createDecipheriv()` ] [ ] methods are
654
+ The [ ` crypto.createDecipheriv() ` ] [ ] method is
655
655
used to create ` Decipher ` instances. ` Decipher ` objects are not to be created
656
656
directly using the ` new ` keyword.
657
657
@@ -2954,77 +2954,6 @@ added: v15.8.0
2954
2954
2955
2955
Checks the primality of the ` candidate ` .
2956
2956
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
-
3028
2957
### ` crypto.createCipheriv(algorithm, key, iv[, options]) `
3029
2958
3030
2959
<!-- YAML
@@ -3099,55 +3028,6 @@ something has to be unpredictable and unique, but does not have to be secret;
3099
3028
remember that an attacker must not be able to predict ahead of time what a
3100
3029
given IV will be.
3101
3030
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
-
3151
3031
### ` crypto.createDecipheriv(algorithm, key, iv[, options]) `
3152
3032
3153
3033
<!-- YAML
@@ -6096,7 +5976,6 @@ See the [list of SSL OP Flags][] for details.
6096
5976
[ NIST SP 800-131A ] : https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar2.pdf
6097
5977
[ NIST SP 800-132 ] : https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf
6098
5978
[ 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
6100
5979
[ OpenSSL's FIPS README file ] : https://github.com/openssl/openssl/blob/openssl-3.0/README-FIPS.md
6101
5980
[ OpenSSL's SPKAC implementation ] : https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html
6102
5981
[ RFC 1421 ] : https://www.rfc-editor.org/rfc/rfc1421.txt
@@ -6113,17 +5992,14 @@ See the [list of SSL OP Flags][] for details.
6113
5992
[ `Buffer` ] : buffer.md
6114
5993
[ `DH_generate_key()` ] : https://www.openssl.org/docs/man3.0/man3/DH_generate_key.html
6115
5994
[ `DiffieHellmanGroup` ] : #class-diffiehellmangroup
6116
- [ `EVP_BytesToKey` ] : https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html
6117
5995
[ `KeyObject` ] : #class-keyobject
6118
5996
[ `Sign` ] : #class-sign
6119
5997
[ `String.prototype.normalize()` ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
6120
5998
[ `UV_THREADPOOL_SIZE` ] : cli.md#uv_threadpool_sizesize
6121
5999
[ `Verify` ] : #class-verify
6122
6000
[ `cipher.final()` ] : #cipherfinaloutputencoding
6123
6001
[ `cipher.update()` ] : #cipherupdatedata-inputencoding-outputencoding
6124
- [ `crypto.createCipher()` ] : #cryptocreatecipheralgorithm-password-options
6125
6002
[ `crypto.createCipheriv()` ] : #cryptocreatecipherivalgorithm-key-iv-options
6126
- [ `crypto.createDecipher()` ] : #cryptocreatedecipheralgorithm-password-options
6127
6003
[ `crypto.createDecipheriv()` ] : #cryptocreatedecipherivalgorithm-key-iv-options
6128
6004
[ `crypto.createDiffieHellman()` ] : #cryptocreatediffiehellmanprime-primeencoding-generator-generatorencoding
6129
6005
[ `crypto.createECDH()` ] : #cryptocreateecdhcurvename
@@ -6144,7 +6020,6 @@ See the [list of SSL OP Flags][] for details.
6144
6020
[ `crypto.publicEncrypt()` ] : #cryptopublicencryptkey-buffer
6145
6021
[ `crypto.randomBytes()` ] : #cryptorandombytessize-callback
6146
6022
[ `crypto.randomFill()` ] : #cryptorandomfillbuffer-offset-size-callback
6147
- [ `crypto.scrypt()` ] : #cryptoscryptpassword-salt-keylen-options-callback
6148
6023
[ `crypto.webcrypto.getRandomValues()` ] : webcrypto.md#cryptogetrandomvaluestypedarray
6149
6024
[ `crypto.webcrypto.subtle` ] : webcrypto.md#class-subtlecrypto
6150
6025
[ `decipher.final()` ] : #decipherfinaloutputencoding
0 commit comments