dkg

package
v0.0.0-...-05508b9 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcuateXi

func CalcuateXi(shares map[int]*big.Int) *big.Int

测试用 从本地收集的所有碎片计算 自己的xi,这是一个关键秘密信息

func CalculatePublicKey

func CalculatePublicKey(verifyPoints []*ecc.Point) (publicKeyPoint *ecc.Point, err error)

测试用

func CalculatePublicKeys

func CalculatePublicKeys(verifyPoints []*ecc.Point, allPartnerShares []*PartnerShares, threshold int) (publicKeysPoints []*ecc.Point, err error)

测试用

func GetPolynomialForSecretShareGenerate

func GetPolynomialForSecretShareGenerate(totalShareNumber, minimumShareNumber int) ([]*big.Int, error)

为产生本地秘密的私钥碎片做准备,预先生成好一个目标多项式 minimumShareNumber可以理解为threshold

func GetSpecifiedSecretShareByPolynomial

func GetSpecifiedSecretShareByPolynomial(poly []*big.Int, index *big.Int) *big.Int

为产生本地秘密的私钥碎片做准备,通过目标多项式和节点index生成对应的碎片

func GetVerifyPointByPolynomial

func GetVerifyPointByPolynomial(poly []*big.Int) (*ecc.Point, error)

为产生本地秘密的私钥碎片做准备,通过目标多项式生成验证点

func LocalPrivateKeyGenerate

func LocalPrivateKeyGenerate(shares []*big.Int) *ecdsa.PrivateKey

每个参与节点根据所收集的所有的与自己相关的碎片(自己的Index是X值,收集所有该X值对应的Y值), 来计算出自己的本地私钥xi(该X值对应的Y值之和),这是一个关键秘密信息 func LocalPrivateKeyGenerate(shares map[int]*big.Int) *ecdsa.PrivateKey {

func LocalPrivateSharesGather

func LocalPrivateSharesGather(allPartnerShares []*PartnerShares, localIndex int) []*big.Int

测试用 从收集的所有碎片中保存与自己相关的密钥部分,并保存在本地

func LocalSecretShareGenerateWithVerifyPoints

func LocalSecretShareGenerateWithVerifyPoints(totalShareNumber, minimumShareNumber int) (shares map[int]*big.Int, points []*ecc.Point, err error)

产生本地秘密的私钥碎片,可以把每个碎片理解为一个坐标点。 key: partner index,也就是x坐标, value: 实际数值,也就是y坐标 minimumShareNumber可以理解为threshold

func PublicKeyGenerate

func PublicKeyGenerate(verifyPoints []*ecc.Point) (*ecdsa.PublicKey, error)

根据所有潜在节点发布的验证点集合中的第一个元素(也就是秘密值的验证点),计算出公钥

func SecretShareLocalKeyGather

func SecretShareLocalKeyGather(allPartnerShares []*PartnerShares, localIndex int) (shares map[int]*big.Int)

测试用 从收集的所有碎片中保存与自己相关的密钥部分,并保存在本地

func SecretShareLocalKeyGenerateWithVerifyPoints

func SecretShareLocalKeyGenerateWithVerifyPoints(totalShareNumber, minimumShareNumber int, secret []byte) (shares map[int]*big.Int, points []*ecc.Point, err error)

测试用 产生本地秘密的私钥碎片,可以把每个碎片理解为一个坐标点。 key: partner index,也就是x坐标, value: 实际数值,也就是y坐标 minimumShareNumber可以理解为threshold

func SecretShareVerifyPointsGather

func SecretShareVerifyPointsGather(allPartnerShares []*PartnerShares, threshold int) (points []*ecc.Point, err error)

测试用 从收集的所有碎片中保存验证点部分,并保存在本地

Types

type PartnerPrivate

type PartnerPrivate struct {
	PublicInfo *PartnerPublic
	Xi         *big.Int
	// contains filtered or unexported fields
}

type PartnerPublic

type PartnerPublic struct {
	Index        int
	IndentityKey *big.Int
}

type PartnerShares

type PartnerShares struct {
	//		Index int
	PartnerInfo *PartnerPublic
	// key: partner index,也就是x坐标, value: 实际数值,也就是y坐标
	Shares map[int]*big.Int
	//		VerifyPoints map[*big.Int]*big.Int
	VerifyPoints []*ecc.Point
}

Jump to

Keyboard shortcuts

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