[][src]Function hpke::setup::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>), HpkeError> where
    A: Aead,
    Kdf: KdfTrait,
    Kem: KemTrait,
    R: CryptoRng + RngCore

Initiates an encryption context to the given recipient. Does an "authenticated" encapsulation if sk_sender_id is set. This ties the sender identity to the shared secret.

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.