Skip to content

Commit 81f88e3

Browse files
committed
crypto: doc-only deprecate createCipher/Decipher
createCipher and createDecipher are cryptographically weak, can cause severe security issues when used improperly and are unsupported in FIPS mode. PR-URL: #19343 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
1 parent 1d42b20 commit 81f88e3

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

doc/api/crypto.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,11 @@ This property is deprecated. Please use `crypto.setFips()` and
12541254
### crypto.createCipher(algorithm, password[, options])
12551255
<!-- YAML
12561256
added: v0.1.94
1257+
deprecated: REPLACEME
12571258
-->
1259+
1260+
> Stability: 0 - Deprecated: Use [`crypto.createCipheriv()`][] instead.
1261+
12581262
- `algorithm` {string}
12591263
- `password` {string | Buffer | TypedArray | DataView}
12601264
- `options` {Object} [`stream.transform` options][]
@@ -1334,7 +1338,11 @@ called.
13341338
### crypto.createDecipher(algorithm, password[, options])
13351339
<!-- YAML
13361340
added: v0.1.94
1341+
deprecated: REPLACEME
13371342
-->
1343+
1344+
> Stability: 0 - Deprecated: Use [`crypto.createDecipheriv()`][] instead.
1345+
13381346
- `algorithm` {string}
13391347
- `password` {string | Buffer | TypedArray | DataView}
13401348
- `options` {Object} [`stream.transform` options][]

doc/api/deprecations.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,11 +959,25 @@ Type: Runtime
959959
[`decipher.final()`][]. In the future, this API will likely be removed, and it
960960
is recommended to use [`decipher.final()`][] instead.
961961
962+
<a id="DEP0106"></a>
963+
### DEP0106: crypto.createCipher and crypto.createDecipher
964+
965+
Type: Documentation-only
966+
967+
Using [`crypto.createCipher()`][] and [`crypto.createDecipher()`][] should be
968+
avoided as they use a weak key derivation function (MD5 with no salt) and static
969+
initialization vectors. It is recommended to derive a key using
970+
[`crypto.pbkdf2()`][] and to use [`crypto.createCipheriv()`][] and
971+
[`crypto.createDecipheriv()`][] to obtain the [`Cipher`][] and [`Decipher`][]
972+
objects respectively.
973+
962974
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
963975
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
964976
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
965977
[`Buffer.from(buffer)`]: buffer.html#buffer_class_method_buffer_from_buffer
966978
[`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj
979+
[`Cipher`]: crypto.html#crypto_class_cipher
980+
[`Decipher`]: crypto.html#crypto_class_decipher
967981
[`assert`]: assert.html
968982
[`clearInterval()`]: timers.html#timers_clearinterval_timeout
969983
[`clearTimeout()`]: timers.html#timers_cleartimeout_timeout
@@ -976,7 +990,11 @@ is recommended to use [`decipher.final()`][] instead.
976990
[`child_process`]: child_process.html
977991
[`console.error()`]: console.html#console_console_error_data_args
978992
[`console.log()`]: console.html#console_console_log_data_args
993+
[`crypto.createCipher()`]: crypto.html#crypto_crypto_createcipher_algorithm_password_options
994+
[`crypto.createCipheriv()`]: crypto.html#crypto_crypto_createcipheriv_algorithm_key_iv_options
979995
[`crypto.createCredentials()`]: crypto.html#crypto_crypto_createcredentials_details
996+
[`crypto.createDecipher()`]: crypto.html#crypto_crypto_createdecipher_algorithm_password_options
997+
[`crypto.createDecipheriv()`]: crypto.html#crypto_crypto_createdecipheriv_algorithm_key_iv_options
980998
[`crypto.DEFAULT_ENCODING`]: crypto.html#crypto_crypto_default_encoding
981999
[`crypto.fips`]: crypto.html#crypto_crypto_fips
9821000
[`crypto.pbkdf2()`]: crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback

0 commit comments

Comments
 (0)