Documentation
¶
Overview ¶
Package tss implements a threshold signature scheme.
Index ¶
- type Share
- type Signature
- type TSS
- type ThresholdKey
- func (tk *ThresholdKey) CheckSecretKey(pid uint16, decryptionKey encrypt.SymmetricKey) bool
- func (tk *ThresholdKey) CombineShares(shares []*Share) (*Signature, bool)
- func (tk *ThresholdKey) CreateShare(msg []byte) *Share
- func (tk *ThresholdKey) Encode() []byte
- func (tk *ThresholdKey) PolyVerify(pv bn256.PolyVerifier) bool
- func (tk *ThresholdKey) Threshold() uint16
- func (tk *ThresholdKey) VerifySecretKey() *bn256.SecretKey
- func (tk *ThresholdKey) VerifyShare(share *Share, msg []byte) bool
- func (tk *ThresholdKey) VerifySignature(s *Signature, msg []byte) bool
- type WeakThresholdKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Share ¶
type Share struct {
// contains filtered or unexported fields
}
Share is a share of the coin owned by a process.
func SumShares ¶
SumShares returns a share for a set of threshold keys. All the shares should be created by the same process. The given slice of shares has to be non empty.
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
Signature is a result of merging Shares.
type TSS ¶
type TSS struct {
// contains filtered or unexported fields
}
TSS is a set of all raw threshold keys generated by a dealer for all parties.
func NewRandom ¶
NewRandom generates a random polynomial of degree thereshold - 1 and builds a TSS based on the polynomial.
func (*TSS) Encrypt ¶
func (tss *TSS) Encrypt(encryptionKeys []encrypt.SymmetricKey) (*ThresholdKey, error)
Encrypt encrypts secretKeys of the given TSS using given a set of encryptionKeys and returns an (unowned)ThresholdKey.
type ThresholdKey ¶
type ThresholdKey struct {
// contains filtered or unexported fields
}
ThresholdKey contains encrypted secretKeys of other parties and decrypted key of the owner.
func Decode ¶
func Decode(data []byte, dealer, owner uint16, decryptionKey encrypt.SymmetricKey) (*ThresholdKey, bool, error)
Decode decodes encoded ThresholdKey obtained from the dealer using given decryptionKey. It returns (1) decoded ThresholdKey, (2) whether the owner's secretKey is correctly encoded and matches corresponding verification key, (3) an error in decoding (excluding errors obtained while decoding owners secret key),
func (*ThresholdKey) CheckSecretKey ¶
func (tk *ThresholdKey) CheckSecretKey(pid uint16, decryptionKey encrypt.SymmetricKey) bool
CheckSecretKey checks whether the secret key of the given pid is correct.
func (*ThresholdKey) CombineShares ¶
func (tk *ThresholdKey) CombineShares(shares []*Share) (*Signature, bool)
CombineShares combines the given shares into a Signature. It returns a Signature and a bool value indicating whether the combining was successful or not.
func (*ThresholdKey) CreateShare ¶
func (tk *ThresholdKey) CreateShare(msg []byte) *Share
CreateShare creates a Share for given process and nonce.
func (*ThresholdKey) Encode ¶
func (tk *ThresholdKey) Encode() []byte
Encode returns a byte representation of the given (unowned) ThresholdKey in the following form (1) threshold, 2 bytes as uint16 (2) length of marshalled globalVK, 4 bytes as uint32 (3) marshalled globalVK (4) len(vks), 4 bytes as uint32 (5) Marshalled vks in the form
a) length of marshalled vk b) marshalled vk
(6) Encrypted sks in the form
a) length of the cipher text b) cipher text of the key
func (*ThresholdKey) PolyVerify ¶
func (tk *ThresholdKey) PolyVerify(pv bn256.PolyVerifier) bool
PolyVerify uses the given polyVerifier to verify if the verification keys form a polynomial sequence.
func (*ThresholdKey) Threshold ¶
func (tk *ThresholdKey) Threshold() uint16
Threshold returns the threshold of the given ThresholdCoin.
func (*ThresholdKey) VerifySecretKey ¶
func (tk *ThresholdKey) VerifySecretKey() *bn256.SecretKey
VerifySecretKey checks if the verificationKey and secretKey form a valid pair. It returns the incorrect secret key when the pair of keys is invalid or nil when the keys are valid.
func (*ThresholdKey) VerifyShare ¶
func (tk *ThresholdKey) VerifyShare(share *Share, msg []byte) bool
VerifyShare verifies whether the given signature share is correct.
func (*ThresholdKey) VerifySignature ¶
func (tk *ThresholdKey) VerifySignature(s *Signature, msg []byte) bool
VerifySignature verifies whether the given signature is correct.
type WeakThresholdKey ¶
type WeakThresholdKey struct { ThresholdKey // contains filtered or unexported fields }
WeakThresholdKey is a threshold key that can produce shares iff the owner is a share provider
func CreateWTK ¶
func CreateWTK(tks []*ThresholdKey, shareProviders map[uint16]bool) *WeakThresholdKey
CreateWTK generates a weak threshold key for the given ThresholdKeys i.e. a ThresholdKey which corresponds to the sum of polynomials which are defining the given ThresholdKeys. Shares may be produced only by shareProviders. We assume that:
(0) tks is a non-empty slice (1) the threshold is the same for all given thresholdKeys (2) the thresholdKeys were created by different processes (3) the thresholdKeys have the same owner
The resulting WeakThresholdKey has undefined dealer and encSKs.
func SeededWTK ¶
func SeededWTK(nProc, pid uint16, seed int64, shareProviders map[uint16]bool) *WeakThresholdKey
SeededWTK returns a WeakThresholdKey generated by the provided seed. NOTE! This function is not safe, should be used for testing purposes only!
func (*WeakThresholdKey) CreateShare ¶
func (wtk *WeakThresholdKey) CreateShare(msg []byte) *Share
CreateShare creates a Share for given process and message if the holder of the weak threshold key is a share provider. Else it returns nil.
func (*WeakThresholdKey) ShareProviders ¶
func (wkt *WeakThresholdKey) ShareProviders() map[uint16]bool
ShareProviders returns the map describing which parties may produce shares of signatures.