Struct lorawan::parser::EncryptedJoinAcceptPayload
source · pub struct EncryptedJoinAcceptPayload<T, F>(/* private fields */);
Expand description
Implementations§
source§impl<T: AsRef<[u8]> + AsMut<[u8]>, F: CryptoFactory> EncryptedJoinAcceptPayload<T, F>
impl<T: AsRef<[u8]> + AsMut<[u8]>, F: CryptoFactory> EncryptedJoinAcceptPayload<T, F>
sourcepub fn new_with_factory(data: T, factory: F) -> Result<Self, Error>
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.
sourcepub fn decrypt(self, key: &AppKey) -> DecryptedJoinAcceptPayload<T, F>
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>
impl<T: AsRef<[u8]> + AsMut<[u8]>> EncryptedJoinAcceptPayload<T, DefaultFactory>
sourcepub fn new(data: T) -> Result<Self, Error>
Available on crate feature default-crypto
only.
pub fn new(data: T) -> Result<Self, Error>
default-crypto
only.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>
impl<T: AsRef<[u8]>, F> AsPhyPayloadBytes for EncryptedJoinAcceptPayload<T, F>
source§impl<T: PartialEq, F: PartialEq> PartialEq for EncryptedJoinAcceptPayload<T, F>
impl<T: PartialEq, F: PartialEq> PartialEq for EncryptedJoinAcceptPayload<T, F>
source§fn eq(&self, other: &EncryptedJoinAcceptPayload<T, F>) -> bool
fn eq(&self, other: &EncryptedJoinAcceptPayload<T, F>) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.impl<T: Eq, F: Eq> Eq for EncryptedJoinAcceptPayload<T, F>
impl<T, F> StructuralPartialEq for EncryptedJoinAcceptPayload<T, F>
Auto Trait Implementations§
impl<T, F> Freeze for EncryptedJoinAcceptPayload<T, F>
impl<T, F> RefUnwindSafe for EncryptedJoinAcceptPayload<T, F>where
T: RefUnwindSafe,
F: RefUnwindSafe,
impl<T, F> Send for EncryptedJoinAcceptPayload<T, F>
impl<T, F> Sync for EncryptedJoinAcceptPayload<T, F>
impl<T, F> Unpin for EncryptedJoinAcceptPayload<T, F>
impl<T, F> UnwindSafe for EncryptedJoinAcceptPayload<T, F>where
T: UnwindSafe,
F: UnwindSafe,
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