Back to articles
NetworkingVideo companion23 Nov 2026

Chrome shows the padlock, the app fails: the TLS handshake, step by step

A renewed certificate breaks every mobile payment while browsers stay happy. Debugging it walks through the whole TLS 1.3 handshake — and ends at one missing intermediate certificate.

#tls#security#networking#devops

Watch the video

More on the channel
TLS Handshake Explained in an Easy Way: ClientHello, Certificates & a Real Debugging Story

Friday, 18:40. Your payments API has just been given a renewed TLS certificate. Chrome shows the padlock. But every payment from the mobile app is failing.

Same server. Same certificate. So why?

[!NOTE] This is a realistic composite scenario, not a single true story. Hosts are example.com, and the times and numbers are illustrative — but every error message and command is real.

Three clients, one complaint

Here's what the on-call engineer sees:

ClientError
Android appTrust anchor for certification path not found
A partner's Java servicePKIX path building failed
curl from a Linux boxSSL certificate problem: unable to get local issuer certificate

Three different wordings, one complaint: I can't prove this certificate is real. Hold that thought — first, what is a certificate supposed to prove?

Why TLS exists

On an open network, anyone on the path could do three things to your traffic: read it, change it, or pretend to be the server. TLS stops all three.

It uses two kinds of encryption, because neither is enough on its own:

  • Symmetric encryption (like AES) is fast, but both sides need the same secret key — and you can't just send that key across the wire.
  • Asymmetric encryption uses a public/private key pair. It solves the sharing problem, but it's far too slow for bulk data.

So TLS uses both: asymmetric cryptography to agree on keys and prove identity, then fast symmetric encryption for everything after.

The handshake, part 1: hello and a shared secret

With TLS 1.3, the whole handshake takes a single round trip.

  1. ClientHelloSupported TLS versions and cipher suites, a random value, and a key share for an elliptic-curve Diffie-Hellman exchange (e.g. x25519)
  2. SNI and ALPNThe hostname it wants (so one IP can serve many sites) and the protocol it prefers (HTTP/2 or HTTP/1.1)
  3. ServerHelloThe server's chosen cipher suite and its own key share
  4. Shared secretBoth sides compute the same secret from the two key shares — without ever sending it
  5. Encrypted from hereEverything after ServerHello, including the certificate, travels encrypted

[!TIP] The ClientHello — including the SNI hostname — still travels in the clear, unless the client and server both use Encrypted Client Hello (ECH).

The handshake, part 2: proving identity

Next, the server proves who it is:

  1. Certificate — it sends its certificate chain: its own leaf certificate, plus the intermediate that signed it.
  2. CertificateVerify — a signature over the whole handshake so far, made with its private key. This proves the server owns the certificate, not just a copy of it.

The client then checks three things:

  • Name — is the name in the certificate the host I asked for?
  • Dates — is it within its validity period?
  • Chain — can I follow the signatures from the leaf, to the intermediate, to a root CA already in my trust store?
  1. Leaf certificateCN = pay.example.com — signed by the intermediate
  2. Intermediatee.g. Let's Encrypt R11 — signed by the root
  3. Root CAISRG Root X1 — already in the client's trust store
  4. FinishedOnly if every link holds do both sides send Finished and start the encrypted application data

Remember that chain. It's where Friday night went wrong.

Debugging: what does the server actually send?

The fastest way to see a handshake is openssl s_client. Pass -servername so SNI is sent, and -showcerts to print every certificate the server sends:

terminal
$ curl https://pay.example.com
curl: (60) SSL certificate problem: unable to get local issuer certificate
$ openssl s_client -connect pay.example.com:443 -servername pay.example.com -showcerts </dev/null
CONNECTED(00000003)
depth=0 CN = pay.example.com
verify error:num=20:unable to get local issuer certificate
verify error:num=21:unable to verify the first certificate
---
Certificate chain
 0 s:CN = pay.example.com
   i:C = US, O = Let's Encrypt, CN = R11
# (PEM block and session details trimmed)
---
Verify return code: 21 (unable to verify the first certificate)

And there it is. The server sends exactly one certificate: the leaf. No intermediate. OpenSSL says it plainly — verify return code 21. The chain is broken at the very first link.

Root cause: browsers fill the gap

So why was Chrome happy?

Many browsers quietly repair a broken chain. They cache intermediates they've seen before, or download the missing one using a link inside the certificate (the Authority Information Access extension). Firefox ships a list of known intermediates. Mobile apps, Java, curl and most server-to-server clients do none of that.

During the renewal, nginx had been pointed at cert.pem — the leaf only — instead of fullchain.pem, which is the leaf plus the intermediate. The fix is one line:

nginx
# Before: leaf only
ssl_certificate     /etc/letsencrypt/live/pay/cert.pem;
# After: leaf + intermediate
ssl_certificate     /etc/letsencrypt/live/pay/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/pay/privkey.pem;

Test the config, reload, and check again:

terminal
$ sudo nginx -t && sudo systemctl reload nginx
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ openssl s_client -connect pay.example.com:443 -servername pay.example.com -showcerts </dev/null | grep -E '^ [0-9] s:|Verify return'
 0 s:CN = pay.example.com
 1 s:C = US, O = Let's Encrypt, CN = R11
Verify return code: 0 (ok)

Two certificates, verify return code 0. Payments recover. Total outage: forty-seven minutes.

[!WARNING] "It works in Chrome" proves nothing about your chain. Always test a certificate change with curl or openssl s_client, which behave like your API clients do.

TLS in production: where it really ends

In production, TLS rarely ends at your app:

  1. User → CDN / load balancerThe user's TLS session ends here — TLS termination — with a certificate from ACM or Let's Encrypt
  2. Load balancer → backendTraffic is usually encrypted again, because the inside of your network isn't automatically safe
  3. Service → serviceMany teams use mutual TLS (mTLS): both sides present a certificate, often handled by a service mesh like Istio or Linkerd

Same handshake every time — mTLS just adds a client certificate.

Never again: four habits

  1. Automate certificates — cert-manager in Kubernetes, ACM on AWS. This matters more every year: public certificate lifetimes are shrinking from 398 days to 200 days (from March 2026), 100 days (from March 2027) and 47 days (from March 2029).

  2. Monitor expiry, not just with a calendar reminder:

    bash
    openssl x509 -enddate -noout -in fullchain.pem
    # notAfter=Feb 21 09:12:44 2027 GMT
  3. Check the full chain in CI, not just in a browser — openssl s_client … | grep 'Verify return code: 0' is a one-line gate.

  4. Keep TLS 1.2 as the minimum, with TLS 1.3 preferred.

Cheat sheet

Verify return codeMeaningFix
0 (ok)The client can walk the chain to a trusted root—
21Unable to verify the first certificate — usually a missing intermediateServe fullchain.pem
10Certificate has expiredRenew, then automate renewal

Remember: TLS uses asymmetric crypto to agree on keys and prove identity, then symmetric crypto for speed. A client trusts a certificate only if it can walk the chain to a root it already knows. And when one client works but another fails, check the chain first.