Documentation ¶
Index ¶
- Constants
- Variables
- func NewQsafePriv() (sig.Priv, error)
- type Priv
- func (priv *Priv) Clean()
- func (priv *Priv) ComputeSharedSecret(_ sig.Pub) [32]byte
- func (priv *Priv) GenerateSig(header sig.SignedMessage, vrfProof sig.VRFProof, signType types.SignType) (*sig.SigItem, error)
- func (priv *Priv) GetBaseKey() sig.Priv
- func (priv *Priv) GetPrivForSignType(signType types.SignType) (sig.Priv, error)
- func (priv *Priv) GetPub() sig.Pub
- func (priv *Priv) New() sig.Priv
- func (priv *Priv) NewSig() sig.Sig
- func (priv *Priv) SetIndex(index sig.PubKeyIndex)
- func (priv *Priv) ShallowCopy() sig.Priv
- func (priv *Priv) Sign(msg sig.SignedMessage) (sig.Sig, error)
- type QsafePub
- func (pub *QsafePub) CheckSignature(msg *sig.MultipleSignedMessage, sigItem *sig.SigItem) error
- func (pub *QsafePub) Decode(reader io.Reader) (n int, err error)
- func (pub *QsafePub) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (int, error)
- func (pub *QsafePub) DeserializeSig(m *messages.Message, signType types.SignType) (*sig.SigItem, int, error)
- func (pub *QsafePub) Encode(writer io.Writer) (n int, err error)
- func (pub *QsafePub) FromPubBytes(b sig.PubKeyBytes) (sig.Pub, error)
- func (pub *QsafePub) GetBytes(m *messages.Message) ([]byte, error)
- func (pub *QsafePub) GetID() messages.HeaderID
- func (pub *QsafePub) GetIndex() sig.PubKeyIndex
- func (pub *QsafePub) GetMsgID() messages.MsgID
- func (pub *QsafePub) GetPubBytes() (sig.PubKeyBytes, error)
- func (pub *QsafePub) GetPubID() (sig.PubKeyID, error)
- func (pub *QsafePub) GetPubString() (sig.PubKeyStr, error)
- func (pub *QsafePub) GetRealPubBytes() (sig.PubKeyBytes, error)
- func (pub *QsafePub) GetSigMemberNumber() int
- func (pub *QsafePub) New() sig.Pub
- func (*QsafePub) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)
- func (pub *QsafePub) Serialize(m *messages.Message) (int, error)
- func (pub *QsafePub) SetIndex(index sig.PubKeyIndex)
- func (pub *QsafePub) ShallowCopy() sig.Pub
- func (pub *QsafePub) VerifySig(msg sig.SignedMessage, aSig sig.Sig) (bool, error)
- type QsafeSig
- func (sig *QsafeSig) Corrupt()
- func (sig *QsafeSig) Decode(reader io.Reader) (n int, err error)
- func (sig *QsafeSig) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (int, error)
- func (sig *QsafeSig) Encode(writer io.Writer) (n int, err error)
- func (sig *QsafeSig) GetBytes(m *messages.Message) ([]byte, error)
- func (sig *QsafeSig) GetID() messages.HeaderID
- func (sig *QsafeSig) GetMsgID() messages.MsgID
- func (sig *QsafeSig) New() sig.Sig
- func (*QsafeSig) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)
- func (sig *QsafeSig) Serialize(m *messages.Message) (int, error)
Constants ¶
const SigTypeName = "DEFAULT"
Variables ¶
var Stats = sig.SigStats{
PubSize: 1184,
SigSize: 2046,
SigVerifyTime: 37337,
SignTime: 131871,
}
Functions ¶
func NewQsafePriv ¶
NewQsafePriv creates a new random ECDSA private key object
Types ¶
type Priv ¶
type Priv struct {
// contains filtered or unexported fields
}
QsafePriv represents the ECDSA private key object
func (*Priv) ComputeSharedSecret ¶
ComputeSharedSecret returns the hash of Diffie-Hellman.
func (*Priv) GenerateSig ¶
func (priv *Priv) 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 (*Priv) GetPrivForSignType ¶
Returns key that is used for signing the sign type.
func (*Priv) SetIndex ¶
func (priv *Priv) SetIndex(index sig.PubKeyIndex)
SetIndex sets the index of the node represented by this key in the consensus participants
func (*Priv) ShallowCopy ¶
Shallow copy makes a copy of the object without following pointers.
type QsafePub ¶
type QsafePub struct {
// contains filtered or unexported fields
}
QsafePub represents an quantum safe public key
func (*QsafePub) CheckSignature ¶
CheckSignature validates the signature with the public key, it returns an error if a coin proof is included.
func (*QsafePub) Deserialize ¶
func (pub *QsafePub) 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 (*QsafePub) DeserializeSig ¶
func (pub *QsafePub) DeserializeSig(m *messages.Message, signType types.SignType) (*sig.SigItem, int, error)
DeserializeSig takes a message and returns an qsafe public key object and signature as well as the number of bytes read
func (*QsafePub) FromPubBytes ¶
FromPubBytes generates an public key object from the bytes of a public key
func (*QsafePub) GetIndex ¶
func (pub *QsafePub) GetIndex() sig.PubKeyIndex
GetIndex gets the index of the node represented by this key in the consensus participants
func (*QsafePub) GetPubBytes ¶
func (pub *QsafePub) GetPubBytes() (sig.PubKeyBytes, error)
GetPubBytes returns the pub key as bytes (same as GetRealPubBytes for keys)
func (*QsafePub) 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 (*QsafePub) GetPubString ¶
GetPubString is the same as GetPubBytes, except returns a string
func (*QsafePub) GetRealPubBytes ¶
func (pub *QsafePub) GetRealPubBytes() (sig.PubKeyBytes, error)
GetRealPubBytes returns the pub key as bytes (same as GetPubBytes for keys)
func (*QsafePub) GetSigMemberNumber ¶
GetSigMemberNumber always returns one since qsafe signautres can only represent a single signer
func (*QsafePub) PeekHeaders ¶
func (*QsafePub) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)
PeekHeader returns nil.
func (*QsafePub) Serialize ¶
Serialize the pub key into the message, return the number of bytes written
func (*QsafePub) SetIndex ¶
func (pub *QsafePub) SetIndex(index sig.PubKeyIndex)
SetIndex sets the index of the node represented by this key in the consensus participants
func (*QsafePub) ShallowCopy ¶
Shallow copy makes a copy of the object without following pointers.
type QsafeSig ¶
type QsafeSig struct {
// contains filtered or unexported fields
}
QsafeSig is the object representing an qsafe signature
func (*QsafeSig) Corrupt ¶
func (sig *QsafeSig) Corrupt()
Corrupt invlidates an qsafe signature object
func (*QsafeSig) Deserialize ¶
func (sig *QsafeSig) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (int, error)
Derserialize updates the fields of the qsafe signature object from m, and returns the number of bytes read
func (*QsafeSig) PeekHeaders ¶
func (*QsafeSig) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)
PeekHeader returns the indices related to the messages without impacting m.