pub trait Group:
Dh
+ Clone
+ Default
+ Debug
+ Display {
type POINT: Point;
// Required methods
fn scalar_len(&self) -> usize;
fn scalar(&self) -> <Self::POINT as Point>::SCALAR;
fn point_len(&self) -> usize;
fn point(&self) -> Self::POINT;
fn is_prime_order(&self) -> Option<bool>;
}Expand description
Group interface represents a mathematical group
usable for Diffie-Hellman key exchange, ElGamal encryption,
and the related body of public-key cryptographic algorithms
and zero-knowledge proof methods.
The Group interface is designed in particular to be a generic front-end
to both traditional DSA-style modular arithmetic groups
and ECDSA-style elliptic curves:
the caller of this interface’s methods
need not know or care which specific mathematical construction
underlies the interface.
The Group interface is essentially just a “constructor” interface
enabling the caller to generate the two particular types of objects
relevant to DSA-style public-key cryptography;
we call these objects Points and Scalars.
The caller must explicitly initialize or set a new Point or Scalar object
to some value before using it as an input to some other operation
involving Point and/or Scalar objects.
For example, to compare a point P against the neutral (identity) element,
you might use P.eq(suite.point().null()),
but not just P.eq(suite.point()).
It is expected that any implementation of this interface
should satisfy suitable hardness assumptions for the applicable group:
e.g., that it is cryptographically hard for an adversary to
take an encrypted Point and the known generator it was based on,
and derive the Scalar with which the Point was encrypted.
Any implementation is also expected to satisfy
the standard homomorphism properties that Diffie-Hellman
and the associated body of public-key cryptography are based on.
Required Associated Types§
Required Methods§
Sourcefn scalar_len(&self) -> usize
fn scalar_len(&self) -> usize
[scalar_len()] returns the max length of scalars in bytes
fn point_len(&self) -> usize
Sourcefn is_prime_order(&self) -> Option<bool>
fn is_prime_order(&self) -> Option<bool>
[is_prime_order()] returns Some(true) if the group has a prime order,
if None is returned is assumes that the group has a prime order
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.