Trait DH

Source
pub trait DH {
    type Key: U8Array;
    type Pubkey: U8Array;
    type Output: U8Array;

    // Required methods
    fn name() -> &'static str;
    fn genkey() -> Self::Key;
    fn pubkey(_: &Self::Key) -> Self::Pubkey;
    fn dh(_: &Self::Key, _: &Self::Pubkey) -> Result<Self::Output, ()>;
}
Expand description

A DH.

Required Associated Types§

Source

type Key: U8Array

Type of private key.

Source

type Pubkey: U8Array

Type of pubkey key.

Source

type Output: U8Array

Type of output.

Required Methods§

Source

fn name() -> &'static str

Name of this DH function, e.g., “25519”.

Source

fn genkey() -> Self::Key

Randomly generate a new private key.

Source

fn pubkey(_: &Self::Key) -> Self::Pubkey

Calculate public key from a private key.

Source

fn dh(_: &Self::Key, _: &Self::Pubkey) -> Result<Self::Output, ()>

Perform DH key exchange.

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.

Implementors§