[][src]Struct lorawan::parser::EncryptedJoinAcceptPayload

pub struct EncryptedJoinAcceptPayload<T, F>(_, _);

EncryptedJoinAcceptPayload represents an encrypted JoinAccept.

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

Implementations

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

pub fn new_with_factory<'a>(data: T, factory: F) -> Result<Self, &'a str>[src]

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.

pub fn decrypt(self, key: &AES128) -> DecryptedJoinAcceptPayload<T, F>[src]

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::AES128([0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
    0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff]);
let decrypted = phy.unwrap().decrypt(&key);

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

pub fn new<'a>(data: T) -> Result<Self, &'a str>[src]

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

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

impl<T: Debug, F: Debug> Debug for EncryptedJoinAcceptPayload<T, F>[src]

impl<T: PartialEq, F: PartialEq> PartialEq<EncryptedJoinAcceptPayload<T, F>> for EncryptedJoinAcceptPayload<T, F>[src]

impl<T, F> StructuralPartialEq for EncryptedJoinAcceptPayload<T, F>[src]

Auto Trait Implementations

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AsPhyPayloadBytes for T where
    T: DataHeader
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> MHDRAble for T where
    T: AsPhyPayloadBytes
[src]

impl<T> MICAble for T where
    T: AsPhyPayloadBytes
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.