[][src]Struct hpke::AeadCtxR

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

The HPKE receiver's context. This is what you use to open ciphertexts.

Implementations

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

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

Does a "detached open in place", meaning it overwrites ciphertext with the resulting plaintext, and takes the tag as a separate input.

Return Value

Returns Ok(()) 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 the tag fails to validate, returns Err(HpkeError::InvalidTag). If this happens, plaintext is in an undefined state.

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 AeadCtxR<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 AeadCtxR<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 AeadCtxR<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 AeadCtxR<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 AeadCtxR<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>,