{}DSA Atlas

TLS, HTTPS & PKI

The cryptography behind HTTPS (symmetric, asymmetric, hashes, MACs, signatures, key exchange), certificates and chains of trust, the TLS 1.2 and 1.3 handshakes, forward secrecy, session resumption and 0-RTT, SNI and ECH, mTLS, certificate pinning, HSTS, and how TLS terminates at load balancers.

Intermediate → Advanced8 interview questions

Crypto building blocks

PrimitiveWhat it givesExamples
Symmetric encryptionconfidentiality with one shared key; fastAES-128/256-GCM, ChaCha20-Poly1305
Asymmetric encryption / key exchangeagree on a secret over an open channel(EC)DHE: X25519; ML-KEM hybrids (post-quantum)
Digital signaturesprove who signed; integrityRSA-PSS, ECDSA, Ed25519
Hashfixed-size fingerprint; collision-resistantSHA-256, SHA-384
MAC / AEAD tagintegrity + authenticity with a shared keyHMAC-SHA256, GCM tag
KDFderive keys from a secretHKDF

Diffie-Hellman in one paragraph

Both sides pick secret random numbers a and b, exchange public values g^a and g^b, and each computes g^(ab) — a shared secret an eavesdropper (who only saw g^a and g^b) can't feasibly compute. Elliptic-curve DH (X25519) does the same with smaller keys. Without authentication DH is vulnerable to man-in-the-middle, which is why the server signs the handshake with its certified key.

Certificates and PKI

Root CAself-signed, in theOS/browser trust store Intermediate CAsigned by root(root key kept offline) Leaf: api.example.compublic key, SANs, validitysigned by intermediate client verifies each signature upward until it reaches a trusted root, checks hostname ∈ SANs, validity dates, key usage, and revocation / CT server sends leaf + intermediates; the client already has the roots
Trust flows down from roots the client already trusts.
ConceptNotes
DV / OV / EV certificatesdomain-validated (automated, e.g. Let's Encrypt) vs organisation-validated vs extended validation; browsers no longer highlight EV
SANSubject Alternative Names: the domains the certificate covers; wildcards *.example.com match one label
Validitypublicly trusted TLS certificates are being shortened by CA/Browser Forum rules (from 398 days toward 47 days by 2029) → automate renewal
ACMEprotocol for automated issuance/renewal (Let's Encrypt, cert-manager in Kubernetes)
RevocationCRLs, OCSP, OCSP stapling; Let's Encrypt ended OCSP in 2025 in favour of short lifetimes + CRLs
Certificate Transparencyevery public certificate is logged; monitor CT logs for your domains

The TLS 1.3 handshake

Client Server ClientHello: versions, ciphers, key_share, SNI, ALPN ServerHello: chosen cipher, key_share 🔒 encrypted from here (handshake keys from ECDHE) {EncryptedExtensions} {Certificate} {CertificateVerify} {Finished} {Finished} + first HTTP request HTTP response 1 RTT
TLS 1.3 needs one round trip; the certificate itself travels encrypted.

TLS 1.2 vs 1.3

TLS 1.2TLS 1.3
Full handshake2 RTT1 RTT
Resumptionsession IDs/tickets (1 RTT)PSK (1 RTT) or 0-RTT
Key exchangeRSA or (EC)DHE(EC)DHE only → forward secrecy always
Cipher suitesmany, including weak (CBC, RC4, SHA-1)5 AEAD suites
Certificate visible on the wireyesencrypted

0-RTT caveat: early data can be replayed by an attacker, so servers should accept only idempotent requests (GETs) in 0-RTT.

SNI, ALPN and ECH

  • SNI (Server Name Indication): the client says which hostname it wants in ClientHello, so one IP can host many certificates (essential for CDNs and shared load balancers). Sent in clear text unless…
  • ECH (Encrypted Client Hello): encrypts the inner ClientHello (including SNI) using a key published in DNS (HTTPS record).
  • ALPN: negotiates the application protocol (h2, http/1.1) during the handshake; HTTP/3 is advertised via Alt-Svc/DNS.

mTLS

orders-svccert: spiffe://prod/orders payments-svccert: spiffe://prod/payments both present certificates; both verify authorization policy: "only orders-svc may call POST /charges"
Service meshes automate short-lived workload certificates and mTLS between every pair of services.

HSTS, pinning and other hardening

MeasurePurpose
Strict-Transport-Security (+ preload)never use HTTP; prevents SSL stripping
Redirect HTTP → HTTPS (301/308)initial upgrade
Modern config (TLS 1.2+ only, AEAD ciphers)remove weak crypto (tools: Mozilla SSL config, SSL Labs)
OCSP stapling / short-lived certsfaster, privacy-friendly revocation
Certificate pinningmobile apps pin a key; powerful but risky (bricking on rotation) — pin intermediates/backup keys
CAA recordsrestrict which CAs may issue for your domain
Post-quantum hybrid key exchangeX25519 + ML-KEM, enabled by default in modern browsers and CDNs to defeat "harvest now, decrypt later"

TLS in system designs

client CDN / WAF L7 loadbalancer service(+ mesh sidecar) TLS 1.3re-encryptmTLS terminate at the edge for caching/WAF/routing, re-encrypt inside for zero trust
Encrypt every hop; terminate where you need to inspect.
Shell
# inspect a server's certificate chain and negotiated protocol
openssl s_client -connect api.example.com:443 -servername api.example.com -alpn h2 </dev/null
curl -vI https://api.example.com 2>&1 | grep -E "SSL|TLS|ALPN|subject|expire"

Interview questions

0 / 8 marked confident

Answer out loud first, then open the model answer. Mark a question confident only when you could explain it to an interviewer without notes.