Trait cypher::Ecdh

source ·
pub trait Ecdh: EcSk {
    type SharedSecret: Copy + Eq + Sized + Send + AsRef<[u8]>;

    // Required method
    fn ecdh(&self, pk: &Self::Pk) -> Result<Self::SharedSecret, EcdhError>;
}
Expand description

Elliptic-curve based public key type which can be used for ECDH.

§Safety

The type provides no guarantees on the key validity upon deserialization.

Required Associated Types§

Required Methods§

source

fn ecdh(&self, pk: &Self::Pk) -> Result<Self::SharedSecret, EcdhError>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Ecdh for SecretKey

Available on crate feature x25519 only.
§

type SharedSecret = [u8; 32]

source§

fn ecdh(&self, pk: &Self::Pk) -> Result<Self::SharedSecret, EcdhError>

Implementors§

source§

impl Ecdh for PrivateKey

Available on crate feature x25519 only.