Understand the cryptographic primitives that secure modern systems and their common pitfalls.
Applied cryptography — what developers and security engineers must know:
Symmetric Encryption:
- AES-256-GCM (authenticated encryption — preferred)
- AES-CBC (vulnerable to padding oracle if not authenticated)
- ChaCha20-Poly1305 (fast on mobile/IoT)
Asymmetric Encryption:
- RSA: key sizes (2048/4096), OAEP padding, PKCS#1 v1.5 (avoid)
- ECC: ECDSA, ECDH, Curve25519 — smaller keys, faster
Hashing:
- SHA-256, SHA-3 — general purpose
- bcrypt, Argon2, scrypt — password hashing (slow by design)
- Never MD5 or SHA-1 for security purposes
Key Exchange:
- Diffie-Hellman (DH) — key agreement without transmitting key
- ECDHE — elliptic curve DH, provides forward secrecy
Common Mistakes:
- Using ECB mode (deterministic, patterns visible)
- Reusing IVs/nonces
- Custom crypto implementations
- Missing MAC (encrypt-then-MAC pattern)
- Using random() instead of cryptographically secure PRNG
PKI:
- X.509 certificates, CA hierarchy, certificate pinning
- Let's Encrypt for free TLS certificates
Symmetric Encryption:
- AES-256-GCM (authenticated encryption — preferred)
- AES-CBC (vulnerable to padding oracle if not authenticated)
- ChaCha20-Poly1305 (fast on mobile/IoT)
Asymmetric Encryption:
- RSA: key sizes (2048/4096), OAEP padding, PKCS#1 v1.5 (avoid)
- ECC: ECDSA, ECDH, Curve25519 — smaller keys, faster
Hashing:
- SHA-256, SHA-3 — general purpose
- bcrypt, Argon2, scrypt — password hashing (slow by design)
- Never MD5 or SHA-1 for security purposes
Key Exchange:
- Diffie-Hellman (DH) — key agreement without transmitting key
- ECDHE — elliptic curve DH, provides forward secrecy
Common Mistakes:
- Using ECB mode (deterministic, patterns visible)
- Reusing IVs/nonces
- Custom crypto implementations
- Missing MAC (encrypt-then-MAC pattern)
- Using random() instead of cryptographically secure PRNG
PKI:
- X.509 certificates, CA hierarchy, certificate pinning
- Let's Encrypt for free TLS certificates