<# .SYNOPSIS Lab 09.2 — Enable Hybrid X25519_MLKEM768 & Capture TCP 443 ClientHello via pktmon .DESCRIPTION Backs up current TLS ECC curves, enables X25519_MLKEM768 at Position 0, verifies hybrid negotiation in a fresh PowerShell child process (bypassing HTTP/1.1 Keep-Alive cache), and captures a pcapng packet trace using built-in Windows pktmon (zero third-party tools). Classification : Security configuration & telemetry collection (Pilot / Lab) Required Roles : Local Administrator Run On : WIN11-01 or DC01 (Windows 11 24H2+ / Windows Server 2025, Legacy FIPS Off) .NOTES Author : Caner Cetinkaya (canercetinkaya.com/labs/09-post-quantum-cryptography/) #> [CmdletBinding()] param( [string]$OutDir = 'C:\Temp\PQC-Lab', [switch]$CaptureOnly ) Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' New-Item -ItemType Directory -Path $OutDir -Force | Out-Null if (-not $CaptureOnly) { Write-Host '[1/4] Backing up baseline Get-TlsEccCurve...' -ForegroundColor Cyan Get-TlsEccCurve | Out-File -FilePath (Join-Path $OutDir 'baseline-curves.txt') -Encoding utf8 Write-Host '[2/4] Enabling X25519_MLKEM768 at Position 0...' -ForegroundColor Cyan Enable-TlsEccCurve -Name 'X25519_MLKEM768' -Position 0 Get-TlsEccCurve } Write-Host '[3/4] Starting pktmon capture on TCP 443 and testing fresh TLS 1.3 handshake...' -ForegroundColor Cyan $etlPath = Join-Path $OutDir 'capture-pqc.etl' $pcapPath = Join-Path $OutDir 'capture-pqc.pcapng' pktmon filter remove | Out-Null pktmon filter add -p 443 | Out-Null pktmon start --capture --pkt-size 0 --file-name $etlPath | Out-Null try { # Fresh child process avoids reusing an existing HTTP/1.1 Keep-Alive TCP socket $trace = powershell.exe -NoProfile -Command "Invoke-RestMethod -Uri 'https://pq.cloudflareresearch.com/cdn-cgi/trace' -TimeoutSec 15" $trace -split "`n" | Where-Object { $_ -match '^(tls|kex|http)=' } } finally { pktmon stop | Out-Null pktmon etl2pcap $etlPath --out $pcapPath | Out-Null pktmon filter remove | Out-Null } Write-Host "[4/4] Capture saved to $pcapPath (Inspect in Wireshark with: tls.handshake.extensions_supported_group == 0x11ec)" -ForegroundColor Green