[][src]Trait bls_like::EngineBLS

pub trait EngineBLS {
    type Engine: Engine + ScalarEngine<Fr = Self::Scalar>;
    type Scalar: PrimeField + SqrtField;
    type PublicKeyGroup: CurveProjective<Engine = Self::Engine, Scalar = Self::Scalar> + Into<<Self::PublicKeyGroup as CurveProjective>::Affine>;
    type SignatureGroup: CurveProjective<Engine = Self::Engine, Scalar = Self::Scalar> + Into<<Self::SignatureGroup as CurveProjective>::Affine>;
    fn miller_loop<'a, I>(i: I) -> <Self::Engine as Engine>::Fqk
    where
        I: IntoIterator<Item = (&'a <<Self::PublicKeyGroup as CurveProjective>::Affine as CurveAffine>::Prepared, &'a <<Self::SignatureGroup as CurveProjective>::Affine as CurveAffine>::Prepared)>
;
fn pairing<G1, G2>(p: G1, q: G2) -> <Self::Engine as Engine>::Fqk
    where
        G1: Into<<Self::PublicKeyGroup as CurveProjective>::Affine>,
        G2: Into<<Self::SignatureGroup as CurveProjective>::Affine>
; fn generate<R: Rng>(rng: &mut R) -> Self::Scalar { ... }
fn hash_to_signature_curve<M: Borrow<[u8]>>(
        message: M
    ) -> Self::SignatureGroup { ... }
fn final_exponentiation(
        e: &<Self::Engine as Engine>::Fqk
    ) -> Option<<Self::Engine as Engine>::Fqk> { ... }
fn verify_prepared<'a, I>(
        signature: &'a <<Self::SignatureGroup as CurveProjective>::Affine as CurveAffine>::Prepared,
        inputs: I
    ) -> bool
    where
        I: IntoIterator<Item = (&'a <<Self::PublicKeyGroup as CurveProjective>::Affine as CurveAffine>::Prepared, &'a <<Self::SignatureGroup as CurveProjective>::Affine as CurveAffine>::Prepared)>
, { ... } }

A weakening of pairing::Engine to permit transposing the groups.

You cannot transpose the two groups in a pairing::Engine without first providing panicing implementations of pairing::PrimeField for Engine::Fqe, which is not a prime field, and second, providing wrapper types for the projective and affine group representations, which makes interacting with the original pairing::Engine annoying. This trait merely replicates transposable functionality from pairing::Engine by removing the fields of definition, but leaves the actual BLS signature scheme to wrapper types.

We also extract two functions users may with to override: random scalar generation and hashing to the singature curve.

Associated Types

type Engine: Engine + ScalarEngine<Fr = Self::Scalar>

type Scalar: PrimeField + SqrtField

type PublicKeyGroup: CurveProjective<Engine = Self::Engine, Scalar = Self::Scalar> + Into<<Self::PublicKeyGroup as CurveProjective>::Affine>

Group where BLS public keys live

You should take this to be the Engine::G1 curve usually becuase all verifiers perform additions on this curve, or even scalar multiplicaitons with delinearization.

type SignatureGroup: CurveProjective<Engine = Self::Engine, Scalar = Self::Scalar> + Into<<Self::SignatureGroup as CurveProjective>::Affine>

Group where BLS signatures live

You should take this to be the Engine::G2 curve usually becuase only aggregators perform additions on this curve, or scalar multiplicaitons with delinearization.

Loading content...

Required methods

fn miller_loop<'a, I>(i: I) -> <Self::Engine as Engine>::Fqk where
    I: IntoIterator<Item = (&'a <<Self::PublicKeyGroup as CurveProjective>::Affine as CurveAffine>::Prepared, &'a <<Self::SignatureGroup as CurveProjective>::Affine as CurveAffine>::Prepared)>, 

Run the Miller loop from Engine but orients its arguments to be a SignatureGroup and PublicKeyGroup.

fn pairing<G1, G2>(p: G1, q: G2) -> <Self::Engine as Engine>::Fqk where
    G1: Into<<Self::PublicKeyGroup as CurveProjective>::Affine>,
    G2: Into<<Self::SignatureGroup as CurveProjective>::Affine>, 

Performs a pairing operation e(p, q) by calling Engine::pairing but orients its arguments to be a PublicKeyGroup and SignatureGroup.

Loading content...

Provided methods

fn generate<R: Rng>(rng: &mut R) -> Self::Scalar

Generate a random scalar for use as a secret key.

fn hash_to_signature_curve<M: Borrow<[u8]>>(message: M) -> Self::SignatureGroup

Hash one message to the signature curve.

fn final_exponentiation(
    e: &<Self::Engine as Engine>::Fqk
) -> Option<<Self::Engine as Engine>::Fqk>

Perform final exponentiation on the result of a Miller loop.

fn verify_prepared<'a, I>(
    signature: &'a <<Self::SignatureGroup as CurveProjective>::Affine as CurveAffine>::Prepared,
    inputs: I
) -> bool where
    I: IntoIterator<Item = (&'a <<Self::PublicKeyGroup as CurveProjective>::Affine as CurveAffine>::Prepared, &'a <<Self::SignatureGroup as CurveProjective>::Affine as CurveAffine>::Prepared)>, 

Implement verification equation for aggregate BLS signatures provided as prepared points

This low-level routine does no verification of critical security properties like message distinctness. It exists purely to simplify replacing mid-level routines with optimized variants, like versions that cache public key preperation or use fewer pairings.

Loading content...

Implementors

impl<E: Engine> EngineBLS for TinyBLS<E>[src]

type Engine = E

type Scalar = <Self::Engine as ScalarEngine>::Fr

type PublicKeyGroup = E::G2

type SignatureGroup = E::G1

impl<E: Engine> EngineBLS for UsualBLS<E>[src]

type Engine = E

type Scalar = <Self::Engine as ScalarEngine>::Fr

type PublicKeyGroup = E::G1

type SignatureGroup = E::G2

Loading content...