Skip to main content

SessionKeys11

Struct SessionKeys11 

Source
pub struct SessionKeys11 {
    pub app_s_key: AppSKey,
    pub f_nwk_s_int_key: FNwkSIntKey,
    pub s_nwk_s_int_key: SNwkSIntKey,
    pub nwk_s_enc_key: NwkSEncKey,
}
Expand description

LoRaWAN 1.1 session keys derived during OTAA.

1.1 splits the 1.0 NwkSKey into three role-specific keys (FNwkSIntKey, SNwkSIntKey, NwkSEncKey) plus keeps the application session key. See crate::V1_1MicKeys for how they slot into MIC computation.

Fields§

§app_s_key: AppSKey

Application session key (FRMPayload crypt with FPort > 0).

§f_nwk_s_int_key: FNwkSIntKey

Forwarding network session integrity key (lower 2 MIC bytes for uplink Data frames).

§s_nwk_s_int_key: SNwkSIntKey

Serving network session integrity key (upper 2 MIC bytes for uplinks, full MIC for downlinks).

§nwk_s_enc_key: NwkSEncKey

Network session encryption key (FOpts MAC commands, plus FRMPayload when FPort == 0).

Implementations§

Source§

impl SessionKeys11

Source

pub fn derive( app_key: &AppKey, nwk_key: &NwkKey, join_eui: &AppEui, app_nonce: &AppNonce, dev_nonce: &DevNonce, ) -> Self

Derive all four 1.1 session keys.

AppSKey is derived from AppKey; the three network keys are derived from NwkKey. Inputs include JoinEUI because 1.1 binds the session to the join server identity.

§Examples
use lora_packet::{SessionKeys11, AppKey, NwkKey, AppEui, AppNonce, DevNonce};

let keys = SessionKeys11::derive(
  &AppKey::new([0u8; 16]),
  &NwkKey::new([0u8; 16]),
  &AppEui::new([0u8; 8]),
  &AppNonce::new([0, 0, 0]),
  &DevNonce::new([0, 0]),
);
assert_ne!(keys.app_s_key.as_bytes(), keys.f_nwk_s_int_key.as_bytes());

Trait Implementations§

Source§

impl Clone for SessionKeys11

Source§

fn clone(&self) -> SessionKeys11

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SessionKeys11

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.