Trait zk_pass::chaum_pedersen::ChaumPedersen
source · 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§
sourcetype GroupParameters
type GroupParameters
The type representing the group parameters used in the protocol.
sourcetype CommitParameters
type CommitParameters
The type representing the commitment parameters in the protocol.
sourcetype CommitmentRandom
type CommitmentRandom
The type representing the commitment randomness in the protocol.
Required Methods§
sourcefn commitment(
params: &Self::GroupParameters,
x: &Self::Secret
) -> (Self::CommitParameters, Self::CommitmentRandom)where
Self: Sized,
fn commitment( params: &Self::GroupParameters, x: &Self::Secret ) -> (Self::CommitParameters, Self::CommitmentRandom)where Self: Sized,
sourcefn challenge(params: &Self::GroupParameters) -> Self::Challengewhere
Self: Sized,
fn challenge(params: &Self::GroupParameters) -> Self::Challengewhere Self: Sized,
sourcefn challenge_response(
params: &Self::GroupParameters,
k: &Self::CommitmentRandom,
c: &Self::Challenge,
x: &Self::Secret
) -> Self::Responsewhere
Self: Sized,
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.
sourcefn verify(
params: &Self::GroupParameters,
s: &Self::Response,
c: &Self::Challenge,
cp: &Self::CommitParameters
) -> boolwhere
Self: Sized,
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
impl ChaumPedersen for Curve25519ChaumPedersen
Implementing the ChaumPedersen trait for EllipticCurveChaumPedersen.