What happens when a browser opens an HTTPS site for the first time?

Answer

The browser looks up the IP address, opens a TCP connection, and runs a one-round-trip TLS 1.3 handshake. That handshake agrees on fresh encryption keys and verifies the server's identity before the browser sends its first HTTP request.

  1. The browser sends its key share inside ClientHello, finishing key agreement in one round trip.1
  2. Everything after ServerHello travels encrypted, including the server's certificate.1
  3. CertificateVerify proves the server holds the private key matching its certificate.
  4. Both sides discard their one-time key shares afterward, so a future private-key leak cannot decrypt this visit.

Applies toTLS 1.3 over TCPfirst visit to a hostno proxy, no session resumption

1

What crosses the wire before the first request?

First HTTPS visit: DNS to first response
Diagram structure
  • Browser browser
  • DNS resolver dns
  • Web server server
  • browser → dns · DNS query: example.com
  • dns → browser · IP address
  • browser → server · SYN
  • server → browser · SYN + ACK
  • browser → server · ACK
  • browser → server · ClientHello: suites, SNI, key share
  • server → browser · ServerHello: chosen suite, key share
  • server → browser · Certificate + CertificateVerify + Finished (encrypted)
  • browser → server · Finished
  • browser → server · GET /
  • server → browser · 200 OK + page
  1. DNS resolver

    Turns the hostname into an IP address so the browser knows where to connect.

  2. Browser

    Opens TCP and sends ClientHello with supported cipher suites, the hostname (SNI) and a one-time key share.

  3. Web server

    Returns its key share in ServerHello, then sends its certificate, signature and Finished message under encryption.

2

How does the browser know this is the real site?

CheckWhat the browser verifies
ChainThe certificate chains back to a root CA in the browser's trust store.
HostnameThe site's domain matches the certificate's Subject Alternative Name (SAN) list.
ValidityToday's date falls between the certificate's notBefore and notAfter timestamps.
OwnershipCertificateVerify signs the live handshake transcript; only the private-key holder can produce that signature.
RevocationSoft-failStapled OCSP or browser revocation lists check whether the certificate was revoked, often best-effort.
3

Where do the session keys come from?

Key shares
Browser and server each generate a one-time Diffie-Hellman share, usually X25519.
Shared secret
Each side combines its own private share with the other side's public share to reach the same secret.
Key derivation
HKDF mixes that secret with the handshake transcript to derive handshake keys, then separate HTTP traffic keys.
Forward secrecy
Both sides delete the ephemeral shares after handshake, keeping recorded traffic safe if a server key leaks later.
Client Finished
MAC over the full transcript confirming neither side saw tampered messages; HTTP data can follow immediately.
4

What changes on the next visit?

AspectFirst visitResumed visit
Server proofFull certificate chain and live signature checkPre-shared key from an earlier NewSessionTicket
Round trips before HTTPDNS + 1 RTT TCP + 1 RTT TLS0-RTT1 RTT TCP, then request can ride inside ClientHello
Replay riskNone; request waits until FinishedReplayable0-RTT early data can be replayed, so servers restrict it to safe reads

Opening diagram…