From b75656a01ef3cb51168636b1b6b600a9776ebd9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Wed, 14 Mar 2018 01:54:42 +0100 Subject: [PATCH 1/3] crypto: doc-only deprecate createCipher/Decipher --- doc/api/crypto.md | 8 ++++++++ doc/api/deprecations.md | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 94e7dcd15734b3..771bcef6a84891 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1254,7 +1254,11 @@ This property is deprecated. Please use `crypto.setFips()` and ### crypto.createCipher(algorithm, password[, options]) + +> Stability: 0 - Deprecated: Use [`crypto.createCipheriv()`][] instead. + - `algorithm` {string} - `password` {string | Buffer | TypedArray | DataView} - `options` {Object} [`stream.transform` options][] @@ -1334,7 +1338,11 @@ called. ### crypto.createDecipher(algorithm, password[, options]) + +> Stability: 0 - Deprecated: Use [`crypto.createDecipheriv()`][] instead. + - `algorithm` {string} - `password` {string | Buffer | TypedArray | DataView} - `options` {Object} [`stream.transform` options][] diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 7e520412c0db72..14560eb626ee45 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -959,11 +959,23 @@ Type: Runtime [`decipher.final()`][]. In the future, this API will likely be removed, and it is recommended to use [`decipher.final()`][] instead. + +### DEP00XX: crypto.createCipher and crypto.createDecipher + +Type: Documentation-only + +Using [`crypto.createCipher()`][] and [`crypto.createDecipher()`][] should be +avoided as they use a weak key derivation function (MD5 with no salt) and static +initialization vectors. It is recommended to derive a key using +[`crypto.pbkdf2()`][] and to use [`crypto.createCipheriv()`][] and +[`crypto.createDecipheriv()`][] to obtain the [`Cipher`] object. + [`--pending-deprecation`]: cli.html#cli_pending_deprecation [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size [`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array [`Buffer.from(buffer)`]: buffer.html#buffer_class_method_buffer_from_buffer [`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj +[`Cipher`]: crypto.html#crypto_class_cipher [`assert`]: assert.html [`clearInterval()`]: timers.html#timers_clearinterval_timeout [`clearTimeout()`]: timers.html#timers_cleartimeout_timeout @@ -976,7 +988,11 @@ is recommended to use [`decipher.final()`][] instead. [`child_process`]: child_process.html [`console.error()`]: console.html#console_console_error_data_args [`console.log()`]: console.html#console_console_log_data_args +[`crypto.createCipher()`]: crypto.html#crypto_crypto_createcipher_algorithm_password_options +[`crypto.createCipheriv()`]: crypto.html#crypto_crypto_createcipheriv_algorithm_key_iv_options [`crypto.createCredentials()`]: crypto.html#crypto_crypto_createcredentials_details +[`crypto.createDecipher()`]: crypto.html#crypto_crypto_createdecipher_algorithm_password_options +[`crypto.createDecipheriv()`]: crypto.html#crypto_crypto_createdecipheriv_algorithm_key_iv_options [`crypto.DEFAULT_ENCODING`]: crypto.html#crypto_crypto_default_encoding [`crypto.fips`]: crypto.html#crypto_crypto_fips [`crypto.pbkdf2()`]: crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback From 2252714d26caa4411f91f25eb5b32b7f9d38f92c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Wed, 14 Mar 2018 12:27:00 +0100 Subject: [PATCH 2/3] address mscdex' suggestion --- doc/api/deprecations.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 14560eb626ee45..9682312b0b933b 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -968,7 +968,8 @@ Using [`crypto.createCipher()`][] and [`crypto.createDecipher()`][] should be avoided as they use a weak key derivation function (MD5 with no salt) and static initialization vectors. It is recommended to derive a key using [`crypto.pbkdf2()`][] and to use [`crypto.createCipheriv()`][] and -[`crypto.createDecipheriv()`][] to obtain the [`Cipher`] object. +[`crypto.createDecipheriv()`][] to obtain the [`Cipher`][] and [`Decipher`][] +object, respectively. [`--pending-deprecation`]: cli.html#cli_pending_deprecation [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size @@ -976,6 +977,7 @@ initialization vectors. It is recommended to derive a key using [`Buffer.from(buffer)`]: buffer.html#buffer_class_method_buffer_from_buffer [`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj [`Cipher`]: crypto.html#crypto_class_cipher +[`Decipher`]: crypto.html#crypto_class_decipher [`assert`]: assert.html [`clearInterval()`]: timers.html#timers_clearinterval_timeout [`clearTimeout()`]: timers.html#timers_cleartimeout_timeout From d40b2c8a2220377be8f1466174a287d45b6de96d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Wed, 14 Mar 2018 23:42:56 +0100 Subject: [PATCH 3/3] address trott's comments --- doc/api/deprecations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 9682312b0b933b..02208b6e56e42e 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -969,7 +969,7 @@ avoided as they use a weak key derivation function (MD5 with no salt) and static initialization vectors. It is recommended to derive a key using [`crypto.pbkdf2()`][] and to use [`crypto.createCipheriv()`][] and [`crypto.createDecipheriv()`][] to obtain the [`Cipher`][] and [`Decipher`][] -object, respectively. +objects respectively. [`--pending-deprecation`]: cli.html#cli_pending_deprecation [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size