Function hpke::single_shot_seal_in_place_detached
source · pub fn single_shot_seal_in_place_detached<A, Kdf, Kem, R>(
mode: &OpModeS<'_, Kem>,
pk_recip: &Kem::PublicKey,
info: &[u8],
plaintext: &mut [u8],
aad: &[u8],
csprng: &mut R
) -> Result<(Kem::EncappedKey, AeadTag<A>), HpkeError>where
A: Aead,
Kdf: KdfTrait,
Kem: KemTrait,
R: CryptoRng + RngCore,
Expand description
Does a setup_sender
and AeadCtxS::seal_in_place_detached
in one shot. That is, it does a
key encapsulation to the specified recipient and encrypts the provided plaintext in place. See
setup::setup_sender
and AeadCtxS::seal_in_place_detached
for more detail.
Return Value
Returns Ok((encapped_key, auth_tag))
on success. If an error happened during key
encapsulation, returns Err(HpkeError::EncapError)
. If an error happened during encryption,
returns Err(HpkeError::SealError)
. In this case, the contents of plaintext
is undefined.