Documentation ¶
Index ¶
- Constants
- func CalculatePrivateCommitment(curve CurveSystem, index *big.Int, pubCommit []Point) Point
- func CoefficientGen(curve CurveSystem) (*big.Int, Point, Point, error)
- func Decrypt(curve CurveSystem, sk *big.Int, encrypterPk Point, dataToDec *big.Int) *big.Int
- func Encrypt(curve CurveSystem, sk *big.Int, decrypterPk Point, dataToEnc *big.Int) *big.Int
- func GetAllPublicKey(curve CurveSystem, threshold int, pubCommitG2 [][]Point) []Point
- func GetGroupPublicKey(curve CurveSystem, pubCommitG2 []Point) Point
- func GetPrivateCommitment(curve CurveSystem, ind *big.Int, coefficients []*big.Int) *big.Int
- func GetSecretKey(prvCommits []*big.Int) *big.Int
- func GetSpecificPublicKey(curve CurveSystem, index *big.Int, threshold int, pubCommitG2 [][]Point) Point
- func Init()
- func LoadPublicKeyG1(curve CurveSystem, sk *big.Int) Point
- func SignAndVerify(curve CurveSystem, threshold int, n int, data *DataForCommit) (bool, error)
- func SignatureReconstruction(curve CurveSystem, sigs []Point, signersIndices []*big.Int) (Point, error)
- func VerifyPrivateCommitment(curve CurveSystem, myIndex *big.Int, prvCommit *big.Int, pubCommitG1 []Point) bool
- func VerifyPrvCommitment(curve CurveSystem, threshold int, n int, data *DataForCommit) (bool, error)
- func VerifyPublicCommitment(curve CurveSystem, pubCommitG1 Point, pubCommitG2 Point) bool
- type DataForCommit
- type JsonDataForCommit
Constants ¶
const BIGINT_BASE = 16
const INTERNAL_DATA_FILE = "internal.json"
const POINT_ELEMENTS = 4
Variables ¶
This section is empty.
Functions ¶
func CalculatePrivateCommitment ¶
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 ¶
CoefficientGen generates a coefficient secret (*big.Int) and points (commitments) in G1 and G2
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 ¶
GetPrivateCommitment returns a private commitment in the index ind. There should be t+1 coefficients
func GetSecretKey ¶
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 LoadPublicKeyG1 ¶
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)