Skip to content

Commit 0a67932

Browse files
ryzokukentniessen
authored andcommitted
doc: update language regarding key stretching
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: #19810 Fixes: #19748 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 77b52fd commit 0a67932

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

doc/api/crypto.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,6 +1377,13 @@ The `key` is the raw key used by the `algorithm` and `iv` is an
13771377
[Buffers][`Buffer`], `TypedArray`, or `DataView`s. If the cipher does not need
13781378
an initialization vector, `iv` may be `null`.
13791379

1380+
Initialization vectors should be unpredictable and unique; ideally, they will be
1381+
cryptographically random. They do not have to be secret: IVs are typically just
1382+
added to ciphertext messages unencrypted. It may sound contradictory that
1383+
something has to be unpredictable and unique, but does not have to be secret;
1384+
it is important to remember that an attacker must not be able to predict ahead
1385+
of time what a given IV will be.
1386+
13801387
### crypto.createCredentials(details)
13811388
<!-- YAML
13821389
added: v0.1.92
@@ -1458,6 +1465,13 @@ The `key` is the raw key used by the `algorithm` and `iv` is an
14581465
[Buffers][`Buffer`], `TypedArray`, or `DataView`s. If the cipher does not need
14591466
an initialization vector, `iv` may be `null`.
14601467

1468+
Initialization vectors should be unpredictable and unique; ideally, they will be
1469+
cryptographically random. They do not have to be secret: IVs are typically just
1470+
added to ciphertext messages unencrypted. It may sound contradictory that
1471+
something has to be unpredictable and unique, but does not have to be secret;
1472+
it is important to remember that an attacker must not be able to predict ahead
1473+
of time what a given IV will be.
1474+
14611475
### crypto.createDiffieHellman(prime[, primeEncoding][, generator][, generatorEncoding])
14621476
<!-- YAML
14631477
added: v0.11.12

0 commit comments

Comments
 (0)