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

Who proves the server’s identity? Open bytes Key shares Identity proof Finished

Scroll sideways to see the full diagram.

  1. The phone already has a connection for exchanging bytes.

    Step 1 of 4
  2. The two peers exchange public values and derive handshake secrets.

    Step 2 of 4
  3. The phone checks the certificate and the proof tied to the recorded messages.

    Step 3 of 4
  4. Finished 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.

CheckWhat it answers
Certificate validationIs 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?
CertificateVerifyCan 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?
FinishedDoes 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.

Back to the main puzzle

Check yourself

The peer proves it owns a key for images.example.com. The phone asked for api.example.com. What fails?

Not quite. The TCP setup can succeed regardless of the name. Re-read that part ↑

Right. Key ownership and the intended name are distinct checks.

Not quite. Possession of that other service’s key can still be proved. Re-read that part ↑

What additional evidence does CertificateVerify give beyond presenting a certificate?

Right. The peer actively signs data tied to the exchange.

Not quite. Authentication does not guarantee an application outcome. Re-read that part ↑

Not quite. The certificate proof concerns the TLS exchange. Re-read that part ↑

What does the Finished message check?

Right. Finished ties the transcript to the negotiated secrets.

Not quite. Certificate validity is a separate verification step. Re-read that part ↑

Not quite. The regular application request is a separate step. Re-read that part ↑

Sources

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.