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