dkg

package
v0.0.0-...-f6df52c Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BIGINT_BASE = 16
View Source
const INTERNAL_DATA_FILE = "internal.json"
View Source
const POINT_ELEMENTS = 4

Variables

This section is empty.

Functions

func CalculatePrivateCommitment

func CalculatePrivateCommitment(curve CurveSystem, index *big.Int, pubCommit []Point) Point

CalculatePrivateCommitment calculates the commitment to the private commitment of participant with index pubCommit (G1/G2) is the public commitments of the participant represented by index

func CoefficientGen

func CoefficientGen(curve CurveSystem) (*big.Int, Point, Point, error)

CoefficientGen generates a coefficient secret (*big.Int) and points (commitments) in G1 and G2

func Decrypt

func Decrypt(curve CurveSystem, sk *big.Int, encrypterPk Point, dataToDec *big.Int) *big.Int

Decrypt decrypts a big integer

func Encrypt

func Encrypt(curve CurveSystem, sk *big.Int, decrypterPk Point, dataToEnc *big.Int) *big.Int

Encrypt encrypts a big integer

func GetAllPublicKey

func GetAllPublicKey(curve CurveSystem, threshold int, pubCommitG2 [][]Point) []Point

GetAllPublicKey returns all participants' public keys pubCommitG2 is the public commitments of all praticipants (composed of (t+1)*n points)!

func GetGroupPublicKey

func GetGroupPublicKey(curve CurveSystem, pubCommitG2 []Point) Point

GetGroupPublicKey turns the public commitments from G2 group of all participants to the group's PK (in G2). The pubCommitG2 is composed of n points each are the commitments to the zero'th coefficient (the first coefficient)

func GetPrivateCommitment

func GetPrivateCommitment(curve CurveSystem, ind *big.Int, coefficients []*big.Int) *big.Int

GetPrivateCommitment returns a private commitment in the index ind. There should be t+1 coefficients

func GetSecretKey

func GetSecretKey(prvCommits []*big.Int) *big.Int

GetSecretKey returns the secret key generated after the DKG scheme has done

func GetSpecificPublicKey

func GetSpecificPublicKey(curve CurveSystem, index *big.Int, threshold int, pubCommitG2 [][]Point) Point

GetSpecificPublicKey returns a specific participant (index) public key pubCommitG2 is the public commitments of all praticipants (composed of (t+1)*n points)!

func Init

func Init()

func LoadPublicKeyG1

func LoadPublicKeyG1(curve CurveSystem, sk *big.Int) Point

LoadPublicKeyG1 turns secret key into a public key of type Point1

func SignAndVerify

func SignAndVerify(curve CurveSystem, threshold int, n int, data *DataForCommit) (bool, error)

func SignatureReconstruction

func SignatureReconstruction(curve CurveSystem, sigs []Point, signersIndices []*big.Int) (Point, error)

SignatureReconstruction reconstructs the group signature out of t+1 verified signatures signersIndices[i] should be the index of the signer the signed sigs[i] e.g., if we have 3 signatures (sigs=[0x..,0x..,0x..]) signed by 5,1 and 2 respectivly then signersIndices=[5,1,2]

func VerifyPrivateCommitment

func VerifyPrivateCommitment(curve CurveSystem, myIndex *big.Int, prvCommit *big.Int, pubCommitG1 []Point) bool

VerifyPrivateCommitment verifies the private commitment from some participant (j) myIndex is the index of the caller (not j - the other examined participant!) prvCommit is the private commitment from j (to the accuser, of course) pubCommitG1 is all the G1's public commitments from j

func VerifyPrvCommitment

func VerifyPrvCommitment(curve CurveSystem, threshold int, n int, data *DataForCommit) (bool, error)

This is for the Complaint flow only - don't call it for now

func VerifyPublicCommitment

func VerifyPublicCommitment(curve CurveSystem, pubCommitG1 Point, pubCommitG2 Point) bool

VerifyPublicCommitment verifies using pairing that a commitment to a secret (x) using a point on G1 (i.e, x*g1) is the same secret on a committed G2 point (i.e, x*g2).

Types

type DataForCommit

type DataForCommit struct {
	CoefficientsAll [][]*big.Int
	PubCommitG1All  [][]Point
	PubCommitG2All  [][]Point
	PrvCommitAll    [][]*big.Int
}

func GetCommitDataForAllParticipants

func GetCommitDataForAllParticipants(curve CurveSystem, threshold int, n int) (*DataForCommit, error)

type JsonDataForCommit

type JsonDataForCommit struct {
	CoefficientsAll [][]string
	PubCommitG1All  [][][]string
	PubCommitG2All  [][][]string
	PrvCommitAll    [][]string
}

Jump to

Keyboard shortcuts

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