Share some knowledge, skills and others — security research, pentesting notes and more.

View on GitHub
20 February 2020

TLS Handshake

by allencharp

Introduction

TLS (Transport Layer Security) secures nearly all modern web traffic. The handshake is the phase where the client and server authenticate each other and derive session keys; after that, data flows with symmetric encryption.

This post walks through the TLS 1.2 handshake with an ephemeral Diffie-Hellman (DHE/ECDHE) cipher suite, then contrasts it with TLS 1.3.

Steps of the TLS 1.2 Handshake (DHE cipher suite)

Forward secrecy

With ephemeral Diffie-Hellman (DHE/ECDHE), each handshake uses fresh, short-lived key material. Even if a server’s long-term private key leaks later, previously recorded sessions cannot be decrypted — this property is called forward secrecy. Non-ephemeral key exchange (plain RSA key exchange) does not provide it, which is why DHE/ECDHE suites are the modern standard.

Certificate chain and CA validation

The server’s certificate is signed by a Certificate Authority (CA). The client validates the chain:

  1. The certificate is signed by a trusted root/intermediate CA (or chains up to one).
  2. The certificate covers the hostname being contacted (validity period and SAN entries are checked).
  3. The certificate is not revoked or expired.

A browser’s trust store decides which roots are trusted — which is why MITM proxies (like the ZAP CA in my ZAP post) must be explicitly imported into the trust store.

TLS 1.3 in one glance

TLS 1.3 (RFC 8446) simplifies the handshake dramatically:

Summary

The TLS handshake authenticates the server (certificate + signature), establishes a shared secret (DHE/ECDHE), and derives session keys. Ephemeral key exchange gives forward secrecy, and TLS 1.3 makes the whole process faster and more secure by default.

tags: network-security - tls - crypto