pub trait Kem: Sized {
type PublicKey: Clone + Serializable + Deserializable;
type PrivateKey: Clone + Serializable + Deserializable;
type EncappedKey: Clone + Serializable + Deserializable;
const KEM_ID: u16;
// Required method
fn derive_keypair(ikm: &[u8]) -> (Self::PrivateKey, Self::PublicKey);
// Provided method
fn gen_keypair<R: CryptoRng + RngCore>(
csprng: &mut R
) -> (Self::PrivateKey, Self::PublicKey) { ... }
}
Expand description
Represents authenticated encryption functionality
Required Associated Types§
sourcetype PublicKey: Clone + Serializable + Deserializable
type PublicKey: Clone + Serializable + Deserializable
The key exchange’s public key type. If you want to generate a keypair, see
Kem::gen_keypair
or Kem::derive_keypair
sourcetype PrivateKey: Clone + Serializable + Deserializable
type PrivateKey: Clone + Serializable + Deserializable
The key exchange’s private key type. If you want to generate a keypair, see
Kem::gen_keypair
or Kem::derive_keypair
sourcetype EncappedKey: Clone + Serializable + Deserializable
type EncappedKey: Clone + Serializable + Deserializable
The encapsulated key for this KEM. This is used by the recipient to derive the shared secret.
Required Associated Constants§
Required Methods§
sourcefn derive_keypair(ikm: &[u8]) -> (Self::PrivateKey, Self::PublicKey)
fn derive_keypair(ikm: &[u8]) -> (Self::PrivateKey, Self::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::PrivateKey::size()
. For X25519 and P-256, this is 256 bits of
entropy.
Provided Methods§
sourcefn gen_keypair<R: CryptoRng + RngCore>(
csprng: &mut R
) -> (Self::PrivateKey, Self::PublicKey)
fn gen_keypair<R: CryptoRng + RngCore>( csprng: &mut R ) -> (Self::PrivateKey, Self::PublicKey)
Generates a random keypair using the given RNG