pub struct SessionKeys10 {
pub app_s_key: AppSKey,
pub nwk_s_key: NwkSKey,
}Expand description
LoRaWAN 1.0 session keys derived during OTAA.
The two keys cover all 1.0 session needs:
AppSKeyencryptsFRMPayloadwhenFPort > 0.NwkSKeycomputes the Data MIC and encryptsFRMPayloadwhenFPort == 0.
Build with SessionKeys10::derive given the device’s AppKey and the
join exchange’s NetId, AppNonce, and DevNonce.
Fields§
§app_s_key: AppSKeyApplication session key.
nwk_s_key: NwkSKeyNetwork session key.
Implementations§
Source§impl SessionKeys10
impl SessionKeys10
Sourcepub fn derive(
app_key: &AppKey,
net_id: &NetId,
app_nonce: &AppNonce,
dev_nonce: &DevNonce,
) -> Self
pub fn derive( app_key: &AppKey, net_id: &NetId, app_nonce: &AppNonce, dev_nonce: &DevNonce, ) -> Self
Derive AppSKey and NwkSKey from the OTAA root key and join nonces.
The derivation is AES-ECB-encrypt(AppKey, 0x0? || AppNonce_LE || NetID_LE || DevNonce_LE || padding) with 0x01 for NwkSKey and
0x02 for AppSKey.
§Examples
use lora_packet::{SessionKeys10, AppKey, NetId, AppNonce, DevNonce};
let app_key = AppKey::new([0u8; 16]);
let keys = SessionKeys10::derive(
&app_key,
&NetId::new([0, 0, 0]),
&AppNonce::new([0, 0, 0]),
&DevNonce::new([0, 0]),
);
assert_ne!(keys.app_s_key.as_bytes(), keys.nwk_s_key.as_bytes());Trait Implementations§
Source§impl Clone for SessionKeys10
impl Clone for SessionKeys10
Source§fn clone(&self) -> SessionKeys10
fn clone(&self) -> SessionKeys10
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SessionKeys10
impl RefUnwindSafe for SessionKeys10
impl Send for SessionKeys10
impl Sync for SessionKeys10
impl Unpin for SessionKeys10
impl UnsafeUnpin for SessionKeys10
impl UnwindSafe for SessionKeys10
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