pub mod arrayref;
pub mod owned;
pub mod slice;
#[cfg(feature = "generic-tests")]
pub mod tests;
use rand::CryptoRng;
pub type KeyPair<DK, EK> = (DK, EK);
#[derive(Debug)]
pub enum KEMError {
KeyGeneration,
Encapsulation,
Decapsulation,
}
pub trait KEM {
type Ciphertext;
type SharedSecret;
type EncapsulationKey;
type DecapsulationKey;
fn generate_key_pair(
rng: &mut impl CryptoRng,
) -> Result<KeyPair<Self::DecapsulationKey, Self::EncapsulationKey>, KEMError>;
fn encapsulate(
ek: &Self::EncapsulationKey,
rng: &mut impl CryptoRng,
) -> Result<(Self::SharedSecret, Self::Ciphertext), KEMError>;
fn decapsulate(
dk: &Self::DecapsulationKey,
ctxt: &Self::Ciphertext,
) -> Result<Self::SharedSecret, KEMError>;
}