pssign

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

This section is empty.

Types

type BlindSignRequest

type BlindSignRequest struct {
	// Pedersen commitment of a vector of messages
	Commitment *math.G1
	// Elgamal encryption of the committed messages
	Ciphertexts []*elgamal.Ciphertext
	// Proof of correctness of encryption and commitment
	Proof *EncProof
	// One-time Elgamal public key picked by the recipient
	EncPK *elgamal.PublicKey
}

BlindSignRequest is what the recipient send to the Pointcheval-Sanders signer to obtain the blind signature

type BlindSignResponse

type BlindSignResponse struct {
	// hash used in the  Pointcheval-Sanders signature
	Hash *math.Zr
	// this encrypts the Pointcheval-Sanders signature
	Ciphertext *elgamal.Ciphertext
}

BlindSignResponse is the response of the BlindSigner to a blind signature request

type BlindSigner

type BlindSigner struct {
	// Signer is a Pointcheval-Sanders signer
	*Signer
	// PedersenParameters is the generators used to commit to the vector
	// of messages to be signed
	PedersenParameters []*math.G1
}

BlindSigner produces Pointcheval-Sanders blind signatures

func NewBlindSigner

func NewBlindSigner(SK []*math.Zr, PK []*math.G2, Q *math.G2, pp []*math.G1, curve *math.Curve) *BlindSigner

NewBlindSigner returns a Pointcheval-Sanders BlindSigner as a function of the passed arguments

func (*BlindSigner) BlindSign

func (s *BlindSigner) BlindSign(request *BlindSignRequest) (*BlindSignResponse, error)

BlindSign takes as input a BlindSignRequest and returns the corresponding BlindSignResponse, if the request is valid. Else, BlindSign returns an error

type EncProof

type EncProof struct {
	// ZKP of knowledge of committed/encrypted messages
	Messages []*math.Zr
	// ZKP of knowledge of randomness used in the encryption
	EncRandomness []*math.Zr
	// ZKP of knowledge of the randomness (blinding factor) used in the commitment
	ComBlindingFactor *math.Zr
	// ZKP challenge
	Challenge *math.Zr
}

EncProof is a zero-knowledge proof of correct encryption of committed messages It consists of zero-knowledge proofs of knowledge of messages that open a commitment and proofs of correct encryption of the same messages under a known Elgamal public key

type EncProofCommitments

type EncProofCommitments struct {
	C1         []*math.G1
	C2         []*math.G1
	Commitment *math.G1
}

EncProofCommitments contains the commitments to EncProof randomness For a statement (x1, ..., x_n): y = \prod_{i=1}^n g_i^x_i, one computes s = \prod_{i=1}^n g_i^r_i as the commitment to randomness (r_1, ..., r_n)

type Recipient

type Recipient struct {
	*SignVerifier
	// Elgamal encryption secret key
	// This is used to decrypt the blind signature
	EncSK *elgamal.SecretKey
	// encWitness coresponds to the message and the randomness used to
	// encrypt the blind signature request
	Witness *encWitness
	// Elliptic curve
	Curve *math.Curve
	// contains filtered or unexported fields
}

Recipient requests a Pointcheval-Sanders blind signature Recipient would like to obtain a Pointcheval-Sanders signature on a committed vector of messages

func NewRecipient

func NewRecipient(messages []*math.Zr, blindingfactor *math.Zr, com *math.G1, sk *math.Zr, gen, pk *math.G1, pp []*math.G1, PK []*math.G2, Q *math.G2, curve *math.Curve) *Recipient

NewRecipient returns a Recipient that would like to obtain a Pointcheval-Sanders blind signature on the passed messages

func (*Recipient) GenerateBlindSignRequest

func (r *Recipient) GenerateBlindSignRequest() (*BlindSignRequest, error)

GenerateBlindSignRequest returns a blind Pointcheval-Sanders signature request

func (*Recipient) Prove

func (r *Recipient) Prove() (*EncProof, error)

Prove produces a serialized EncProof

func (*Recipient) VerifyResponse

func (r *Recipient) VerifyResponse(response *BlindSignResponse) (*Signature, error)

VerifyResponse returns a Pointcheval-Sanders signature if the BlindSingResponse is valid. Else, it returns error.

type SignVerifier

type SignVerifier struct {
	PK    []*math.G2
	Q     *math.G2
	Curve *math.Curve
}

SignVerifier checks the validity of a Pointcheval-Sanders signature

func NewVerifier

func NewVerifier(PK []*math.G2, Q *math.G2, c *math.Curve) *SignVerifier

NewVerifier returns a SignVerifier as a function of an array of public kets

func (*SignVerifier) Randomize

func (v *SignVerifier) Randomize(sig *Signature) error

Randomize randomizes a Pointcheval-Sanders signature

func (*SignVerifier) Verify

func (v *SignVerifier) Verify(m []*math.Zr, sig *Signature) error

Verify takes a vector of messages and a signature, and validates it against SignVerifier Verify returns an error if the signature is invalid Verify checks if e(R, PK_0*\prod_{i=1}^n PK_i^{m_i}*PK_{n+1}^{m_{n+1}}) = e(S, Q)

type Signature

type Signature struct {
	R *math.G1
	S *math.G1
}

Signature is a Pointcheval-Sanders signature

func (*Signature) Copy

func (sig *Signature) Copy(sigma *Signature)

Copy copies a Pointcheval-Sanders signature

func (*Signature) Deserialize

func (sig *Signature) Deserialize(bytes []byte) error

Deserialize unmarshals a Pointcheval-Sanders signature

func (*Signature) Serialize

func (sig *Signature) Serialize() ([]byte, error)

Serialize marshals a Pointcheval-Sanders signature

type Signer

type Signer struct {
	*SignVerifier
	SK []*math.Zr
}

Signer produces a Pointcheval-Sanders signature

func NewSigner

func NewSigner(SK []*math.Zr, PK []*math.G2, Q *math.G2, c *math.Curve) *Signer

NewSigner returns a Signer as function of an array of secret keys and the corresponding array of public keys

func (*Signer) Deserialize

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

Deserialize un-marshals Pointcheval-Sanders Signer

func (*Signer) KeyGen

func (s *Signer) KeyGen(length int) error

KeyGen instantiates Signer secret and public keys as a function of the length of the vector of messages to be signed KeyGen takes the length of vector of messages that Signer would like to sign

func (*Signer) Serialize

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

Serialize marshals Pointcheval-Sanders Signer

func (*Signer) Sign

func (s *Signer) Sign(m []*math.Zr) (*Signature, error)

Sign returns a Pointcheval-Sanders signature for the vector of messages passed as argument

Jump to

Keyboard shortcuts

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