From 0a679327be992d2a60fc3522ab2335064e9750dc Mon Sep 17 00:00:00 2001 From: Ujjwal Sharma Date: Thu, 5 Apr 2018 02:17:56 +0530 Subject: [PATCH] doc: update language regarding key stretching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the docs to provide clearer instructions regarding the exact scope of the use (and re-use) of an IV, stating the instructions explicitly with greater clarity. PR-URL: https://github.com/nodejs/node/pull/19810 Fixes: https://github.com/nodejs/node/issues/19748 Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell Reviewed-By: Tobias Nießen --- doc/api/crypto.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 5064d1a7b267b4..f00adf02ec835f 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1377,6 +1377,13 @@ The `key` is the raw key used by the `algorithm` and `iv` is an [Buffers][`Buffer`], `TypedArray`, or `DataView`s. If the cipher does not need an initialization vector, `iv` may be `null`. +Initialization vectors should be unpredictable and unique; ideally, they will be +cryptographically random. They do not have to be secret: IVs are typically just +added to ciphertext messages unencrypted. It may sound contradictory that +something has to be unpredictable and unique, but does not have to be secret; +it is important to remember that an attacker must not be able to predict ahead +of time what a given IV will be. + ### crypto.createCredentials(details)