[][src]Trait hpke::Kem

pub trait Kem: Sized {
    type Kex: KeyExchange;
    type Kdf: KdfTrait;

    const KEM_ID: u16;
    fn derive_keypair(
        ikm: &[u8]
    ) -> (<Self::Kex as KeyExchange>::PrivateKey, <Self::Kex as KeyExchange>::PublicKey) { ... }
fn gen_keypair<R: CryptoRng + RngCore>(
        csprng: &mut R
    ) -> (<Self::Kex as KeyExchange>::PrivateKey, <Self::Kex as KeyExchange>::PublicKey) { ... } }

Defines a combination of key exchange mechanism and a KDF, which together form a KEM

Associated Types

Loading content...

Associated Constants

const KEM_ID: u16

Loading content...

Provided methods

fn derive_keypair(
    ikm: &[u8]
) -> (<Self::Kex as KeyExchange>::PrivateKey, <Self::Kex as KeyExchange>::PublicKey)

Deterministically derives a keypair from the given input keying material

Requirements

This keying material SHOULD have as many bits of entropy as the bit length of a secret key, i.e., 8* Self::Kex::PrivateKey::size(). For X25519 and P-256, this is 32 bytes of entropy.

fn gen_keypair<R: CryptoRng + RngCore>(
    csprng: &mut R
) -> (<Self::Kex as KeyExchange>::PrivateKey, <Self::Kex as KeyExchange>::PublicKey)

Generates a random keypair using the given RNG

Loading content...

Implementors

Loading content...