Skip to content

wpa::keydata

The key-data field: the station’s RSN IE, and the AP’s GTK.

Two small, fixed binary shapes live here. On the way out, message 2 carries the station’s RSN information element — its declaration of which ciphers and key-management it wants. On the way in, message 3’s key data (once decrypted) carries the group key wrapped in a KDE, a type-length-value with the RSN OUI. Both are transcribed from the reference rather than the standard’s prose.

struct Gtk {
pub key: [u8; 32],
pub len: usize,
pub key_id: u8,
}

A group key recovered from message 3.

Implements: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

fn find_gtk(key_data: &[u8]) -> Option<Gtk>

Find and parse the GTK KDE inside decrypted message-3 key data.

The key data is a sequence of elements. The GTK arrives as a vendor-specific KDE: 0xDD, len, 00-0F-AC, 01, key_id/tx byte, reserved, GTK…. Other elements (the AP’s RSN IE, padding) are skipped. None if no GTK KDE is present or it is malformed.

References: Gtk

const RSN_IE_WPA2_PSK_CCMP: [u8; 22];

The station’s RSN IE for WPA2-PSK with CCMP, for message 2’s key data.

Fixed for this configuration: version 1, group cipher CCMP, one pairwise cipher (CCMP), one AKM (PSK), no RSN capabilities set. The AP compares this against what it advertised; a mismatch fails the handshake, so the bytes must be exactly what the reference sends for the same configuration.