Cryptographic goals
Never invent cryptography
Use maintained high-level libraries and established constructions instead of designing algorithms, modes, padding, or message formats yourself.
8 minute lesson
Cryptographic code can look correct and fail catastrophically. Use a high-level reviewed library.
Prefer APIs that choose secure algorithms, generate nonces, authenticate ciphertext, and define a versioned format. Follow the library’s current documentation and test vectors. Keep the cryptographic boundary small enough to review and replace.
A developer encrypts with AES-CBC and adds a custom checksum. The design looks reasonable, but it accepts modified ciphertext before the checksum is checked and leaks useful error differences.
A high-level construction removes choices about modes, padding, and tag handling. It may create a format migration later, so store an explicit version from the start.
Inventory every direct cryptographic call in one project and map each call to its security goal. Replace or wrap one low-level composition with a maintained high-level API, then save passing published test vectors. Corrupt the ciphertext, nonce, and tag separately and prove every case fails without returning plaintext.
Lesson completed