Skip to content

crypto,doc: update language around key stretching #19748

@bnoordhuis

Description

@bnoordhuis

doc/api/crypto.md currently says this:

it is recommended that developers derive a key and IV on their own using crypto.pbkdf2()

That's only sound when the key+IV are used once. Using the same key+IV twice is undesirable in general and downright disastrous with counter mode ciphers:

  1. identical plaintexts encrypt to the same ciphertext (usually not what you want)
  2. leaks information about the initial plaintext block with CBC and CFB ciphers
  3. completely destroys the security of CTR, GCM and OFB ciphers

It would be good to add some guidelines on how to safely create and store IVs. They should be unpredictable but don't need to be kept secret after encrypting. Are there exceptions to this rule?

Refs: indexzero/nconf#299

Metadata

Metadata

Assignees

No one assigned

    Labels

    cryptoIssues and PRs related to the crypto subsystem.docIssues and PRs related to the documentations.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions