pvss

package
v0.0.0-...-52a804f Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESdecrypt

func AESdecrypt(key []byte, cipherText []byte) (message *[]byte, err error)

func AESencrypt

func AESencrypt(key []byte, plainText []byte) (c *[]byte, err error)

func CreateAndPrepareShares

func CreateAndPrepareShares(nodes []common.Node, secret big.Int, threshold int, privKey big.Int) ([]*common.SigncryptedOutput, *[]common.Point, error)

deprecated: use CreateShares and let client handle signcryption. Client may need to add more information before signcrypting (eg. broadcast id)

func CreateShares

func CreateShares(nodes []common.Node, secret big.Int, threshold int) (*[]common.PrimaryShare, *[]common.Point, error)

use this instead of CreateAndPrepareShares

func LagrangeScalar

func LagrangeScalar(shares []common.PrimaryShare, target int) *big.Int

func RandomBigInt

func RandomBigInt() *big.Int

func Signcrypt

func Signcrypt(recipientPubKey common.Point, data []byte, privKey big.Int) (*common.Signcryption, error)

func UnSignCrypt

func UnSignCrypt(signcryption common.Signcryption, privKey big.Int, senderPubKey common.Point) (*[]byte, error)

func UnsigncryptShare

func UnsigncryptShare(signcryption common.Signcryption, privKey big.Int, sendingNodePubKey common.Point) (*[]byte, error)

Types

type CSPaillierEC

type CSPaillierEC struct {
	SecParams *CSPaillierECSecParams

	PubKey *CSPaillierECPubKey
	SecKey *CSPaillierECSecKey
	// contains filtered or unexported fields
}

CSPaillierEC represents Camenisch-Shoup variant of Paillier to make it (Paillier) CCA2 secure. http://eprint.iacr.org/2002/161.pdf

func NewCSPaillierEC

func NewCSPaillierEC(secParams *CSPaillierECSecParams) *CSPaillierEC

func NewCSPaillierECFromPubKey

func NewCSPaillierECFromPubKey(pubKey *CSPaillierECPubKey) *CSPaillierEC

func NewCSPaillierECFromSecKey

func NewCSPaillierECFromSecKey(secKey *CSPaillierECSecKey) (*CSPaillierEC, error)

func (*CSPaillierEC) Abs

func (csp *CSPaillierEC) Abs(a *big.Int) (*big.Int, error)

func (*CSPaillierEC) Decrypt

func (csp *CSPaillierEC) Decrypt(u, e, v, label *big.Int) (*big.Int, error)

func (*CSPaillierEC) Encrypt

func (csp *CSPaillierEC) Encrypt(m, label *big.Int) (*big.Int, *big.Int, *big.Int, error)

Returns (u, e, v).

func (*CSPaillierEC) GetChallenge

func (csp *CSPaillierEC) GetChallenge() *big.Int

func (*CSPaillierEC) GetOpeningMsg

func (csp *CSPaillierEC) GetOpeningMsg(m *big.Int) (*big.Int, *Point)

Returns l = g1^m * h1^s where s is a random integer smaller than n/4.

func (*CSPaillierEC) GetProofData

func (csp *CSPaillierEC) GetProofData(c *big.Int) (*big.Int, *big.Int, *big.Int)

Prover should use this function to compute data for second (last) sigma protocol message.

func (*CSPaillierEC) GetProofRandomData

func (csp *CSPaillierEC) GetProofRandomData(u, e, label *big.Int) (*big.Int, *big.Int,
	*big.Int, *Point, *big.Int, error)

Prover (encryptor) should use this function to generate values for the first sigma protocol message.

func (*CSPaillierEC) SetProofRandomData

func (csp *CSPaillierEC) SetProofRandomData(u1, e1, v1 *big.Int, delta1 Point, l1, c *big.Int)

Verifier should call this function when it receives proof random data as the second protocol message.

func (*CSPaillierEC) SetVerifierEncData

func (csp *CSPaillierEC) SetVerifierEncData(u, e, v *big.Int, delta Point, label, l *big.Int)

Verifier should call this function when it receives l = g1^m * h1^s as the first protocol message.

func (*CSPaillierEC) Verify

func (csp *CSPaillierEC) Verify(rTilde, sTilde, mTilde *big.Int) bool

type CSPaillierECProverEncData

type CSPaillierECProverEncData struct {
	R *big.Int
	M *big.Int
}

type CSPaillierECProverRandomData

type CSPaillierECProverRandomData struct {
	S  *big.Int
	R1 *big.Int
	S1 *big.Int
	M1 *big.Int
}

type CSPaillierECPubKey

type CSPaillierECPubKey struct {
	N  *big.Int
	G  *big.Int
	Y1 *big.Int
	Y2 *big.Int
	Y3 *big.Int
	// the parameters below are for verifiable encryption
	Gamma                *secp256k1.KoblitzCurve // for discrete logarithm
	VerifiableEncGroupN  *big.Int
	VerifiableEncGroupG1 *big.Int
	VerifiableEncGroupH1 *big.Int
	K                    int
	K1                   int
}

CSPaillierECPubKey currently does not use auxiliary parameters/primes - no additional n, p, q parameters (as specified in a paper, original n, p, q can be used).

type CSPaillierECSecKey

type CSPaillierECSecKey struct {
	N  *big.Int
	G  *big.Int
	X1 *big.Int
	X2 *big.Int
	X3 *big.Int
	// the parameters below are for verifiable encryption
	Gamma                *secp256k1.KoblitzCurve // for discrete logarithm
	VerifiableEncGroupN  *big.Int
	VerifiableEncGroupG1 *big.Int
	VerifiableEncGroupH1 *big.Int
	K                    int
	K1                   int
}

type CSPaillierECSecParams

type CSPaillierECSecParams struct {
	L        int // length of p1 and q1 (l in a paper)
	RoLength int // ro is order of cyclic group Gamma (used for discrete logarithm)
	K        int // k in a paper; it must hold 2**K < min{p1, q1, ro}
	K1       int // k' in a paper; it must hold ro * 2**(K + K1 + 3) < n

}

type CSPaillierECVerifierEncData

type CSPaillierECVerifierEncData struct {
	U     *big.Int
	E     *big.Int
	V     *big.Int
	Label *big.Int
	Delta *Point
}

type CSPaillierECVerifierRandomData

type CSPaillierECVerifierRandomData struct {
	L      *big.Int
	U1     *big.Int
	E1     *big.Int
	V1     *big.Int
	Delta1 *Point
	L1     *big.Int
	C      *big.Int
}

type DLEQProof

type DLEQProof struct {
	C  big.Int      // challenge
	R  big.Int      // response
	VG common.Point // public commitment with respect to base point secp256k1.G
	VH common.Point // public commitment with respect to base point secp256k1.H
}

func GenerateDLEQProof

func GenerateDLEQProof(G common.Point, H common.Point, x big.Int) (p *DLEQProof, xG common.Point, xH common.Point)

func (*DLEQProof) Verify

func (p *DLEQProof) Verify(G common.Point, H common.Point, xG common.Point, xH common.Point) bool

type Point

type Point struct {
	X big.Int
	Y big.Int
}

type VerifiableEncGroupEC

type VerifiableEncGroupEC struct {
	*qr.RSASpecial
	G1 *big.Int
	H1 *big.Int
	// contains filtered or unexported fields
}

func NewVerifiableEncGroupEC

func NewVerifiableEncGroupEC(primes *qr.RSASpecialPrimes) (*VerifiableEncGroupEC, error)

Jump to

Keyboard shortcuts

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