coconutworker

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package coconutworker is a wrapper for computing coconut-related operations concurrently, such that the callee does not need to be concerned with system-wide params.

Package coconutworker provides the functionalities required to use the Coconut scheme concurrently.

Package coconutworker provides the functionalities required to use the Coconut scheme concurrently.

Package coconutworker provides the functionalities required to use the Coconut scheme concurrently.

Package coconutworker provides the functionalities required to use the Coconut scheme concurrently.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoconutWorker

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

CoconutWorker allows writing coconut actions to a shared job queue, so that they could be run concurrently.

func New

func New(jobQueue chan<- *jobpacket.JobPacket, params *coconut.Params) *CoconutWorker

New creates new instance of a coconutWorker.

func (*CoconutWorker) AggregateSignatures

func (cw *CoconutWorker) AggregateSignatures(params *MuxParams,
	sigs []*coconut.Signature,
	pp *coconut.PolynomialPoints,
) *coconut.Signature

AggregateSignatures aggregates Coconut credentials on the same set of attributes that were produced by multiple signing authorities. Optionally it does so in a threshold manner.

func (*CoconutWorker) AggregateSignaturesWrapper

func (cw *CoconutWorker) AggregateSignaturesWrapper(sigs []*coconut.Signature, pp *coconut.PolynomialPoints) *coconut.Signature

AggregateSignaturesWrapper wraps the provided arguments with pre-generated params. nolint: lll

func (*CoconutWorker) AggregateVerificationKeys

func (cw *CoconutWorker) AggregateVerificationKeys(params *MuxParams,
	vks []*coconut.VerificationKey,
	pp *coconut.PolynomialPoints,
) *coconut.VerificationKey

AggregateVerificationKeys aggregates verification keys of the signing authorities. Optionally it does so in a threshold manner.

func (*CoconutWorker) AggregateVerificationKeysWrapper

func (cw *CoconutWorker) AggregateVerificationKeysWrapper(vks []*coconut.VerificationKey, pp *coconut.PolynomialPoints) *coconut.VerificationKey

AggregateVerificationKeysWrapper wraps the provided arguments with pre-generated params. nolint: lll

func (*CoconutWorker) BlindSign

func (cw *CoconutWorker) BlindSign(params *MuxParams,
	sk *coconut.SecretKey,
	lambda *coconut.Lambda,
	egPub *elgamal.PublicKey,
	pubM []*Curve.BIG,
) (*coconut.BlindedSignature, error)

BlindSign creates a blinded Coconut credential on the attributes provided to PrepareBlindSign.

func (*CoconutWorker) BlindSignWrapper

func (cw *CoconutWorker) BlindSignWrapper(sk *coconut.SecretKey, l *coconut.Lambda, egPub *elgamal.PublicKey, pubM []*Curve.BIG) (*coconut.BlindedSignature, error)

BlindSignWrapper wraps the provided arguments with pre-generated params. nolint: lll

func (*CoconutWorker) BlindVerify

func (cw *CoconutWorker) BlindVerify(params *MuxParams,
	vk *coconut.VerificationKey,
	sig *coconut.Signature,
	theta *coconut.Theta,
	pubM []*Curve.BIG,
) bool

BlindVerify verifies the Coconut credential on the private and optional public attributes.

func (*CoconutWorker) BlindVerifyTumbler

func (cw *CoconutWorker) BlindVerifyTumbler(
	params *MuxParams,
	vk *coconut.VerificationKey,
	sig *coconut.Signature,
	theta *coconut.ThetaTumbler,
	pubM []*Curve.BIG,
	address []byte,
) bool

BlindVerifyTumbler verifies the Coconut credential on the private and optional public attributes. It also checks the attached proof. It is designed to work for the tumbler system.

func (*CoconutWorker) BlindVerifyTumblerWrapper

func (cw *CoconutWorker) BlindVerifyTumblerWrapper(
	vk *coconut.VerificationKey,
	sig *coconut.Signature,
	theta *coconut.ThetaTumbler,
	pubM []*Curve.BIG,
	address []byte,
) bool

BlindVerifyTumblerWrapper wraps the provided arguments with pre-generated params.

func (*CoconutWorker) BlindVerifyWrapper

func (cw *CoconutWorker) BlindVerifyWrapper(vk *coconut.VerificationKey, sig *coconut.Signature, t *coconut.Theta, pubM []*Curve.BIG) bool

BlindVerifyWrapper wraps the provided arguments with pre-generated params. nolint: lll

func (*CoconutWorker) ConstructKappaNu

func (cw *CoconutWorker) ConstructKappaNu(vk *coconut.VerificationKey,
	sig *coconut.Signature,
	privM []*Curve.BIG,
	t *Curve.BIG,
) (*Curve.ECP2, *Curve.ECP, error)

ConstructKappaNu creates Kappa and Nu based on values in the signature to allow for proofs with different application-specific predicates by not tying it to Show protocol

func (*CoconutWorker) ConstructSignerProof

func (cw *CoconutWorker) ConstructSignerProof(params *MuxParams,
	gamma *Curve.ECP,
	encs []*elgamal.Encryption,
	cm *Curve.ECP,
	k []*Curve.BIG,
	r *Curve.BIG,
	pubM []*Curve.BIG,
	privM []*Curve.BIG,
) (*coconut.SignerProof, error)

ConstructSignerProof creates a non-interactive zero-knowledge proof to prove corectness of ciphertexts and cm. nolint: gocyclo, lll

func (*CoconutWorker) ConstructTumblerProof

func (cw *CoconutWorker) ConstructTumblerProof(
	params *MuxParams,
	vk *coconut.VerificationKey,
	sig *coconut.Signature,
	privM []*Curve.BIG,
	t *Curve.BIG,
	address []byte,
) (*coconut.TumblerProof, error)

ConstructTumblerProof constructs a zero knowledge proof required to implement Coconut's coin tumbler (https://arxiv.org/pdf/1802.07344.pdf). It proves knowledge of all private attributes in the credential and binds the proof to the address. Note that the first privM parameter HAS TO be coin's sequence number since the zeta is later revealed. loosely based on: https://github.com/asonnino/coconut-chainspace/blob/master/contracts/tumbler_proofs.py TODO: NEED SOMEBODY TO VERIFY CORECTNESS OF IMPLEMENTATION

func (*CoconutWorker) ConstructVerifierProof

func (cw *CoconutWorker) ConstructVerifierProof(params *MuxParams,
	vk *coconut.VerificationKey,
	sig *coconut.Signature,
	privM []*Curve.BIG,
	t *Curve.BIG,
) (*coconut.VerifierProof, error)

ConstructVerifierProof creates a non-interactive zero-knowledge proof in order to prove corectness of kappa and nu.

func (*CoconutWorker) ElGamalDecrypt

func (cw *CoconutWorker) ElGamalDecrypt(params *MuxParams, pk *elgamal.PrivateKey, enc *elgamal.Encryption) *Curve.ECP

ElGamalDecrypt takes the ElGamal encryption of a message and returns a point on the G1 curve that represents original h^m.

func (*CoconutWorker) ElGamalDecryptWrapper

func (cw *CoconutWorker) ElGamalDecryptWrapper(pk *elgamal.PrivateKey, enc *elgamal.Encryption) *Curve.ECP

ElGamalDecryptWrapper wraps the provided arguments with pre-generated params.

func (*CoconutWorker) ElGamalEncrypt

func (cw *CoconutWorker) ElGamalEncrypt(params *MuxParams, pub *elgamal.PublicKey, m *Curve.BIG, h *Curve.ECP) *elgamal.EncryptionResult

ElGamalEncrypt encrypts the given message in the form of h^m, where h is a point on the G1 curve using the given public key. The random k is returned alongside the encryption as it is required by the Coconut Scheme to create proofs of knowledge. nolint: lll

func (*CoconutWorker) ElGamalEncryptWrapper

func (cw *CoconutWorker) ElGamalEncryptWrapper(pub *elgamal.PublicKey, m *Curve.BIG, h *Curve.ECP) *elgamal.EncryptionResult

ElGamalEncryptWrapper wraps the provided arguments with pre-generated params. nolint: lll

func (*CoconutWorker) ElGamalKeygen

func (cw *CoconutWorker) ElGamalKeygen(params *MuxParams) (*elgamal.PrivateKey, *elgamal.PublicKey)

ElGamalKeygen generates private and public keys required for ElGamal encryption scheme.

func (*CoconutWorker) ElGamalKeygenWrapper

func (cw *CoconutWorker) ElGamalKeygenWrapper() (*elgamal.PrivateKey, *elgamal.PublicKey)

ElGamalKeygenWrapper wraps the provided arguments with pre-generated params.

func (*CoconutWorker) Keygen

Keygen generates a single Coconut keypair ((x, y1, y2...), (g2, g2^x, g2^y1, ...)). It is not suitable for threshold credentials as all generated keys are independent of each other.

func (*CoconutWorker) PrepareBlindSign

func (cw *CoconutWorker) PrepareBlindSign(params *MuxParams,
	egPub *elgamal.PublicKey,
	pubM []*Curve.BIG,
	privM []*Curve.BIG,
) (*coconut.Lambda, error)

PrepareBlindSign builds cryptographic material for blind sign. It returns commitment to the private and public attributes, encryptions of the private attributes and zero-knowledge proof asserting corectness of the above.

func (*CoconutWorker) PrepareBlindSignTokenWrapper

func (cw *CoconutWorker) PrepareBlindSignTokenWrapper(egPub *elgamal.PublicKey, token *token.Token) (*coconut.Lambda, error)

PrepareBlindSignTokenWrapper wraps the provided arguments with pre-generated params and unwraps attributes embedded in the token. nolint: lll

func (*CoconutWorker) PrepareBlindSignWrapper

func (cw *CoconutWorker) PrepareBlindSignWrapper(egPub *elgamal.PublicKey, pubM []*Curve.BIG, privM []*Curve.BIG) (*coconut.Lambda, error)

PrepareBlindSignWrapper wraps the provided arguments with pre-generated params. nolint: lll

func (*CoconutWorker) RandomBIG

func (cw *CoconutWorker) RandomBIG() *Curve.BIG

RandomBIG generates a pseudorandom BIG number.

func (*CoconutWorker) Randomize

func (cw *CoconutWorker) Randomize(params *MuxParams, sig *coconut.Signature) *coconut.Signature

FIXME: spelling Randomize randomises the Coconut credential such that it becomes indistinguishable from a fresh credential on different attributes

func (*CoconutWorker) RandomizeWrapper

func (cw *CoconutWorker) RandomizeWrapper(sig *coconut.Signature) *coconut.Signature

RandomizeWrapper wraps the provided arguments with pre-generated params.

func (*CoconutWorker) Setup

func (cw *CoconutWorker) Setup(q int) (*MuxParams, error)

Setup generates the public parameters required by the Coconut scheme. q indicates the maximum number of attributes that can be embed in the credentials.

func (*CoconutWorker) ShowBlindSignature

func (cw *CoconutWorker) ShowBlindSignature(params *MuxParams,
	vk *coconut.VerificationKey,
	sig *coconut.Signature,
	privM []*Curve.BIG) (*coconut.Theta, error)

ShowBlindSignature builds cryptographic material required for blind verification. It returns kappa and nu - group elements needed to perform verification and zero-knowledge proof asserting corectness of the above.

func (*CoconutWorker) ShowBlindSignatureTumbler

func (cw *CoconutWorker) ShowBlindSignatureTumbler(
	params *MuxParams,
	vk *coconut.VerificationKey,
	sig *coconut.Signature,
	privM []*Curve.BIG,
	address []byte,
) (*coconut.ThetaTumbler, error)

ShowBlindSignatureTumbler builds cryptographic material required for blind verification for the tumbler. It returns kappa, nu and zeta - group elements needed to perform verification and zero-knowledge proof asserting corectness of the above. The proof is bound to the provided address.

func (*CoconutWorker) ShowBlindSignatureTumblerWrapper

func (cw *CoconutWorker) ShowBlindSignatureTumblerWrapper(
	vk *coconut.VerificationKey,
	sig *coconut.Signature,
	privM []*Curve.BIG,
	address []byte,
) (*coconut.ThetaTumbler, error)

ShowBlindSignatureTumblerWrapper wraps the provided arguments with pre-generated params.

func (*CoconutWorker) ShowBlindSignatureWrapper

func (cw *CoconutWorker) ShowBlindSignatureWrapper(vk *coconut.VerificationKey, sig *coconut.Signature, privM []*Curve.BIG) (*coconut.Theta, error)

ShowBlindSignatureWrapper wraps the provided arguments with pre-generated params. nolint: lll

func (*CoconutWorker) Sign

func (cw *CoconutWorker) Sign(params *MuxParams, sk *coconut.SecretKey, pubM []*Curve.BIG) (*coconut.Signature, error)

Sign creates a Coconut credential under a given secret key on a set of public attributes only.

func (*CoconutWorker) SignWrapper

func (cw *CoconutWorker) SignWrapper(sk *coconut.SecretKey, pubM []*Curve.BIG) (*coconut.Signature, error)

SignWrapper wraps the provided arguments with pre-generated params.

func (*CoconutWorker) TTPKeygen

TTPKeygen generates a set of n Coconut keypairs [((x, y1, y2...), (g2, g2^x, g2^y1, ...)), ...], such that they support threshold aggregation of t parties. It is expected that this procedure is executed by a Trusted Third Party.

func (*CoconutWorker) Unblind

func (cw *CoconutWorker) Unblind(params *MuxParams,
	blindedSignature *coconut.BlindedSignature,
	egPub *elgamal.PrivateKey,
) *coconut.Signature

Unblind unblinds the blinded Coconut credential.

func (*CoconutWorker) UnblindWrapper

func (cw *CoconutWorker) UnblindWrapper(blindedSignature *coconut.BlindedSignature, egPub *elgamal.PrivateKey) *coconut.Signature

UnblindWrapper wraps the provided arguments with pre-generated params. nolint: lll

func (*CoconutWorker) Verify

func (cw *CoconutWorker) Verify(params *MuxParams,
	vk *coconut.VerificationKey,
	pubM []*Curve.BIG,
	sig *coconut.Signature,
) bool

Verify verifies the Coconut credential that has been either issued exlusiviely on public attributes or all private attributes have been publicly revealed.

func (*CoconutWorker) VerifySignerProof

func (cw *CoconutWorker) VerifySignerProof(params *MuxParams, gamma *Curve.ECP, signMats *coconut.Lambda) bool

VerifySignerProof verifies non-interactive zero-knowledge proofs in order to check corectness of ciphertexts and cm.

func (*CoconutWorker) VerifyTumblerProof

func (cw *CoconutWorker) VerifyTumblerProof(
	params *MuxParams,
	vk *coconut.VerificationKey,
	sig *coconut.Signature,
	theta *coconut.ThetaTumbler,
	address []byte,
) bool

VerifyTumblerProof verifies non-interactive zero-knowledge proofs in order to check corectness of kappa, nu and zeta.

func (*CoconutWorker) VerifyVerifierProof

func (cw *CoconutWorker) VerifyVerifierProof(params *MuxParams,
	vk *coconut.VerificationKey,
	sig *coconut.Signature,
	theta *coconut.Theta,
) bool

VerifyVerifierProof verifies non-interactive zero-knowledge proofs in order to check corectness of kappa and nu.

func (*CoconutWorker) VerifyWrapper

func (cw *CoconutWorker) VerifyWrapper(vk *coconut.VerificationKey, pubM []*Curve.BIG, sig *coconut.Signature) bool

VerifyWrapper wraps the provided arguments with pre-generated params.

type MuxParams

type MuxParams struct {
	*coconut.Params
	sync.Mutex
}

MuxParams is identical to normal params, but has an attached mutex, so that rng in bpgroup could be shared safely.

Jump to

Keyboard shortcuts

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