tcrypto

package
v0.6.1-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package tcrypto stands for Threshold Cryptography. It provides a structure for storing a distributed key share and several high level functions to work with it.

Distributed key shares are usually generated using a DKG procedure. See the `dkg` package for the generation part. This package provides a way to use them.

Index

Constants

This section is empty.

Variables

View Source
var ErrDKShareNotFound = errors.New("dkShare not found")

Functions

func DecodeHexKyberPoint added in v1.0.3

func DecodeHexKyberPoint(group kyber.Group, dataHex string) (kyber.Point, error)

func DecodeHexKyberPoints added in v1.0.3

func DecodeHexKyberPoints(group kyber.Group, dataHex []string) ([]kyber.Point, error)

func DecodeHexKyberScalar added in v1.0.3

func DecodeHexKyberScalar(group kyber.Group, dataHex string) (kyber.Scalar, error)

func DefaultEd25519Suite added in v0.3.0

func DefaultEd25519Suite() suites.Suite

Types

type DKShare

type DKShare interface {
	json.Marshaler
	json.Unmarshaler
	ID() *util.ComparableAddress
	Clone() onchangemap.Item[string, *util.ComparableAddress]
	Bytes() []byte
	GetAddress() iotago.Address
	GetIndex() *uint16
	GetN() uint16
	GetT() uint16
	GetNodePubKeys() []*cryptolib.PublicKey
	GetSharedPublic() *cryptolib.PublicKey
	SetPublicShares(edPublicShares []kyber.Point, blsPublicShares []kyber.Point)
	//
	// Schnorr based crypto (for L1 signatures).
	DSSPublicShares() []kyber.Point
	DSSSharedPublic() kyber.Point
	DSSSignShare(data []byte, nonce SecretShare) (*dss.PartialSig, error)
	DSSVerifySigShare(data []byte, sigshare *dss.PartialSig) error
	DSSRecoverMasterSignature(sigShares []*dss.PartialSig, data []byte, nonce SecretShare) ([]byte, error)
	DSSVerifyMasterSignature(data, signature []byte) error
	DSS() SecretShare
	//
	// BLS based crypto (for randomness only.)
	BLSThreshold() uint16
	BLSSharedPublic() kyber.Point
	BLSPublicShares() []kyber.Point
	BLSSignShare(data []byte) (tbls.SigShare, error)
	BLSVerifySigShare(data []byte, sigshare tbls.SigShare) error
	BLSRecoverMasterSignature(sigShares [][]byte, data []byte) (*bls.SignatureWithPublicKey, error)
	BLSVerifyMasterSignature(data, signature []byte) error
	BLSSign(data []byte) ([]byte, error)                        // Non-threshold variant.
	BLSVerify(signer kyber.Point, data, signature []byte) error // Non-threshold variant.
	BLSCommits() *share.PubPoly                                 // TODO: Abstract the BLS signing part to some interface and keep the keys inside.
	BLSPriShare() *share.PriShare                               // TODO: Abstract the BLS signing part to some interface and keep the keys inside.
	//
	// For tests only.
	AssignNodePubKeys(nodePubKeys []*cryptolib.PublicKey)
	AssignCommonData(dks DKShare)
	ClearCommonData()
}

DKShare stands for the information stored on a node as a result of the DKG procedure.

func DKShareFromBytes added in v0.1.0

func DKShareFromBytes(buf []byte, edSuite suites.Suite, blsSuite Suite, nodePrivKey *cryptolib.PrivateKey) (DKShare, error)

DKShareFromBytes reads DKShare from bytes.

func NewDKShare added in v0.1.0

func NewDKShare(
	index uint16,
	n uint16,
	t uint16,
	nodePrivKey *cryptolib.PrivateKey,
	nodePubKeys []*cryptolib.PublicKey,
	edSuite suites.Suite,
	edSharedPublic kyber.Point,
	edPublicCommits []kyber.Point,
	edPublicShares []kyber.Point,
	edPrivateShare kyber.Scalar,
	blsSuite Suite,
	blsThreshold uint16,
	blsSharedPublic kyber.Point,
	blsPublicCommits []kyber.Point,
	blsPublicShares []kyber.Point,
	blsPrivateShare kyber.Scalar,
) (DKShare, error)

NewDKShare creates new share of the key.

func NewDKSharePublic added in v0.3.0

func NewDKSharePublic(
	sharedAddress iotago.Address,
	n uint16,
	t uint16,
	nodePrivKey *cryptolib.PrivateKey,
	nodePubKeys []*cryptolib.PublicKey,
	edSuite suites.Suite,
	edSharedPublic kyber.Point,
	edPublicShares []kyber.Point,
	blsSuite Suite,
	blsThreshold uint16,
	blsSharedPublic kyber.Point,
	blsPublicShares []kyber.Point,
) DKShare

NewDKSharePublic creates a DKShare containing only the publicly accessible information.

func NewEmptyDKShare added in v1.0.3

func NewEmptyDKShare(nodePrivKey *cryptolib.PrivateKey, edSuite suites.Suite, blsSuite Suite) DKShare

type SecretShare added in v0.3.0

type SecretShare interface {
	PriShare() *share.PriShare
	Commitments() []kyber.Point
	NodeCount() int // N -- Total number of parties.
	MaxFaulty() int // F -- Maximal number of faulty nodes.
	Threshold() int // T -- Minimal number of participants to recover a secret, T = N - F.
}

It also covers the dss.SecretShare.

func NewDistKeyShare added in v1.0.3

func NewDistKeyShare(priShare *share.PriShare, commitments []kyber.Point, nodeCount, threshold int) SecretShare

type Suite added in v0.1.0

type Suite interface {
	kyber.Group
	pairing.Suite
	key.Suite
}

func DefaultBLSSuite added in v0.3.0

func DefaultBLSSuite() Suite

Jump to

Keyboard shortcuts

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