pub struct EncryptedJoinAcceptPayload<T, F>(/* private fields */);
Expand description

EncryptedJoinAcceptPayload represents an encrypted JoinAccept.

It can be built either directly through the new or using the parse function.

Implementations§

source§

impl<T: AsRef<[u8]> + AsMut<[u8]>, F: CryptoFactory> EncryptedJoinAcceptPayload<T, F>

source

pub fn new_with_factory(data: T, factory: F) -> Result<Self, Error>

Creates a new EncryptedJoinAcceptPayload if the provided data is acceptable.

Argument
  • data - the bytes for the payload.
  • factory - the factory that shall be used to create object for crypto functions.
source

pub fn decrypt(self, key: &AppKey) -> DecryptedJoinAcceptPayload<T, F>

Decrypts the EncryptedJoinAcceptPayload producing a DecryptedJoinAcceptPayload.

This method consumes the EncryptedJoinAcceptPayload as it reuses the underlying memory. Please note that it does not verify the mic.

Argument
  • key - the key to be used for the decryption.
Examples
let mut data = vec![0x20, 0x49, 0x3e, 0xeb, 0x51, 0xfb, 0xa2, 0x11, 0x6f, 0x81, 0x0e, 0xdb,
    0x37, 0x42, 0x97, 0x51, 0x42];
let phy = lorawan::parser::EncryptedJoinAcceptPayload::new(data);
let key = lorawan::keys::AppKey::from([0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
    0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff]);
let decrypted = phy.unwrap().decrypt(&key);
source§

impl<T: AsRef<[u8]> + AsMut<[u8]>> EncryptedJoinAcceptPayload<T, DefaultFactory>

source

pub fn new(data: T) -> Result<Self, Error>

Creates a new EncryptedJoinAcceptPayload if the provided data is acceptable.

Argument
  • data - the bytes for the payload.
Examples
let data = vec![0x20, 0x49, 0x3e, 0xeb, 0x51, 0xfb, 0xa2, 0x11, 0x6f, 0x81, 0x0e, 0xdb,
    0x37, 0x42, 0x97, 0x51, 0x42];
let phy = lorawan::parser::EncryptedJoinAcceptPayload::new(data);

Trait Implementations§

source§

impl<T: AsRef<[u8]>, F> AsPhyPayloadBytes for EncryptedJoinAcceptPayload<T, F>

source§

fn as_bytes(&self) -> &[u8]

source§

impl<T: Debug, F: Debug> Debug for EncryptedJoinAcceptPayload<T, F>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: PartialEq, F: PartialEq> PartialEq for EncryptedJoinAcceptPayload<T, F>

source§

fn eq(&self, other: &EncryptedJoinAcceptPayload<T, F>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Eq, F: Eq> Eq for EncryptedJoinAcceptPayload<T, F>

source§

impl<T, F> StructuralEq for EncryptedJoinAcceptPayload<T, F>

source§

impl<T, F> StructuralPartialEq for EncryptedJoinAcceptPayload<T, F>

Auto Trait Implementations§

§

impl<T, F> RefUnwindSafe for EncryptedJoinAcceptPayload<T, F>

§

impl<T, F> Send for EncryptedJoinAcceptPayload<T, F>
where F: Send, T: Send,

§

impl<T, F> Sync for EncryptedJoinAcceptPayload<T, F>
where F: Sync, T: Sync,

§

impl<T, F> Unpin for EncryptedJoinAcceptPayload<T, F>
where F: Unpin, T: Unpin,

§

impl<T, F> UnwindSafe for EncryptedJoinAcceptPayload<T, F>
where F: UnwindSafe, T: UnwindSafe,

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> 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> MHDRAble for T

source§

fn mhdr(&self) -> MHDR

Gives the MIC of the PhyPayload.
source§

impl<T> MICAble for T

source§

fn mic(&self) -> MIC

Gives the MIC of the PhyPayload.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.