L'HTTPS non è altro che HTTP che gira dentro un canale cifrato con TLS. Il TLS (Transport Layer Security) ti dà tre garanzie: confidentiality (il traffico è cifrato), integrity (non può essere manomesso senza essere rilevato) e authentication (stai davvero parlando con il server indicato nel certificato). Viene negoziato in un handshake prima che venga inviato qualsiasi HTTP:
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)
