sigproof

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashMessages

func HashMessages(m []*math.Zr, c *math.Curve) (*math.Zr, error)

HashMessages returns a hash of the passed array of messages

Types

type MembershipCommitment

type MembershipCommitment struct {
	CommitmentToValue *math.G1
	Signature         *math.Gt
}

MembershipCommitment is commitment to randomness used to compute MembershipProof

type MembershipProof

type MembershipProof struct {
	// Challenge is the challenge computed for the ZK proof
	Challenge *math.Zr
	// Obfuscated Pointcheval-Sanders Signature
	Signature *pssign.Signature
	// Proof of knowledge of committed value
	Value *math.Zr
	// Proof of knowledge of the blinding factor in the Pedersen commitment
	ComBlindingFactor *math.Zr
	// Proof of knowledge of the blinding factor used to obfuscate Pointcheval-Sanders signature
	SigBlindingFactor *math.Zr
	// Proof of knowledge of the hash signed in Pointcheval-Sanders signature
	Hash *math.Zr
	// Pedersen commitment to Value
	Commitment *math.G1
}

MembershipProof is a ZK proof that shows that a committed value is signed using Pointcheval-Sanders signature

func (*MembershipProof) Deserialize

func (p *MembershipProof) Deserialize(raw []byte) error

Deserialize un-marshals MembershipProof

func (*MembershipProof) Serialize

func (p *MembershipProof) Serialize() ([]byte, error)

Serialize marshals MembershipProof

type MembershipProver

type MembershipProver struct {
	*MembershipVerifier
	// contains filtered or unexported fields
}

MembershipProver is a ZK prover that shows that a committed value is signed with Pointcheval-Sanders signature

func NewMembershipProver

func NewMembershipProver(witness *MembershipWitness, com, P *math.G1, Q *math.G2, PK []*math.G2, pp []*math.G1, curve *math.Curve) *MembershipProver

NewMembershipProver returns a MembershipWitnessProver for the passed MembershipWitness

func (*MembershipProver) Prove

func (p *MembershipProver) Prove() (*MembershipProof, error)

Prove produces a MembershipProof

type MembershipRandomness

type MembershipRandomness struct {
	// contains filtered or unexported fields
}

MembershipRandomness is randomness used to compute MembershipProof

type MembershipVerifier

type MembershipVerifier struct {
	*POKVerifier
	PedersenParams    []*math.G1
	CommitmentToValue *math.G1
}

MembershipVerifier verifies whether a committed value has been signed using Pointcheval-Sanders signature

func NewMembershipVerifier

func NewMembershipVerifier(com, P *math.G1, Q *math.G2, PK []*math.G2, pp []*math.G1, curve *math.Curve) *MembershipVerifier

NewMembershipVerifier returns a MembershipVerifier for the passed commitment com The verifier checks if the committed value in com is signed using Pointcheval-Sanders and the signature verifies correctly relative to the passed public key PK

func (*MembershipVerifier) Verify

func (v *MembershipVerifier) Verify(proof *MembershipProof) error

Verify checks the validity of a serialized MembershipProof Verify returns an error if the serialized MembershipProof is invalid

type MembershipWitness

type MembershipWitness struct {
	// contains filtered or unexported fields
}

MembershipWitness contains the information needed to generate a MembershipProof

func NewMembershipWitness

func NewMembershipWitness(sig *pssign.Signature, value *math.Zr, bf *math.Zr) *MembershipWitness

NewMembershipWitness returns a MembershipWitness as a function of the passed arguments

type POK

type POK struct {
	// Challenge is the challenge used in the proof
	Challenge *math.Zr
	// Signature is an obfuscated Pointcheval-Sanders signature
	Signature *pssign.Signature
	// Proof of signed messages
	Messages []*math.Zr
	// BlindingFactor is randomness used to obfuscate Pointcheval-Sadners signature
	BlindingFactor *math.Zr
	// Proof of hash (hash is computed as the hash of the signed messages)
	Hash *math.Zr
}

POK is a zero-knowledge proof of knowledge of a Pointcheval-Sanders Signature

type POKProver

type POKProver struct {
	*POKVerifier
	Witness *POKWitness
	// contains filtered or unexported fields
}

POKProver produces a POK proof

func (*POKProver) Prove

func (p *POKProver) Prove() (*POK, error)

Prove returns a POK proof

type POKRandomness

type POKRandomness struct {
	// contains filtered or unexported fields
}

POKRandomness is the Randomness used during the POK proof

type POKVerifier

type POKVerifier struct {
	// PK is the public key under which the signature should be valid
	PK    []*math.G2
	Q     *math.G2
	P     *math.G1
	Curve *math.Curve
}

POKVerifier validates if a POK proof is valid

func (*POKVerifier) Verify

func (v *POKVerifier) Verify(proof *POK) error

Verify checks if the passed POK is valid; if not, Verify returns an error

type POKWitness

type POKWitness struct {
	// Messages corresponds to signed messages
	Messages []*math.Zr
	// Signature is Pointcheval-Sanders signature
	Signature *pssign.Signature
	// BlindingFactor is the randomness used to obfuscate Pointcheval-Sanders signature
	// for the POK proof
	BlindingFactor *math.Zr
}

POKWitness encodes the witness of POK proof

type SigCommitment

type SigCommitment struct {
	CommitmentToMessages *math.G1
	Signature            *math.Gt
}

SigCommitment encodes the commitments to the randomness used in the SigProof

type SigProof

type SigProof struct {
	// Challenge is the challenge used in the proof
	Challenge *math.Zr
	// Hidden is an array that contains proofs of knowledge of hidden messages
	Hidden []*math.Zr
	// Hash is the proof of knowledge of the hash signed in Pointcheval-Sanders signature
	// If hash is computed as a function of the signed messages, it should never be disclosed
	// Hash cannot be nil
	Hash *math.Zr
	// Signature is an obfuscated Pointcheval-Sanders signature
	Signature *pssign.Signature
	// SigBlindingFactor is the proof of knowledge of the randomness used to obfuscate
	// Pointcheval-Sanders signature
	SigBlindingFactor *math.Zr
	// ComBlindingFactor is a proof of knowledge of the randomness used to compute
	// the Pedersen commitment
	ComBlindingFactor *math.Zr
	// Commitment is a Pedersen commitment of to the hidden messages
	Commitment *math.G1 // for hidden values
}

SigProof is a proof of knowledge of Pointcheval-Signature with partial message disclosure

type SigProver

type SigProver struct {
	*SigVerifier

	Commitment *SigCommitment
	// contains filtered or unexported fields
}

SigProver produces a proof of knowledge Pointcheval-Sanders signature with partial message disclosure

func NewSigProver

func NewSigProver(hidden, disclosed []*math.Zr, signature *pssign.Signature, hash, bf *math.Zr, com *math.G1, hiddenindices, disclosedindices []int, P *math.G1, Q *math.G2, PK []*math.G2, pp []*math.G1, curve *math.Curve) *SigProver

NewSigProver returns a SigProver as a function of the passed arguments

func (*SigProver) Prove

func (p *SigProver) Prove() (*SigProof, error)

Prove returns a SigProof

type SigRandomness

type SigRandomness struct {
	// contains filtered or unexported fields
}

SigRandomness represents the randomness used in the SigProof

type SigVerifier

type SigVerifier struct {
	*POKVerifier
	// indices of messages to be hidden in the signed vector
	HiddenIndices []int
	// indices of messages to be disclosed
	DisclosedIndices []int
	// Disclosed contains the content of the disclosed messages
	Disclosed []*math.Zr
	// PedersenParams corresponds to Pedersen commitment generators
	PedersenParams []*math.G1
	// CommitmentToMessages is a Pedersen commitment to the signed messages
	CommitmentToMessages *math.G1
}

SigVerifier checks the validity of SigProof

func NewSigVerifier

func NewSigVerifier(hidden, disclosed []int, disclosedInf []*math.Zr, com, P *math.G1, Q *math.G2, PK []*math.G2, pp []*math.G1, curve *math.Curve) *SigVerifier

NewSigVerifier returns a SigVerifier as a function of the passed arguments

func (*SigVerifier) Verify

func (v *SigVerifier) Verify(p *SigProof) error

Verify returns an error if the passed SigProof is invalid

type SigWitness

type SigWitness struct {
	// contains filtered or unexported fields
}

SigWitness is the witness for SigProof

func NewSigWitness

func NewSigWitness(hidden []*math.Zr, signature *pssign.Signature, hash, bf *math.Zr) *SigWitness

NewSigWitness instantiates a SigWitness with the passed arguments

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL