TLS and Encryption in Transit

Understand what TLS protects, how the handshake and certificates work, and how to spot weak or broken configurations.

Beginner · about 4 hours · difficulty 3/5

Learn first: HTTP for Security Work

TLS is the protocol behind the padlock in HTTPS. It gives three guarantees: the traffic is encrypted (confidentiality), tamper-evident (integrity), and the server is authenticated by a certificate.

The handshake in plain words (TLS 1.3)

  1. The client says hello with supported cipher suites and a key share.
  2. The server replies with its key share and its certificate, signed by a certificate authority.
  3. Both sides derive the same session keys using an ephemeral key exchange (ECDHE), which gives forward secrecy: stealing the server key later does not decrypt old traffic.
  4. Encrypted application data flows.

The client validates the certificate chain up to a trusted root, checks the hostname and the validity dates. If any check fails, the browser warns.

What TLS does not do

It does not make the server trustworthy, hide which domain you visit (SNI is usually visible), or protect data once it reaches the server. Phishing sites have valid certificates too.

Configuration issues to recognize

  • Old protocol versions (SSLv3, TLS 1.0, 1.1) and weak ciphers.
  • Expired, self-signed or mismatched certificates.
  • Missing HSTS, allowing downgrade to plain HTTP.
  • Apps that disable certificate verification in code (verify=False), which silently enables man-in-the-middle attacks.

Tools

openssl s_client -connect example.com:443, Qualys SSL Labs, and testssl.sh.

Good enough: you can inspect a site's certificate chain and TLS version, and explain why an app skipping certificate verification is a critical bug.

Key concepts

  • TLS guarantees
  • TLS 1.3 handshake
  • Certificate validation
  • Forward secrecy
  • HSTS and downgrade attacks
  • openssl s_client and SSL Labs
  • Mutual TLS (mTLS)

Mini project

Scan three websites with SSL Labs and openssl, then write a comparison of their protocol versions, certificate chains and HSTS settings.

Check yourself

Why does a valid HTTPS certificate not prove a website is safe?

Free resources