The TLS Handshake: How Asymmetric and Symmetric Encryption Combine to Secure Web Traffic
The Transport Layer Security (TLS) handshake secures internet communication by using heavy asymmetric cryptography to securely exchange a fast symmetric key. This process establishes an encrypted session in milliseconds, protecting data from interception while maintaining high network speeds.
By Kavya Nair
Share this story
In short
- The TLS handshake uses slow asymmetric encryption to securely agree on a fast symmetric key.
- The client and server exchange 32-byte random numbers and a premaster secret to generate a 48-byte master secret.
- Modern TLS implementations use ephemeral Diffie-Hellman to ensure forward secrecy, protecting past traffic from future key compromises.
When a browser requests a secure webpage, within the first 300 milliseconds after the TCP connection opens, a cryptographic negotiation dictates whether the traffic will be safe from interception. This process, the Transport Layer Security (TLS) handshake, combines the security of asymmetric encryption with the speed of symmetric encryption to establish a secure session. Cloudflare notes that "[a] TLS handshake takes place whenever a user navigates to a website over HTTPS and the browser first begins to query the website's origin server."[4]
The core engineering challenge of secure communication is key distribution: both parties need a shared secret to encrypt data, but they must agree on that secret over a network that is actively being monitored.
Asymmetric encryption, which uses a public key to encrypt and a private key to decrypt, solves the distribution problem but introduces a severe performance penalty. The Internet Society points out that "a 2048-bit asymmetric key is approximately equivalent to a 112-bit symmetric key" in cryptographic strength, making the asymmetric math up to a thousand times more computationally intensive.[3]
To avoid crippling network speeds, the TLS handshake uses heavy asymmetric cryptography strictly for the initial authentication and key exchange. Once a secure channel is established, the protocol switches to symmetric encryption—typically Advanced Encryption Standard (AES) using 128-bit or 256-bit keys—for the actual bulk data transfer.[3][6]
The handshake begins immediately after the underlying TCP connection is established. The client initiates the sequence by transmitting a "Client Hello" message. This packet contains the highest TLS version the client supports, a list of acceptable cipher suites, and a randomly generated 32-byte value known as the client random.[1][4]
The server responds with a "Server Hello" message, selecting the strongest mutually supported cipher suite. It also transmits its own 32-byte server random and its X.509 digital certificate. The client verifies this certificate against its local store of trusted Certificate Authorities, confirming that the server is the legitimate owner of the requested domain and preventing man-in-the-middle interception.[4]
With the server's identity verified, the two parties must generate the shared secret. In older RSA-based handshakes, the client generates a random string of bytes called the premaster secret, encrypts it with the server's public key, and transmits it. Because only the server holds the corresponding private key, only the server can decrypt the premaster secret.[4]
Modern TLS implementations heavily favor ephemeral Diffie-Hellman (ECDHE) key exchanges over RSA. Instead of the client sending an encrypted secret, both the client and server exchange mathematical parameters that allow them to independently calculate a matching premaster secret. This method provides forward secrecy: because the session keys are not derived directly from the server's static private key, an attacker who records the encrypted traffic and later steals the private key still cannot decrypt the historical data.[3][4]
Once both sides possess the premaster secret, they use a pseudorandom function (PRF) to combine it with the 32-byte client random and the 32-byte server random. According to the Internet Engineering Task Force's RFC 5246 specification, this operation expands the inputs into a 48-byte master secret.[1]
The 48-byte master secret is then fed through the PRF again to generate the final symmetric session keys. These include the client write encryption key, the server write encryption key, and the Message Authentication Code (MAC) keys used to verify data integrity. Both the client and server send a final "Finished" message, which is encrypted with the newly generated session keys. If both sides successfully decrypt and verify the MAC of the "Finished" messages, the handshake is complete.[1][4]
Following the handshake, the TLS Record Protocol takes over the transmission of application data. The record layer fragments the data into manageable blocks of 2^14 bytes or less. Each fragment is compressed, encrypted using the symmetric session keys, and appended with a MAC that includes a sequence number. This sequence number ensures that any missing, extra, or repeated messages are immediately detected by the receiving party.[1]
The protocol has undergone aggressive modernization to eliminate legacy vulnerabilities. MDN Web Docs reports that "[a]ll major browsers began removing support for TLS 1.0 and 1.1 in early 2020," with browsers like Firefox returning a hard "Secure Connection Failed" error from version 74 onwards.[2]
The deployment of TLS 1.3 accelerates this modernization by removing support for RSA key exchange entirely and drastically reducing the number of supported cipher suites. By assuming the server's preferred key exchange method, TLS 1.3 cuts the cryptographic negotiation down to a single round trip. For returning visitors, it introduces a 0-RTT (zero round-trip time) mode, allowing the client to send encrypted application data in its very first message.[4]
The protocol's reliance on third-party Certificate Authorities remains its primary structural vulnerability. If a trusted CA is compromised or coerced, attackers can issue fraudulent certificates that bypass the handshake's authentication phase entirely. Until DNS-based authentication models achieve widespread adoption, the mathematical certainty of the TLS handshake will continue to depend on the operational security of the organizations issuing the certificates.[3][5][7]
Jargon, explained
- Asymmetric Encryption
- A cryptographic system that uses a public key to encrypt data and a mathematically related private key to decrypt it.
- Symmetric Encryption
- A cryptographic system where both the sender and receiver use the exact same secret key to encrypt and decrypt data.
- Cipher Suite
- A standardized set of cryptographic algorithms used to secure a network connection, including key exchange, bulk encryption, and message authentication.
- Forward Secrecy
- A security feature ensuring that session keys will not be compromised even if the server's long-term private key is stolen in the future.
- Master Secret
- A 48-byte cryptographic value derived during the handshake, used to generate the final symmetric session keys.
Common questions
What is the difference between SSL and TLS?
Secure Sockets Layer (SSL) was the original protocol developed in the 1990s. Transport Layer Security (TLS) is its modern, secure successor, though the terms are still often used interchangeably.
Why doesn't TLS use asymmetric encryption for everything?
Asymmetric encryption is highly secure but computationally expensive. Using it for bulk data transfer would severely slow down web browsing, so it is only used to securely exchange a faster symmetric key.
What happens if a server's private key is stolen?
In older TLS versions using RSA key exchange, a stolen private key could decrypt past recorded traffic. Modern TLS using ephemeral Diffie-Hellman provides 'forward secrecy,' meaning past sessions remain secure even if the long-term key is compromised.
Competing readings
Protocol Engineers
Advocate for strict forward secrecy and the deprecation of vulnerable legacy cipher suites.
Engineers designing the TLS standard argue that supporting legacy cryptography is a structural liability. They point out that older algorithms, such as RSA key exchange or SHA-1 hashing, leave connections vulnerable to downgrade attacks where malicious actors force the session into a weaker encryption state. By strictly enforcing TLS 1.3 and ephemeral Diffie-Hellman, they guarantee forward secrecy, ensuring that even if a server's private key is compromised in the future, past traffic remains permanently encrypted.
Web Performance Advocates
Prioritize reducing cryptographic latency through single round-trip and 0-RTT handshakes.
Performance advocates emphasize that security cannot come at the cost of latency, noting that every millisecond added to the handshake degrades the end-user experience. They champion TLS 1.3 because it reduces the cryptographic negotiation from two round trips to one by assuming the server's preferred key exchange method. For returning visitors, they heavily promote the 0-RTT (zero round-trip time) feature, which allows encrypted application data to flow immediately in the very first message.
Enterprise Security Administrators
Value network visibility and often rely on middleboxes that are complicated by strict forward secrecy.
Corporate security teams argue that total end-to-end encryption creates dangerous blind spots within their own networks. They historically relied on static RSA keys to decrypt and inspect internal traffic for malware or data exfiltration using network middleboxes. Because modern TLS enforces strict forward secrecy, these administrators are now forced to deploy complex, resource-intensive proxy architectures to maintain visibility into the traffic crossing their perimeters.
- Protocol Engineers
- Advocate for strict forward secrecy and the deprecation of vulnerable legacy cipher suites.
- Web Performance Advocates
- Prioritize reducing cryptographic latency through single round-trip and 0-RTT handshakes.
- Enterprise Security Administrators
- Value network visibility and often rely on middleboxes that are complicated by strict forward secrecy.
Perspectives this story doesn't cover
- Legacy Hardware Manufacturers
- Certificate Authority Operators
Sources
[1]IETFProtocol EngineersRFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2
Read on IETF →
[2]MDN Web DocsWeb Performance AdvocatesTransport Layer Security (TLS) - Glossary
Read on MDN Web Docs →
[3]Internet SocietyProtocol EngineersWhat is TLS & How Does it Work?
Read on Internet Society →
[4]CloudflareWeb Performance AdvocatesWhat Happens in a TLS Handshake? | SSL Handshake
Read on Cloudflare →
[5]IBMEnterprise Security AdministratorsHow TLS provides identification, authentication, confidentiality, and integrity
Read on IBM →
[6]F5Web Performance AdvocatesWhat is SSL/TLS Encryption?
Read on F5 →
[7]Factlen Editorial TeamEnterprise Security AdministratorsSynthesis by Factlen editorial team
Read on Factlen Editorial Team →
More in Guides
See all →Database Design
The Elimination of Redundancy and Transitive Dependency: How Database Normal Forms Prevent Update Anomalies
6 sources
Data Compression
The (Offset, Length, Next Character) Triple: How the LZ77 Sliding Window Achieves Lossless Data Compression
4 sources
Ammonia Synthesis
The 450°C and 200 Bar Trade-Off: How the Haber-Bosch Process Converts Atmospheric Nitrogen to Ammonia
4 sources
Microphone Tech
Electromagnetic Induction vs. Electrostatic Capacitance: How Dynamic and Condenser Microphones Convert Sound to Signal
6 sources
Comments
Every angle. Every day.
Get Guides stories with full source coverage and perspective breakdowns, free every day.




