CoursesTCP to HTTPS, one request under a microscope
Puzzle 2 · 3 of 5
Who proves the server’s identity?
The phone can already exchange bytes. Work out what it must verify before trusting the peer with an application request.
All puzzles in this course
The problem
The phone opens a TCP connection for api.example.com. A peer answers and offers to encrypt the conversation. How does the phone know it is encrypting data for the intended service?
See it
Scroll sideways to see the full diagram.
The phone already has a connection for exchanging bytes.
Step 1 of 4The two peers exchange public values and derive handshake secrets.
Step 2 of 4The phone checks the certificate and the proof tied to the recorded messages.
Step 3 of 4Finished authenticates the transcript with a derived key before the regular request path.
Step 4 of 4
The building block
TLS adds a protected channel over a transport. The TCP sequence numbers synchronize delivery and have no role in authenticating the service. Consider a full TLS 1.3 exchange with server certificate authentication. The client and server exchange key shares, public values used to derive shared secrets. The exchange also supports checks about who is on the other side. A handshake transcript is the ordered record of relevant handshake messages used in these checks. A cryptographic digest gives those messages a compact fingerprint for verification.
| Check | What it answers |
|---|---|
| Certificate validation | Is there a valid chain to a configured trust anchor, appropriate for server authentication, and does the service identity match the name the client intended to reach? |
| CertificateVerify | Can this peer make a valid digital signature over context-bound data derived from a cryptographic digest of the handshake transcript, using the private key matching the certificate? |
| Finished | Does this handshake transcript check out under a key derived from the handshake secrets? |
For server identity, validate against the expected service name, not merely a name asserted by the peer. A trusted certificate for images.example.com alone does not establish identity for api.example.com.
In the standard full server-authenticated case, the server sends its certificate, proof and Finished after the first server message that selects the connection parameters. Those authentication messages are protected by handshake keys. Once verification succeeds, the client ordinarily sends its own Finished and can send the first protected application request. This example leaves out resumed connections, early data, and client certificates.
Go deeperSeparate private-key proof from identity
A peer has the key for a valid images.example.com certificate. It passes the proof-of-possession check. Can a client expecting api.example.com trust it on that evidence alone?
The possession check says the peer controls that key. The client still needs the expected service name to match the presented identity.
Check yourself
What you now know
In a typical certificate-authenticated TLS 1.3 handshake, the certificate links an identity and key, CertificateVerify proves possession, and Finished binds the handshake to the derived secrets.
Answer every question above correctly to unlock the next puzzle.
Something wrong or unclear on this page? Tell me: a puzzle that didn't click is a bug in the puzzle.