pub trait Kem {
// Required methods
fn generate_keypair(&self) -> Result<KemKeypair>;
fn encapsulate(
&self,
public_key: &KemPublicKey,
) -> Result<(Vec<u8>, Vec<u8>)>;
fn decapsulate(
&self,
secret_key: &KemSecretKey,
ciphertext: &[u8],
) -> Result<Vec<u8>>;
}
Expand description
Trait for key encapsulation mechanisms
Required Methods§
Sourcefn generate_keypair(&self) -> Result<KemKeypair>
fn generate_keypair(&self) -> Result<KemKeypair>
Generate a keypair
Sourcefn encapsulate(&self, public_key: &KemPublicKey) -> Result<(Vec<u8>, Vec<u8>)>
fn encapsulate(&self, public_key: &KemPublicKey) -> Result<(Vec<u8>, Vec<u8>)>
Encapsulate a shared secret
Sourcefn decapsulate(
&self,
secret_key: &KemSecretKey,
ciphertext: &[u8],
) -> Result<Vec<u8>>
fn decapsulate( &self, secret_key: &KemSecretKey, ciphertext: &[u8], ) -> Result<Vec<u8>>
Decapsulate a shared secret