Trait frost_core::Group

source ·
pub trait Group: Copy + Clone + PartialEq {
    type Field: Field;
    type Element: Add<Output = Self::Element> + Copy + Clone + Eq + Mul<<Self::Field as Field>::Scalar, Output = Self::Element> + PartialEq + Sub<Output = Self::Element>;
    type Serialization: AsRef<[u8]> + Debug + TryFrom<Vec<u8>>;

    // Required methods
    fn cofactor() -> <Self::Field as Field>::Scalar;
    fn identity() -> Self::Element;
    fn generator() -> Self::Element;
    fn serialize(element: &Self::Element) -> Self::Serialization;
    fn deserialize(
        buf: &Self::Serialization
    ) -> Result<Self::Element, GroupError>;
}
Expand description

A prime-order group (or subgroup) that provides everything we need to create and verify Schnorr signatures.

This trait does not have to be implemented for the curve/element/point itself, it can be a pass-through, implemented for a type just for the ciphersuite, and calls through to another implementation underneath, so that this trait does not have to be implemented for types you don’t own.

Required Associated Types§

source

type Field: Field

A prime order finite field GF(q) over which all scalar values for our prime order group can be multiplied are defined.

source

type Element: Add<Output = Self::Element> + Copy + Clone + Eq + Mul<<Self::Field as Field>::Scalar, Output = Self::Element> + PartialEq + Sub<Output = Self::Element>

An element of our group that we will be computing over.

source

type Serialization: AsRef<[u8]> + Debug + TryFrom<Vec<u8>>

A unique byte array buf of fixed length N.

Little-endian!

Required Methods§

source

fn cofactor() -> <Self::Field as Field>::Scalar

The order of the the quotient group when the prime order subgroup divides the order of the full curve group.

If using a prime order elliptic curve, the cofactor should be 1 in the scalar field.

source

fn identity() -> Self::Element

Additive identity of the prime order group.

source

fn generator() -> Self::Element

The fixed generator element of the prime order group.

The ‘base’ of [‘ScalarBaseMult()’] from the spec.

source

fn serialize(element: &Self::Element) -> Self::Serialization

A member function of a group G that maps an Element to a unique byte array buf of fixed length Ne.

https://www.ietf.org/archive/id/draft-irtf-cfrg-frost-11.html#section-3.1-3.6

source

fn deserialize(buf: &Self::Serialization) -> Result<Self::Element, GroupError>

A member function of a Group that attempts to map a byte array buf to an Element.

Fails if the input is not a valid byte representation of an Element of the Group. This function can raise an Error if deserialization fails or if the resulting Element is the identity element of the group

https://www.ietf.org/archive/id/draft-irtf-cfrg-frost-11.html#section-3.1-3.7

Implementors§