LABS · PROTOCOLS · NET PATH

TLS: the HTTPS padlock, message by message

TLS 1.3 agrees on keys in a single round trip, proves the server's identity with its certificate and encrypts everything else. Watch the form that could be read in the clear over HTTP turn into a block of opaque bytes.

Level: intermediate · 15 minutes

Interactive simulation

The animation needs JavaScript. The full lesson is written out below.

Download the capture and open it in Wireshark to keep exploring.

What TLS is

TLS (Transport Layer Security; version 1.3 is in RFC 8446) protects a connection between two applications: it encrypts it, so nobody else can read it; it protects its integrity, so nobody can change it unnoticed; and it authenticates the server with a certificate. It's the S in HTTPS, and it also protects email, remote-access VPNs and APIs.

SSL is the name of its old versions, all insecure, and TLS 1.0 and 1.1 have been retired too. Today TLS 1.2 and, above all, TLS 1.3 are used.

The TLS 1.3 handshake

MessageFromWhat it carriesIn the clear?
ClientHelloClientVersions, ciphers, SNI, ALPN and ephemeral keyYes
ServerHelloServerChosen version and cipher, ephemeral keyYes
EncryptedExtensionsServerThe chosen ALPN and other extensionsNo
CertificateServerThe certificate and its chainNo
CertificateVerifyServerSignature of the handshake with the certificate's keyNo
FinishedBothSummary of the handshake, to detect tamperingNo

How it works: from ClientHello to encrypted data

Six steps: the TCP connection, the ClientHello, the ServerHello with the encrypted handshake, Finished, the data and the encrypted password.

  1. TCP to port 443

    curl opens a TCP connection to 192.168.20.10 on port 443, the HTTPS port. Up to here everything is the same as with HTTP: the three-way handshake. TLS starts with the first data byte.

  2. ClientHello: what the client proposes

    The first message travels in the clear. curl offers TLS 1.3 and 1.2 (supported_versions), 31 cipher suites starting with TLS_AES_256_GCM_SHA384, and the signature algorithms it accepts. It names the site (SNI), so the server picks the right certificate, and the protocols it can speak inside (ALPN: h2 and http/1.1). It also sends its X25519 ephemeral public key up front: TLS 1.3 sends it right away to save a round trip.

  3. ServerHello and the encrypted handshake

    The server picks TLS 1.3 and TLS_AES_256_GCM_SHA384 and replies with its X25519 ephemeral key. With both keys, each end computes the same secret and derives the encryption keys. That's why, in the same segment, the rest of the handshake is already encrypted: the extensions (with ALPN http/1.1), the certificate, the CertificateVerify signature and Finished. In TLS 1.3, not even the certificate shows up in the capture. The Change Cipher Spec does nothing: it's there so old middleboxes don't get confused.

  4. Finished: the client checks and confirms

    curl decrypts the handshake and checks the certificate: it was signed by Canadá Logística's CA, which is installed on the laptop; the name matches the SNI and it hasn't expired. The CertificateVerify signature proves the server holds the certificate's private key, and Finished proves nobody tampered with the handshake. curl replies with its own Finished, encrypted. The whole handshake took a single round trip.

  5. Application Data: HTTP inside TLS

    curl sends GET / inside an Application Data record: 113 bytes that tell nothing to anyone capturing the traffic. Meanwhile, the server sends two session tickets, used to resume another connection faster. Then the response arrives: 200 OK with the page and the Strict-Transport-Security header, which tells the browser to always use HTTPS with this site. From outside, only sizes and timing are visible.

  6. The password, now encrypted

    Over the same connection, curl sends the POST /login with usuario=ana&clave=Vancouver2026, the same one that could be read in the clear in the HTTP lab. Now it's a 219-byte record that looks random. The server replies 303 with the session cookie, which now carries the Secure attribute: the browser will only send it over HTTPS.

Certificates and trust

A certificate binds a name (intranet.canada-logistica.example) to a public key, and is signed by a certificate authority (CA). The client trusts the certificate if a CA it has installed signed it, the name matches what it asked for, and it hasn't expired or been revoked. A company can run its own internal CA, like Canadá Logística, and distribute it to its devices.

TLS 1.3 compared with TLS 1.2

TLS 1.2TLS 1.3
Handshake round trips21 (or 0 when resuming)
Key exchangeRSA or (EC)DHE(EC)DHE only: perfect forward secrecy
Certificate in the captureVisibleEncrypted
Cipher suitesMany, some weak5, all AEAD
Compression and renegotiationYesRemoved

TLS on Cisco IOS XE

CommandWhat it does
crypto pki trustpoint TP-HTTPSDefines where the router's certificate comes from: a CA or self-signed.
ip http secure-serverTurns on the HTTPS server: web interface and RESTCONF.
ip http secure-trustpoint TP-HTTPSThe certificate the HTTPS server presents.
ip http tls-version TLSv1.2Limits the TLS versions it accepts.
no ip http serverTurns off unencrypted HTTP.
show ip http server secure statusThe HTTPS server's status, ciphers and certificate.

What happens when it fails

  • Certificate from an unknown CA: the client rejects it (in curl, «unable to get local issuer certificate»). Install the CA or use a certificate from a public CA.
  • The name doesn't match: the certificate is for another name, for example because you connected by IP. Check the certificate's SAN.
  • Expired certificate: check the dates and the device clock; a wrong clock causes the same error (sync it with NTP).
  • No version or cipher in common: an old server with only TLS 1.0 and a client that requires TLS 1.2 can't agree («handshake failure»).
  • TLS inspection on a firewall: the firewall presents its own certificate, and without its CA installed, clients see errors.

Frequently asked questions

What's the difference between SSL and TLS?

SSL is the name of the old versions (SSL 2.0 and 3.0), insecure and retired. TLS is its successor; today TLS 1.2 and 1.3 are used. People still say «SSL certificate» out of habit.

Does HTTPS hide which site I visit?

Not completely. The content, paths and cookies are encrypted, but the SNI in the ClientHello and the DNS query reveal the site name, and the destination IP is always visible. ECH (Encrypted Client Hello) and encrypted DNS reduce that exposure.

Why is there a Change Cipher Spec if TLS 1.3 doesn't use it?

For compatibility: some old middleboxes cut connections that didn't look like TLS 1.2. TLS 1.3 sends it anyway and ignores it.

What is perfect forward secrecy?

The session keys come from ephemeral keys (X25519) that are discarded at the end. Even if the certificate's private key is stolen later, sessions captured earlier can't be decrypted.

What does TLS have to do with the CCNA?

Secure device management (web interface and RESTCONF over HTTPS), TLS remote-access VPNs (topic 4.5) and troubleshooting web services all depend on understanding TLS and certificates.

Key takeaways

  • TLS encrypts, protects integrity and authenticates the server with a certificate; HTTPS is HTTP inside TLS, on port 443.
  • TLS 1.3 completes the handshake in one round trip: the client sends its ephemeral key in the ClientHello.
  • Only the ClientHello and ServerHello are in the clear; the certificate and everything else travel encrypted.
  • The client trusts the certificate if a known CA signed it, the name matches and it hasn't expired.
  • On IOS XE: a trustpoint with a certificate, ip http secure-server and no ip http server.

NEXT STEP

From this lesson to the Canadá Logística network

In the CCNA 2.0 Course you secure management of Canadá Logística's devices with HTTPS and certificates, troubleshoot TLS errors and get to know remote-access VPNs, in Packet Tracer or CML. We'll let you know when it opens.

Upcoming labs

Sources

Lesson prepared with AI assistance and checked against the sources cited. The bytes of every packet are generated according to the standard and verified with an independent tool.