Opscraft
How SSL/TLS works · Lesson 1 of 8 · 4 min read

The cryptography behind TLS

TLS — still loosely called "SSL" — is what puts the S in HTTPS. It proves a server is who it claims to be, agrees encryption keys over an untrusted network, and protects every byte in transit from reading and tampering. For a Senior DevOps engineer, TLS is operational territory: issuing and rotating certificates with ACM and cert-manager, deciding where TLS terminates on ALBs, NLBs, ingresses and service meshes, debugging handshake failures and broken chains, and making sure a certificate never expires at 2 AM. This topic covers the cryptography you need, the handshake step by step, certificates and PKI, and the AWS/Kubernetes operations.

What TLS guarantees

  • Confidentiality — eavesdroppers can't read the traffic.
  • Integrity — tampering is detected (every record carries an authentication tag).
  • Authentication — the client verifies the server's identity via its certificate (and optionally the server verifies the client — mTLS).

What it doesn't hide: the IP addresses, the fact that you're talking, traffic volume/timing, and (unless Encrypted Client Hello is used) the hostname in SNI.

SSL vs TLS

SSL 2.0/3.0 (Netscape, 1990s) are broken and disabled everywhere. TLS 1.0 (1999) and 1.1 are deprecated; TLS 1.2 (2008) is the minimum acceptable today; TLS 1.3 (2018) is the modern standard. People say "SSL certificate" out of habit — the certificates are the same X.509 certificates used by TLS.

HTTPS = HTTP over TLS, default port 443. TLS also protects SMTP (STARTTLS), database connections, gRPC, LDAPS, Kafka, and DNS (DoT/DoH).

Symmetric vs asymmetric cryptography

Symmetric Asymmetric (public-key)
Keys One shared secret key A key pair: public (shared) + private (secret)
Speed Very fast (hardware-accelerated AES) Much slower
Problem it solves Bulk encryption Key exchange and identity
Examples AES-GCM, ChaCha20-Poly1305 RSA, ECDSA, Ed25519; Diffie-Hellman/ECDHE for key agreement

TLS combines them:

  1. Asymmetric cryptography to authenticate the server (it proves it holds the private key matching the certificate's public key by signing handshake data) and to agree on a shared secret (ephemeral Diffie-Hellman, ECDHE).
  2. Symmetric session keys derived from that secret encrypt all application data.

So: certificates authenticate; session keys encrypt.

Enlarge diagramHandshakeasymmetric: certificateproves identity, ECDHEagrees a secretSession keysderived from that sharedsecretEvery request andresponseencrypted with fastsymmetric AES-GCMCertificates authenticate; session keys encrypt.
Figure 1. TLS uses slow public-key cryptography once, to prove identity and agree a secret, then fast symmetric encryption for all the data.
Swipe sideways to see all of it, or tap to open it full screen.

Hashes, signatures and MACs

  • A hash (SHA-256) is a one-way fingerprint of data — you can't reverse it. Hashing ≠ encryption: encryption is reversible with a key.
  • A digital signature = hash the data, then sign the hash with a private key; anyone with the public key can verify. CAs sign certificates this way; servers sign the handshake.
  • AEAD ciphers (AES-GCM, ChaCha20-Poly1305) encrypt and authenticate each record in one operation.
Enlarge diagramDatae.g. a certificateSHA-256 hasha short fingerprintSign withprivate keyonly the CA orserver canVerify withpublic keyanyone can, usingthe certificate
Figure 2. A digital signature: hash the data, sign the hash with the private key. Anyone holding the public key can check it, but only the key owner could have made it.
Swipe sideways to see all of it, or tap to open it full screen.

Forward secrecy

With ephemeral Diffie-Hellman (ECDHE), each session's keys are derived from temporary key pairs discarded after the handshake. If the server's long-term private key is stolen later, past recorded sessions can't be decrypted. Old "RSA key exchange" (the client encrypts the secret with the server's RSA public key) lacks this — a stolen key decrypts everything ever captured. TLS 1.3 only allows forward-secret key exchange.

Enlarge diagramOld RSA key exchangeECDHE (TLS 1.3 always)Session secret encrypted with the server'slong-term keyAttacker records traffic todaySteals the key next year: decrypts everythingFresh key pair for every session, then thrownawayThe long-term key only signsA stolen key cannot decrypt old sessions
Figure 3. Forward secrecy: with ephemeral key exchange, stealing the server key later does not unlock traffic someone recorded earlier.
Swipe sideways to see all of it, or tap to open it full screen.