Skip to main content

SendCtx

Struct SendCtx 

Source
pub struct SendCtx<K, F, A>
where K: HpkeKem, F: HpkeKdf, A: HpkeAead,
{ /* private fields */ }
Expand description

An encryption context that encrypts messages for a particular recipient.

Implementations§

Source§

impl<K, F, A> SendCtx<K, F, A>
where K: HpkeKem, F: HpkeKdf, A: HpkeAead,

Source

pub const OVERHEAD: usize = SealCtx<A>::OVERHEAD

The size in bytes of the overhead added to the plaintext.

Source

pub fn seal( &mut self, dst: &mut [u8], plaintext: &[u8], additional_data: &[u8], ) -> Result<Seq, HpkeError>

Encrypts and authenticates plaintext, returning the sequence number.

The resulting ciphertext is written to dst, which must be at least plaintext.len() + OVERHEAD bytes long.

Source

pub fn seal_in_place( &mut self, data: impl AsMut<[u8]>, tag: &mut [u8], additional_data: &[u8], ) -> Result<Seq, HpkeError>

Encrypts and authenticates data in-place, returning the sequence number.

Source

pub fn export<T>(&self, context: &[u8]) -> Result<T, KdfError>
where T: Expand,

Exports a secret from the encryption context.

Source

pub fn export_into( &self, out: &mut [u8], context: &[u8], ) -> Result<(), KdfError>

Exports a secret from the encryption context, writing it to out.

Trait Implementations§

Source§

impl<K, F, A> Debug for SendCtx<K, F, A>
where K: HpkeKem, F: HpkeKdf, A: HpkeAead + Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<K, F, A> Freeze for SendCtx<K, F, A>

§

impl<K, F, A> RefUnwindSafe for SendCtx<K, F, A>

§

impl<K, F, A> Send for SendCtx<K, F, A>
where A: Send,

§

impl<K, F, A> Sync for SendCtx<K, F, A>
where A: Sync,

§

impl<K, F, A> Unpin for SendCtx<K, F, A>

§

impl<K, F, A> UnwindSafe for SendCtx<K, F, A>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V