Skip to main content

encapsulate_to_p256_public

Function encapsulate_to_p256_public 

Source
pub fn encapsulate_to_p256_public(
    public_bytes: &[u8],
) -> Result<(Vec<u8>, [u8; 32]), CryptoError>
Expand description

Encapsulate a fresh shared secret to a foreign P-256-hybrid public key ek_M ‖ pk_P — the sender side, holding only the recipient’s public half. Pure software (no hardware): it mirrors super::kem::encapsulate_to_public for the P-256 variant. Returns the ciphertext ct_M ‖ ct_P (DEK_P256_CIPHERTEXT_LEN bytes) and the 32-byte combined shared secret.

A wrong-length public_bytes, or one whose ML-KEM/P-256 half fails decoding, is rejected.