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>
impl<'m, S: Suite> EncryptedMessage<'m, S>
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
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.
Sourcepub fn from_bytes(bytes: &'m mut [u8]) -> Result<Self, DeserializeError>
pub fn from_bytes(bytes: &'m mut [u8]) -> Result<Self, DeserializeError>
Read the message triplet from bytes
Trait Implementations§
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>where
<<<S as Suite>::Mac as OutputSizeUser>::OutputSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
<<S as Suite>::E as Curve>::Point: RefUnwindSafe,
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> 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