Public Key Infrastructure ยท 4.4

๐Ÿ”’ TLS & HTTPS

How PKI secures every connection to every websiteโฑ ~3 min

TLS (Transport Layer Security) is the protocol that secures HTTPS, IMAPS, SMTPS, and most other internet traffic. It uses PKI for authentication and asymmetric key exchange, then switches to symmetric AES for the actual data. The 's' in https, the padlock in your browser โ€” that's TLS.

๐Ÿ’ป Browser๐ŸŒ Server1. ClientHello โ€” โ€œhere are the ciphers I speak + my key shareโ€2. ServerHello + Certificate โ€” โ€œhere's my cert + key shareโ€3. Both compute the same shared secret (ECDHE)4. Encrypted traffic โ€” AES takes over ๐Ÿ”’
The TLS 1.3 handshake โ€” what happens in the milliseconds before a page loads
Why not encrypt everything with RSA? Because it's ~1000ร— slower than AES!๐ŸขAsymmetric (RSA/ECDH)slow but solves key exchange๐Ÿ‡Symmetric (AES)blazing fast bulk encryptiondelivers the tiny AES keyHYBRID: asymmetric for the handshake ๐Ÿค, symmetric for the data ๐Ÿ“ฆThis is how every HTTPS connection you make actually works
Hybrid encryption: asymmetric opens the door, symmetric moves the furniture

TLS 1.3 Handshake (Simplified)

  1. 1.ClientHello โ€” client sends: TLS version, list of supported cipher suites, random value, ECDH public key
  2. 2.ServerHello โ€” server sends: chosen cipher suite, random value, ECDH public key, and its certificate
  3. 3.Certificate Verification โ€” client verifies the certificate chain up to a trusted root CA
  4. 4.Key Derivation โ€” both sides compute the same shared secret via ECDHE; derive session keys
  5. 5.Finished โ€” both send an encrypted 'Finished' message using the derived keys; handshake authenticated
  6. 6.Application Data โ€” all traffic now encrypted with AES-GCM or ChaCha20-Poly1305
โ˜… FactTLS 1.3 reduced the handshake from 2 round-trips (TLS 1.2) to 1 round-trip โ€” cutting latency in half. It also supports 0-RTT resumption for returning visitors: a returning client can send application data in the very first message, before the server responds.

TLS Versions โ€” What to Use

VersionYearStatusNotes
SSL 3.01996โŒ DisabledPOODLE attack โ€” never enable
TLS 1.01999โŒ DeprecatedBEAST, CRIME attacks; disabled by all major browsers
TLS 1.12006โŒ DeprecatedSimilar vulnerabilities; disabled since 2021
TLS 1.22008โœ“ AcceptableStill widely used; requires careful cipher selection
TLS 1.32018โœ“โœ“ RecommendedMandatory Forward Secrecy; removed all weak options; use this
๐Ÿ”’ SecurityConfigure your web server to support only TLS 1.2 and TLS 1.3. Disable TLS 1.0, TLS 1.1, and all SSL versions. Also disable weak cipher suites: RC4, DES, 3DES, export-grade ciphers, MD5, SHA-1 in certificates. Use Mozilla's TLS configuration generator (ssl-config.mozilla.org) for nginx/Apache configs.

HSTS โ€” HTTP Strict Transport Security

๐Ÿ’ก TipThe HSTS header tells browsers to never connect to your domain over plain HTTP โ€” even if the user types http:// โ€” for the specified duration. This prevents SSL stripping attacks. Add: Strict-Transport-Security: max-age=31536000; includeSubDomains; preload and submit your domain to the HSTS preload list (hstspreload.org) to have it hardcoded into all browsers.
๐Ÿง Quick Checkfirst try = +5 XP

In TLS 1.3, what encrypts the actual web traffic after the handshake?

โญ 0 XP๐Ÿ”ฅ 0 days