Skip to content

TLS

Transport Layer Security (TLS) provides encryption, authentication, and integrity for data Transmitted over a network. TLS is the successor to Secure Sockets Layer (SSL), which was developed By Netscape in the mid-1990s. SSL 3.0 (1996) was the last SSL version; TLS 1.0 (1999, RFC 2246) was Its successor. All SSL versions are now considered insecure and deprecated.

TLS operates between the transport layer and the application layer, encrypting application data (HTTP, SMTP, IMAP, etc.) before it is sent over the network.

VersionRFCYearStatus
SSL 3.0RFC 61011996Deprecated (POODLE attack, CVE-2014-3566)
TLS 1.0RFC 22461999Deprecated (BEAST, RC4 attacks)
TLS 1.1RFC 43462006Deprecated
TLS 1.2RFC 52462008Current (widespread support)
TLS 1.3RFC 84462018Current (recommended)

TLS 1.0 and 1.1 were officially deprecated by the IETF in June 2021 (RFC 8996). TLS 1.2 remains Widely supported and is the minimum acceptable version for any new deployment. TLS 1.3 is the Recommended version for all new deployments.

PCI DSS v4.0 (effective March 2025) requires TLS 1.2 or higher and deprecates TLS 1.0 and 1.1. Major Browsers and cloud providers have already removed support for TLS 1.0 and 1.1.

TLS 1.2 uses a two-round-trip (2-RTT) handshake:

Client Server
| |
|--- ClientHello ------------------>| Supported TLS versions, cipher suites,
| | extensions, random bytes
|<-- ServerHello -------------------| Chosen version, cipher suite,
| | random bytes
|<-- Certificate -------------------| Server"s X.509 certificate chain
|<-- ServerKeyExchange ------------| Key exchange parameters (for DH/ECDHE)
|<-- ServerHelloDone --------------| Server finished
| |
|--- ClientKeyExchange ------------>| Client's key exchange parameters
|--- ChangeCipherSpec ------------->| Switch to encrypted mode
|--- Finished --------------------->| Verify handshake integrity
| |
|<-- ChangeCipherSpec --------------| Switch to encrypted mode
|<-- Finished ----------------------| Verify handshake integrity
| |
|==== Encrypted Application Data ===|
  1. ClientHello: The client sends its supported TLS versions, cipher suites, compression methods, extensions (SNI, ALPN, EC point formats), and 32 bytes of random data.
  2. ServerHello: The server selects the TLS version and cipher suite (the highest mutually supported version and the server’s preferred cipher suite). The server sends its own 32 bytes of random data.
  3. Certificate: The server sends its X.509 certificate chain. The chain includes the server’s leaf certificate and any intermediate certificates. The root certificate is not included (the client already trusts it).
  4. ServerKeyExchange: For ephemeral Diffie-Hellman key exchange (DHE or ECDHE), the server sends its DH parameters and a signature proving ownership of the certificate’s private key.
  5. ServerHelloDone: Signals the end of the server’s handshake messages.
  6. ClientKeyExchange: For DHE/ECDHE, the client sends its DH public value. For RSA key exchange, the client encrypts a pre-master secret with the server’s public key (RSA key exchange is now considered insecure and deprecated).
  7. ChangeCipherSpec: Both sides signal the switch to encrypted communication.
  8. Finished: Both sides send a hash of all handshake messages, encrypted with the negotiated keys. This verifies that the handshake was not tampered with.

The pre-master secret and both random values are combined to generate the master secret:

\mathrm{master\_secret = \mathrm{PRF(\mathrm{pre\_master\_secret, \mathrm{"master secret", \mathrm{ClientRandom + \mathrm{ServerRandom)

The master secret is then used to generate the symmetric encryption keys and MAC keys for the Session.

TLS 1.3 (RFC 8446) simplifies the handshake to 1-RTT and removes support for legacy algorithms:

Client Server
| |
|--- ClientHello ------------------>| Supported versions, key shares,
| | extensions (all in first flight)
|<-- ServerHello -------------------| Chosen version, key share,
|<-- EncryptedExtensions ----------| Extensions (encrypted)
|<-- Certificate -------------------| Server certificate chain
|<-- CertificateVerify -------------| Signature over transcript
|<-- Finished ----------------------| Handshake complete
| |
|--- [Application Data] ----------->| Can send immediately after
|--- Finished --------------------->| Client handshake complete
| |
|==== Encrypted Application Data ===|
  1. 1-RTT handshake: The server’s response includes the certificate, key exchange, and finished message in a single flight. This reduces handshake latency by one RTT compared to TLS 1.2.

  2. 0-RTT resumption: On repeat connections with a pre-shared key (PSK), the client can send application data with the first flight (0-RTT data). This eliminates handshake latency entirely for returning clients.

Client Server
|--- ClientHello + EarlyData ------>| Application data in first flight
|<-- ServerHello + Finished -------| Server responds
|==== Encrypted Application Data ===|