pub trait ChaumPedersen {
    type Secret;
    type Response;
    type Challenge;
    type GroupParameters;
    type CommitParameters;
    type CommitmentRandom;

    // Required methods
    fn commitment(
        params: &Self::GroupParameters,
        x: &Self::Secret
    ) -> (Self::CommitParameters, Self::CommitmentRandom)
       where Self: Sized;
    fn challenge(params: &Self::GroupParameters) -> Self::Challenge
       where Self: Sized;
    fn challenge_response(
        params: &Self::GroupParameters,
        k: &Self::CommitmentRandom,
        c: &Self::Challenge,
        x: &Self::Secret
    ) -> Self::Response
       where Self: Sized;
    fn verify(
        params: &Self::GroupParameters,
        s: &Self::Response,
        c: &Self::Challenge,
        cp: &Self::CommitParameters
    ) -> bool
       where Self: Sized;
}
Expand description

A trait defining the interface for the Chaum-Pedersen zero-knowledge protocol.

This trait provides the necessary methods for implementing the Chaum-Pedersen protocol, which is a cryptographic protocol for proving knowledge of a secret without revealing it.

Required Associated Types§

source

type Secret

The type representing the secret to be proven.

source

type Response

The type representing the response in the protocol.

source

type Challenge

The type representing the challenge in the protocol.

source

type GroupParameters

The type representing the group parameters used in the protocol.

source

type CommitParameters

The type representing the commitment parameters in the protocol.

source

type CommitmentRandom

The type representing the commitment randomness in the protocol.

Required Methods§

source

fn commitment( params: &Self::GroupParameters, x: &Self::Secret ) -> (Self::CommitParameters, Self::CommitmentRandom)where Self: Sized,

Calculates the commitment in the Chaum-Pedersen protocol.

Arguments
  • params - Group parameters used in the protocol.
  • x - The secret value for which the commitment is calculated.
Returns

A tuple containing the commitment parameters and the commitment randomness.

source

fn challenge(params: &Self::GroupParameters) -> Self::Challengewhere Self: Sized,

Generates a challenge in the Chaum-Pedersen protocol.

Arguments
  • params - Group parameters used in the protocol.
Returns

The challenge value used in the protocol.

source

fn challenge_response( params: &Self::GroupParameters, k: &Self::CommitmentRandom, c: &Self::Challenge, x: &Self::Secret ) -> Self::Responsewhere Self: Sized,

Calculates the challenge response in the Chaum-Pedersen protocol.

Arguments
  • params - Group parameters used in the protocol.
  • k - The commitment randomness used in the protocol.
  • c - The challenge value used in the protocol.
  • x - The secret value for which the response is calculated.
Returns

The response value in the protocol.

source

fn verify( params: &Self::GroupParameters, s: &Self::Response, c: &Self::Challenge, cp: &Self::CommitParameters ) -> boolwhere Self: Sized,

Verifies the response in the Chaum-Pedersen protocol.

Arguments
  • params - Group parameters used in the protocol.
  • s - The response value to be verified.
  • c - The challenge value used in the protocol.
  • cp - The commitment parameters used in the protocol.
Returns

A boolean indicating whether the verification was successful.

Implementors§

source§

impl ChaumPedersen for Curve25519ChaumPedersen

Implementing the ChaumPedersen trait for EllipticCurveChaumPedersen.

§

type Secret = Scalar

§

type CommitmentRandom = Scalar

§

type Response = Scalar

§

type Challenge = Scalar

§

type GroupParameters = GroupParams<RistrettoPoint>

§

type CommitParameters = (RistrettoPoint, RistrettoPoint, RistrettoPoint, RistrettoPoint)

source§

impl ChaumPedersen for DiscreteLogChaumPedersen

source§

impl ChaumPedersen for PallasCurveChaumPedersen

§

type Secret = Fq

§

type Response = Fq

§

type Challenge = Fq

§

type CommitmentRandom = Fq

§

type GroupParameters = GroupParams<Ep>

§

type CommitParameters = (Ep, Ep, Ep, Ep)

source§

impl ChaumPedersen for VestaCurveChaumPedersen

§

type Secret = Fp

§

type Response = Fp

§

type Challenge = Fp

§

type CommitmentRandom = Fp

§

type GroupParameters = GroupParams<Eq>

§

type CommitParameters = (Eq, Eq, Eq, Eq)