pub struct FourWayHandshake { /* private fields */ }Expand description
WPA2 4-way handshake state machine (supplicant side)
Implementations§
Source§impl FourWayHandshake
impl FourWayHandshake
Sourcepub fn new(pmk: [u8; 32], spa: MacAddress, aa: MacAddress) -> Self
pub fn new(pmk: [u8; 32], spa: MacAddress, aa: MacAddress) -> Self
Create a new handshake instance
Sourcepub fn ptk(&self) -> Option<&TemporalKey>
pub fn ptk(&self) -> Option<&TemporalKey>
Get derived PTK (available after message 1 processing)
Sourcepub fn process_message_1(
&mut self,
key_frame: &EapolKeyFrame,
) -> Option<Vec<u8>>
pub fn process_message_1( &mut self, key_frame: &EapolKeyFrame, ) -> Option<Vec<u8>>
Process Message 1 from AP: receive ANonce, generate SNonce, derive PTK.
Returns Message 2 EAPOL-Key frame bytes to send back.
Sourcepub fn process_message_3(
&mut self,
key_frame: &EapolKeyFrame,
) -> Option<Vec<u8>>
pub fn process_message_3( &mut self, key_frame: &EapolKeyFrame, ) -> Option<Vec<u8>>
Process Message 3 from AP: verify MIC, install PTK.
Returns Message 4 EAPOL-Key frame bytes to send back.
Sourcepub fn process_message_2(&mut self, key_frame: &EapolKeyFrame) -> bool
pub fn process_message_2(&mut self, key_frame: &EapolKeyFrame) -> bool
Process Message 2 (AP/authenticator side): verify MIC from supplicant.
Returns true if Message 2 is valid.
Sourcepub fn process_message_4(&mut self, key_frame: &EapolKeyFrame) -> bool
pub fn process_message_4(&mut self, key_frame: &EapolKeyFrame) -> bool
Process Message 4 (AP/authenticator side): handshake complete.
Returns true if Message 4 is valid.
Sourcepub fn verify_mic(kck: &[u8; 16], key_frame: &EapolKeyFrame) -> bool
pub fn verify_mic(kck: &[u8; 16], key_frame: &EapolKeyFrame) -> bool
Verify MIC on an EAPOL-Key frame using HMAC-SHA256(KCK, frame_with_zero_mic)