Enum wlan_common::security::wep::WepKey
source · pub enum WepKey {
Wep40([u8; 5]),
Wep104([u8; 13]),
}
Expand description
WEP key.
IEEE Std 802.11-2016 describes two WEP key sizes: WEP-40 and WEP-104. Key
provides variants
for these standard key sizes represented as unencoded bytes.
Variants§
Wep40([u8; 5])
WEP-40 key. This is a partial key and is joined with an IV to form a 64-bit key.
Wep104([u8; 13])
WEP-104 key. This is a partial key and is joined with an IV to form a 128-bit key.
Implementations§
source§impl WepKey
impl WepKey
sourcepub fn parse(bytes: impl AsRef<[u8]>) -> Result<Self, WepError>
pub fn parse(bytes: impl AsRef<[u8]>) -> Result<Self, WepError>
Parses a WEP key from a byte sequence.
This function parses both unencoded keys and ASCII hexadecimal encoded keys. IEEE Std 802.11-2016 does not specify an encoding for non-hexadecimal keys, so the raw bytes are accepted as is, though these keys are typically ASCII or UTF-8 encoded text in practice. ASCII hexadecimal encoded keys are decoded into raw bytes.
Note that Key
does not provide a mechanism to restore the original byte sequence parsed
by this function, so the exact encoding of ASCII hexadecimal encoded keys may be lost.
§Errors
Returns an error if the size or encoding of the byte sequence is incompatible.
Trait Implementations§
source§impl From<WepKey> for BareCredentials
impl From<WepKey> for BareCredentials
Conversion from a WEP key into bare credentials.