Skip to main content

crypto_kem_xwing_enc

Function crypto_kem_xwing_enc 

Source
pub fn crypto_kem_xwing_enc(
    ciphertext: &mut Ciphertext,
    shared_secret: &mut SharedSecret,
    public_key: &PublicKey,
) -> Result<(), Error>
Expand description

Creates a random shared secret for public_key, writing it to shared_secret and its encapsulation to ciphertext.

Compatible with libsodium’s crypto_kem_xwing_enc.

§Errors

Returns Error::InvalidKey if the ML-KEM-768 part of public_key is not a valid encapsulation key, or if its X25519 part is a low-order point that gives an all-zero X25519 shared secret. ciphertext and shared_secret are then left unchanged.