ecdsa

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 10 Imported by: 1

Documentation

Overview

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

Index

Constants

View Source
const (
	// PrivateKeyFileType is the PEM type for a private key.
	PrivateKeyFileType = "ECDSA PRIVATE KEY"

	// PublicKeyFileType is the PEM type for a public key.
	PublicKeyFileType = "ECDSA PUBLIC KEY"
)

Variables

This section is empty.

Functions

func New

func New() consensus.CryptoImpl

New returns a new signer and a new verifier.

Types

type Signature

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

Signature is an ECDSA signature

func RestoreSignature added in v0.3.0

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

RestoreSignature restores an existing signature. It should not be used to create new signatures, use Sign instead.

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

type ThresholdSignature added in v0.3.0

type ThresholdSignature map[hotstuff.ID]*Signature

ThresholdSignature is a set of (partial) signatures that form a valid threshold signature when there are a quorum of valid (partial) signatures.

func RestoreThresholdSignature added in v0.3.0

func RestoreThresholdSignature(signatures []*Signature) ThresholdSignature

RestoreThresholdSignature should only be used to restore an existing threshold signature from a set of signatures. To create a new verifiable threshold signature, use CreateThresholdSignature instead.

func (ThresholdSignature) Add added in v0.3.0

func (sig ThresholdSignature) Add(id hotstuff.ID)

Add adds an ID to the set.

func (ThresholdSignature) Contains added in v0.3.0

func (sig ThresholdSignature) Contains(id hotstuff.ID) bool

Contains returns true if the set contains the ID.

func (ThresholdSignature) ForEach added in v0.3.0

func (sig ThresholdSignature) ForEach(f func(hotstuff.ID))

ForEach calls f for each ID in the set.

func (ThresholdSignature) Participants added in v0.3.0

func (sig ThresholdSignature) Participants() consensus.IDSet

Participants returns the IDs of replicas who participated in the threshold signature.

func (ThresholdSignature) ToBytes added in v0.3.0

func (sig ThresholdSignature) ToBytes() []byte

ToBytes returns the object as bytes.

Jump to

Keyboard shortcuts

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