Key Takeaways: Cryptography Fundamentals

A one-page reference. Reread before an exam or before Chapter 5. Dense by design. The governing rule of the whole chapter: you use crypto, you don't break it — and almost every real failure is usage, not math.

The four guarantees (which primitive provides what)

Guarantee Plain meaning Provided by NOT provided by
Confidentiality keep data secret encryption (symmetric/asymmetric) hashing, signatures alone
Integrity detect alteration hash, HMAC, authenticated encryption plain encryption (e.g., CBC alone)
Authenticity prove who produced it HMAC, digital signature a bare hash
Non-repudiation signer can't deny it digital signature only HMAC (shared key — either party)

Trap: encryption ≠ integrity. Encrypting data does not stop tampering — use authenticated encryption (AES-GCM) or add a MAC.

Symmetric vs. asymmetric (memorize this table)

Symmetric Asymmetric (public-key)
Keys one shared secret a key pair: public + private
Speed very fast (bulk data) slow (small data only)
Use for encrypting the actual data exchanging a key; signatures
Algorithms AES (128/256) RSA, ECC
Hard problem it solves the key-distribution problem
Hard problem it has key distribution speed / size limits
Real systems hybrid: asymmetric exchanges a symmetric key, symmetric encrypts the data (this is TLS — Ch.5)

Hash vs. encryption

Hash Encryption
Reversible? No (one-way) Yes (with the key)
Uses a key? No (public function) Yes
Provides integrity confidentiality
Use for integrity checks, password storage (salted+slow), signing keeping data secret

Algorithm & key-size quick reference

Purpose USE AVOID / PROHIBIT
Symmetric encryption AES-128 / AES-256, mode GCM (authenticated) ECB (leaks patterns), DES, 3DES, RC4, CBC w/o integrity
Hashing (integrity) SHA-256 (SHA-2), SHA-3 MD5, SHA-1 (collisions — broken)
Password storage salted Argon2 (or bcrypt/scrypt), high work factor any bare/fast hash, no salt, plain SHA-256/MD5
Asymmetric (RSA) RSA-3072+ (2048 minimum) RSA-1024
Asymmetric (ECC) ECC P-256+ weak/custom curves
Equivalence to remember ECC-256 ≈ RSA-3072
Randomness CSPRNG (secrets, /dev/urandom) default random() for secrets
Entropy floor ≥ 128 bits for keys/high-value secrets

Modes of operation (symmetric)

Mode Behavior Verdict
ECB each block independent; identical plaintext → identical ciphertext ✗ never — leaks structure
CBC chains blocks; needs unpredictable IV ~ no built-in integrity; pair with a MAC
GCM (AEAD) counter mode + auth tag ✓ confidentiality and integrity — prefer this

IV/nonce rules: need not be secret; must be unique per key (CTR/GCM) and unpredictable (CBC). Nonce reuse under one key = catastrophe (leaks plaintext; in GCM, enables forgery).

Password storage (the rule that prevents megabreaches)

  • Salt (unique, random, per user; stored in clear) → defeats rainbow tables / precomputation.
  • Slow + memory-hard algorithm (Argon2/bcrypt/scrypt) at a real work factor → defeats offline brute force. You need both.
  • Severity of a credential dump = the storage method: plaintext / unsalted MD5/SHA-1 → assume total compromise; salted Argon2/bcrypt → largely contained.

PKI in one glance

Component Role
Certificate authority (CA) trusted third party; signs the binding of a public key to an identity
X.509 certificate the format: subject, subject public key, issuer, validity, serial, key usage, CA signature
Chain of trust leaf ← intermediate CA ← root CA (pre-installed/trusted); verify each signature up to a trusted root
Revocation invalidate before expiry: CRL (list) or OCSP (live query)
#1 self-inflicted outage expired certificate nobody tracked → self-inflicted DoS. Inventory + auto-renew + alert. (lifecycle: Ch.5; cert_days_left: Ch.20)

Crypto-failure catalog (§4.7 — this is where defenders win)

  1. Rolling your own crypto — use vetted libraries; never custom/secret algorithms.
  2. Weak/deprecated algorithms — MD5, SHA-1, DES/3DES, RC4, RSA-1024, ECB.
  3. Bad randomness — non-CSPRNG / guessable seed; predictable keys/IVs; reused ECDSA nonce leaks the private key.
  4. Nonce/IV reuse under the same key.
  5. Key management (the big one, operational) — keys in source/config, keys stored next to the data, no rotation, broad access.
  6. Encryption without integrity — unauthenticated mode, no MAC.
  7. Over-trusting a valid signature — proves a key signed it, not that intent was legitimate.

Defender's leverage: these are usage failures → your tools are code review + config audit (grep for MD5/DES/ECB/random(); hunt hard-coded keys; confirm GCM, CSPRNG, salts, cert inventory), not cryptanalysis.

Certification crosswalk

Concept CompTIA Security+ (ISC)² CISSP domain
Symmetric vs. asymmetric; AES/RSA/ECC 1.0 General Security Concepts Security Architecture & Engineering (Cryptography)
Hashing, salting, password storage 1.0; 4.0 Security Operations Security Architecture & Engineering; IAM
Digital signatures / HMAC / non-repudiation 1.0 General Security Concepts Security Architecture & Engineering
PKI, CA, X.509, chain of trust, revocation 1.0; 3.0 Security Architecture Security Architecture & Engineering
Crypto attacks / misuse (collisions, weak modes, key mgmt) 2.0 Threats & Vulnerabilities Security Architecture & Engineering

Project additions this chapter

  • Meridian program: encryption standard (algorithms, key sizes, modes, key-management rules) — the PCI-DSS data-protection backbone for cardholder data at rest (Requirement 3 area; full crosswalk in Ch.28).
  • bluekit toolkit: cryptutil.pysha256_hex(data) (integrity digest), hmac_sign(key, msg) (authenticity), entropy_bits(charset_size, length) (secret-strength check; floor ≈ 128 bits).

Common pitfalls

  • "It's encrypted, so we're safe/compliant" — how, with what key, who can decrypt, is integrity covered?
  • Encryption assumed to provide integrity (it does not — use AEAD).
  • ECB mode; a fixed/reused IV or nonce.
  • Bare/unsalted/fast hashing of passwords (MD5, plain SHA-256).
  • Keys hard-coded in code/config or stored beside the data; never rotated; broadly accessible.
  • Trusting a valid signature as proof of safety rather than of which key signed.
  • Rolling your own crypto, or trusting "proprietary/secret" algorithms.
  • Letting a certificate expire unnoticed.