pub trait EcPoint<'a, const LEN: usize, const SCALAR_LEN: usize> {
type Scalar<'s>: EcScalar<'s, SCALAR_LEN>
where Self: 'a + 's;
// Required methods
fn is_valid_pubkey(&self) -> Result<bool, Error>;
fn neg(&self) -> Result<Self, Error>
where Self: Sized;
fn mul(&self, scalar: &Self::Scalar<'a>) -> Result<Self, Error>
where Self: Sized;
fn add_mul(
&self,
s1: &Self::Scalar<'a>,
p2: &Self,
s2: &Self::Scalar<'a>,
) -> Result<Self, Error>
where Self: Sized;
fn write_canon(&self, point: &mut CryptoSensitive<LEN>) -> Result<(), Error>;
}Expand description
Trait representing an Elliptic Curve (EC) point.
Required Associated Types§
Required Methods§
Sourcefn is_valid_pubkey(&self) -> Result<bool, Error>
fn is_valid_pubkey(&self) -> Result<bool, Error>
Return true if this point is a valid public key on the curve, i.e. it
is on the curve, its coordinates are in range, and it is not the
identity (point at infinity) — equivalently, per RFC 9383 §4, that the
cofactor multiple h*P is not the identity element.
SPAKE2+ requires this validation on the peer’s public share (X on the
verifier side, Y on the prover side); an unchecked identity/invalid
point lets a peer force the shared secret and break the protocol’s
guarantees.
Sourcefn mul(&self, scalar: &Self::Scalar<'a>) -> Result<Self, Error>where
Self: Sized,
fn mul(&self, scalar: &Self::Scalar<'a>) -> Result<Self, Error>where
Self: Sized,
Multiply this EC point by the given scalar.
Sourcefn add_mul(
&self,
s1: &Self::Scalar<'a>,
p2: &Self,
s2: &Self::Scalar<'a>,
) -> Result<Self, Error>where
Self: Sized,
fn add_mul(
&self,
s1: &Self::Scalar<'a>,
p2: &Self,
s2: &Self::Scalar<'a>,
) -> Result<Self, Error>where
Self: Sized,
Sourcefn write_canon(&self, point: &mut CryptoSensitive<LEN>) -> Result<(), Error>
fn write_canon(&self, point: &mut CryptoSensitive<LEN>) -> Result<(), Error>
Write the canonical representation of this EC point into the given buffer.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".