Part II β The Shield Β· Lesson 3.6
Secure Communication (HTTPS)
In one lineTLS gives you three things at once: encryption, integrity, and proof of who you're talking to.
Where you've seen itPublic wifi that injects a banner ad into a page β possible only because that page travelled as plain HTTP.
Diagram
TLS 1.3 HANDSHAKE β one round trip, then encrypted
Client Server
βββ ClientHello βββββββββββββββββββββΊβ ciphers + key share
βββ ServerHello + certificate ββββββββ key share + proof of identity
β (client verifies cert chain β
β against trusted root CAs) β
βββ Finished ββββββββββββββββββββββββΊβ
ββββββββ application data, encrypted β‘
TLS 1.2 needed 2 RTT. TLS 1.3 needs 1 β and 0 on resumption.THREE GUARANTEES, THREE ATTACKS STOPPED
Encryption ββΊ nobody on the path can READ it (wifi sniffing)
Integrity ββΊ nobody can MODIFY it undetected (ad injection)
Identity ββΊ you're talking to the real server (impersonation)
A padlock proves identity + encryption.
It does NOT prove the site is honest β phishing sites have padlocks too.HSTS β closing the first-request gap
Without HSTS:
user types example.com βββΊ http:// βββΊ 301 to https://
βββ that one request is interceptable
With HSTS (after first visit):
user types example.com βββΊ browser rewrites to https:// internally
no plaintext request ever leaves
Strict-Transport-Security: max-age=31536000; includeSubDomains; preloadHow it works
- Client and server agree on a cipher and exchange key material in one round trip.
- The certificate proves the server controls the domain; the browser validates the chain to a trusted root.
- Session keys encrypt everything after the handshake; forward secrecy means a later key compromise can't decrypt past traffic.
- HSTS removes the plaintext first hop on subsequent visits; the preload list removes it even on the first.
- Mark cookies
Secureso they never travel over HTTP at all.
Trade-offs
| Concern | Reality |
|---|---|
| "TLS is slow" | TLS 1.3 is 1 RTT, 0 on resume; HTTP/2 and /3 require it |
| Mixed content | One http:// subresource downgrades the whole page's trust |
| Certificate expiry | The most common self-inflicted outage β automate renewal |
| HSTS preload | Effectively permanent; be certain before submitting |
Interview angle
"Site is HTTPS. Is the data safe?"
- In transit, yes: encrypted, tamper-evident, and the server's identity is verified.
- Not at rest, not in the browser, and not against XSS β TLS protects the pipe, not the endpoints.
- Add HSTS for the first-request gap,
Securecookies, and eliminate mixed content.
Recap
- Encryption, integrity, identity β three guarantees from one protocol.
- HSTS closes the plaintext gap that a redirect alone leaves open.
- HTTPS protects the wire; it says nothing about what either end does with the data.