Skip to main content

KeyAgreement

Trait KeyAgreement 

Source
pub trait KeyAgreement: Algorithm {
    const PRIVATE_KEY_LEN: usize;
    const PUBLIC_KEY_LEN: usize;
    const SHARED_SECRET_LEN: usize;

    // Required methods
    fn public_key(private_key: &[u8], out: &mut [u8]) -> Result<()>;
    fn agree(
        private_key: &[u8],
        peer_public_key: &[u8],
        out: &mut [u8],
    ) -> Result<()>;
}
Expand description

A Diffie-Hellman style key agreement scheme.

Required Associated Constants§

Source

const PRIVATE_KEY_LEN: usize

Private key (scalar) length in bytes.

Source

const PUBLIC_KEY_LEN: usize

Public key (encoded point) length in bytes.

Source

const SHARED_SECRET_LEN: usize

Shared secret length in bytes.

Required Methods§

Source

fn public_key(private_key: &[u8], out: &mut [u8]) -> Result<()>

Compute the public key for a private key.

Source

fn agree( private_key: &[u8], peer_public_key: &[u8], out: &mut [u8], ) -> Result<()>

Compute the shared secret from our private key and their public key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§