Software-Engineering

TLS/SSL Protocols

What is SSL/TLS?

SSL (Secure Sockets Layer) and TLS (Transport Layer Security) are cryptographic protocols that provide secure communication over computer networks. TLS is the successor to SSL and is widely used to secure web traffic (HTTPS), email, VoIP, and other communications.

SSL vs TLS

Why is TLS Needed?

TLS addresses fundamental security requirements:

Without TLS, network communications are vulnerable to:

How Does TLS Work?

TLS operates as a sublayer between application protocols (HTTP, SMTP) and transport protocols (TCP). It provides:

  1. Encryption: Symmetric cryptography for data protection
  2. Authentication: Digital certificates for identity verification
  3. Integrity: Message authentication codes (MAC) for tamper detection

TLS Handshake Process

The TLS handshake establishes a secure connection:

sequenceDiagram
    participant Client
    participant Server

    Client->>Server: Client Hello<br/>(TLS version, cipher suites, random)
    Server->>Client: Server Hello<br/>(chosen cipher, random, session ID)
    Server->>Client: Certificate<br/>(server's public key certificate)
    Server->>Client: Server Key Exchange<br/>(if needed for key exchange)
    Server->>Client: Certificate Request<br/>(if client auth required)
    Server->>Client: Server Hello Done
    Client->>Server: Certificate<br/>(client cert if requested)
    Client->>Server: Client Key Exchange<br/>(pre-master secret encrypted with server's public key)
    Client->>Server: Certificate Verify<br/>(if client cert sent)
    Client->>Server: Change Cipher Spec
    Client->>Server: Finished<br/>(verify handshake integrity)
    Server->>Client: Change Cipher Spec
    Server->>Client: Finished

Handshake Steps Explained

  1. Client Hello: Client proposes TLS version and cipher suites
  2. Server Hello: Server selects protocol parameters
  3. Certificate: Server sends its certificate for authentication
  4. Key Exchange: Parties exchange information to generate session keys
  5. Change Cipher Spec: Switch to encrypted communication
  6. Finished: Verify handshake was not tampered with

Cryptographic Primitives

Symmetric Encryption

Asymmetric Encryption

Hash Functions

Digital Signatures

TLS Versions

SSL 1.0 (1995)

SSL 2.0 (1995)

SSL 3.0 (1996)

TLS 1.0 (1999)

TLS 1.1 (2006)

TLS 1.2 (2008)

TLS 1.3 (2018)

Common TLS Attacks and Mitigations

Attack Description Mitigation
POODLE SSL 3.0 padding oracle Disable SSL 3.0
BEAST CBC mode attack Use TLS 1.1+ or AEAD ciphers
Heartbleed OpenSSL buffer overflow Update OpenSSL, use TLS 1.2+
Logjam Weak DH parameters Use strong DH parameters
FREAK RSA export cipher suites Disable export ciphers
DROWN Cross-protocol attack Disable SSL/TLS on same server