keygen

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// To change these parameters, you must first delete the text fixture files in test/_fixtures/ and then run the keygen test alone.
	// Then the signing and resharing tests will work with the new n, t configuration using the newly written fixture files.
	TestParticipants = test.TestParticipants
	TestThreshold    = test.TestParticipants / 2
)
View Source
const (
	TaskName = "ecdsa-keygen"
)

Variables

View Source
var File_protob_ecdsa_keygen_proto protoreflect.FileDescriptor

Functions

func LoadNTildeH1H2FromTestFixture

func LoadNTildeH1H2FromTestFixture(idx int) (NTildei, h1i, h2i *big.Int, err error)

func NewKGRound1Message

func NewKGRound1Message(
	from *tss.PartyID,
	ct cmt.HashCommitment,
	paillierPK *paillier.PublicKey,
	nTildeI, h1I, h2I *big.Int,
	dlnProof1, dlnProof2 *dlnproof.Proof,
) (tss.ParsedMessage, error)

func NewKGRound2Message1

func NewKGRound2Message1(
	to, from *tss.PartyID,
	share *vss.Share,
) tss.ParsedMessage

func NewKGRound2Message2

func NewKGRound2Message2(
	from *tss.PartyID,
	deCommitment cmt.HashDeCommitment,
) tss.ParsedMessage

func NewKGRound3Message

func NewKGRound3Message(
	from *tss.PartyID,
	proof paillier.Proof,
) tss.ParsedMessage

func NewLocalParty

func NewLocalParty(
	params *tss.Parameters,
	out chan<- tss.Message,
	end chan<- LocalPartySaveData,
	optionalPreParams ...LocalPreParams,
) tss.Party

Exported, used in `tss` client

Types

type KGRound1Message

type KGRound1Message struct {
	Commitment []byte   `protobuf:"bytes,1,opt,name=commitment,proto3" json:"commitment,omitempty"`
	PaillierN  []byte   `protobuf:"bytes,2,opt,name=paillier_n,json=paillierN,proto3" json:"paillier_n,omitempty"`
	NTilde     []byte   `protobuf:"bytes,3,opt,name=n_tilde,json=nTilde,proto3" json:"n_tilde,omitempty"`
	H1         []byte   `protobuf:"bytes,4,opt,name=h1,proto3" json:"h1,omitempty"`
	H2         []byte   `protobuf:"bytes,5,opt,name=h2,proto3" json:"h2,omitempty"`
	Dlnproof_1 [][]byte `protobuf:"bytes,6,rep,name=dlnproof_1,json=dlnproof1,proto3" json:"dlnproof_1,omitempty"`
	Dlnproof_2 [][]byte `protobuf:"bytes,7,rep,name=dlnproof_2,json=dlnproof2,proto3" json:"dlnproof_2,omitempty"`
	// contains filtered or unexported fields
}

Represents a BROADCAST message sent during Round 1 of the ECDSA TSS keygen protocol.

func (*KGRound1Message) Descriptor deprecated

func (*KGRound1Message) Descriptor() ([]byte, []int)

Deprecated: Use KGRound1Message.ProtoReflect.Descriptor instead.

func (*KGRound1Message) GetCommitment

func (x *KGRound1Message) GetCommitment() []byte

func (*KGRound1Message) GetDlnproof_1 added in v1.2.0

func (x *KGRound1Message) GetDlnproof_1() [][]byte

func (*KGRound1Message) GetDlnproof_2 added in v1.2.0

func (x *KGRound1Message) GetDlnproof_2() [][]byte

func (*KGRound1Message) GetH1

func (x *KGRound1Message) GetH1() []byte

func (*KGRound1Message) GetH2

func (x *KGRound1Message) GetH2() []byte

func (*KGRound1Message) GetNTilde

func (x *KGRound1Message) GetNTilde() []byte

func (*KGRound1Message) GetPaillierN

func (x *KGRound1Message) GetPaillierN() []byte

func (*KGRound1Message) ProtoMessage

func (*KGRound1Message) ProtoMessage()

func (*KGRound1Message) ProtoReflect added in v1.3.3

func (x *KGRound1Message) ProtoReflect() protoreflect.Message

func (*KGRound1Message) Reset

func (x *KGRound1Message) Reset()

func (*KGRound1Message) String

func (x *KGRound1Message) String() string

func (*KGRound1Message) UnmarshalCommitment

func (m *KGRound1Message) UnmarshalCommitment() *big.Int

func (*KGRound1Message) UnmarshalDLNProof1 added in v1.2.0

func (m *KGRound1Message) UnmarshalDLNProof1() (*dlnproof.Proof, error)

func (*KGRound1Message) UnmarshalDLNProof2 added in v1.2.0

func (m *KGRound1Message) UnmarshalDLNProof2() (*dlnproof.Proof, error)

func (*KGRound1Message) UnmarshalH1

func (m *KGRound1Message) UnmarshalH1() *big.Int

func (*KGRound1Message) UnmarshalH2

func (m *KGRound1Message) UnmarshalH2() *big.Int

func (*KGRound1Message) UnmarshalNTilde

func (m *KGRound1Message) UnmarshalNTilde() *big.Int

func (*KGRound1Message) UnmarshalPaillierPK

func (m *KGRound1Message) UnmarshalPaillierPK() *paillier.PublicKey

func (*KGRound1Message) ValidateBasic

func (m *KGRound1Message) ValidateBasic() bool

type KGRound2Message1

type KGRound2Message1 struct {
	Share []byte `protobuf:"bytes,1,opt,name=share,proto3" json:"share,omitempty"`
	// contains filtered or unexported fields
}

Represents a P2P message sent to each party during Round 2 of the ECDSA TSS keygen protocol.

func (*KGRound2Message1) Descriptor deprecated

func (*KGRound2Message1) Descriptor() ([]byte, []int)

Deprecated: Use KGRound2Message1.ProtoReflect.Descriptor instead.

func (*KGRound2Message1) GetShare

func (x *KGRound2Message1) GetShare() []byte

func (*KGRound2Message1) ProtoMessage

func (*KGRound2Message1) ProtoMessage()

func (*KGRound2Message1) ProtoReflect added in v1.3.3

func (x *KGRound2Message1) ProtoReflect() protoreflect.Message

func (*KGRound2Message1) Reset

func (x *KGRound2Message1) Reset()

func (*KGRound2Message1) String

func (x *KGRound2Message1) String() string

func (*KGRound2Message1) UnmarshalShare

func (m *KGRound2Message1) UnmarshalShare() *big.Int

func (*KGRound2Message1) ValidateBasic

func (m *KGRound2Message1) ValidateBasic() bool

type KGRound2Message2

type KGRound2Message2 struct {
	DeCommitment [][]byte `protobuf:"bytes,1,rep,name=de_commitment,json=deCommitment,proto3" json:"de_commitment,omitempty"`
	// contains filtered or unexported fields
}

Represents a BROADCAST message sent to each party during Round 2 of the ECDSA TSS keygen protocol.

func (*KGRound2Message2) Descriptor deprecated

func (*KGRound2Message2) Descriptor() ([]byte, []int)

Deprecated: Use KGRound2Message2.ProtoReflect.Descriptor instead.

func (*KGRound2Message2) GetDeCommitment

func (x *KGRound2Message2) GetDeCommitment() [][]byte

func (*KGRound2Message2) ProtoMessage

func (*KGRound2Message2) ProtoMessage()

func (*KGRound2Message2) ProtoReflect added in v1.3.3

func (x *KGRound2Message2) ProtoReflect() protoreflect.Message

func (*KGRound2Message2) Reset

func (x *KGRound2Message2) Reset()

func (*KGRound2Message2) String

func (x *KGRound2Message2) String() string

func (*KGRound2Message2) UnmarshalDeCommitment

func (m *KGRound2Message2) UnmarshalDeCommitment() []*big.Int

func (*KGRound2Message2) ValidateBasic

func (m *KGRound2Message2) ValidateBasic() bool

type KGRound3Message

type KGRound3Message struct {
	PaillierProof [][]byte `protobuf:"bytes,1,rep,name=paillier_proof,json=paillierProof,proto3" json:"paillier_proof,omitempty"`
	// contains filtered or unexported fields
}

Represents a BROADCAST message sent to each party during Round 3 of the ECDSA TSS keygen protocol.

func (*KGRound3Message) Descriptor deprecated

func (*KGRound3Message) Descriptor() ([]byte, []int)

Deprecated: Use KGRound3Message.ProtoReflect.Descriptor instead.

func (*KGRound3Message) GetPaillierProof

func (x *KGRound3Message) GetPaillierProof() [][]byte

func (*KGRound3Message) ProtoMessage

func (*KGRound3Message) ProtoMessage()

func (*KGRound3Message) ProtoReflect added in v1.3.3

func (x *KGRound3Message) ProtoReflect() protoreflect.Message

func (*KGRound3Message) Reset

func (x *KGRound3Message) Reset()

func (*KGRound3Message) String

func (x *KGRound3Message) String() string

func (*KGRound3Message) UnmarshalProofInts

func (m *KGRound3Message) UnmarshalProofInts() paillier.Proof

func (*KGRound3Message) ValidateBasic

func (m *KGRound3Message) ValidateBasic() bool

type LocalParty

type LocalParty struct {
	*tss.BaseParty
	// contains filtered or unexported fields
}

func (*LocalParty) FirstRound

func (p *LocalParty) FirstRound() tss.Round

func (*LocalParty) PartyID

func (p *LocalParty) PartyID() *tss.PartyID

func (*LocalParty) Start

func (p *LocalParty) Start() *tss.Error

func (*LocalParty) StoreMessage

func (p *LocalParty) StoreMessage(msg tss.ParsedMessage) (bool, *tss.Error)

func (*LocalParty) String

func (p *LocalParty) String() string

func (*LocalParty) Update

func (p *LocalParty) Update(msg tss.ParsedMessage) (ok bool, err *tss.Error)

func (*LocalParty) UpdateFromBytes

func (p *LocalParty) UpdateFromBytes(wireBytes []byte, from *tss.PartyID, isBroadcast bool) (bool, *tss.Error)

func (*LocalParty) ValidateMessage added in v1.3.1

func (p *LocalParty) ValidateMessage(msg tss.ParsedMessage) (bool, *tss.Error)

type LocalPartySaveData

type LocalPartySaveData struct {
	LocalPreParams
	LocalSecrets

	// original indexes (ki in signing preparation phase)
	Ks []*big.Int

	// n-tilde, h1, h2 for range proofs
	NTildej, H1j, H2j []*big.Int

	// public keys (Xj = uj*G for each Pj)
	BigXj       []*crypto.ECPoint     // Xj
	PaillierPKs []*paillier.PublicKey // pkj

	// used for test assertions (may be discarded)
	ECDSAPub *crypto.ECPoint // y
}

Everything in LocalPartySaveData is saved locally to user's HD when done

func BuildLocalSaveDataSubset added in v1.1.1

func BuildLocalSaveDataSubset(sourceData LocalPartySaveData, sortedIDs tss.SortedPartyIDs) LocalPartySaveData

BuildLocalSaveDataSubset re-creates the LocalPartySaveData to contain data for only the list of signing parties.

func LoadKeygenTestFixtures

func LoadKeygenTestFixtures(qty int, optionalStart ...int) ([]LocalPartySaveData, tss.SortedPartyIDs, error)

func LoadKeygenTestFixturesRandomSet added in v1.1.1

func LoadKeygenTestFixturesRandomSet(qty, fixtureCount int) ([]LocalPartySaveData, tss.SortedPartyIDs, error)

func NewLocalPartySaveData added in v1.1.1

func NewLocalPartySaveData(partyCount int) (saveData LocalPartySaveData)

func (LocalPartySaveData) OriginalIndex

func (save LocalPartySaveData) OriginalIndex() (int, error)

recovers a party's original index in the set of parties during keygen

type LocalPreParams

type LocalPreParams struct {
	PaillierSK *paillier.PrivateKey // ski
	NTildei,
	H1i, H2i,
	Alpha, Beta,
	P, Q *big.Int
}

func GeneratePreParams

func GeneratePreParams(timeout time.Duration, optionalConcurrency ...int) (*LocalPreParams, error)

GeneratePreParams finds two safe primes and computes the Paillier secret required for the protocol. This can be a time consuming process so it is recommended to do it out-of-band. If not specified, a concurrency value equal to the number of available CPU cores will be used.

func (LocalPreParams) Validate

func (preParams LocalPreParams) Validate() bool

func (LocalPreParams) ValidateWithProof added in v1.2.0

func (preParams LocalPreParams) ValidateWithProof() bool

type LocalSecrets

type LocalSecrets struct {
	// secret fields (not shared, but stored locally)
	Xi, ShareID *big.Int // xi, kj
}

Jump to

Keyboard shortcuts

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