[−][src]Struct hpke::aead::AeadCtxR
The HPKE receiver's context. This is what you use to open
ciphertexts.
Implementations
impl<A: Aead, Kdf: KdfTrait, Kem: KemTrait> AeadCtxR<A, Kdf, Kem>
[src]
pub fn open(
&mut self,
ciphertext: &mut [u8],
aad: &[u8],
tag: &AeadTag<A>
) -> Result<(), HpkeError>
[src]
&mut self,
ciphertext: &mut [u8],
aad: &[u8],
tag: &AeadTag<A>
) -> Result<(), HpkeError>
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 about 255x the digest size
of the underlying hash function, returns an Err(HpkeError::InvalidKdfLength)
. The exact
number is given in the "Input Length Restrictions" section of the spec. Just don't use to
fill massive buffers and you'll be fine.
Auto Trait Implementations
impl<A, Kdf, Kem> RefUnwindSafe for AeadCtxR<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,
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 AeadCtxR<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>,
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 AeadCtxR<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>,
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 AeadCtxR<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,
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 AeadCtxR<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,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,