Skip to main content

Kem

Trait Kem 

Source
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§

Source

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.

Source

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.

Source

type SharedKeySize: ArraySize

Size of the shared key/secret returned by both encapsulation and decapsulation.

Source

type CiphertextSize: ArraySize

Size of the ciphertext (a.k.a. “encapsulated key”) produced by Self::EncapsulationKey.

Provided Methods§

Source

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.

Source

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".

Implementors§