pub struct WorKeys;Expand description
Namespace for Relay / Wake-On-Radio key derivation.
A unit struct that groups WorKeys::root and WorKeys::session
without polluting the crate root.
§Examples
Derive a root WOR key then a session pair:
use lora_packet::{WorKeys, NwkSKey, DevAddr};
let nwk_s_key = NwkSKey::new([0u8; 16]);
let root = WorKeys::root(&nwk_s_key);
let session = WorKeys::session(&root, &DevAddr::new([0x01, 0x02, 0x03, 0x04]));
assert_ne!(session.wor_s_int_key.as_bytes(), session.wor_s_enc_key.as_bytes());Implementations§
Source§impl WorKeys
impl WorKeys
Sourcepub fn root(nwk_s_key: &NwkSKey) -> RootWorSKey
pub fn root(nwk_s_key: &NwkSKey) -> RootWorSKey
Derive RootWorSKey from NwkSKey.
RootWorSKey = AES-ECB-encrypt(NwkSKey, 0x01 || 0x00..).
Sourcepub fn session(root: &RootWorSKey, dev_addr: &DevAddr) -> WorSessionKeys
pub fn session(root: &RootWorSKey, dev_addr: &DevAddr) -> WorSessionKeys
Derive WOR session keys from a root key and DevAddr.
Two AES-ECB blocks under the root, with the first byte set to 0x01
for the integrity key and 0x02 for the encryption key. The remainder
is DevAddr_LE padded with zeros.
Auto Trait Implementations§
impl Freeze for WorKeys
impl RefUnwindSafe for WorKeys
impl Send for WorKeys
impl Sync for WorKeys
impl Unpin for WorKeys
impl UnsafeUnpin for WorKeys
impl UnwindSafe for WorKeys
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