ec2

package
v0.0.0-...-eb4c3ac Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIdNoEqualN = errors.New("[ERROR]: the length of input ids is not equal to the share number n.")

var ErrShareNotPass = errors.New("[ERROR]: the set of shares contain invalid share.")

View Source
var ErrMessageTooLong = errors.New("[ERROR]: message is too long.")
View Source
var ErrShareNotEnough = errors.New("[ERROR]: the shares is not enough to satisfy the threshold.")

Functions

func Combine

func Combine(shares []*ShareStruct) (*big.Int, error)

func GenerateKeyPair

func GenerateKeyPair(length int) (*PublicKey, *PrivateKey)

func GetSharesId

func GetSharesId(ss *ShareStruct) *big.Int

func Vss

func Vss(secret *big.Int, ids []*big.Int, t int, n int) (*PolyGStruct, *PolyStruct, []*ShareStruct, error)

func ZkUVerify

func ZkUVerify(uG []*big.Int, zkUProof *ZkUProof) bool

Types

type Commitment

type Commitment struct {
	C *big.Int
	D []*big.Int
}

func (*Commitment) Commit

func (commitment *Commitment) Commit(secrets ...*big.Int) *Commitment

func (*Commitment) DeCommit

func (commitment *Commitment) DeCommit() (bool, []*big.Int)

func (*Commitment) Verify

func (commitment *Commitment) Verify() bool

type MtAZK1Proof

type MtAZK1Proof struct {
	Z  *big.Int
	U  *big.Int
	W  *big.Int
	S  *big.Int
	S1 *big.Int
	S2 *big.Int
}

func MtAZK1Prove

func MtAZK1Prove(m *big.Int, r *big.Int, publicKey *PublicKey, zkFactProof *ZkFactProof) *MtAZK1Proof

func MtAZK1Prove(m *big.Int, r *big.Int, publicKey *paillier.PublicKey, zkFactProof *paillier.ZkFactProof) *MtAZK1Proof {

func (*MtAZK1Proof) MtAZK1Verify

func (mtAZK1Proof *MtAZK1Proof) MtAZK1Verify(c *big.Int, publicKey *PublicKey, zkFactProof *ZkFactProof) bool

func (mtAZK1Proof *MtAZK1Proof) MtAZK1Verify(c *big.Int, publicKey *paillier.PublicKey, zkFactProof *paillier.ZkFactProof) bool {

type MtAZK2Proof

type MtAZK2Proof struct {
	Z    *big.Int
	ZBar *big.Int
	T    *big.Int
	V    *big.Int
	W    *big.Int
	S    *big.Int
	S1   *big.Int
	S2   *big.Int
	T1   *big.Int
	T2   *big.Int
}

func MtAZK2Prove

func MtAZK2Prove(x *big.Int, y *big.Int, r *big.Int, c1 *big.Int, publicKey *PublicKey, zkFactProof *ZkFactProof) *MtAZK2Proof

func MtAZK2Prove(x *big.Int, y *big.Int, r *big.Int, c1 *big.Int, publicKey *paillier.PublicKey, zkFactProof *paillier.ZkFactProof) *MtAZK2Proof {

func (*MtAZK2Proof) MtAZK2Verify

func (mtAZK2Proof *MtAZK2Proof) MtAZK2Verify(c1 *big.Int, c2 *big.Int, publicKey *PublicKey, zkFactProof *ZkFactProof) bool

func (mtAZK2Proof *MtAZK2Proof) MtAZK2Verify(c1 *big.Int, c2 *big.Int, publicKey *paillier.PublicKey, zkFactProof *paillier.ZkFactProof) bool {

type PolyGStruct

type PolyGStruct struct {
	T     int          // threshold
	N     int          // total num
	PolyG [][]*big.Int //x and y
}

type PolyStruct

type PolyStruct struct {
	PolyGStruct
	Poly []*big.Int // coefficient set
}

type PrivateKey

type PrivateKey struct {
	Length string
	PublicKey
	L *big.Int // (p-1)*(q-1)
	U *big.Int // L^-1 mod N
}

func (*PrivateKey) Decrypt

func (privateKey *PrivateKey) Decrypt(cipherBigInt *big.Int) (*big.Int, error)

func (*PrivateKey) ZkFactProve

func (privateKey *PrivateKey) ZkFactProve() *ZkFactProof

type PublicKey

type PublicKey struct {
	Length string
	N      *big.Int // n = p*q, where p and q are prime
	G      *big.Int // in practical, G = N + 1
	N2     *big.Int // N2 = N * N
}

func (*PublicKey) Encrypt

func (publicKey *PublicKey) Encrypt(mBigInt *big.Int) (*big.Int, *big.Int, error)

func (publicKey *PublicKey) Encrypt(mBigInt *big.Int) (*big.Int, error) {

func (*PublicKey) HomoAdd

func (publicKey *PublicKey) HomoAdd(c1, c2 *big.Int) *big.Int

func (*PublicKey) HomoMul

func (publicKey *PublicKey) HomoMul(cipher, k *big.Int) *big.Int

func (*PublicKey) ZkFactVerify

func (publicKey *PublicKey) ZkFactVerify(zkFactProof *ZkFactProof) bool

type ShareStruct

type ShareStruct struct {
	T     int
	Id    *big.Int // ID, x coordinate
	Share *big.Int
}

func (*ShareStruct) Verify

func (share *ShareStruct) Verify(polyG *PolyGStruct) bool

type ZkFactProof

type ZkFactProof struct {
	H1 *big.Int
	H2 *big.Int
	Y  *big.Int // r+(n-\phi(n))*e
	E  *big.Int
	N  *big.Int
}

type ZkUProof

type ZkUProof struct {
	E *big.Int
	S *big.Int
}

func ZkUProve

func ZkUProve(u *big.Int) *ZkUProof

Jump to

Keyboard shortcuts

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