[][src]Function hpke::setup_sender

pub fn setup_sender<A, Kdf, Kem, R>(
    mode: &OpModeS<'_, Kem::Kex>,
    pk_recip: &<Kem::Kex as KeyExchange>::PublicKey,
    info: &[u8],
    csprng: &mut R
) -> Result<(EncappedKey<Kem::Kex>, AeadCtxS<A, Kdf, Kem>), HpkeError> where
    A: Aead,
    Kdf: KdfTrait,
    Kem: KemTrait,
    R: CryptoRng + RngCore

Initiates an encryption context to the given recipient public key

Return Value

On success, returns an encapsulated public key (intended to be sent to the recipient), and an encryption context. If an error happened during key exchange, returns Err(HpkeError::InvalidKeyExchange). This is the only possible error.