Skip to main content

Encrypted

Struct Encrypted 

Source
pub struct Encrypted<'a> {
    pub security: Security,
    pub data: &'a [u8],
    pub encrypted_len: usize,
    pub meter: Option<Address>,
    /* private fields */
}
Expand description

An encrypted layer and everything needed to open it.

Fields§

§security: Security

How it is protected.

§data: &'a [u8]

The encrypted bytes, and any plain bytes after them.

§encrypted_len: usize

How many leading bytes of data are encrypted.

§meter: Option<Address>

The meter whose key opens it, if known.

Implementations§

Source§

impl Encrypted<'_>

Source

pub fn decrypt<'o, K: Keys + ?Sized>( &self, keys: &K, out: &'o mut [u8], ) -> Result<Application<'o>>

Available on crate feature oms only.

Decrypt (and, for mode 7 with an AFL MAC and mode 10, authenticate) this layer into out, and parse what is inside.

SecurityKeyVerified byAuthenticity
mode 5the meter’s2F 2FAuthenticity::Encrypted
mode 7derived from the meter’s and the AFL counterAFL CMAC, then 2F 2FAuthenticity::Authenticated (without a MAC: Encrypted)
mode 10derived from the meter’s and the TPL counterCCM tagAuthenticity::Authenticated
ELLthe meter’spayload CRCEncrypted; the inner layers may add more

out needs self.data.len() bytes. On any failed check the result is an error naming the check (Check), never partial records and never key material. A transport layer that is not data records (alarm, error, compact) is Error::UnsupportedCi. An ELL may contain a TPL that is itself encrypted: the result’s body is then Body::Encrypted again (wireless::open opens both).

Trait Implementations§

Source§

impl<'a> Clone for Encrypted<'a>

Source§

fn clone(&self) -> Self

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<'a> Copy for Encrypted<'a>

Source§

impl<'a> Debug for Encrypted<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Forget for Encrypted<'a>

§

impl<'a> Freeze for Encrypted<'a>
where &'a [u8]: Freeze,

§

impl<'a> Move for Encrypted<'a>

§

impl<'a> RefUnwindSafe for Encrypted<'a>

§

impl<'a> Send for Encrypted<'a>
where &'a [u8]: Send,

§

impl<'a> Sync for Encrypted<'a>

§

impl<'a> Unpin for Encrypted<'a>
where &'a [u8]: Unpin,

§

impl<'a> UnsafeUnpin for Encrypted<'a>
where &'a [u8]: UnsafeUnpin,

§

impl<'a> UnwindSafe for Encrypted<'a>
where &'a [u8]: 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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.