13: TLS and HTTPS
Course: Networking - Security Advanced · Updated: October 2026 Literature: K&R chapter 8: securing TCP connections (TLS) Related lab: Wireshark lab: SSL/TLS (solution) Prerequisites: Article 11: Cryptography, Article 12: Authentication
Learning objectives
After studying this article you can:
- explain what TLS offers (confidentiality, integrity, server/client authentication) and where it sits in the protocol stack
- describe the phases of TLS: handshake, key derivation, data transfer, closing the connection
- explain what a cipher suite is
- explain the TLS 1.3 handshake and how it differs from SSL/TLS 1.2
- explain certificates, Certificate Authorities, the chain of trust and Certificate Transparency
- analyse a TLS session in Wireshark
1. From SSL to TLS
| Version | Year | Status (2026) |
|---|---|---|
| SSL 2.0 | 1995 | Broken, forbidden (RFC 6176) |
| SSL 3.0 | 1996 | Broken (POODLE, 2014), forbidden (RFC 7568) |
| TLS 1.0 | 1999 | Deprecated (RFC 8996, 2021) |
| TLS 1.1 | 2006 | Deprecated (RFC 8996) |
| TLS 1.2 | 2008 | Still allowed, if configured correctly (AEAD and ECDHE only) |
| TLS 1.3 | 2018 (RFC 8446) | Current standard, used by most HTTPS traffic |
The 2018 course and the Wireshark lab used the name SSL. In practice, "SSL" is still used informally (e.g. "SSL certificate"), but all SSL versions are obsolete. The correct name is TLS.
TLS is used by HTTPS (port 443), and also by e-mail (SMTP/IMAP with STARTTLS, or ports 465/993), DNS over TLS/HTTPS, VPNs (OpenVPN, SSL-VPN), MQTT, LDAPS, database connections and more. QUIC builds TLS 1.3 directly into the transport protocol (see article 01).
2. Where does TLS sit?
1 2 3 4 5 6 7 8 9 10 | |
TLS offers an API similar to sockets (see article 02). From the network's point of view, it is part of the application layer.
3. A "toy" TLS: the four phases (K&R)
- Handshake: Alice and Bob use certificates and private keys to authenticate each other (usually only the server is authenticated) and exchange a shared secret.
- Key derivation: from the shared secret, both sides derive a set of keys: separate encryption keys and MAC keys for each direction (client→server and server→client). Why separate keys? Using the same key for different purposes is risky.
- Data transfer: the data stream is split into records. Each record gets a MAC (for integrity) and is encrypted. Every record also has a sequence number inside the MAC calculation, so that Trudy can't reorder or replay records. A nonce protects against replaying a whole connection.
- Closing the connection: with a special close_notify record, which is protected with a MAC. Otherwise Trudy could cut the connection with a forged TCP FIN (a truncation attack).
4. Cipher suites
A cipher suite lists the algorithms used in a session. The client offers a list and the server chooses.
TLS 1.2 example:
1 2 3 4 5 6 | |
TLS 1.3 simplified this a lot. There are only five cipher suites, all AEAD, and key exchange is always (EC)DHE (negotiated separately):
1 2 3 4 | |
TLS 1.3 removed: RSA key transport (no forward secrecy), CBC modes, RC4, 3DES, MD5/SHA-1, compression and renegotiation. These were sources of attacks such as BEAST, CRIME, Lucky 13, POODLE and ROBOT.
5. The TLS 1.3 handshake
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
- One round trip (1-RTT) before application data can flow. TLS 1.2 needed 2 RTT.
- 0-RTT (early data) for repeat visits, which is faster but vulnerable to replay. Use it only for safe requests (GET).
- Forward secrecy is always on: the session keys come from ephemeral Diffie-Hellman keys that are thrown away afterwards.
- The certificate is encrypted, which gives more privacy than TLS 1.2.
- SNI (Server Name Indication) is still visible in the ClientHello, so an observer can see which website you visit. ECH (Encrypted Client Hello) fixes this. It is supported by Firefox, Chrome and Cloudflare, and is being standardised by the IETF.
- Post-quantum: modern browsers send a hybrid X25519MLKEM768 key share (see article 11).
6. Certificates and PKI
6.1 What is a certificate?
An X.509 certificate binds a public key to an identity (for example www.hva.nl), signed by a Certificate Authority (CA). It contains:
- Subject (domain name(s) in Subject Alternative Name)
- The public key
- Issuer (the CA)
- Validity period (Not Before / Not After)
- Serial number, extensions (key usage, ...)
- The CA's digital signature
6.2 Chain of trust
1 2 3 4 5 | |
The browser checks:
- Is the signature valid all the way up to a trusted root?
- Does the domain name match the website?
- Is the certificate valid (not expired)?
- Has it been revoked? (CRL / OCSP. This is in practice increasingly done with short-lived certificates and browser-pushed lists such as CRLite.)
- Does it appear in Certificate Transparency logs?
6.3 Developments
| Development | Description |
|---|---|
| Let's Encrypt (2015) | Free, automatic certificates through the ACME protocol (RFC 8555). It made HTTPS the default. More than 85–90% of web page loads in browsers now use HTTPS. |
| Certificate Transparency (RFC 6962) | All certificates must be published in public, append-only logs. Anyone can see which certificates exist for their domain (e.g. at crt.sh). |
| Shorter validity periods | Max. 398 days (since 2020). The CA/Browser Forum decided in 2025 to reduce this step by step to 47 days by 2029 (200 days from March 2026, 100 days from March 2027). Automation is a must. |
| OCSP phased out | Let's Encrypt stopped OCSP in 2025 for privacy reasons, in favour of short-lived certificates and CRLs. |
| CA distrust | Browsers remove CAs that misbehave (DigiNotar 2011, Symantec 2018, Entrust 2024). |
| mTLS | Mutual TLS: the client also has a certificate. Used for APIs, service meshes and Zero Trust. |
7. TLS in Wireshark
- Filter:
tls(old Wireshark versions usedssl) tls.handshake.type == 1shows ClientHello messages, with the SNI and the offered cipher suites- With TLS 1.3 you will see almost nothing after the ServerHello: everything is encrypted (Application Data)
- Decrypting your own traffic: set the environment variable
SSLKEYLOGFILE=C:\temp\keys.logbefore you start the browser, then point Wireshark to it (Preferences → Protocols → TLS → (Pre)-Master-Secret log filename)
References
Videos
- Jim Kurose: Securing TCP connections: TLS (chapter 8 video lectures): https://gaia.cs.umass.edu/kurose_ross/lectures.php
- Computerphile: "TLS Handshake Explained", "Diffie-Hellman Key Exchange": https://www.youtube.com/@Computerphile
- Chris Greer: "TLS 1.3 handshake in Wireshark": https://www.youtube.com/@ChrisGreer
- Hussein Nasser: "TLS 1.2 vs TLS 1.3": https://www.youtube.com/@hnasr
Articles
- The Illustrated TLS 1.3 Connection: every byte explained: https://tls13.xargs.org/
- Cloudflare Learning Center, What happens in a TLS handshake?: https://www.cloudflare.com/learning/ssl/what-happens-in-a-tls-handshake/
- Bulletproof TLS and PKI, 2nd ed. (Ivan Ristić, Feisty Duck, 2022)
- Let's Encrypt, How It Works: https://letsencrypt.org/how-it-works/
- Wireshark Wiki, TLS (decryption): https://wiki.wireshark.org/TLS
Standards
- RFC 8446: TLS 1.3 · RFC 5246: TLS 1.2 · RFC 8996: Deprecating TLS 1.0 and 1.1
- RFC 5280: X.509 certificates · RFC 6962: Certificate Transparency · RFC 8555: ACME
- RFC 9325: Recommendations for Secure Use of TLS and DTLS
Tools
- SSL Labs Server Test: grade the TLS configuration of any website: https://www.ssllabs.com/ssltest/
- testssl.sh: command-line TLS scanner: https://testssl.sh/
- Mozilla SSL Configuration Generator: secure server configs for nginx, Apache etc.: https://ssl-config.mozilla.org/
- crt.sh: search Certificate Transparency logs: https://crt.sh/
openssl s_client -connect www.hva.nl:443 -tls1_3- Certbot (ACME client for Let's Encrypt): https://certbot.eff.org/
Cyber Security
Why it matters
TLS protects most of the world's sensitive traffic: online banking, DigiD, e-mail, logins and APIs. If it is missing or misconfigured:
- Eavesdropping and MITM: on public Wi-Fi or a compromised network, passwords and session cookies can be captured.
- SSL stripping: an attacker downgrades HTTPS to HTTP when the user first visits (tool:
sslstrip). HSTS solves this. - Rogue or compromised CAs: in DigiNotar (2011), a Dutch CA was hacked. Fake certificates for
*.google.comwere used to spy on Iranian users, and DigiNotar went bankrupt. It also hit DigiD and the Dutch government, which used DigiNotar certificates. - Protocol attacks: Heartbleed (2014, server memory leaked), POODLE, BEAST, DROWN, ROBOT. They are mostly fixed in TLS 1.3, but old servers still exist.
- Expired or misconfigured certificates cause outages (e.g. Microsoft Teams in 2020, Starlink in 2023) and train users to click away warnings.
- TLS also hides attackers: most malware now uses HTTPS for command-and-control and data exfiltration. Defenders lose visibility (see article 17 and article 18).
- Phishing sites with valid certificates: a padlock means "encrypted", not "trustworthy".
- Private key theft: whoever has the server's key can impersonate the server.
How to make it safe
- Use only TLS 1.2 and 1.3. Disable SSL 2/3 and TLS 1.0/1.1. Allow only AEAD ciphers with ECDHE (use the Mozilla "intermediate" or "modern" profile).
- Use HTTPS everywhere: redirect HTTP to HTTPS, and enable HSTS (
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload). Submit the domain to the HSTS preload list. - Automate certificates with ACME (Let's Encrypt, or the ACME service of a commercial CA). Monitor expiry dates. This is essential with 47-day certificates.
- Protect private keys: file permissions, an HSM or cloud KMS for important keys, and no keys in Git or container images.
- Use CAA records in DNS (which CAs may issue for your domain), and monitor Certificate Transparency for certificates you didn't ask for (e.g. with crt.sh or Cert Spotter).
- Test regularly with SSL Labs and testssl.sh. Aim for grade A/A+.
- Use mTLS for service-to-service and API traffic inside your infrastructure.
- Plan for post-quantum: enable hybrid key exchange (X25519MLKEM768) on servers and load balancers. It is supported by recent OpenSSL (3.5+), BoringSSL, nginx, Caddy and the major cloud and CDN providers.
- Decide how to handle TLS inspection: in companies, TLS can be decrypted at a proxy or firewall to inspect traffic for malware. This needs a company CA on all devices, careful privacy policies (GDPR) and exceptions (banking, health). Badly implemented inspection lowers security.
- Teach users: certificate warnings are serious. The padlock says nothing about whether a site is trustworthy.
Extra references
- NCSC-NL, IT Security Guidelines for Transport Layer Security (TLS) (2025 version): https://www.ncsc.nl/
- Fox-IT, Black Tulip: Report of the investigation into the DigiNotar Certificate Authority breach (2012): https://www.rijksoverheid.nl/
- OWASP Transport Layer Security Cheat Sheet and HTTP Strict Transport Security Cheat Sheet: https://cheatsheetseries.owasp.org/
- HSTS preload list: https://hstspreload.org/
- CA/Browser Forum, Ballot SC-081 (shorter certificate lifetimes): https://cabforum.org/
- CISA/NSA, Eliminating Obsolete Transport Layer Security (TLS) Protocol Configurations: https://media.defense.gov/