common

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

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

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 ComputePedersenCommitment

func ComputePedersenCommitment(opening []*math.Zr, base []*math.G1, c *math.Curve) (*math.G1, error)

ComputePedersenCommitment returns the commitment to opening relative to base in passed curve.

func GetBytesArray

func GetBytesArray(bytes ...[]byte) []byte

GetBytesArray takes a series of array of bytes and returns the concatenation

func GetZrArray

func GetZrArray(elements ...[]*math.Zr) []*math.Zr

GetZrArray takes a series of Zr elements and returns the corresponding array

func NewNymSigner

func NewNymSigner(sk, bf *math.Zr, nymParams []*math.G1, nym *math.G1, curve *math.Curve) (*nymSigner, error)

func Sum

func Sum(values []*math.Zr, c *math.Curve) (*math.Zr, error)

Sum takes an array of Zr elements and returns the corresponding sum modulo the group order c.GroupOrder

Types

type G1Array

type G1Array struct {
	Elements []*math.G1
}

G1Array is an array of G1 elements

func GetG1Array

func GetG1Array(elements ...[]*math.G1) *G1Array

GetG1Array takes a series of G1 elements and returns the corresponding array

func (*G1Array) Bytes

func (a *G1Array) Bytes() ([]byte, error)

Bytes serialize an array of G1 elements

type G2Array

type G2Array struct {
	Elements []*math.G2
}

G2Array is an array of G2 elements

func GetG2Array

func GetG2Array(elements ...[]*math.G2) *G2Array

GetG2Array takes a series of G2 elements and returns the corresponding array

func (*G2Array) Bytes

func (a *G2Array) Bytes() ([]byte, error)

Bytes serializes an array of G2 elements

type GTArray

type GTArray struct {
	Elements []*math.Gt
}

GTArray is an array of GT elements

func GetGTArray

func GetGTArray(elements ...[]*math.Gt) *GTArray

GetGTArray takes a series of GT elements and returns the corresponding array

func (*GTArray) Bytes

func (a *GTArray) Bytes() ([]byte, error)

Bytes serializes an array of GT elements

type NYMSig

type NYMSig struct {
	SK        *math.Zr
	BF        *math.Zr
	Challenge *math.Zr
}

NYMSig is the SOK signature produced by nymSigner

func (*NYMSig) Deserialize

func (s *NYMSig) Deserialize(raw []byte) error

Deserialize un-marshals NYMSig

func (*NYMSig) Serialize

func (s *NYMSig) Serialize() ([]byte, error)

Serialize marshals NYMSig

type NymVerifier

type NymVerifier struct {
	NYMParams []*math.G1
	NYM       *math.G1
	Curve     *math.Curve
}

NymVerifier verify SOK signature produced by nymSigner

func NewNymVerifier

func NewNymVerifier(nymParams []*math.G1, nym *math.G1, curve *math.Curve) (*NymVerifier, error)

func (*NymVerifier) Deserialize

func (v *NymVerifier) Deserialize(raw []byte) error

Deserialize returns an error if it fails to deserialize a NymVerifier from raw.

func (*NymVerifier) Serialize

func (v *NymVerifier) Serialize() ([]byte, error)

Serialize returns a serialized pseudonym (PedGen^SK*Q^BF)

func (*NymVerifier) Verify

func (v *NymVerifier) Verify(message []byte, signature []byte) error

Verify SOK signature relative to pseudonym in NymVerifier

type Prover

type Prover interface {
	Prove() ([]byte, error)
}

type SchnorrProof

type SchnorrProof struct {
	Statement *math.G1
	Proof     []*math.Zr
	Challenge *math.Zr
}

SchnorrProof carries a ZKP for statement (w_1, ..., w_n): Com = \Prod_{j=1}^n P_i^w_i

type SchnorrProver

type SchnorrProver struct {
	*SchnorrVerifier
	Witness    []*math.Zr
	Randomness []*math.Zr
	Challenge  *math.Zr
}

SchnorrProver produces a Schnorr proof

func (*SchnorrProver) Prove

func (p *SchnorrProver) Prove() ([]*math.Zr, error)

Prove produces an array of Zr elements that match the passed challenge, witnesses and randomness.

type SchnorrVerifier

type SchnorrVerifier struct {
	PedParams []*math.G1
	Curve     *math.Curve
}

SchnorrVerifier verifies a SchnorrProof

func (*SchnorrVerifier) ComputeChallenge

func (v *SchnorrVerifier) ComputeChallenge(raw []byte) (*math.Zr, error)

ComputeChallenge takes an array of bytes and returns the corresponding hash.

func (*SchnorrVerifier) RecomputeCommitment

func (v *SchnorrVerifier) RecomputeCommitment(zkp *SchnorrProof) (*math.G1, error)

RecomputeCommitment is called by the verifier. It takes a SchnorrProof and returns the corresponding randomness commitment.

func (*SchnorrVerifier) RecomputeCommitments

func (v *SchnorrVerifier) RecomputeCommitments(zkps []*SchnorrProof, challenge *math.Zr) ([]*math.G1, error)

type SigningIdentity

type SigningIdentity interface {
	driver.SigningIdentity
}

type Verifier

type Verifier interface {
	Verify([]byte) error
}

type WrappedSigningIdentity

type WrappedSigningIdentity struct {
	Identity view.Identity
	Signer   driver.Signer
}

func (*WrappedSigningIdentity) Serialize

func (w *WrappedSigningIdentity) Serialize() ([]byte, error)

func (*WrappedSigningIdentity) Sign

func (w *WrappedSigningIdentity) Sign(raw []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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