Function hpke::single_shot_open
source · pub fn single_shot_open<A, Kdf, Kem>(
mode: &OpModeR<'_, Kem>,
sk_recip: &Kem::PrivateKey,
encapped_key: &Kem::EncappedKey,
info: &[u8],
ciphertext: &[u8],
aad: &[u8]
) -> Result<Vec<u8>, HpkeError>where
A: Aead,
Kdf: KdfTrait,
Kem: KemTrait,
Expand description
Does a setup_receiver
and AeadCtxR::open
in one shot. That is, it does a key decapsulation
for the specified recipient and decrypts the provided ciphertext. See setup::setup_reciever
and AeadCtxR::open
for more detail.
Return Value
Returns Ok(plaintext)
on success. If an error happened during key decapsulation, returns
Err(HpkeError::DecapError)
. If an error happened during decryption, returns
Err(HpkeError::OpenError)
.