qsafe

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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const SigTypeName = "DEFAULT"

Variables

View Source
var Stats = sig.SigStats{
	PubSize:       1184,
	SigSize:       2046,
	SigVerifyTime: 37337,
	SignTime:      131871,
}

Functions

func NewQsafePriv

func NewQsafePriv() (sig.Priv, error)

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) Clean

func (priv *Priv) Clean()

Clean garbage collects the c objects.

func (*Priv) ComputeSharedSecret

func (priv *Priv) ComputeSharedSecret(_ sig.Pub) [32]byte

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) GetBaseKey

func (priv *Priv) GetBaseKey() sig.Priv

GetBaseKey returns the same key.

func (*Priv) GetPrivForSignType

func (priv *Priv) GetPrivForSignType(signType types.SignType) (sig.Priv, error)

Returns key that is used for signing the sign type.

func (*Priv) GetPub

func (priv *Priv) GetPub() sig.Pub

GetPub returns the coreesponding ECDSA public key object

func (*Priv) New

func (priv *Priv) New() sig.Priv

New creates an empty ECDSA private key object

func (*Priv) NewSig

func (priv *Priv) NewSig() sig.Sig

NewSig returns an empty sig object of the same 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

func (priv *Priv) ShallowCopy() sig.Priv

Shallow copy makes a copy of the object without following pointers.

func (*Priv) Sign

func (priv *Priv) Sign(msg sig.SignedMessage) (sig.Sig, error)

Sign signs a message and returns the signature.

type QsafePub

type QsafePub struct {
	// contains filtered or unexported fields
}

QsafePub represents an quantum safe public key

func (*QsafePub) CheckSignature

func (pub *QsafePub) CheckSignature(msg *sig.MultipleSignedMessage, sigItem *sig.SigItem) error

CheckSignature validates the signature with the public key, it returns an error if a coin proof is included.

func (*QsafePub) Decode

func (pub *QsafePub) Decode(reader io.Reader) (n int, err error)

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) Encode

func (pub *QsafePub) Encode(writer io.Writer) (n int, err error)

func (*QsafePub) FromPubBytes

func (pub *QsafePub) FromPubBytes(b sig.PubKeyBytes) (sig.Pub, error)

FromPubBytes generates an public key object from the bytes of a public key

func (*QsafePub) GetBytes

func (pub *QsafePub) GetBytes(m *messages.Message) ([]byte, error)

GetBytes returns the bytes of the qsafe public key from the message

func (*QsafePub) GetID

func (pub *QsafePub) GetID() messages.HeaderID

GetID returns the header id for pub objects

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) GetMsgID

func (pub *QsafePub) GetMsgID() messages.MsgID

GetMsgID returns the message id for an qsafe public key

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

func (pub *QsafePub) GetPubID() (sig.PubKeyID, error)

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

func (pub *QsafePub) GetPubString() (sig.PubKeyStr, error)

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

func (pub *QsafePub) GetSigMemberNumber() int

GetSigMemberNumber always returns one since qsafe signautres can only represent a single signer

func (*QsafePub) New

func (pub *QsafePub) New() sig.Pub

New returns a blank qsafe public key object

func (*QsafePub) PeekHeaders

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

PeekHeader returns nil.

func (*QsafePub) Serialize

func (pub *QsafePub) Serialize(m *messages.Message) (int, error)

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

func (pub *QsafePub) ShallowCopy() sig.Pub

Shallow copy makes a copy of the object without following pointers.

func (*QsafePub) VerifySig

func (pub *QsafePub) VerifySig(msg sig.SignedMessage, aSig sig.Sig) (bool, error)

VerifySig verifies that sig is a valid signature for msg by qsafe public key pub

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) Decode

func (sig *QsafeSig) Decode(reader io.Reader) (n int, err error)

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) Encode

func (sig *QsafeSig) Encode(writer io.Writer) (n int, err error)

func (*QsafeSig) GetBytes

func (sig *QsafeSig) GetBytes(m *messages.Message) ([]byte, error)

GetBytes returns the bytes of the signature from the message

func (*QsafeSig) GetID

func (sig *QsafeSig) GetID() messages.HeaderID

GetID returns the header id for qsafe signatures

func (*QsafeSig) GetMsgID

func (sig *QsafeSig) GetMsgID() messages.MsgID

GetMsgID returns the message ID for qsafe sig header

func (*QsafeSig) New

func (sig *QsafeSig) New() sig.Sig

New creates a new blank qsafe signature object

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.

func (*QsafeSig) Serialize

func (sig *QsafeSig) Serialize(m *messages.Message) (int, error)

Serialize the signature into the message, and return the nuber of bytes written

Jump to

Keyboard shortcuts

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