sig

package
v0.0.0-...-ff61ee7 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

This package implements different types of signing mechanisms. Each type includes a public key type object, a private key type object, and a signature type object. The public key objects and signature objects must implment the messages.MsgHeader interface, so they can be serialized and sent over the network.

The follow signature types are supported:

Index

Constants

This section is empty.

Variables

View Source
var BlsMultiNew = false
View Source
var Coin2ShareSize = 212

EdSuite is the group used by schnorr and threshold sigs (this can be changed)

View Source
var EddsaGroup = new(edwards25519.Curve)

the group used by eddsa signature (this is fixed)

View Source
var EncryptMsgSize = 46
View Source
var EncryptOverhead = config.EncryptOverhead // 24
View Source
var SignMsgSize = 26
View Source
var SleepValidate = false
View Source
var TestIndex types.ConsensusInt = 10
View Source
var TestKeyIndex = PubKeyIndex(0)

var Thrshn2, Thrsht2 = 10, 4

View Source
var UseMultisig = false
View Source
var UsePubIndex = true

The following settings should be changed in "../../generalconfig.go" and not here

Functions

func AfterSortPubs

func AfterSortPubs(myPriv Priv, fixedCoord Pub, members PubList,
	otherPubs PubList) (newMyPriv Priv, coord Pub, newMembers, newOtherPubs []Pub, memberMap map[PubKeyID]Pub,
	allPubs []Pub)

AfterSortPubs should be called after sorting has completed to let the keys know their indecies

func CheckPubsEqual

func CheckPubsEqual(a, b Pub) bool

func CheckPubsIDEqual

func CheckPubsIDEqual(a, b Pub) bool

func CheckSerVRF

func CheckSerVRF(vrfProof VRFProof, m *messages.Message) error

CheckSerVRF is a helper function used by implementations of GenerateSig

func CheckSingleSupporter

func CheckSingleSupporter(msg messages.MsgHeader) error

CheckSingleSupporter checks if the message is either a Signed or Unsigned message and returns an error if it has a number of supporters not equal to 1.

func DoSleepValidation

func DoSleepValidation(d time.Duration)

DoSleepValidation is called instead of doing a validation when SleepValidate is set to true

func GetBlsMultiNew

func GetBlsMultiNew() bool

func GetCoinThresh

func GetCoinThresh(to types.TestOptions) int

func GetDSSThresh

func GetDSSThresh(to types.TestOptions) (primary int, secondary int)

GetDSSThresh returns the threshold for threshold signatures

func GetUseMultisig

func GetUseMultisig() bool

GetUseMultisig returns the state set by SetUseMultisig

func GetUsePubIndex

func GetUsePubIndex() bool

GetUsePubIndex returns the state set by SetUsePubIndex

func RunFuncWithConfigSetting

func RunFuncWithConfigSetting(toRun func(), usePubIndex types.BoolSetting, useMultisig types.BoolSetting,
	blsMultiNew types.BoolSetting, sleepValidate types.BoolSetting)

func SetBlsMultiNew

func SetBlsMultiNew(val bool)

SetBlsMultiNew sets what type of multisigs to use, if SetUseMultisig was set to true If true we use multi-sigs from https://crypto.stanford.edu/~dabo/pubs/papers/BLSmultisig.html

func SetSleepValidate

func SetSleepValidate(val bool)

SetSleepValidate sets whether or not nodes validate sigs (unsafe just for testing) If true then we dont validate sigs, just sleep and return true.

func SetUseMultisig

func SetUseMultisig(val bool)

SetUseMultisig set wheter to use multi-signatures or not If true will use multisig, must default to false

func SetUsePubIndex

func SetUsePubIndex(val bool)

SetUsePubIndex sets how a node sends its identifier in messages. If true, the when sending a pub it only sends the index it is in the list of participants TODO change index when members are chagned, right now indecies are static are the start

func SigTestComputeSharedSecret

func SigTestComputeSharedSecret(newPriv func() (Priv, error), t *testing.T)

func SigTestEncode

func SigTestEncode(newPriv func() (Priv, error), t *testing.T)

func SigTestFromBytes

func SigTestFromBytes(newPriv func() (Priv, error), t *testing.T)

func SigTestMultiSignTestMsgSerialize

func SigTestMultiSignTestMsgSerialize(newPriv func() (Priv, error), t *testing.T)

func SigTestPrintStats

func SigTestPrintStats(newPriv func() (Priv, error), t *testing.T)

func SigTestRand

func SigTestRand(newPriv func() (Priv, error), t *testing.T)

func SigTestSerialize

func SigTestSerialize(newPriv func() (Priv, error), signType types.SignType, t *testing.T)

func SigTestSign

func SigTestSign(newPriv func() (Priv, error), signType types.SignType, t *testing.T)

func SigTestSignTestMsgSerialize

func SigTestSignTestMsgSerialize(newPriv func() (Priv, error), t *testing.T)

func SigTestSort

func SigTestSort(newPriv func() (Priv, error), t *testing.T)

func SigTestVRF

func SigTestVRF(newPriv func() (Priv, error), t *testing.T)

func TestPartThrsh

func TestPartThrsh(privFunc func() (Priv, error), signType types.SignType, tval, n int, t *testing.T)

func TestSigMerge

func TestSigMerge(newPriv func() (Priv, error), t *testing.T)

func VerifySignature

func VerifySignature()

Types

type AllMultiPub

type AllMultiPub interface {
	MultiPub
	Pub
}

type AllMultiSig

type AllMultiSig interface {
	MultiSig
	Sig
}

type BasicSignedMessage

type BasicSignedMessage []byte

func (BasicSignedMessage) GetSignedHash

func (bsm BasicSignedMessage) GetSignedHash() types.HashBytes

func (BasicSignedMessage) GetSignedMessage

func (bsm BasicSignedMessage) GetSignedMessage() []byte

type BasicThresholdInterface

type BasicThresholdInterface interface {
	ThresholdCountInterface
	// GetPartialPub() Pub // Get the partial public key for this node.
	GetSharedPub() Pub // Get the shared public key for the threshold.
}

type CoinProof

type CoinProof interface {
	Sig
}

type CoinProofPubInterface

type CoinProofPubInterface interface {
	ThresholdCountInterface
	CheckCoinProof(SignedMessage, CoinProof) error // Check if a coin proof is valid for a message.
	CombineProofs(myPriv Priv, items []*SigItem) (coinVal types.BinVal, err error)
	// DeserializeCoinProof(m *messages.Message) (coinProof CoinProof, size int, err error)
	NewCoinProof() CoinProof // returns an empty coin proof object
}

type ConsIDPub

type ConsIDPub struct {
	ID  types.ConsensusID
	Pub Pub
}

ConsIDPub contains a consensus id and a public key.

type CorruptInterface

type CorruptInterface interface {
	Corrupt() // Corrupts a signature for testing
}

type EncodeInterface

type EncodeInterface interface {
	Encode(writer io.Writer) (n int, err error)
	Decode(reader io.Reader) (n int, err error)
}

type EncodedMsg

type EncodedMsg struct {
	*messages.Message
	WasEncrypted bool
	Pub          Pub
}

func FromMessage

func FromMessage(msg *messages.Message) EncodedMsg

func NewEncodedMsg

func NewEncodedMsg(msg []byte, wasEncrypted bool, pub Pub) EncodedMsg

func NewUnencodedMsg

func NewUnencodedMsg(msg *messages.Message) EncodedMsg

func (EncodedMsg) NewEncodedMsgCopy

func (enc EncodedMsg) NewEncodedMsgCopy(msg []byte) EncodedMsg

func (EncodedMsg) ShallowCopy

func (enc EncodedMsg) ShallowCopy() EncodedMsg

type MultiPub

type MultiPub interface {
	// Clone returns a new pub only containing the points (no bitid), should be called before merging the first set of keys with MergePubPartial
	Clone() MultiPub
	// MergePubPartial merges the pubs without updating the BitID identifiers.
	MergePubPartial(MultiPub)
	// DonePartialMerge should be called after merging keys with MergePubPartial to set the bitid.
	DonePartialMerge(idInterface bitid.NewBitIDInterface)
	// MergePub combines two BLS public key objects into a single one (doing all necessary steps)
	MergePub(MultiPub) (MultiPub, error)
	// GetBitID returns the BitID for this public key
	GetBitID() bitid.NewBitIDInterface
	// SubMultiPub removes the input pub from he pub and returns the new pub
	SubMultiPub(MultiPub) (MultiPub, error)
	// GenerateSerializedSig serialized the public key and the signature and returns the bytes
	GenerateSerializedSig(MultiSig) ([]byte, error)
}

MultiPub is for multisignatures.

type MultiSig

type MultiSig interface {
	// SubSig removes sig2 from sig1, it assumes sig 1 already contains sig2
	SubSig(MultiSig) (MultiSig, error)
	// MergeBlsSig combines two signatures, it assumes the sigs are valid to be merged
	MergeSig(MultiSig) (MultiSig, error)
}

type MultiSignTestMsg

type MultiSignTestMsg struct {
	Round  uint32
	BinVal types.BinVal
}

func NewMultiSignTestMsg

func NewMultiSignTestMsg(pub Pub) *MultiSignTestMsg

func (*MultiSignTestMsg) DeserializeInternal

func (scm *MultiSignTestMsg) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

func (*MultiSignTestMsg) GetBaseMsgHeader

func (scm *MultiSignTestMsg) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*MultiSignTestMsg) GetID

func (scm *MultiSignTestMsg) GetID() messages.HeaderID

func (*MultiSignTestMsg) GetMsgID

func (scm *MultiSignTestMsg) GetMsgID() messages.MsgID

func (*MultiSignTestMsg) GetSignType

func (*MultiSignTestMsg) GetSignType() types.SignType

func (*MultiSignTestMsg) NeedsSMValidation

func (scm *MultiSignTestMsg) NeedsSMValidation(msgIndex types.ConsensusIndex, proposalIdx int) (idx types.ConsensusIndex,
	proposal []byte, err error)

func (*MultiSignTestMsg) SerializeInternal

func (scm *MultiSignTestMsg) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

func (*MultiSignTestMsg) ShallowCopy

type MultipleSignedMessage

type MultipleSignedMessage struct {
	messages.InternalSignedMsgHeader                      // the specific message
	Index                            types.ConsensusIndex // the cons index of the message

	Hash types.HashBytes // The hash of the signed part of the message as bytes

	Msg      []byte     // The signed part of the message
	SigItems []*SigItem // A list of signatures
	// contains filtered or unexported fields
}

MultipleSignedMessage represents a message with a list of signatures for that message

func NewMultipleSignedMsg

func NewMultipleSignedMsg(index types.ConsensusIndex, pub Pub, internalMsg messages.InternalSignedMsgHeader) *MultipleSignedMessage

NewMultipleSignedMsg generates a new multiple signed msg object given the input, it does not compute the hash fields.

func (*MultipleSignedMessage) DeserSign

func (sm *MultipleSignedMessage) DeserSign(m EncodedMsg, l, offset, endOffset int, size uint32) (int, error)

DeserSign takes as input a signed message m, the index in the message where signatures are placed l, the start and end indecies of the signed part of the message (offset and endOffest) and size the total size of the message It fills in the Hash and SigItems fields of the sm object and returns the size of the message.

func (*MultipleSignedMessage) Deserialize

func (sm *MultipleSignedMessage) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (n int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*MultipleSignedMessage) DeserializeEncoded

func (sm *MultipleSignedMessage) DeserializeEncoded(m EncodedMsg, unmarFunc types.ConsensusIndexFuncs) (n int, err error)

DeserializeEncoded deserialzes a header into the object, returning the number of bytes read

func (*MultipleSignedMessage) GetBytes

func (sm *MultipleSignedMessage) GetBytes(m *messages.Message) ([]byte, error)

GetBytes returns the bytes that make up the message

func (*MultipleSignedMessage) GetHashString

func (sm *MultipleSignedMessage) GetHashString() types.HashStr

GetHashString returns the hash of the message as a string

func (*MultipleSignedMessage) GetIndex

GetIndex returns the consensus index for this message.

func (*MultipleSignedMessage) GetSigCount

func (sm *MultipleSignedMessage) GetSigCount() (count int)

GetSigCount returns the number of times this message has been signed (can be greater than the number of signatures when using threshold signatures)

func (*MultipleSignedMessage) GetSigItems

func (sm *MultipleSignedMessage) GetSigItems() []*SigItem

GetSigItems returns the list of signatures of the message

func (*MultipleSignedMessage) GetSignedHash

func (sm *MultipleSignedMessage) GetSignedHash() types.HashBytes

GetSignedHash returns the hash of the signed part of the message message as bytes (see issue #22)

func (*MultipleSignedMessage) GetSignedMessage

func (sm *MultipleSignedMessage) GetSignedMessage() []byte

GetSignedMessage returns the bytes of the signed part of the message

func (*MultipleSignedMessage) PeekHeaders

func (sm *MultipleSignedMessage) PeekHeaders(m *messages.Message,
	unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)

PeekHeader returns the indices related to the messages without impacting m.

func (*MultipleSignedMessage) Serialize

func (sm *MultipleSignedMessage) Serialize(m *messages.Message) (int, error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*MultipleSignedMessage) SetSigItems

func (sm *MultipleSignedMessage) SetSigItems(si []*SigItem)

SetSigItems sets the list of signatures for the message

func (*MultipleSignedMessage) ShallowCopy

ShallowCopy generates a new multiple signed msg object that is a shallow copy of the original.

func (*MultipleSignedMessage) Sign

func (sm *MultipleSignedMessage) Sign(m *messages.Message, l, offset, endOffset, sizeOffset int) (int, error)

Sign takes as input a message m, it's lenght l, the part of the message to sign (from offset to endOffset) and where within the message the size should be stored (sizeOffset). If the sm object has a private key, then it uses that to sign the message. If the sm object has any signatures (in SigItems) those are also added to the message It returns the total lenght of the message including the signatures

type NewPrivFunc

type NewPrivFunc func() (Priv, error)

type Priv

type Priv interface {
	ComputeSharedSecret(pub Pub) [32]byte // ComputeSharedSecret should perform Diffie-Hellman.
	GetPub() Pub                          // GetPub returns the public key associated with this private key
	// SetIndex should be called after sorting the pubs (see SetUsePubIndex) with the sorted pub and the new pub key.
	SetIndex(newPubIndex PubKeyIndex)
	GenerateSig(msg SignedMessage, vrf VRFProof, signType types.SignType) (*SigItem, error) // Signs a message and returns the SigItem object containing the signature
	GetPrivForSignType(signType types.SignType) (Priv, error)                               // Returns key that is used for signing the sign type.
	Sign(message SignedMessage) (Sig, error)                                                // Signs a message and returns the signature
	GetBaseKey() Priv                                                                       // Returns the normal version of the key (eg. for partial signature keys returns the normal key)
	ShallowCopy() Priv
	Clean() // Called when the priv key is no longer used

	//////////////////////////////////////////////////////
	// Static methods
	/////////////////////////////////////////////////////
	// New() Priv   // Creates a new private key object of the same type
	NewSig() Sig // Creates an empty sig object of the same type.
}

Priv is a private key object

type PrivList

type PrivList []Priv

func (PrivList) SetIndices

func (a PrivList) SetIndices()

SetIndices should be called after sorting has completed to let the keys know their indecies

type Pub

type Pub interface {
	VerifySig(SignedMessage, Sig) (bool, error) // Verify a signature, returns (true, nil) if valid, (false, nil) if invalid, or (false, error) if there was an error verifying the signature
	// CheckSignature will should check what kind of message and signature to verify. It will call CheckCoinProof or VerfiySig
	// depending on the message type.
	CheckSignature(msg *MultipleSignedMessage, sig *SigItem) error
	GetPubBytes() (PubKeyBytes, error) // This is the key we use to sign/verify (might be an hash/operation performed on the original key)
	// GetRealPubBytes is the original unmodified public key. This is used when adding new public keys, from this we can generate all
	// the other values.
	GetRealPubBytes() (PubKeyBytes, error)
	GetPubString() (PubKeyStr, error) // This is the same as GetPubBytes, except returns a string, this is used to sort the keys
	GetSigMemberNumber() int          // This returns the number of members this sig counts for (can be > 1 for multisigs and threshold sigs)
	// GetPubID returns the id of the public key (see type definition for PubKeyID). IMPORTANT: this should only be used by
	// the member checker objects and when sending messages, since the id is based on the current set of member for a consensus index and can chage.
	// GetPubBytes, GetRealPubBytes, GetPubString should be used in other cases.
	// The member checker may change the PubID, after making a ShallowCopy, using AfterSortPubs to assign new IDs.
	GetPubID() (PubKeyID, error)
	SetIndex(PubKeyIndex)                  // This should be called after sorting all if the benchmark is using the index as the key id (see SetUsePubIndex)
	FromPubBytes(PubKeyBytes) (Pub, error) // This creates a public key object from the public key bytes
	ShallowCopy() Pub
	// GetIndex gets the index of the node represented by this key in the consensus participants
	GetIndex() PubKeyIndex

	New() Pub                                                                                            // Creates a new public key object of the same type
	DeserializeSig(m *messages.Message, signType types.SignType) (sigItem *SigItem, size int, err error) // Deserializes a public key and signature object from m, size is the number of bytes read

	messages.MsgHeader
	EncodeInterface
}

Pub is a public key object

func GetSingleSupporter

func GetSingleSupporter(msg messages.MsgHeader) Pub

CheckSingleSupporter checks if the message is either a Signed or Unsigned message and returns the supporter pub. It should be called after CheckSingleSupporter

func RemoveDuplicatePubs

func RemoveDuplicatePubs(pubs []Pub) (ret []Pub)

type PubKeyBytes

type PubKeyBytes []byte

PubKeyBytes is the public key encoded as bytes

type PubKeyID

type PubKeyID string

PubKeyID is a string that uniquely identifies a public key for a certain consensus instance this may be an integer or the full public key, depending on how SetUsePubIndex was set

func GetPubID

func GetPubID(idx PubKeyIndex, pub Pub) PubKeyID

type PubKeyIndex

type PubKeyIndex int

PubKeyIndex is the index of the pub key in the sorted list of consensus participants

type PubKeyStr

type PubKeyStr string

PubKeyStr is the public key endoced as a string

type PubKeyStrList

type PubKeyStrList []PubKeyStr

type PubList

type PubList []Pub

type SecondaryPriv

type SecondaryPriv interface {
	GetSecondaryPriv() Priv
}

type SecondaryPub

type SecondaryPub interface {
	VerifySecondarySig(SignedMessage, Sig) (bool, error) // Verify a signature, returns (true, nil) if valid, (false, nil) if invalid, or (false, error) if there was an error verifying the signature
}

type Sig

type Sig interface {
	//////////////////////////////////////////////////////
	// Static methods
	/////////////////////////////////////////////////////
	New() Sig // Creates a new sig object of the same type

	messages.MsgHeader
	EncodeInterface
}

Sig is a signature object

type SigItem

type SigItem struct {
	WasEncrypted bool     // Set to true if this was an encrypted message
	Pub          Pub      // The public key that will be used to verify the signature
	Sig          Sig      // The signature
	VRFProof     VRFProof // The VRF proof if enabled
	VRFID        uint64   // The first uint64 computed by the vrf
	SigBytes     []byte   // The bytes of the signature

}

SigItem tracks a signature and public key object that should verify the signature

func DeserVRF

func DeserVRF(pub Pub, m *messages.Message) (*SigItem, int, error)

DeserVRF is a helper function used by implementations of DeserializeSig

func GenerateSigHelper

func GenerateSigHelper(priv Priv, header SignedMessage, allowsVRF bool, vrfProof VRFProof, signType types.SignType) (*SigItem, error)

GenerateSigHelper is a helper function for implementations of GenerateSig

func GenerateSigHelperFromSig

func GenerateSigHelperFromSig(pub Pub, sig Sig, vrfProof VRFProof, signType types.SignType) (*SigItem, error)

GenerateSigHelper is a helper function for implementations of GenerateSig

type SigStats

type SigStats struct {
	PubSize, SigSize, ThrshShareSize, VRFSize        int
	SigVerifyTime, SignTime                          time.Duration
	ShareVerifyTime, ShareGenTime                    time.Duration
	ShareCombineTime                                 time.Duration
	MultiCombineTime                                 time.Duration
	VRFGenTime, VRFVerifyTime                        time.Duration
	AllowsCoin, AllowsMulti, AllowsThresh, AllowsVRF bool
}

type SignedMessage

type SignedMessage interface {
	GetSignedHash() types.HashBytes
	GetSignedMessage() []byte
}

type SortPriv

type SortPriv []Priv

SortPriv is private keys sorted by pub bytes

func (SortPriv) Len

func (a SortPriv) Len() int

func (SortPriv) Less

func (a SortPriv) Less(i, j int) bool

func (SortPriv) Swap

func (a SortPriv) Swap(i, j int)

type SortPub

type SortPub []Pub

SortPub is uses to create a sorted list of public keys

func (SortPub) Len

func (a SortPub) Len() int

func (SortPub) Less

func (a SortPub) Less(i, j int) bool

func (SortPub) Swap

func (a SortPub) Swap(i, j int)

type ThreshStateInterface

type ThreshStateInterface interface {
	BasicThresholdInterface
	// VerifyPartialSig([]byte, Pub, Sig) error    // Verify a partial signature.
	CombinePartialSigs([]Sig) (*SigItem, error) // Create a threshold signatue for the partial signatures.
	PartialSign(msg SignedMessage) (Sig, error) // Sign a message using the local node's partial key.
}

ThreshStateInterface is for storing state about threshold signatures. Methods should be concurrent safe.

type ThresholdCountInterface

type ThresholdCountInterface interface {
	GetT() int // Get the number of signatures needed for the threshold.
	GetN() int // Get the number of participants.
}

type ThrshSig

type ThrshSig interface {
	GetRand() types.BinVal // Get a random binary from the signature if supported.
}

ThrshSig interface of a threshold signature

type UnsignedMessage

type UnsignedMessage struct {
	messages.InternalSignedMsgHeader                      // the specific message
	Index                            types.ConsensusIndex // the cons index of the message

	Hash types.HashBytes // The hash of the signed part of the message as bytes

	Msg         []byte // The signed part of the message
	EncryptPubs []Pub  // The nodes who sent this message
	// contains filtered or unexported fields
}

UnsignedMessage represents a message with a list of signatures for that message

func NewUnsignedMessage

func NewUnsignedMessage(index types.ConsensusIndex, pub Pub, internalMsg messages.InternalSignedMsgHeader) *UnsignedMessage

NewMultipleSignedMsg generates a new multiple signed msg object given the input, it does not compute the hash fields.

func (*UnsignedMessage) Deserialize

func (sm *UnsignedMessage) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (n int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*UnsignedMessage) DeserializeEncoded

func (sm *UnsignedMessage) DeserializeEncoded(m EncodedMsg, unmarFunc types.ConsensusIndexFuncs) (n int, err error)

DeserializeEncoded deserialzes a header into the object, returning the number of bytes read

func (*UnsignedMessage) GetBytes

func (sm *UnsignedMessage) GetBytes(m *messages.Message) ([]byte, error)

GetBytes returns the bytes that make up the message

func (*UnsignedMessage) GetEncryptPubs

func (sm *UnsignedMessage) GetEncryptPubs() []Pub

GetSigItems returns the list of signatures of the message

func (*UnsignedMessage) GetHashString

func (sm *UnsignedMessage) GetHashString() types.HashStr

GetHashString returns the hash of the message as a string

func (*UnsignedMessage) GetIndex

func (sm *UnsignedMessage) GetIndex() types.ConsensusIndex

GetIndex returns the consensus index for this message.

func (*UnsignedMessage) GetSigCount

func (sm *UnsignedMessage) GetSigCount() (count int)

GetSigCount returns the number of times this message has been signed (can be greater than the number of signatures when using threshold signatures)

func (*UnsignedMessage) GetSignedHash

func (sm *UnsignedMessage) GetSignedHash() types.HashBytes

GetSignedHash returns the hash of the signed part of the message message as bytes (see issue #22)

func (*UnsignedMessage) GetSignedMessage

func (sm *UnsignedMessage) GetSignedMessage() []byte

GetSignedMessage returns the bytes of the signed part of the message

func (*UnsignedMessage) PeekHeaders

func (sm *UnsignedMessage) PeekHeaders(m *messages.Message,
	unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)

PeekHeader returns the indices related to the messages without impacting m.

func (*UnsignedMessage) Serialize

func (sm *UnsignedMessage) Serialize(m *messages.Message) (int, error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*UnsignedMessage) SetEncryptPubs

func (sm *UnsignedMessage) SetEncryptPubs(pubs []Pub)

SetSigItems sets the list of signatures for the message

func (*UnsignedMessage) ShallowCopy

ShallowCopy generates a new multiple signed msg object that is a shallow copy of the original.

type VRFPriv

type VRFPriv interface {
	Evaluate(m SignedMessage) (index [32]byte, proof VRFProof) // For generating VRFs.
}

VRFPriv interface for private key VRF operations.

type VRFProof

type VRFProof interface {
	EncodeInterface

	//////////////////////////////////////////////////////
	// Static methods
	/////////////////////////////////////////////////////
	New() VRFProof // Creates a VRFProof oject of the same type
}

type VRFPub

type VRFPub interface {
	// NewVRFProof returns an empty VRFProof object
	NewVRFProof() VRFProof
	// ProofToHash checks the VRF for the message and returns the random bytes if valid
	ProofToHash(m SignedMessage, proof VRFProof) (index [32]byte, err error) // For validating VRFs
}

VRFPub interface for public keys that support VRFs

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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