tcrypto

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0, BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Overview

wrapper package for BLS threshold cryptography used in the Wasp node TODO DKG protocol must be rewritten because currently it is not 100% secure

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecoverPubPoly

func RecoverPubPoly(suite *bn256.Suite, pubKeys []kyber.Point, t, n uint16) (*share.PubPoly, error)

RecoverPubPoly recovers public polynomial from the partial public keys

func ValidateDKSParams

func ValidateDKSParams(t, n, index uint16) error

func VerifyWithPublicKey

func VerifyWithPublicKey(data, signature, pubKeyBin []byte) error

VerifyWithPublicKey checks signature against arbitrary public key

Types

type DKShare

type DKShare struct {
	// interface for the BN256 bilinear pairing for the underlying BLS cryptography
	Suite *bn256.Suite
	// size of the committee
	N uint16
	// threshold factor, 1 <= T <= N
	T uint16
	// peer index of the owner of this share in he committee
	// all N peers are indexed 0..N-1
	Index uint16
	// BLS address represented by the set of shares. It is used as a key to find the DKShare
	// all nodes in the committee have DKShare records with same address
	// Addresses is blake2 hash of master public key prefixed with one byte of signature type
	Address *address.Address
	// partial public keys of all committee nodes for this DKS
	// may be used to identify and authenticate individual committee node
	PubKeys []kyber.Point // all public shares by peers
	// must be same same as PubKeys[Index]
	// TODO cleanup. remove redundant information, plus tests
	PubKeyOwn kyber.Point
	// public polynomial, recovered form public keys according to BDN
	PubPoly *share.PubPoly
	// public key from own private key. It corresponds to address
	PubKeyMaster kyber.Point

	// temporary fields used during DKG process
	// not used after
	// TODO refactor during cleanup, remove tmp fields from the permanent structure
	Aggregated bool              // true after DKG
	Committed  bool              // true after DKG
	PriShares  []*share.PriShare // nil after DKG
	// contains filtered or unexported fields
}

DKShare represents distributed key share for (T,N) threshold signatures based on BLS Structure is a partial share owned by the node to participate in the committee. The only 'priKey' part is secret, the rest is public

func NewRndDKShare

func NewRndDKShare(t, n, index uint16) (*DKShare, error)

NewRndDKShare creates empty structure

func UnmarshalDKShare

func UnmarshalDKShare(data []byte, maskPrivate bool) (*DKShare, error)

UnmarshalDKShare parses DKShare, validates and calculates master public key

func (*DKShare) AggregateDKS

func (ks *DKShare) AggregateDKS(priShares []kyber.Scalar) error

AggregateDKS is a call in DKG process

func (*DKShare) FinalizeDKS

func (ks *DKShare) FinalizeDKS(pubKeys []kyber.Point) error

FinalizeDKS is a call in DKG process

func (*DKShare) Read

func (ks *DKShare) Read(r io.Reader) error

func (*DKShare) RecoverFullSignature

func (ks *DKShare) RecoverFullSignature(sigShares [][]byte, data []byte) (signaturescheme.Signature, error)

RecoverFullSignature generates (recovers) master signature from partial sigshares. returns signature as defined in the value Tangle

func (*DKShare) SignShare

func (ks *DKShare) SignShare(data []byte) (tbdn.SigShare, error)

SignShare signs the data with the own key share. returns SigShare, which contains signature and the index

func (*DKShare) VerifyMasterSignature

func (ks *DKShare) VerifyMasterSignature(data []byte, signature []byte) error

VerifyMasterSignature checks signature against master public key

func (*DKShare) VerifyOwnSigShare

func (ks *DKShare) VerifyOwnSigShare(data []byte, sigshare tbdn.SigShare) error

VerifyOwnSigShare is only used for assertions

func (*DKShare) VerifySigShare

func (ks *DKShare) VerifySigShare(data []byte, sigshare tbdn.SigShare) error

VerifySigShare checks if partial signature (sigshare) of the data is valid

func (*DKShare) Write

func (ks *DKShare) Write(w io.Writer) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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