Documentation
¶
Overview ¶
Package dkg implements the protocol described in "A threshold cryptosystem without a trusted party" by Torben Pryds Pedersen. https://dl.acm.org/citation.cfm?id=1754929.
Index ¶
- Variables
- type DKGError
- type Deal
- func (*Deal) Descriptor() ([]byte, []int)
- func (m *Deal) GetDeal() *pedersen.EncryptedDeal
- func (m *Deal) GetIndex() uint32
- func (m *Deal) GetSessionId() string
- func (*Deal) ProtoMessage()
- func (m *Deal) Reset()
- func (m *Deal) String() string
- func (m *Deal) XXX_DiscardUnknown()
- func (m *Deal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Deal) XXX_Merge(src proto.Message)
- func (m *Deal) XXX_Size() int
- func (m *Deal) XXX_Unmarshal(b []byte) error
- type DistKeyGenerator
- func (d *DistKeyGenerator) Certified() bool
- func (d *DistKeyGenerator) Deals() (map[int]*Deal, error)
- func (d *DistKeyGenerator) DistKeyShare() (*DistKeyShare, error)
- func (d *DistKeyGenerator) ProcessDeal(dd *Deal) (*Response, error)
- func (d *DistKeyGenerator) ProcessJustification(j *Justification) error
- func (d *DistKeyGenerator) ProcessResponse(resp *Response) (*Justification, error)
- func (d *DistKeyGenerator) QUAL() []int
- func (d *DistKeyGenerator) SetTimeout()
- type DistKeyShare
- type Justification
- type PDKGInterface
- type PublicKey
- func (*PublicKey) Descriptor() ([]byte, []int)
- func (m *PublicKey) GetIndex() uint32
- func (m *PublicKey) GetProofBytes() []byte
- func (m *PublicKey) GetPublicInputs() []byte
- func (m *PublicKey) GetPublickey() *pedersen.PublicKey
- func (m *PublicKey) GetSessionId() string
- func (m *PublicKey) GetTrustedSetupBytes() []byte
- func (*PublicKey) ProtoMessage()
- func (m *PublicKey) Reset()
- func (m *PublicKey) String() string
- func (m *PublicKey) XXX_DiscardUnknown()
- func (m *PublicKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *PublicKey) XXX_Merge(src proto.Message)
- func (m *PublicKey) XXX_Size() int
- func (m *PublicKey) XXX_Unmarshal(b []byte) error
- type Response
- func (*Response) Descriptor() ([]byte, []int)
- func (m *Response) GetIndex() uint32
- func (m *Response) GetResponse() *pedersen.Response
- func (m *Response) GetSessionId() string
- func (*Response) ProtoMessage()
- func (m *Response) Reset()
- func (m *Response) String() string
- func (m *Response) XXX_DiscardUnknown()
- func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Response) XXX_Merge(src proto.Message)
- func (m *Response) XXX_Size() int
- func (m *Response) XXX_Unmarshal(b []byte) error
- type Responses
- func (*Responses) Descriptor() ([]byte, []int)
- func (m *Responses) GetResponse() []*Response
- func (m *Responses) GetSessionId() string
- func (*Responses) ProtoMessage()
- func (m *Responses) Reset()
- func (m *Responses) String() string
- func (m *Responses) XXX_DiscardUnknown()
- func (m *Responses) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Responses) XXX_Merge(src proto.Message)
- func (m *Responses) XXX_Size() int
- func (m *Responses) XXX_Unmarshal(b []byte) error
- type Suite
Constants ¶
This section is empty.
Variables ¶
var ( ErrDupPubKey = errors.New("duplicated share public key") ErrDupPubKeyIndex = errors.New("duplicated public key index") ErrCanNotFindID = errors.New("can't find id in group IDs") ErrCasting = errors.New("casting failed") ErrRespNotApproval = errors.New("response not approval") ErrNotCertified = errors.New("not certified") ErrCanNotLoadSec = errors.New("can't load sec") ErrCanNotLoadGroup = errors.New("can't load group") ErrResponseNoApproval = errors.New("response no approval") ErrDKGNotCertified = errors.New("dkg is not certified") )
Functions ¶
This section is empty.
Types ¶
type Deal ¶
type Deal struct { SessionId string `protobuf:"bytes,1,opt,name=sessionId,proto3" json:"sessionId,omitempty"` Index uint32 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` Deal *pedersen.EncryptedDeal `protobuf:"bytes,3,opt,name=deal,proto3" json:"deal,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Deal) Descriptor ¶
func (*Deal) GetDeal ¶
func (m *Deal) GetDeal() *pedersen.EncryptedDeal
func (*Deal) GetSessionId ¶
func (*Deal) ProtoMessage ¶
func (*Deal) ProtoMessage()
func (*Deal) XXX_DiscardUnknown ¶
func (m *Deal) XXX_DiscardUnknown()
func (*Deal) XXX_Unmarshal ¶
type DistKeyGenerator ¶
type DistKeyGenerator struct {
// contains filtered or unexported fields
}
DistKeyGenerator is the struct that runs the DKG protocol.
func NewDistKeyGenerator ¶
func NewDistKeyGenerator(suite Suite, longterm kyber.Scalar, participants []kyber.Point, t int) (*DistKeyGenerator, error)
NewDistKeyGenerator returns a DistKeyGenerator out of the suite, the longterm secret key, the list of participants, the threshold t parameter and a given secret. It returns an error if the secret key's commitment can't be found in the list of participants.
func NewDistKeyGeneratorWithoutSecret ¶
func NewDistKeyGeneratorWithoutSecret(suite Suite, longterm kyber.Scalar, participants []kyber.Point, t int) (*DistKeyGenerator, error)
NewDistKeyGeneratorWithoutSecret simply returns a DistKeyGenerator with an nil secret. It is used to renew the private shares without affecting the secret.
func (*DistKeyGenerator) Certified ¶
func (d *DistKeyGenerator) Certified() bool
Certified returns true if at least t deals are certified (see vss.Verifier.DealCertified()). If the distribution is certified, the protocol can continue using d.SecretCommits().
func (*DistKeyGenerator) Deals ¶
func (d *DistKeyGenerator) Deals() (map[int]*Deal, error)
Deals returns all the deals that must be broadcasted to all participants. The deal corresponding to this DKG is already added to this DKG and is omitted from the returned map. To know which participant a deal belongs to, loop over the keys as indices in the list of participants:
for i,dd := range distDeals { sendTo(participants[i],dd) }
If this method cannot process its own Deal, that indicates a sever problem with the configuration or implementation and results in a panic.
func (*DistKeyGenerator) DistKeyShare ¶
func (d *DistKeyGenerator) DistKeyShare() (*DistKeyShare, error)
DistKeyShare generates the distributed key relative to this receiver. It throws an error if something is wrong such as not enough deals received. The shared secret can be computed when all deals have been sent and basically consists of a public point and a share. The public point is the sum of all aggregated individual public commits of each individual secrets. the share is evaluated from the global Private Polynomial, basically SUM of fj(i) for a receiver i.
func (*DistKeyGenerator) ProcessDeal ¶
func (d *DistKeyGenerator) ProcessDeal(dd *Deal) (*Response, error)
ProcessDeal takes a Deal created by Deals() and stores and verifies it. It returns a Response to broadcast to every other participant. It returns an error in case the deal has already been stored, or if the deal is incorrect (see vss.Verifier.ProcessEncryptedDeal).
func (*DistKeyGenerator) ProcessJustification ¶
func (d *DistKeyGenerator) ProcessJustification(j *Justification) error
ProcessJustification takes a justification and validates it. It returns an error in case the justification is wrong.
func (*DistKeyGenerator) ProcessResponse ¶
func (d *DistKeyGenerator) ProcessResponse(resp *Response) (*Justification, error)
ProcessResponse takes a response from every other peer. If the response designates the deal of another participant than this dkg, this dkg stores it and returns nil with a possible error regarding the validity of the response. If the response designates a deal this dkg has issued, then the dkg will process the response, and returns a justification.
func (*DistKeyGenerator) QUAL ¶
func (d *DistKeyGenerator) QUAL() []int
QUAL returns the index in the list of participants that forms the QUALIFIED set as described in the "New-DKG" protocol by Rabin. Basically, it consists of all participants that are not disqualified after having exchanged all deals, responses and justification. This is the set that is used to extract the distributed public key with SecretCommits() and ProcessSecretCommits().
func (*DistKeyGenerator) SetTimeout ¶
func (d *DistKeyGenerator) SetTimeout()
SetTimeout triggers the timeout on all verifiers, and thus makes sure all verifiers have either responded, or have a StatusComplaint response.
type DistKeyShare ¶
type DistKeyShare struct { kyber.Point Share *share.PriShare // share. The final distributed polynomial is the sum of all these // individual polynomials, but it is never computed. PrivatePoly []kyber.Scalar }Commits []
DistKeyShare holds the share of a distributed key for a participant.
func (*DistKeyShare) Commitments ¶
func (d *DistKeyShare) Commitments() []kyber.Point
Commitments implements the dss.DistKeyShare interface so either pedersen or rabin dkg can be used with dss.
func (*DistKeyShare) PriShare ¶
func (d *DistKeyShare) PriShare() *share.PriShare
PriShare implements the dss.DistKeyShare interface so either pedersen or rabin dkg can be used with dss.
func (*DistKeyShare) Public ¶
func (d *DistKeyShare) Public() kyber.Point
Public returns the public key associated with the distributed private key.
func (*DistKeyShare) Renew ¶
func (d *DistKeyShare) Renew(suite Suite, g *DistKeyShare) (*DistKeyShare, error)
Renew adds the new distributed key share g (with secret 0) to the distributed key share d.
type Justification ¶
type Justification struct { // Index of the Dealer who answered with this Justification Index uint32 // Justification issued from the Dealer Justification *vss.Justification }
Justification holds the Justification from a Dealer as well as the index of the Dealer in question.
type PDKGInterface ¶
type PDKGInterface interface { Loop() GetGroupPublicPoly(groupId string) *share.PubPoly GetGroupIDs(groupId string) [][]byte GetGroupNumber() int Grouping(ctx context.Context, groupId string, Participants [][]byte) (chan [5]*big.Int, chan error, error) GroupDissolve(groupId string) }
PDKGInterface is a interface for DKG
func NewPDKG ¶
func NewPDKG(p p2p.P2PInterface, suite suites.Suite) PDKGInterface
NewPDKG creates a pdkg struct
type PublicKey ¶
type PublicKey struct { SessionId string `protobuf:"bytes,1,opt,name=sessionId,proto3" json:"sessionId,omitempty"` Index uint32 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` Publickey *pedersen.PublicKey `protobuf:"bytes,3,opt,name=publickey,proto3" json:"publickey,omitempty"` ProofBytes []byte `protobuf:"bytes,4,opt,name=proofBytes,proto3" json:"proofBytes,omitempty"` TrustedSetupBytes []byte `protobuf:"bytes,5,opt,name=trustedSetupBytes,proto3" json:"trustedSetupBytes,omitempty"` PublicInputs []byte `protobuf:"bytes,6,opt,name=publicInputs,proto3" json:"publicInputs,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*PublicKey) Descriptor ¶
func (*PublicKey) GetProofBytes ¶
func (*PublicKey) GetPublicInputs ¶
func (*PublicKey) GetPublickey ¶
func (*PublicKey) GetSessionId ¶
func (*PublicKey) GetTrustedSetupBytes ¶
func (*PublicKey) ProtoMessage ¶
func (*PublicKey) ProtoMessage()
func (*PublicKey) XXX_DiscardUnknown ¶
func (m *PublicKey) XXX_DiscardUnknown()
func (*PublicKey) XXX_Marshal ¶
func (*PublicKey) XXX_Unmarshal ¶
type Response ¶
type Response struct { SessionId string `protobuf:"bytes,1,opt,name=sessionId,proto3" json:"sessionId,omitempty"` Index uint32 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` Response *pedersen.Response `protobuf:"bytes,3,opt,name=response,proto3" json:"response,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Response) Descriptor ¶
func (*Response) GetResponse ¶
func (*Response) GetSessionId ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) XXX_DiscardUnknown ¶
func (m *Response) XXX_DiscardUnknown()
func (*Response) XXX_Marshal ¶
func (*Response) XXX_Unmarshal ¶
type Responses ¶
type Responses struct { SessionId string `protobuf:"bytes,1,opt,name=sessionId,proto3" json:"sessionId,omitempty"` Response []*Response `protobuf:"bytes,2,rep,name=response,proto3" json:"response,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Responses) Descriptor ¶
func (*Responses) GetResponse ¶
func (*Responses) GetSessionId ¶
func (*Responses) ProtoMessage ¶
func (*Responses) ProtoMessage()
func (*Responses) XXX_DiscardUnknown ¶
func (m *Responses) XXX_DiscardUnknown()