tcrypto

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: Apache-2.0, BSD-2-Clause Imports: 18 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

This section is empty.

Functions

func DefaultEd25519Suite added in v0.3.0

func DefaultEd25519Suite() suites.Suite

Types

type DKShare

type DKShare interface {
	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
	DSSSecretShare() SecretShare
	//
	// BLS based crypto (for randomness only.)
	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.
	//
	// 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,
	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,
	blsSharedPublic kyber.Point,
	blsPublicShares []kyber.Point,
) DKShare

NewDKSharePublic creates a DKShare containing only the publicly accessible information.

type SecretShare added in v0.3.0

type SecretShare interface {
	PriShare() *share.PriShare
	Commitments() []kyber.Point
}

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