[][src]Struct hpke::AeadCtxS

pub struct AeadCtxS<A: Aead, Kdf: KdfTrait, Kem: KemTrait>(_);

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

Implementations

impl<A: Aead, Kdf: KdfTrait, Kem: KemTrait> AeadCtxS<A, Kdf, Kem>[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, Kdf, Kem> RefUnwindSafe for AeadCtxS<A, Kdf, Kem> where
    Kem: RefUnwindSafe,
    <A as Aead>::AeadImpl: AeadInPlace + RefUnwindSafe,
    <<<A as Aead>::AeadImpl as AeadInPlace>::NonceSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
    <<<Kdf as Kdf>::HashImpl as Digest>::OutputSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
    <Kdf as Kdf>::HashImpl: Digest

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

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

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

impl<A, Kdf, Kem> UnwindSafe for AeadCtxS<A, Kdf, Kem> where
    Kem: UnwindSafe,
    <A as Aead>::AeadImpl: AeadInPlace + UnwindSafe,
    <<<A as Aead>::AeadImpl as AeadInPlace>::NonceSize as ArrayLength<u8>>::ArrayType: UnwindSafe,
    <<<Kdf as Kdf>::HashImpl as Digest>::OutputSize as ArrayLength<u8>>::ArrayType: UnwindSafe,
    <Kdf 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>,