pub struct Dot11WEP {
pub offset: usize,
}Expand description
WEP (Wired Equivalent Privacy) encryption wrapper.
Format:
[IV (3 bytes)] [KeyID/Pad (1 byte)] [Encrypted Data ...] [ICV (4 bytes)]The KeyID byte layout:
- Bits 0-5: Pad (reserved, should be 0)
- Bits 6-7: Key ID (0-3)
Fields§
§offset: usizeImplementations§
Source§impl Dot11WEP
impl Dot11WEP
pub fn new(offset: usize) -> Self
Sourcepub fn validate(buf: &[u8], offset: usize) -> Result<(), FieldError>
pub fn validate(buf: &[u8], offset: usize) -> Result<(), FieldError>
Validate buffer length for WEP header.
Sourcepub fn iv_u32(&self, buf: &[u8]) -> Result<u32, FieldError>
pub fn iv_u32(&self, buf: &[u8]) -> Result<u32, FieldError>
Full IV as a u32 (24-bit value, big-endian).
Sourcepub fn key_id_byte(&self, buf: &[u8]) -> Result<u8, FieldError>
pub fn key_id_byte(&self, buf: &[u8]) -> Result<u8, FieldError>
Raw KeyID/Pad byte.
Sourcepub fn icv(&self, buf: &[u8], frame_end: usize) -> Result<u32, FieldError>
pub fn icv(&self, buf: &[u8], frame_end: usize) -> Result<u32, FieldError>
ICV (Integrity Check Value) — 4 bytes at the end of the encrypted data.
frame_end is the offset of the end of the entire frame (after ICV).
Sourcepub fn encrypted_data<'a>(
&self,
buf: &'a [u8],
frame_end: usize,
) -> Result<&'a [u8], FieldError>
pub fn encrypted_data<'a>( &self, buf: &'a [u8], frame_end: usize, ) -> Result<&'a [u8], FieldError>
Encrypted data (between header and ICV).
Sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Header length (always 4 bytes).
Sourcepub fn trailer_len(&self) -> usize
pub fn trailer_len(&self) -> usize
Trailer length (always 4 bytes).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dot11WEP
impl RefUnwindSafe for Dot11WEP
impl Send for Dot11WEP
impl Sync for Dot11WEP
impl Unpin for Dot11WEP
impl UnsafeUnpin for Dot11WEP
impl UnwindSafe for Dot11WEP
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more