TLS and HTTPS explained: the handshake, certificates, SNI and common errors
In short: TLS encrypts traffic and proves the server is who it claims to be. In the TLS 1.3 handshake the client and server agree on keys in one round trip, and the server presents a certificate signed by a trusted certificate authority. SNI tells the server which site the client wants. Most TLS problems are expired certificates, name mismatches, missing intermediate certificates or old protocol versions.
What TLS gives you
Transport Layer Security (TLS) sits between TCP (or QUIC) and the application. It provides three things: confidentiality (nobody on the path can read the data), integrity (nobody can change it unnoticed) and authentication (the client knows it is talking to the real server). HTTPS is simply HTTP over TLS, and the same TLS protects email (SMTPS, IMAPS), LDAPS, VPNs and many APIs. SSL is the old name; all SSL versions and TLS 1.0 and 1.1 are now deprecated.
The handshake in plain words
- ClientHello: the client lists the TLS versions and cipher suites it supports, sends a key share (its half of a Diffie-Hellman exchange) and the SNI, the name of the site it wants.
- ServerHello: the server picks a cipher and sends its own key share. Both sides can now calculate the same secret keys, and everything after this is encrypted.
- Certificate and CertificateVerify: the server sends its certificate chain and proves it holds the matching private key.
- Finished: both sides confirm the handshake was not tampered with. Application data starts.
TLS 1.3 does this in one round trip, compared with two in TLS 1.2, and removed old, weak ciphers entirely. Every key exchange gives forward secrecy: stealing the server's private key later does not decrypt old recorded traffic.
Certificates and the chain of trust
A server certificate contains the site's names (in the Subject Alternative Name field), a public key, validity dates and a signature from a certificate authority (CA). Usually it is signed by an intermediate CA, which is signed by a root CA that your operating system or browser already trusts. The server must send the intermediate certificate as well as its own; if it does not, some clients fail with "unable to get local issuer certificate".
Common errors and causes
- Expired certificate: renewal was missed. Automate it (ACME and Let's Encrypt, or your provider's tools) and monitor expiry dates. Public certificate lifetimes are being shortened step by step, so manual renewal will become impractical.
- Name mismatch: the certificate does not include the name the user typed, for example www missing.
- Untrusted issuer: an internal CA certificate is not installed on the device, or the chain is incomplete.
- Protocol or cipher mismatch: an old device only speaks TLS 1.0, or a server only allows TLS 1.3 and a client is too old.
- Wrong clock: a device with the wrong date thinks valid certificates are expired or not yet valid.
Checking from the command line
openssl s_client -connect www.example.com:443 -servername www.example.com
# shows the chain, the negotiated TLS version and cipher, and any verify errors
curl -vI https://www.example.com
TLS inspection
Many company firewalls decrypt and re-encrypt HTTPS to inspect it, using their own CA certificate installed on managed devices. It helps detect threats but breaks certificate pinning in some apps and has privacy implications, so organisations usually exclude banking, healthcare and other sensitive categories.
Real-world example: the app that only failed on Android
A company's new web API worked from browsers and iPhones but failed from its Android app with a certificate error. openssl s_client showed the server only sent its own certificate, not the intermediate. Desktop browsers had quietly fetched the missing intermediate themselves; the Android HTTP library did not. Adding the full chain to the server fixed it.
Practice
Which part of the TLS ClientHello tells the server which website the client wants?
Why must a server send intermediate certificates?
How many round trips does a TLS 1.3 handshake need before data flows?
Key takeaways
- TLS gives confidentiality, integrity and server authentication.
- TLS 1.3 agrees keys in one round trip with forward secrecy.
- Certificates chain from the server through intermediates to a trusted root.
- Expiry, name mismatch, missing intermediates and old versions cause most errors.
Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.