Skip to content
BoKSA

13: TLS and HTTPS

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
   normal application            application with TLS
  +------------------+          +------------------+
  |   Application    |          |   Application    |
  +------------------+          +------------------+
  |       TCP        |          |       TLS        |   ← user-space library (OpenSSL, BoringSSL, rustls, Schannel)
  +------------------+          +------------------+
  |        IP        |          |       TCP        |
  +------------------+          +------------------+
                                |        IP        |
                                +------------------+

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)

  1. Handshake: Alice and Bob use certificates and private keys to authenticate each other (usually only the server is authenticated) and exchange a shared secret.
  2. 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.
  3. 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.
  4. 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_ECDHE_RSA_WITH_AES_256_GCM_SHA384
    │     │        │           │
    │     │        │           └─ hash for the key derivation (PRF)
    │     │        └─ symmetric encryption (AEAD)
    │     └─ authentication of the server (certificate type)
    └─ key exchange (Elliptic-Curve Diffie-Hellman, ephemeral)

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_AES_128_GCM_SHA256
TLS_AES_256_GCM_SHA384
TLS_CHACHA20_POLY1305_SHA256
(TLS_AES_128_CCM_SHA256, TLS_AES_128_CCM_8_SHA256: for IoT)

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
Client                                                 Server
  |                                                       |
  | ClientHello                                           |
  |  + supported versions, cipher suites                  |
  |  + key_share (ECDHE public value, e.g. X25519MLKEM768)|
  |  + client random (nonce), SNI = www.example.com       |
  | ----------------------------------------------------► |
  |                                                       |
  |                           ServerHello + key_share     |
  |                           {EncryptedExtensions}       |
  |                           {Certificate}               |  ← from here on encrypted!
  |                           {CertificateVerify}         |  (signature with the private key)
  |                           {Finished}                  |
  | ◄---------------------------------------------------- |
  |                                                       |
  | {Finished}                                            |
  | [Application data]  ◄────────────────────────────►    |
  • 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
  Root CA certificate            ← self-signed, built into the OS/browser "trust store"
      │ signs
  Intermediate CA certificate    ← the root's private key stays offline
      │ signs
  Server certificate (www.example.com)

The browser checks:

  1. Is the signature valid all the way up to a trusted root?
  2. Does the domain name match the website?
  3. Is the certificate valid (not expired)?
  4. Has it been revoked? (CRL / OCSP. This is in practice increasingly done with short-lived certificates and browser-pushed lists such as CRLite.)
  5. 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 used ssl)
  • tls.handshake.type == 1 shows 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.log before you start the browser, then point Wireshark to it (Preferences → Protocols → TLS → (Pre)-Master-Secret log filename)

References

Videos

Articles

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


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.com were 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

  1. 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).
  2. 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.
  3. 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.
  4. Protect private keys: file permissions, an HSM or cloud KMS for important keys, and no keys in Git or container images.
  5. 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).
  6. Test regularly with SSL Labs and testssl.sh. Aim for grade A/A+.
  7. Use mTLS for service-to-service and API traffic inside your infrastructure.
  8. 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.
  9. 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.
  10. Teach users: certificate warnings are serious. The padlock says nothing about whether a site is trustworthy.

Extra references