pub trait P256Ecdh {
// Required methods
fn public_key(k: &P256Scalar) -> Result<P256Point, Error>;
fn shared_secret(
k: &P256Scalar,
peer: &P256Point,
) -> Result<[u8; 32], Error>;
}Expand description
P-256 (secp256r1) 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§
Sourcefn public_key(k: &P256Scalar) -> Result<P256Point, Error>
fn public_key(k: &P256Scalar) -> Result<P256Point, Error>
The public key k * G of the private scalar k.
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".