- networking
- l2
- deep-dive
- tls
- tcp-ip --- Portal | Level: L2: Operations | Topics: TLS & PKI, TCP/IP | Domain: Networking
TLS Handshake Deep Dive¶
Scope¶
This document focuses on modern TLS, especially TLS 1.3 behavior and the operational concepts you actually need:
- why TLS exists
- certificate and trust chain basics
- handshake phases
- key exchange intuition
- authentication
- session resumption
- common failure cases
- deployment realities
Reference anchors: - https://www.rfc-editor.org/rfc/rfc8446.html - https://www.rfc-editor.org/rfc/rfc9325.html - https://www.rfc-editor.org/rfc/rfc8996.html
Big Picture¶
TLS exists to give you:
- confidentiality
- integrity
- peer authentication (usually server authentication, optionally client auth)
- resistance to active tampering
It sits above TCP and below application protocols like HTTP, SMTP, IMAP, etc.
Think:
What the Handshake Needs To Achieve¶
Before application data can flow securely, both sides need to establish:
- protocol version / capabilities
- cipher suite agreement
- key exchange parameters
- server authentication
- shared secrets for traffic protection
- optionally client authentication
- transcript integrity
That is why the handshake is not just "send cert and go."
TLS 1.3 Handshake Intuition¶
Very roughly:
- ClientHello
- supported versions
- supported cipher suites
- extensions
- key share(s)
-
SNI, ALPN, etc.
-
ServerHello
- selects parameters
-
returns its key share
-
EncryptedExtensions
-
additional negotiated parameters
-
Certificate
-
server proves identity chain
-
CertificateVerify
-
cryptographic proof tied to server private key
-
Finished
-
transcript-based integrity proof
-
client sends its Finished
- application data can flow
TLS 1.3 compresses and cleans up a lot of older TLS complexity.
Certificates and Trust¶
A certificate says, in effect: "This public key is bound to this identity, signed by an issuer."
The client does not trust a random presented cert because vibes. It validates: - chain to trusted root/intermediate path - name matching - time validity - signature correctness - policy constraints as applicable
If that fails, the secure illusion collapses fast.
Key Exchange Intuition¶
Modern TLS uses ephemeral key exchange so that session secrets are derived fresh.
That matters because: - compromise of long-term certificate private key later should not expose past session traffic in the same direct way - every session gets fresh cryptographic material
This is part of why modern TLS is much better than old "static everything" thinking.
Authentication vs Encryption¶
These are different jobs.
Authentication¶
"Am I really talking to the expected server?"
Encryption¶
"Can others read the traffic?"
Integrity¶
"Can others alter it undetected?"
A system that encrypts without authenticating correctly is still in trouble.
ALPN and SNI¶
SNI¶
Lets the client indicate which hostname it wants on a shared IP.
ALPN¶
Lets client/server agree on application protocol, such as HTTP/2.
These extensions matter a lot in modern hosting reality.
Session Resumption¶
TLS can avoid paying full handshake cost every single time.
Benefits: - lower latency - lower CPU - better scale
But resumption has to be designed carefully; security and key lifetime still matter.
Why TLS 1.0 and 1.1 Are Dead Weight¶
They are deprecated for good reasons: - weaker design era - outdated cipher realities - modern deployment recommendations moved on
For normal modern infrastructure discussion, TLS 1.2 and especially TLS 1.3 are the relevant baseline.
Common Failure Modes¶
Certificate name mismatch¶
Server cert does not match requested hostname.
Expired certificate¶
The classic self-own.
Missing intermediate chain¶
The server presents an incomplete chain.
Protocol/cipher mismatch¶
Old client vs new server or vice versa.
Time skew¶
Certificate validation can fail because clocks are wrong.
Broken trust store assumptions¶
Particularly in containers, custom images, private PKI.
"TLS error" blamed on networking¶
Sometimes the TCP path is fine and crypto policy is what is actually failing.
Operational Commands¶
openssl s_client -connect host:443 -servername host
openssl x509 -in cert.pem -text -noout
curl -Iv https://host
Look for: - negotiated version - cipher - chain - SAN names - OCSP/stapling status if relevant - ALPN result
Interview-Level Things to Explain¶
You should be able to explain:
- what TLS protects
- what happens in ClientHello/ServerHello at a high level
- why certificates are not the same thing as encryption keys for the session
- why name validation matters
- why TLS 1.3 is cleaner than older handshakes
- common cert/chain/protocol failure patterns
Fast Mental Model¶
TLS is a cryptographic negotiation layered on top of TCP that authenticates peers, derives fresh session keys, and then protects application traffic for confidentiality and integrity.
Wiki Navigation¶
Prerequisites¶
- Networking Deep Dive (Topic Pack, L1)
Related Content¶
- Networking Deep Dive (Topic Pack, L1) — TCP/IP, TLS & PKI
- AWS Networking (Topic Pack, L1) — TCP/IP
- Adversarial Interview Gauntlet (30 sequences) (Scenario, L2) — TCP/IP
- Case Study: BMC Clock Skew Cert Failure (Case Study, L2) — TLS & PKI
- Case Study: DNS Looks Broken — TLS Expired, Fix Is Cert-Manager (Case Study, L2) — TLS & PKI
- Case Study: Deployment Stuck — ImagePull Auth Failure, Vault Secret Rotation (Case Study, L2) — TLS & PKI
- Case Study: Duplex Mismatch Symptoms (Case Study, L1) — TCP/IP
- Case Study: NAT Exhaustion Intermittent (Case Study, L2) — TCP/IP
- Case Study: SSL Cert Chain Incomplete (Case Study, L1) — TLS & PKI
- Case Study: TCP RST After Idle (Case Study, L2) — TCP/IP
Pages that link here¶
- HTTP Protocol - Primer
- NAT Port Exhaustion / Intermittent Failures
- Nginx & Web Servers - Primer
- Primer
- Runbook: Certificate Renewal Failed
- Runbook: TLS Certificate Expiry
- Scenario: TLS Certificate Expired
- TCP Connections Reset After Idle Period
- TCP/IP Deep Dive
- TCP/IP Deep Dive - Primer
- TLS & Certificates Ops - Primer
- TLS & PKI - Skill Check
- TLS & PKI Drills
- TLS Works From Some Clients But Fails From Others