Documentation ¶
Index ¶
- Variables
- func NewEcpriv() (sig.Priv, error)
- type Ecpriv
- func (priv *Ecpriv) Clean()
- func (priv *Ecpriv) ComputeSharedSecret(pub sig.Pub) [32]byte
- func (priv *Ecpriv) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (int, error)
- func (priv *Ecpriv) Evaluate(m sig.SignedMessage) (index [32]byte, proof sig.VRFProof)
- func (priv *Ecpriv) GenerateSig(header sig.SignedMessage, vrfProof sig.VRFProof, signType types.SignType) (*sig.SigItem, error)
- func (priv *Ecpriv) GetBaseKey() sig.Priv
- func (priv *Ecpriv) GetBytes(m *messages.Message) ([]byte, error)
- func (priv *Ecpriv) GetID() messages.HeaderID
- func (priv *Ecpriv) GetMsgID() messages.MsgID
- func (priv *Ecpriv) GetPrivForSignType(signType types.SignType) (sig.Priv, error)
- func (priv *Ecpriv) GetPub() sig.Pub
- func (priv *Ecpriv) New() sig.Priv
- func (priv *Ecpriv) NewSig() sig.Sig
- func (Ecpriv) PeekHeaders(*messages.Message, types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)
- func (priv *Ecpriv) Serialize(m *messages.Message) (int, error)
- func (priv *Ecpriv) SetIndex(index sig.PubKeyIndex)
- func (priv *Ecpriv) ShallowCopy() sig.Priv
- func (priv *Ecpriv) Sign(msg sig.SignedMessage) (sig.Sig, error)
- type Ecpub
- func (pub *Ecpub) CheckSignature(msg *sig.MultipleSignedMessage, sigItem *sig.SigItem) error
- func (pub *Ecpub) Decode(reader io.Reader) (n int, err error)
- func (pub *Ecpub) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (int, error)
- func (pub *Ecpub) DeserializeSig(m *messages.Message, signType types.SignType) (*sig.SigItem, int, error)
- func (pub *Ecpub) Encode(writer io.Writer) (n int, err error)
- func (pub *Ecpub) FromPubBytes(b sig.PubKeyBytes) (sig.Pub, error)
- func (pub *Ecpub) GetBytes(m *messages.Message) ([]byte, error)
- func (pub *Ecpub) GetID() messages.HeaderID
- func (pub *Ecpub) GetIndex() sig.PubKeyIndex
- func (pub *Ecpub) GetMsgID() messages.MsgID
- func (pub *Ecpub) GetPubBytes() (sig.PubKeyBytes, error)
- func (pub *Ecpub) GetPubID() (sig.PubKeyID, error)
- func (pub *Ecpub) GetPubString() (sig.PubKeyStr, error)
- func (pub *Ecpub) GetRealPubBytes() (sig.PubKeyBytes, error)
- func (pub *Ecpub) GetSigMemberNumber() int
- func (pub *Ecpub) New() sig.Pub
- func (pub *Ecpub) NewVRFProof() sig.VRFProof
- func (*Ecpub) PeekHeaders(*messages.Message, types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)
- func (pub *Ecpub) ProofToHash(m sig.SignedMessage, proof sig.VRFProof) (index [32]byte, err error)
- func (pub *Ecpub) Serialize(m *messages.Message) (int, error)
- func (pub *Ecpub) SetIndex(index sig.PubKeyIndex)
- func (pub *Ecpub) ShallowCopy() sig.Pub
- func (pub *Ecpub) VerifySig(msg sig.SignedMessage, aSig sig.Sig) (bool, error)
- type Ecsig
- func (sig *Ecsig) Corrupt()
- func (sig *Ecsig) Decode(reader io.Reader) (n int, err error)
- func (sig *Ecsig) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (int, error)
- func (sig *Ecsig) Encode(writer io.Writer) (n int, err error)
- func (sig *Ecsig) GetBytes(m *messages.Message) ([]byte, error)
- func (sig *Ecsig) GetID() messages.HeaderID
- func (sig *Ecsig) GetMsgID() messages.MsgID
- func (sig *Ecsig) New() sig.Sig
- func (*Ecsig) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)
- func (sig *Ecsig) Serialize(m *messages.Message) (int, error)
- type VRFProof
Constants ¶
This section is empty.
Variables ¶
var Stats = sig.SigStats{ PubSize: 65, SigSize: 73, VRFSize: 129, SigVerifyTime: 86693, SignTime: 34126, VRFGenTime: 256468, VRFVerifyTime: 324876, AllowsVRF: true, }
Functions ¶
Types ¶
type Ecpriv ¶
type Ecpriv struct {
// contains filtered or unexported fields
}
Ecpriv represents the ECDSA private key object
func (*Ecpriv) ComputeSharedSecret ¶
ComputeSharedSecret returns the hash of Diffie-Hellman.
func (*Ecpriv) Deserialize ¶
func (*Ecpriv) GenerateSig ¶
func (priv *Ecpriv) GenerateSig(header sig.SignedMessage, vrfProof sig.VRFProof, signType types.SignType) (*sig.SigItem, error)
GenerateSig signs a message and returns the SigItem object containing the signature
func (*Ecpriv) GetBaseKey ¶
GetBaseKey returns the same key.
func (*Ecpriv) GetPrivForSignType ¶
Returns key that is used for signing the sign type.
func (Ecpriv) PeekHeaders ¶
func (Ecpriv) PeekHeaders(*messages.Message, types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)
PeekHeader returns nil.
func (*Ecpriv) SetIndex ¶
func (priv *Ecpriv) SetIndex(index sig.PubKeyIndex)
SetIndex sets the index of the node represented by this key in the consensus participants
func (*Ecpriv) ShallowCopy ¶
Shallow copy makes a copy of the object without following pointers.
type Ecpub ¶
type Ecpub struct {
// contains filtered or unexported fields
}
Ecpub represents an ECDSA public key
func (*Ecpub) CheckSignature ¶
CheckSignature validates the signature with the public key, it returns an error if a coin proof is included.
func (*Ecpub) Deserialize ¶
func (pub *Ecpub) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (int, error)
Deserialize updates the fields of the pub key object from m, and returns the number of bytes read
func (*Ecpub) DeserializeSig ¶
func (pub *Ecpub) DeserializeSig(m *messages.Message, signType types.SignType) (*sig.SigItem, int, error)
DeserializeSig takes a message and returns an ECDSA public key object and signature as well as the number of bytes read
func (*Ecpub) FromPubBytes ¶
FromPubBytes generates an ECDSA public key object from the bytes of a public key
func (*Ecpub) GetIndex ¶
func (pub *Ecpub) GetIndex() sig.PubKeyIndex
GetIndex gets the index of the node represented by this key in the consensus participants
func (*Ecpub) GetPubBytes ¶
func (pub *Ecpub) GetPubBytes() (sig.PubKeyBytes, error)
GetPubBytes returns the ECDSA pub key as bytes (same as GetRealPubBytes for ECDSA keys)
func (*Ecpub) GetPubID ¶
GetPubID returns the unique id for this pubkey (given some consensus instance), it could be the encoded bitid, or just the pub key depending on how SetUsePubIndex was set
func (*Ecpub) GetPubString ¶
GetPubString is the same as GetPubBytes, except returns a string
func (*Ecpub) GetRealPubBytes ¶
func (pub *Ecpub) GetRealPubBytes() (sig.PubKeyBytes, error)
GetRealPubBytes returns the ECDSA pub key as bytes (same as GetPubBytes for ECDSA keys)
func (*Ecpub) GetSigMemberNumber ¶
GetSigMemberNumber always returns one since ECDSA signautres can only represent a single signer
func (*Ecpub) NewVRFProof ¶
NewVRFProof returns an empty VRFProof object, and is not supported for ed.
func (*Ecpub) PeekHeaders ¶
func (*Ecpub) PeekHeaders(*messages.Message, types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)
PeekHeader returns nil.
func (*Ecpub) ProofToHash ¶
ProofToHash is for validating VRFs.
func (*Ecpub) Serialize ¶
Serialize the pub key into the message, return the number of bytes written
func (*Ecpub) SetIndex ¶
func (pub *Ecpub) SetIndex(index sig.PubKeyIndex)
SetIndex sets the index of the node represented by this key in the consensus participants
func (*Ecpub) ShallowCopy ¶
Shallow copy makes a copy of the object without following pointers.
type Ecsig ¶
Ecsig is the object representing an ECDSA signature
func (*Ecsig) Deserialize ¶
func (sig *Ecsig) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (int, error)
Derserialize updates the fields of the ECDSA signature object from m, and returns the number of bytes read
func (*Ecsig) PeekHeaders ¶
func (*Ecsig) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)
PeekHeader returns the indices related to the messages without impacting m.