pub trait Kem:
Copy
+ Clone
+ Debug
+ Default
+ Eq
+ Ord
+ Send
+ Sync
+ 'static {
type DecapsulationKey: TryDecapsulate<Kem = Self> + Generate;
type EncapsulationKey: Encapsulate<Kem = Self> + Clone + Debug + Eq;
type SharedKeySize: ArraySize;
type CiphertextSize: ArraySize;
// Provided methods
fn generate_keypair_from_rng<R: CryptoRng>(
rng: &mut R,
) -> (DecapsulationKey<Self>, EncapsulationKey<Self>) { ... }
fn generate_keypair() -> (DecapsulationKey<Self>, EncapsulationKey<Self>) { ... }
}Expand description
Key encapsulation mechanism.
This trait describes the entire type family used by a KEM.
Required Associated Types§
Sourcetype DecapsulationKey: TryDecapsulate<Kem = Self> + Generate
type DecapsulationKey: TryDecapsulate<Kem = Self> + Generate
KEM decryption key (i.e. private key) which can decrypt encrypted shared secret ciphertexts
which were encrypted by Kem::EncapsulationKey.
Sourcetype EncapsulationKey: Encapsulate<Kem = Self> + Clone + Debug + Eq
type EncapsulationKey: Encapsulate<Kem = Self> + Clone + Debug + Eq
KEM encryption key (i.e. public key) which encrypts shared secrets into ciphertexts which
can be decrypted by Kem::DecapsulationKey.
Size of the shared key/secret returned by both encapsulation and decapsulation.
Sourcetype CiphertextSize: ArraySize
type CiphertextSize: ArraySize
Size of the ciphertext (a.k.a. “encapsulated key”) produced by Self::EncapsulationKey.
Provided Methods§
Sourcefn generate_keypair_from_rng<R: CryptoRng>(
rng: &mut R,
) -> (DecapsulationKey<Self>, EncapsulationKey<Self>)
fn generate_keypair_from_rng<R: CryptoRng>( rng: &mut R, ) -> (DecapsulationKey<Self>, EncapsulationKey<Self>)
Generate a random KEM keypair using the provided random number generator.
Sourcefn generate_keypair() -> (DecapsulationKey<Self>, EncapsulationKey<Self>)
fn generate_keypair() -> (DecapsulationKey<Self>, EncapsulationKey<Self>)
Generate a random KEM keypair using the system’s secure RNG.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".