Skip to main content

Dot11TKIP

Struct Dot11TKIP 

Source
pub struct Dot11TKIP {
    pub offset: usize,
}
Expand description

TKIP (Temporal Key Integrity Protocol) encryption wrapper.

Format:

[TSC1(1)] [WEPSeed(1)] [TSC0(1)] [KeyID/ExtIV(1)] [TSC2(1) TSC3(1) TSC4(1) TSC5(1)] [Encrypted Data...] [ICV(4)]

The KeyID/ExtIV byte:

  • Bits 0-4: Reserved
  • Bit 5: ExtIV flag (always 1 for TKIP)
  • Bits 6-7: Key ID

TSC (TKIP Sequence Counter) is a 48-bit value constructed from TSC0..TSC5.

Fields§

§offset: usize

Implementations§

Source§

impl Dot11TKIP

Source

pub fn new(offset: usize) -> Self

Source

pub fn validate(buf: &[u8], offset: usize) -> Result<(), FieldError>

Validate buffer length for TKIP header.

Source

pub fn tsc1(&self, buf: &[u8]) -> Result<u8, FieldError>

TSC1 (byte 0 of TKIP header).

Source

pub fn wep_seed(&self, buf: &[u8]) -> Result<u8, FieldError>

WEP Seed (byte 1 of TKIP header).

Source

pub fn tsc0(&self, buf: &[u8]) -> Result<u8, FieldError>

TSC0 (byte 2 of TKIP header).

Source

pub fn ext_iv(&self, buf: &[u8]) -> Result<bool, FieldError>

Check if Extended IV flag is set (bit 5 of byte 3).

Source

pub fn key_id(&self, buf: &[u8]) -> Result<u8, FieldError>

Key ID (bits 6-7 of byte 3).

Source

pub fn tsc_high(&self, buf: &[u8]) -> Result<[u8; 4], FieldError>

TSC2-TSC5 (bytes 4-7, only present if ExtIV is set).

Source

pub fn tsc(&self, buf: &[u8]) -> Result<u64, FieldError>

Full 48-bit TSC (TKIP Sequence Counter). TSC = TSC0 | (TSC1 << 8) | (TSC2 << 16) | (TSC3 << 24) | (TSC4 << 32) | (TSC5 << 40)

Source

pub fn header_len(&self, buf: &[u8]) -> usize

Header length: 4 bytes (no ExtIV) or 8 bytes (with ExtIV).

Source

pub fn trailer_len(&self) -> usize

Trailer length (ICV = 4 bytes).

Source

pub fn build_header(tsc: u64, key_id: u8) -> Vec<u8>

Build a TKIP header with Extended IV.

Trait Implementations§

Source§

impl Clone for Dot11TKIP

Source§

fn clone(&self) -> Dot11TKIP

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Dot11TKIP

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V