TLS (Transport Layer Security)

Definition

TLS (Transport Layer Security) is a cryptographic protocol that provides secure communication over a network. It ensures confidentiality (encryption), integrity (tamper detection), and authentication (server/client identity verification).

TLS is the successor to SSL (Secure Sockets Layer), which is now deprecated. TLS 1.3 is the current standard (RFC 8446, 2018).

TLS Handshake (TLS 1.3)

Client                          Server
  │                               │
  │── ClientHello ──────────────▶│  (supported versions, ciphers, key share)
  │                               │
  │◀── ServerHello ──────────────│  (chosen cipher, key share, cert)
  │                               │
  │◀── EncryptedExtensions ──────│
  │                               │
  │◀── Certificate ──────────────│  (server's TLS certificate)
  │                               │
  │◀── CertificateVerify ────────│  (server signs handshake)
  │                               │
  │◀── Finished ─────────────────│
  │                               │
  │── Finished ──────────────────▶│  (client verifies server)
  │                               │
  │◀══ Encrypted Application Data ═▶│  (mutual auth if client cert requested)

TLS Versions

Version Status Notes
SSL 1.0 Deprecated Never released
SSL 2.0 Insecure Broken, do not use
SSL 3.0 Insecure POODLE attack (2014)
TLS 1.0 Deprecated RFC 8996 deprecation (2021)
TLS 1.1 Deprecated RFC 8996 deprecation (2021)
TLS 1.2 Supported Widely deployed, still secure
TLS 1.3 Recommended Faster, more secure, simplified handshake

TLS 1.3 Improvements Over TLS 1.2

  • Faster handshake: 1-RTT (vs 2-RTT for TLS 1.2)
  • 0-RTT: Resumed connections can send data immediately
  • Removed weak ciphers: No RC4, DES, 3DES, CBC-only modes
  • Forward secrecy required: All key exchanges use ECDHE
  • Simplified cipher suites: Reduced from 50+ to just a few
  • Removed compression: Eliminates CRIME attack

TLS Cipher Suites (TLS 1.3)

Cipher Suite Key Exchange Encryption MAC
TLS_AES_256_GCM_SHA384 ECDHE AES-256-GCM SHA384
TLS_AES_128_GCM_SHA256 ECDHE AES-128-GCM SHA256
TLS_CHACHA20_POLY1305_SHA256 ECDHE ChaCha20 SHA256

TLS Certificate Types

Type Description Use Case
DV (Domain Validated) Domain ownership verified Basic websites
OV (Organization Validated) Organization verified Business websites
EV (Extended Validation) Strictest validation, green bar (deprecated) Banks, e-commerce
Wildcard Covers domain and all subdomains (*.example.com) Multi-subdomain sites
SAN (Subject Alternative Name) Multiple domains on one cert Multi-domain sites
Self-signed Not signed by CA Testing, internal use

TLS in Infrastructure

Component TLS Role
Web servers HTTPS for all traffic
Databases Encrypted connections (MySQL, PostgreSQL)
APIs TLS for all REST/gRPC endpoints
Email TLS for SMTP, IMAP, POP3
VPN TLS-based VPNs (WireGuard, OpenVPN)
DNS DoT (DNS over TLS), DoH (DNS over HTTPS)

TLS Troubleshooting

# Check TLS certificate
openssl s_client -connect example.com:443 -servername example.com

# Check certificate details
openssl x509 -in cert.pem -text -noout

# Check TLS version support
nmap --script ssl-enum-ciphers -p 443 example.com

# Test with testssl.sh
./testssl.sh example.com