[][src]Struct hpke::aead::AeadCtxS

pub struct AeadCtxS<A: Aead, K: Kdf>(_);

The HPKE senders's context. This is what you use to seal plaintexts.

Implementations

impl<A: Aead, K: Kdf> AeadCtxS<A, K>[src]

pub fn seal(
    &mut self,
    plaintext: &mut [u8],
    aad: &[u8]
) -> Result<AeadTag<A>, HpkeError>
[src]

Does a "detached seal in place", meaning it overwrites plaintext with the resulting ciphertext, and returns the resulting authentication tag

Return Value

Returns Ok(tag) on success. If this context has been used for so many encryptions that the sequence number overflowed, returns Err(HpkeError::SeqOverflow). If this happens, plaintext will be unmodified. If an unspecified error happened during encryption, returns Err(HpkeError::Encryption). If this happens, the contents of plaintext is undefined.

pub fn export(&self, info: &[u8], out_buf: &mut [u8]) -> Result<(), HpkeError>[src]

Fills a given buffer with secret bytes derived from this encryption context. This value does not depend on sequence number, so it is constant for the lifetime of this context.

Return Value

Returns Ok(()) on success. If the buffer length is more than 255x the digest size of the underlying hash function, returns an Err(HpkeError::InvalidKdfLength).

Auto Trait Implementations

impl<A, K> RefUnwindSafe for AeadCtxS<A, K> where
    <A as Aead>::AeadImpl: Aead + RefUnwindSafe,
    <<<A as Aead>::AeadImpl as Aead>::NonceSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
    <<<K as Kdf>::HashImpl as Digest>::OutputSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
    <K as Kdf>::HashImpl: Digest

impl<A, K> Send for AeadCtxS<A, K> where
    <A as Aead>::AeadImpl: Aead + Send,
    <K as Kdf>::HashImpl: Digest,
    <<A as Aead>::AeadImpl as Aead>::NonceSize: ArrayLength<u8>,
    <<K as Kdf>::HashImpl as Digest>::OutputSize: ArrayLength<u8>, 

impl<A, K> Sync for AeadCtxS<A, K> where
    <A as Aead>::AeadImpl: Aead + Sync,
    <K as Kdf>::HashImpl: Digest,
    <<A as Aead>::AeadImpl as Aead>::NonceSize: ArrayLength<u8>,
    <<K as Kdf>::HashImpl as Digest>::OutputSize: ArrayLength<u8>, 

impl<A, K> Unpin for AeadCtxS<A, K> where
    <A as Aead>::AeadImpl: Aead + Unpin,
    <<<A as Aead>::AeadImpl as Aead>::NonceSize as ArrayLength<u8>>::ArrayType: Unpin,
    <<<K as Kdf>::HashImpl as Digest>::OutputSize as ArrayLength<u8>>::ArrayType: Unpin,
    <K as Kdf>::HashImpl: Digest

impl<A, K> UnwindSafe for AeadCtxS<A, K> where
    <A as Aead>::AeadImpl: Aead + UnwindSafe,
    <<<A as Aead>::AeadImpl as Aead>::NonceSize as ArrayLength<u8>>::ArrayType: UnwindSafe,
    <<<K as Kdf>::HashImpl as Digest>::OutputSize as ArrayLength<u8>>::ArrayType: UnwindSafe,
    <K as Kdf>::HashImpl: Digest

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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