embassy-crypto

Crates

git

Versions

default

Flavors

Skip to main content

P384Ecdh

Trait P384Ecdh 

Source
pub trait P384Ecdh {
    // Required methods
    fn public_key(k: &P384Scalar) -> Result<P384Point, Error>;
    fn shared_secret(
        k: &P384Scalar,
        peer: &P384Point,
    ) -> Result<[u8; 48], Error>;
}
Expand description

P-384 (secp384r1) ECDH driver.

§Contract

  • Private scalars are canonical and nonzero; other values return Error::InvalidKey.
  • No secret-dependent timing with respect to the private scalar.
  • Implementations wipe copies of secrets they materialize in RAM.

Required Methods§

Source

fn public_key(k: &P384Scalar) -> Result<P384Point, Error>

The public key k * G of the private scalar k.

Source

fn shared_secret(k: &P384Scalar, peer: &P384Point) -> Result<[u8; 48], Error>

The shared secret: X coordinate of k * peer.

peer is untrusted: implementations validate that it is a point on the curve and return Error::InvalidKey otherwise.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§