Documentation ¶
Overview ¶
Package bls12 implements the crypto primitives used by HotStuff using curve BLS12-381.
Index ¶
Constants ¶
const ( // PrivateKeyFileType is the PEM type for a private key. PrivateKeyFileType = "BLS12-381 PRIVATE KEY" // PublicKeyFileType is the PEM type for a public key. PublicKeyFileType = "BLS12-381 PUBLIC KEY" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AggregateSignature ¶
type AggregateSignature struct {
// contains filtered or unexported fields
}
AggregateSignature is a bls12-381 aggregate signature. The participants map contains the IDs of the replicas who participated in the creation of the signature. This allows us to build an aggregated public key to verify the signature.
func RestoreAggregateSignature ¶
func RestoreAggregateSignature(sig []byte, participants crypto.Bitfield) (s *AggregateSignature, err error)
RestoreAggregateSignature restores an existing aggregate signature. It should not be used to create new aggregate signatures. Use CreateThresholdSignature instead.
func (AggregateSignature) Bitfield ¶
func (agg AggregateSignature) Bitfield() crypto.Bitfield
Bitfield returns the bitmask.
func (AggregateSignature) Participants ¶
func (agg AggregateSignature) Participants() consensus.IDSet
Participants returns the IDs of replicas who participated in the threshold signature.
func (*AggregateSignature) ToBytes ¶
func (agg *AggregateSignature) ToBytes() []byte
ToBytes returns a byte representation of the aggregate signature.
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
PrivateKey is a bls12-381 private key.
func GeneratePrivateKey ¶
func GeneratePrivateKey() (*PrivateKey, error)
GeneratePrivateKey generates a new private key.
func (*PrivateKey) FromBytes ¶
func (priv *PrivateKey) FromBytes(b []byte)
FromBytes unmarshals the private key from a byte slice.
func (*PrivateKey) Public ¶
func (priv *PrivateKey) Public() consensus.PublicKey
Public returns the public key associated with this private key.
func (PrivateKey) ToBytes ¶
func (priv PrivateKey) ToBytes() []byte
ToBytes marshals the private key to a byte slice.
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey is a bls12-381 public key.