pub trait Ciphersuite: Copy + Clone + PartialEq + Debug {
    type Group: Group;
    type HashOutput: AsRef<[u8]>;
    type SignatureSerialization: AsRef<[u8]> + TryFrom<Vec<u8>>;

    // Required methods
    fn H1(m: &[u8]) -> <<Self::Group as Group>::Field as Field>::Scalar;
    fn H2(m: &[u8]) -> <<Self::Group as Group>::Field as Field>::Scalar;
    fn H3(m: &[u8]) -> <<Self::Group as Group>::Field as Field>::Scalar;
    fn H4(m: &[u8]) -> Self::HashOutput;
    fn H5(m: &[u8]) -> Self::HashOutput;

    // Provided methods
    fn HDKG(
        _m: &[u8]
    ) -> Option<<<Self::Group as Group>::Field as Field>::Scalar> { ... }
    fn verify_signature(
        msg: &[u8],
        signature: &Signature<Self>,
        public_key: &VerifyingKey<Self>
    ) -> Result<(), Error<Self>> { ... }
}
Expand description

A FROST ciphersuite specifies the underlying prime-order group details and cryptographic hash function.

Required Associated Types§

source

type Group: Group

The prime order group (or subgroup) that this ciphersuite operates over.

source

type HashOutput: AsRef<[u8]>

A unique byte array of fixed length.

source

type SignatureSerialization: AsRef<[u8]> + TryFrom<Vec<u8>>

A unique byte array of fixed length that is the Group::ElementSerialization + Group::ScalarSerialization

Required Methods§

source

fn H1(m: &[u8]) -> <<Self::Group as Group>::Field as Field>::Scalar

H1 for a FROST ciphersuite.

Maps arbitrary inputs to Self::Scalar elements of the prime-order group scalar field.

source

fn H2(m: &[u8]) -> <<Self::Group as Group>::Field as Field>::Scalar

H2 for a FROST ciphersuite.

Maps arbitrary inputs to Self::Scalar elements of the prime-order group scalar field.

source

fn H3(m: &[u8]) -> <<Self::Group as Group>::Field as Field>::Scalar

H3 for a FROST ciphersuite.

Maps arbitrary inputs to Self::Scalar elements of the prime-order group scalar field.

source

fn H4(m: &[u8]) -> Self::HashOutput

H4 for a FROST ciphersuite.

Usually an an alias for the ciphersuite hash function H with domain separation applied.

source

fn H5(m: &[u8]) -> Self::HashOutput

H5 for a FROST ciphersuite.

Usually an an alias for the ciphersuite hash function H with domain separation applied.

Provided Methods§

source

fn HDKG(_m: &[u8]) -> Option<<<Self::Group as Group>::Field as Field>::Scalar>

Hash function for a FROST ciphersuite, used for the DKG.

The DKG it not part of the specification, thus this is optional. It can return None if DKG is not supported by the Ciphersuite. This is the default implementation.

Maps arbitrary inputs to non-zero Self::Scalar elements of the prime-order group scalar field.

source

fn verify_signature( msg: &[u8], signature: &Signature<Self>, public_key: &VerifyingKey<Self> ) -> Result<(), Error<Self>>

Verify a signature for this ciphersuite. The default implementation uses the “cofactored” equation (it multiplies by the cofactor returned by Group::cofactor()).

Cryptographic Safety

You may override this to provide a tailored implementation, but if the ciphersuite defines it, it must also multiply by the cofactor to comply with the RFC. Note that batch verification (see crate::batch::Verifier) also uses the default implementation regardless whether a tailored implementation was provided.

Implementors§