Skip to main content

Cryptography for Developers

Welcome to the AppSec Atlas Cryptography for Developers reference guide. Cryptography is the core mathematical foundation of application security. When implemented correctly, it protects confidentiality, guarantees data integrity, proves authenticity, and provides non-repudiation. However, cryptographic flaws are often catastrophic, subtle, and irreversible once exploited.

This guide bridges the gap between theoretical cryptanalysis and practical engineering, providing production-ready code, explicit implementation patterns, failure mode analyses, and step-by-step remediation labs.


πŸ—ΊοΈ Cryptography Architecture & Flow​

+-------------------------------------------------------+
| APPLICATION DATA PIPELINE |
+-------------------------------------------------------+
|
+--------------------------------------+--------------------------------------+
| | |
v v v
+------------------+ +------------------+ +------------------+
| Data In Transit | | Data At Rest | | Identity & Auth |
+------------------+ +------------------+ +------------------+
| - TLS 1.3 | | - AES-256-GCM | | - Argon2id (KDF) |
| - ECDHE Exchange | | - ChaCha20-Poly | | - Ed25519 Sign |
| - Hybrid PQC | | - Envelope Key | | - HKDF Key Deriv |
+------------------+ +------------------+ +------------------+

πŸ“š Guide Map & Topics Covered​

ChapterTitlePrimary FocusKey Algorithms & ProtocolsThreat Vectors Addressed
01Introduction to CryptographyCIA+N Triad, Encoding vs Hashing vs EncryptionBase64, SHA-256, AES, RSA, Ed25519Misconception of Base64 security, PRNG predictability
02Symmetric EncryptionAEAD Modes, AAD binding, Nonce uniquenessAES-256-GCM, ChaCha20-Poly1305ECB pattern leakage, Padding Oracles, Nonce reuse
03Asymmetric Crypto & SignaturesPublic-key math, Signatures, Key ExchangeRSA-4096, Ed25519, ECDHE (X25519), TLS 1.3RSA PKCS#1 v1.5 malleability, ECDSA nonce leaks
04Password Hashing & KDFsSlow memory-hard hashing, Key derivationArgon2id, bcrypt, PBKDF2-HMAC-SHA256, HKDFGPU/ASIC brute-force, Rainbow tables, Side-channels
05Post-Quantum CryptographyQuantum threat models, NIST standardsML-KEM (FIPS 203), ML-DSA (FIPS 204), HybridShor's Algorithm (RSA break), Grover's Algorithm (AES decay), HNDL
06Hands-On Vulnerability LabPractical exploit execution & remediationMD5 vs Argon2id, AES-ECB vs AES-GCMPadding Oracle, ECB pattern leakage, Hash cracking
07References & Security StandardsNIST, OWASP, FIPS & CVE Knowledge BaseFIPS 140-3, NIST SP 800-57, RFC 8446Historical vulnerabilities (Heartbleed, POODLE, CurveBall)

🎯 Learning Objectives​

By working through this guide, software engineers and application security specialists will be able to:

  1. Differentiate Fundamentals: Distinguish between data encoding, cryptographic hashing, symmetric encryption, and asymmetric signatures.
  2. Implement AEAD Encryption: Construct robust AES-GCM and ChaCha20-Poly1305 encryption routines with random Nonce generation and Associated Authenticated Data (AAD) across Python, Node.js, Go, and Java.
  3. Master Key Derivation: Configure memory-hard Password Hashing Functions (Argon2id) with optimal time, memory, and parallelism parameters, and derive session keys using HKDF.
  4. Deploy Asymmetric Authentication: Generate Ed25519 key pairs, produce/verify digital signatures, and execute ECDHE key exchanges with forward secrecy.
  5. Prepare for Post-Quantum Cryptography (PQC): Understand the mechanics of Shor's and Grover's algorithms, evaluate NIST FIPS 203/204/205 standards, and design hybrid classical-quantum key exchange mechanisms.
  6. Detect & Fix Cryptographic Vulnerabilities: Audit source code for insecure primitives (MD5, SHA1, DES, ECB mode, weak CSPRNGs) and execute hands-on exploits against broken implementations.

πŸ“‹ Prerequisites​

To get the maximum value from this guide, developers should possess:

  • Programming Experience: Working knowledge of at least one major language (Python 3.10+, Node.js 18+, Go 1.20+, or Java 17+).
  • Basic Data Representation: Understanding of binary byte arrays, Hexadecimal encoding, and Base64 string representations.
  • CLI & Security Tools: Access to a Unix/Windows command line with Python 3, pip, OpenSSL, and basic Git utilities installed.

[!IMPORTANT] Golden Rule of Cryptography: Never design or implement your own custom cryptographic algorithms or protocols ("Don't Roll Your Own Crypto"). Always rely on standard, peer-reviewed, high-level cryptography libraries like PyCA Cryptography, Node crypto / Web Crypto API, Go crypto/*, or libsodium.


πŸ”— Chapter Navigation​

  1. πŸ“– 01 - Introduction to Cryptography
  2. πŸ”’ 02 - Symmetric Encryption
  3. πŸ”‘ 03 - Asymmetric Encryption and Signatures
  4. πŸ›‘οΈ 04 - Password Hashing and KDF
  5. βš›οΈ 05 - Post-Quantum Cryptography
  6. πŸ§ͺ 06 - Hands-On Vulnerability Lab
  7. πŸ“š 07 - References and Security Standards