Skip to content

Instantly share code, notes, and snippets.

@jbulow
Forked from paragonie-scott/crypto-wrong-answers.md
Created November 18, 2015 10:36
Show Gist options
  • Save jbulow/83360b2d66230e586403 to your computer and use it in GitHub Desktop.
Save jbulow/83360b2d66230e586403 to your computer and use it in GitHub Desktop.
An Open Letter to Developers Everywhere (About Cryptography)

Hello software developers,

Please check your code to ensure you're not making one of the following mistakes related to cryptography.

I. General Mistakes

II. Symmetric-key Cryptography Mistakes

  • Not using authenticated encryption
  • Not following an Encrypt then MAC construction
  • Using ECB mode (ciphertext blocks will repeat, degrading confidentiality)
  • Not using a random IV for CBC mode
  • Ever reusing a nonce in CTR mode with the same key
  • Using a human-readable password (i.e. "Password123") directly as an encryption key instead of a randomly generated string
  • Using the same key for encryption and message authentication
    • This isn't really a vulnerability, just a bad practice; use HKDF-SHA256 to split your key into one for encryption and one for authentication.
  • Hard-coding an encryption key or password into your client software

III. Asymmetric-key Cryptography Mistakes


If you're looking for cryptography right answers, check out the linked gist.

Thank you for your time.

Signed,
A friend who wants your application to be secure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment