common

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Challenge

type Challenge = curves.Scalar

Challenge generated by fiat-shamir heuristic

type Commitment

type Commitment = curves.Point

Commitment represents a point Pedersen commitment of one or more points multiplied by scalars

type HmacDrbg

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

HmacDrbg is an HMAC deterministic random bit generator that can use any hash function. Handles reseeding automatically

func NewHmacDrbg

func NewHmacDrbg(entropy, nonce, pers []byte, hasher func() hash.Hash) *HmacDrbg

func (*HmacDrbg) Read

func (drbg *HmacDrbg) Read(dst []byte) (n int, err error)

func (*HmacDrbg) Reseed

func (drbg *HmacDrbg) Reseed(entropy []byte)

type Nonce

type Nonce = curves.Scalar

Nonce is used for zero-knowledge proofs to prevent replay attacks and prove freshness

type ProofCommittedBuilder

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

ProofCommittedBuilder is used to create proofs from multiple commitments where each secret is committed with a random blinding factor and turned into a Schnorr proof

func NewProofCommittedBuilder

func NewProofCommittedBuilder(curve *curves.Curve) *ProofCommittedBuilder

NewProofCommittedBuilder creates a new builder using the specified curve

func (*ProofCommittedBuilder) Commit

func (pcb *ProofCommittedBuilder) Commit(point curves.Point, scalar curves.Scalar) error

Commit uses the specified point and scalar to create a commitment

func (*ProofCommittedBuilder) CommitRandom

func (pcb *ProofCommittedBuilder) CommitRandom(point curves.Point, reader io.Reader) error

CommitRandom uses the specified point and commits a random value to it

func (ProofCommittedBuilder) GenerateProof

func (pcb ProofCommittedBuilder) GenerateProof(challenge curves.Scalar, secrets []curves.Scalar) ([]curves.Scalar, error)

GenerateProof converts the blinding factors and secrets into Schnorr proofs

func (*ProofCommittedBuilder) Get

func (pcb *ProofCommittedBuilder) Get(index int) (curves.Point, curves.Scalar)

Get returns the point and scalar at the specified index

func (ProofCommittedBuilder) GetChallengeContribution

func (pcb ProofCommittedBuilder) GetChallengeContribution() []byte

GetChallengeContribution returns the bytes that should be added to a sigma protocol transcript for generating the challenge

type ProofMessage

type ProofMessage interface {
	// IsHidden indicates the message should be hidden
	IsHidden() bool
	// GetBlinding is used for hidden messages
	// blindings can either be proof specific to a signature
	// or involved with other proofs like boundchecks,
	// set memberships, or inequalities so the blinding
	// factor is shared among proofs to produce a common
	// schnorr linking proof
	GetBlinding(reader io.Reader) curves.Scalar
	// GetMessage returns the underlying message
	GetMessage() curves.Scalar
}

ProofMessage classifies how a message is presented in a proof Either Revealed or Hidden. Hidden has two sub categories: proof specific i.e. the message is only used for this proof or shared i.e. the message should be proved to be common across proofs

type ProofSpecificMessage

type ProofSpecificMessage struct {
	Message curves.Scalar
}

func (ProofSpecificMessage) GetBlinding

func (ps ProofSpecificMessage) GetBlinding(reader io.Reader) curves.Scalar

func (ProofSpecificMessage) GetMessage

func (ps ProofSpecificMessage) GetMessage() curves.Scalar

func (ProofSpecificMessage) IsHidden

func (ps ProofSpecificMessage) IsHidden() bool

type RevealedMessage

type RevealedMessage struct {
	Message curves.Scalar
}

func (RevealedMessage) GetBlinding

func (r RevealedMessage) GetBlinding(reader io.Reader) curves.Scalar

func (RevealedMessage) GetMessage

func (r RevealedMessage) GetMessage() curves.Scalar

func (RevealedMessage) IsHidden

func (r RevealedMessage) IsHidden() bool

type SharedBlindingMessage

type SharedBlindingMessage struct {
	Message, Blinding curves.Scalar
}

func (SharedBlindingMessage) GetBlinding

func (ps SharedBlindingMessage) GetBlinding(reader io.Reader) curves.Scalar

func (SharedBlindingMessage) GetMessage

func (ps SharedBlindingMessage) GetMessage() curves.Scalar

func (SharedBlindingMessage) IsHidden

func (ps SharedBlindingMessage) IsHidden() bool

type SignatureBlinding

type SignatureBlinding = curves.PairingScalar

SignatureBlinding is a value used for computing blind signatures

Jump to

Keyboard shortcuts

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