← Back to section · Tutorials & Labs
Setting Up Wireshark to Capture a TLS 1.3 Handshake with PQC Groups
From installation and capture privileges to reading the capture: capture a TLS 1.3 handshake in Wireshark or tshark, locate hybrid post-quantum groups such as X25519MLKEM768 in the key_share extension, and decrypt application data with a key log file for cross-checking.
Whether post-quantum migration is actually in effect at the protocol level has to be settled at the byte level: which named groups does the client advertise in its TLS 1.3 ClientHello, and is the key_share actually used a post-quantum hybrid group? Logs and configuration files can lie; a packet capture does not. This tutorial walks you through installing Wireshark, fixing capture privileges, generating a handshake that carries PQC groups, and locating the evidence field by field in the capture; finally, it decrypts the application data with a key log so the two views corroborate each other.
Preparation: Installation and Capture Privileges
On Debian / Ubuntu systems, install with sudo apt install -y wireshark tshark. During installation the package asks whether non-root users should be allowed to capture; answer yes — under the hood this grants capture capabilities to dumpcap. Then add your user to the wireshark group with sudo usermod -aG wireshark $USER and log out and back in for it to take effect. Verify by launching Wireshark: the interface list should appear and double-clicking an interface should not raise a permission error. Running the whole GUI as root long-term is a bad habit: the dissectors parse untrusted input, so least privilege is a real security requirement here. The tshark command-line route is governed by the same privilege setup. Before capturing, also confirm the target interface: experiments reaching the internet use the physical or wireless interface, while experiments between a local client and server use the loopback interface lo — picking the wrong interface is the most common cause of “nothing was captured”.
Generating a Handshake with PQC Groups
A handshake with post-quantum groups requires both endpoints to support them. On the client side, current browsers and recent curl builds (when linked against a TLS library with hybrid group support) already include X25519MLKEM768 in the ClientHello by default; visiting a site known to support the group produces a sample. For a fully controlled setup, run a test server locally with OpenSSL plus oqs-provider and connect with openssl s_client, so group selection is entirely determined by your own configuration. Start the capture before initiating the connection: select the interface in Wireshark and start capturing, then run the connection command, and stop when it completes. Leave the capture filter empty at first so a filter syntax mistake cannot discard your sample; if traffic volume is a problem, narrow it later with a capture filter such as tcp port 443.
Locating key_share in the Handshake
After stopping the capture, narrow the view to TLS handshake messages with the display filter tls.handshake, find the ClientHello, and expand the three extensions in turn: supported_versions, supported_groups and key_share. Three reading points matter. First, supported_groups should list x25519_mlkem768 (recent Wireshark versions show the name directly; older ones show the code point 0x11ec), meaning the client is willing to use the hybrid group. Second, check which group’s key share the key_share extension actually pre-provisions: a TLS 1.3 client pre-loads shares for its most likely groups, and if that is X25519MLKEM768, the Key Exchange field is dramatically longer than the 32 bytes of plain X25519, because it also carries the ML-KEM-768 encapsulation public key (1184 bytes) — the most intuitive byte-level evidence there is. Third, read the ServerHello’s key_share: the group the server finally selected is decided there, and the case where the client advertised the group but the server did not select it must be recorded too — that is exactly where negotiation downgrades become visible. For batch work, tshark -r capture.pcapng -Y "tls.handshake.type==1" filters ClientHellos from the command line, which suits wiring captures into automated verification scripts.
Decrypting Application Data with a Key Log
Handshake messages are plaintext, so everything above needs no keys. To confirm that the application data afterwards really flows over the negotiated channel, you need the session secrets. Have the client write them to a log file: export SSLKEYLOGFILE=$HOME/sslkeylog.log, then launch curl or the browser from the same terminal (mainstream TLS libraries and browsers honor this variable). After capturing, open Edit → Preferences → Protocols → TLS in Wireshark and point the (Pre)-Master-Secret log filename at that file; the application data then appears decrypted. Check two things while reading: the decrypted HTTP request really is the one you issued, and the group selected in the ServerHello matches the connection carrying the application data. Treat the key log as what it is — the session keys themselves. Delete it when the experiment is done, and never send it along with the capture: when sharing a pcap for handshake analysis, the default discipline is pcap only, no key log.
When Nothing Captures or Nothing Decrypts: Debug in This Order
The three most common capture failures each have a fixed diagnostic path; do not flail. The first is “no packets at all”: check the interface first (loopback for local experiments, the physical interface for outbound ones), then whether capture privileges are actually in effect (an interface list that opens does not prove capturing works — start a real capture and watch for permission errors), and finally confirm the target traffic actually happened — ping the target from the same terminal; if ICMP shows up but TLS does not, the problem is on the traffic-generation side. The second is “handshake captured, but no PQC group”: this is usually not a capture problem at all but a negotiation fact — the client is too old to advertise hybrid groups, the server does not support them and picked a classical group, or session resumption shortcut the connection and no full key_share exchange ever happened; force a complete handshake (a fresh browser process, or an explicit s_client connection) and compare the ServerHello’s choice again. The third is “key log configured but application data won’t decrypt”: confirm the client was started after SSLKEYLOGFILE was set (setting the variable after launching the browser does nothing), confirm the log file is actually growing and Wireshark points at the right path, and finally confirm the capture contains the full handshake of that connection — without the handshake packets, even the correct keys cannot decrypt it. Walk the chain — interface, privileges, traffic, negotiation, keys — and all three failures can basically be localized on the spot.
Wrapping Up
A complete capture-based verification has four moves: privileges ready, sample generated, key_share located, and (optionally) application data decrypted with the key log. File the pcap together with your reading conclusions in the experiment record, and “PQC is enabled” stops being a claim made by a configuration file and becomes byte-level evidence anyone can re-check. For how to build a topology where you control both endpoints locally, see the companion article on two-machine lab topologies on this site.
Tags: WiresharkTLS 1.3Packet CaptureHybrid Key Exchange