[−][src]Function hpke::single_shot_seal
pub fn single_shot_seal<A, Kdf, Kem, R>(
mode: &OpModeS<Kem::Kex>,
pk_recip: &<Kem::Kex as KeyExchange>::PublicKey,
info: &[u8],
plaintext: &mut [u8],
aad: &[u8],
csprng: &mut R
) -> Result<(EncappedKey<Kem::Kex>, AeadTag<A>), HpkeError> where
A: Aead,
Kdf: KdfTrait,
Kem: KemTrait,
R: CryptoRng + RngCore,
Does a setup_sender
and AeadCtx::seal
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 AeadCtx::seal
for more detail.
Return Value
Returns Ok((encapped_key, tag))
on success. If an error happened during key exchange, returns
Err(HpkeError::InvalidKeyExchange)
. If an unspecified error happened during encryption,
returns Err(HpkeError::Encryption)
. In this case, the contents of plaintext
is undefined.