Skip to main content
ExplainerWeb EncryptionProtocol Explainer· 5 min read· in Guides

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

Protocol Engineers 40%Web Performance Advocates 35%Enterprise Security Administrators 25%
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

Summary

  1. The TLS handshake uses slow asymmetric encryption to securely agree on a fast symmetric key.
  2. The client and server exchange 32-byte random numbers and a premaster secret to generate a 48-byte master secret.
  3. Modern TLS implementations use ephemeral Diffie-Hellman to ensure forward secrecy, protecting past traffic from future key compromises.
  4. TLS 1.3 reduces the handshake to a single round trip and introduces a 0-RTT mode for returning visitors.
  5. Once the handshake completes, the TLS Record Protocol fragments, encrypts, and authenticates the application data.

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 client and server exchange random values and a premaster secret to derive the final session keys.

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]

With the server's identity verified, the two parties must generate the shared secret.

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]

Asymmetric encryption requires significantly larger key sizes to achieve the same cryptographic strength as symmetric encryption.

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 TLS Record Protocol fragments and encrypts application data using the symmetric keys generated during the handshake.

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]

Definitions

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.

Questions & answers

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.

Significance

The TLS handshake is the invisible mechanism that makes e-commerce, online banking, and private communication possible. Understanding how it balances heavy asymmetric cryptography with fast symmetric ciphers reveals why modern web traffic remains secure without sacrificing page load speeds.

Sources

Source coverage

7 outlets

3 viewpoints surfaced

Protocol Engineers 40%Web Performance Advocates 35%Enterprise Security Administrators 25%
  1. [1]IETFProtocol Engineers

    RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2

    Read on IETF
  2. [2]MDN Web DocsWeb Performance Advocates

    Transport Layer Security (TLS) - Glossary

    Read on MDN Web Docs
  3. [3]Internet SocietyProtocol Engineers

    What is TLS & How Does it Work?

    Read on Internet Society
  4. [4]CloudflareWeb Performance Advocates

    What Happens in a TLS Handshake? | SSL Handshake

    Read on Cloudflare
  5. [5]IBMEnterprise Security Administrators

    How TLS provides identification, authentication, confidentiality, and integrity

    Read on IBM
  6. [6]F5Web Performance Advocates

    What is SSL/TLS Encryption?

    Read on F5
  7. [7]Factlen Editorial TeamEnterprise Security Administrators

    Synthesis by Factlen editorial team

    Read on Factlen Editorial Team

Comments

Stay informed

Every angle. Every day.

Get Guides stories with full source coverage and perspective breakdowns delivered to your inbox.