×

SSL/TLS Handshake Explained: From Key Negotiation to Certificate Chain Verification

Every https:// page starts with a TLS handshake. This process involves asymmetric encryption, certificate chain verification, and cipher suite negotiation. Understanding it helps you debug certificate errors, optimize HTTPS performance, and detect MITM attacks.

TLS handshake and certificate-chain validation diagram
Illustration: TLS handshake and certificate-chain validation diagram

TLS 1.2 vs TLS 1.3 Handshake

ClientHello
ServerHello + Cert
Key Exchange
Finished
Encrypted
ClientHello + KeyShare
ServerHello + Cert + Finished
Encrypted
AspectTLS 1.2TLS 1.3
Round trips2 RTT1 RTT / 0 RTT (resumption)
Key exchangeRSA or DHE/ECDHEECDHE / X25519 only
Cert privacyPlaintextEncrypted
CiphersLegacy (CBC, RC4)AEAD only (AES-GCM, ChaCha20)
Forward secrecyOptionalMandatory
💡 Tip: TLS 1.3's 0-RTT resumption mode is faster but vulnerable to replay attacks. For sensitive operations (e.g., payments), disable 0-RTT server-side or restrict it to idempotent requests only.

Certificate Chains: How Trust Is Built

Server Cert
Intermediate CA
Root CA (pre-installed)

Browsers ship with ~100–150 root CA certificates. The server sends its cert plus intermediate CAs. The browser verifies signatures up the chain. If it reaches a pre-installed root, it's trusted.

⚠️ Warning: Common mistake: Server sends only its own certificate without the intermediate CA certificate. This causes "incomplete certificate chain" errors in some browsers and most API clients. Fix: concatenate the intermediate certificate and server certificate into a single fullchain.pem in your Nginx/Apache config.

Certificate Types Compared

TypeValidationTimeBrowserBest ForCost
DVDomain onlyMinutesPadlockPersonal sitesFree
OVOrganization1–3 daysPadlockBusiness$50–$200
EVStrict entity1–4 weeksPadlock + org nameFinance$100–$500

Common SSL Errors & Fixes

ErrorCauseFix
ERR_CERT_DATE_INVALIDExpiredRenew; check certbot cron
ERR_CERT_COMMON_NAME_INVALIDDomain mismatchCheck SAN includes domain
ERR_CERT_AUTHORITY_INVALIDIncomplete chainAdd intermediate CA cert
ERR_SSL_PROTOCOL_ERRORTLS mismatchEnable TLS 1.2+

Practical Debugging Commands

# View complete certificate chain
openssl s_client -connect example.com:443 -showcerts

# Check certificate validity dates
echo | openssl s_client -connect example.com:443 2>/dev/null | openssl x509 -noout -dates

# Enumerate supported TLS versions and ciphers
nmap --script ssl-enum-ciphers -p 443 example.com

# Quick certificate chain check
curl -vI https://example.com 2>&1 | grep -i "SSL\|issuer\|subject"

✅ TLS Performance Checklist:

  • Enable TLS 1.3
  • Enable OCSP Stapling
  • Enable HTTP/2
  • Use ECDSA certificates
  • Configure TLS Session Tickets

Use ipinfo.im's SSL Certificate Check tool for a one-click analysis of your certificate chain, expiration, and cipher suites.