pub trait KeyExchange {
type SKey: Clone + ToBytes + FromBytes;
type PubKey: Clone + ToBytes + FromBytes;
type CompSecret: ToBytes;
// Required methods
fn generate_private_key(seed: [u8; 32]) -> Self::SKey;
fn generate_public_key(sk: &Self::SKey) -> Self::PubKey;
fn generate_shared_secret(
sk: &Self::SKey,
pk: &Self::PubKey,
) -> Result<Self::CompSecret>;
}Expand description
A trait to describe the types, methods and functions of a key-exhange for a curve
Required Associated Types§
Sourcetype CompSecret: ToBytes
type CompSecret: ToBytes
Shared Secret type
Required Methods§
Sourcefn generate_private_key(seed: [u8; 32]) -> Self::SKey
fn generate_private_key(seed: [u8; 32]) -> Self::SKey
A function to generate a random private key, given a 32 byte seed value.
Sourcefn generate_public_key(sk: &Self::SKey) -> Self::PubKey
fn generate_public_key(sk: &Self::SKey) -> Self::PubKey
A method to generate the public key, given a private key.
A method to compute the shared secret, given a private key and public key.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.