Struct EncryptedMessage

Source
pub struct EncryptedMessage<'m, S: Suite> {
    pub ephemeral_key: NonZero<Point<S::E>>,
    pub message: &'m mut [u8],
    pub tag: GenericArray<u8, <<S as Suite>::Mac as OutputSizeUser>::OutputSize>,
}
Expand description

Represents a parsed message. To convert to and from platform independent wire bytes use EncryptedMessage::from_bytes and EncryptedMessage::to_bytes

The borrows the bytes to be encrypted instead of owning them, which allows for efficient in-place encryption and decryption.

Fields§

§ephemeral_key: NonZero<Point<S::E>>

Ephemeral key in DH in the protocol

§message: &'m mut [u8]

Encrypted bytes of the message, stored elsewhere

§tag: GenericArray<u8, <<S as Suite>::Mac as OutputSizeUser>::OutputSize>

MAC tag of encrypted bytes

Implementations§

Source§

impl<'m, S: Suite> EncryptedMessage<'m, S>

Source

pub fn to_bytes(&self) -> Vec<u8>

Convert the message triplet to bytes following the description in SECG SEC-1: ephemeral_key || message || MAC. Ephemeral key is stored in compressed form when supported.

Source

pub fn from_bytes(bytes: &'m mut [u8]) -> Result<Self, DeserializeError>

Read the message triplet from bytes

Trait Implementations§

Source§

impl<'m, S: Debug + Suite> Debug for EncryptedMessage<'m, S>
where S::E: Debug,

Source§

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

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

impl<'m, S: PartialEq + Suite> PartialEq for EncryptedMessage<'m, S>
where S::E: PartialEq,

Source§

fn eq(&self, other: &EncryptedMessage<'m, S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'m, S: Suite> StructuralPartialEq for EncryptedMessage<'m, S>

Auto Trait Implementations§

§

impl<'m, S> Freeze for EncryptedMessage<'m, S>
where <<<S as Suite>::Mac as OutputSizeUser>::OutputSize as ArrayLength<u8>>::ArrayType: Freeze, <<S as Suite>::E as Curve>::Point: Freeze,

§

impl<'m, S> RefUnwindSafe for EncryptedMessage<'m, S>

§

impl<'m, S> Send for EncryptedMessage<'m, S>

§

impl<'m, S> Sync for EncryptedMessage<'m, S>

§

impl<'m, S> Unpin for EncryptedMessage<'m, S>

§

impl<'m, S> !UnwindSafe for EncryptedMessage<'m, S>

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

Source§

type Output = T

Should always be Self
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.