HTTPS är bara HTTP som körs inuti en TLS-krypterad kanal. TLS (Transport Layer Security) ger dig tre garantier: confidentiality (trafiken är krypterad), integrity (den kan inte manipuleras oupptäckt) och authentication (du pratar verkligen med den server som anges i certifikatet). Det förhandlas fram i en handshake innan någon HTTP skickas:
Client Server
│──── ClientHello ──────────────────────▶│ (TLS versions, cipher suites, random)
│◀─── ServerHello + Certificate ─────────│ (chosen cipher + cert with public key)
│ │
│ verify cert against a trusted CA │
│ agree on keys (e.g. ECDHE key exchange)│
│ │
│──── Finished (encrypted) ──────────────▶│
│◀─── Finished (encrypted) ───────────────│
│========= encrypted application data ====│ (now HTTP flows, encrypted)
