dealer

package
v0.0.0-...-5acd2bf Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package dealer is an implementation of the `dealer` mode of https://eprint.iacr.org/2020/540.pdf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DerivePublicKey

func DerivePublicKey(curve elliptic.Curve, secretKey *big.Int) (*curves.EcPoint, error)

func NewDealerShares

func NewDealerShares(curve elliptic.Curve, threshold, total uint32, ikm *big.Int) (*curves.EcPoint, map[uint32]*Share, error)

NewDealerShares generates the Secp256k1 private key shares and public key if ikm == nil, a new private key will be generated

func NewSecret

func NewSecret(curve elliptic.Curve) (*big.Int, error)

New Secret generates a new private key

func PreparePublicShares

func PreparePublicShares(sharesMap map[uint32]*Share) (map[uint32]*PublicShare, error)

PreparePublicShares makes public shares that can be sent to the participant to compute their additive shares and participate in signing rounds

Types

type DistributedKeyGenType

type DistributedKeyGenType struct {
	ProofParams map[uint32]*ProofParams
}

DistributedKeyGenType means each participant has their own proof params that were distributed to each other participant

func (DistributedKeyGenType) GetProofParams

func (dkg DistributedKeyGenType) GetProofParams(id uint32) *ProofParams

GetProofParams returns the proof params specified by the participant id

func (DistributedKeyGenType) IsTrustedDealer

func (dkg DistributedKeyGenType) IsTrustedDealer() bool

IsTrustedDealer return true if TrustedDealerKeyGenType

type KeyGenType

type KeyGenType interface {
	IsTrustedDealer() bool
	GetProofParams(id uint32) *ProofParams
}

KeyGenType encapsulates the different methods that tecdsa can generate keys. Currently TrustedDealer or Distributed Key Generation

type ParticipantData

type ParticipantData struct {
	Id             uint32
	DecryptKey     *paillier.SecretKey
	SecretKeyShare *Share
	// Public values set to all signing participants
	EcdsaPublicKey *curves.EcPoint
	KeyGenType     KeyGenType
	PublicShares   map[uint32]*PublicShare
	EncryptKeys    map[uint32]*paillier.PublicKey
}

ParticipantData represents all data to be sent to a participant after the dealer is finished

func (ParticipantData) MarshalJSON

func (pd ParticipantData) MarshalJSON() ([]byte, error)

func (*ParticipantData) UnmarshalJSON

func (pd *ParticipantData) UnmarshalJSON(bytes []byte) error

type ParticipantDataJson

type ParticipantDataJson struct {
	Id             uint32
	DecryptKey     *paillier.SecretKey
	SecretKeyShare *Share
	// Public values set to all signing participants
	EcdsaPublicKey    *curves.EcPoint
	DealerParams      *ProofParams
	ParticipantParams map[uint32]*ProofParams
	PublicShares      map[uint32]*PublicShare
	EncryptKeys       map[uint32]*paillier.PublicKey
}

type ProofParams

type ProofParams struct {
	// n is the modulus for the signing rounds, product of two safe primes
	N *big.Int
	// h1 random value quadratic residue in n
	H1 *big.Int
	// h2 is a random modular power of h1
	H2 *big.Int
}

ProofParams is the modulus and generators used when constructing keys and completing the signing rounds

func NewProofParams

func NewProofParams() (*ProofParams, error)

NewProofParams creates new ProofParams with `bits` sized values

func NewProofParamsWithPrimes

func NewProofParamsWithPrimes(p, q *big.Int) (*ProofParams, error)

NewProofParamsWithPrimes creates new ProofParams using the parameters as the primes

type PublicShare

type PublicShare struct {
	Point *curves.EcPoint
}

PublicShare can be sent to a Participant so it can be used to convert Share to its additive form

type Share

type Share struct {
	*v1.ShamirShare
	Point *curves.EcPoint
}

Share represents a piece of the ECDSA private key and a commitment to the share

func (Share) MarshalJSON

func (s Share) MarshalJSON() ([]byte, error)

func (*Share) UnmarshalJSON

func (s *Share) UnmarshalJSON(bytes []byte) error

type ShareJson

type ShareJson struct {
	Identifier uint32   // x-coordinate
	Value      *big.Int // y-coordinate
	Point      *curves.EcPoint
}

ShareJson encapsulates the data that is serialized to JSON used internally and not for external use. Public so other pieces can use for serialization

type TrustedDealerKeyGenType

type TrustedDealerKeyGenType struct {
	ProofParams *ProofParams
}

TrustedDealerKeyGenType means the same proof parameters will be used by all participants

func (TrustedDealerKeyGenType) GetProofParams

func (td TrustedDealerKeyGenType) GetProofParams(_ uint32) *ProofParams

GetProofParams returns the proof params specified by the participant id

func (TrustedDealerKeyGenType) IsTrustedDealer

func (td TrustedDealerKeyGenType) IsTrustedDealer() bool

IsTrustedDealer return true if TrustedDealerKeyGenType

Jump to

Keyboard shortcuts

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