ecdsa

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

Package ecdsa provides a crypto implementation for HotStuff using Go's 'crypto/ecdsa' package.

Index

Constants

This section is empty.

Variables

View Source
var ErrHashMismatch = fmt.Errorf("certificate hash does not match block hash")

ErrHashMismatch is the error used when a partial certificate hash does not match the hash of a block.

View Source
var ErrPartialDuplicate = fmt.Errorf("cannot add more than one signature per replica")

ErrPartialDuplicate is the error used when two or more signatures were created by the same replica.

Functions

func New

New returns a new Signer and a new Verifier.

Types

type PartialCert

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

PartialCert is an ECDSA signature and the hash that was signed.

func NewPartialCert

func NewPartialCert(signature *Signature, hash hotstuff.Hash) *PartialCert

NewPartialCert initializes a PartialCert struct from the given values.

func (PartialCert) BlockHash

func (cert PartialCert) BlockHash() hotstuff.Hash

BlockHash returns the hash of the block that was signed.

func (PartialCert) Signature

func (cert PartialCert) Signature() hotstuff.Signature

Signature returns the signature.

func (PartialCert) String

func (cert PartialCert) String() string

func (PartialCert) ToBytes

func (cert PartialCert) ToBytes() []byte

ToBytes returns a byte representation of the partial certificate.

type PrivateKey

type PrivateKey struct {
	*ecdsa.PrivateKey
}

PrivateKey is an ECDSA private key.

This struct wraps the regular ecdsa.PrivateKey in order to implement the hotstuff.PrivateKey interface.

func (PrivateKey) PublicKey

func (pk PrivateKey) PublicKey() hotstuff.PublicKey

PublicKey returns the public key associated with the private key

type QuorumCert

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

QuorumCert is a set of signature that form a quorum certificate for a block.

func NewQuorumCert

func NewQuorumCert(signatures map[hotstuff.ID]*Signature, hash hotstuff.Hash) *QuorumCert

NewQuorumCert initializes a new QuorumCert struct from the given values.

func (QuorumCert) BlockHash

func (qc QuorumCert) BlockHash() hotstuff.Hash

BlockHash returns the hash of the block for which the certificate was created.

func (QuorumCert) Signatures

func (qc QuorumCert) Signatures() map[hotstuff.ID]*Signature

Signatures returns the signatures within the quorum certificate.

func (QuorumCert) String

func (qc QuorumCert) String() string

func (QuorumCert) ToBytes

func (qc QuorumCert) ToBytes() []byte

ToBytes returns a byte representation of the quorum certificate.

type Signature

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

Signature is an ECDSA signature

func NewSignature

func NewSignature(r, s *big.Int, signer hotstuff.ID) *Signature

NewSignature creates a new Signature struct from the given values.

func (Signature) R

func (sig Signature) R() *big.Int

R returns the r value of the signature

func (Signature) S

func (sig Signature) S() *big.Int

S returns the s value of the signature

func (Signature) Signer

func (sig Signature) Signer() hotstuff.ID

Signer returns the ID of the replica that generated the signature.

func (Signature) ToBytes

func (sig Signature) ToBytes() []byte

ToBytes returns a raw byte string representation of the signature

Jump to

Keyboard shortcuts

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