bls

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SignatureBytes is the length of a BLS signature
	SignatureBytes = 48
	// SecretKeyBytes is the length of a BLS private key
	SecretKeyBytes = 32
	// PublicKeyBytes is the length of a BLS public key
	PublicKeyBytes = 96
)

Variables

View Source
var ErrBytesLen = errors.New("invalid length of the compressed byte slice")
View Source
var ErrInvalidSig = errors.New("invalid signature")
View Source
var ErrSigMismatch = errors.New("signature mismatch")

Functions

This section is empty.

Types

type BlsManager

type BlsManager interface {
	// GenerateKey generates a fresh key-pair for BLS signatures.
	GenerateKey() (SecretKey, PublicKey)
	//Aggregate aggregates signatures together into a new signature.
	Aggregate([]Signature) (Signature, error)
	//AggregatePublic aggregates public keys together into a new PublicKey.
	AggregatePublic([]PublicKey) (PublicKey, error)
	// VerifyAggregatedOne verifies each public key against a message.
	VerifyAggregatedOne([]PublicKey, Message, Signature) error
	// VerifyAggregatedN verifies each public key against each message.
	VerifyAggregatedN([]PublicKey, []Message, Signature) error
	//DecPublicKey decompress a public key
	DecPublicKey([]byte) (PublicKey, error)
	//DecPublicKeyHex decompress a public key from a hex string
	DecPublicKeyHex(string) (PublicKey, error)
	//DecSecretKey decompress a secret key
	DecSecretKey([]byte) (SecretKey, error)
	//DecSecretKeyHex decompress a secret key from a hex string
	DecSecretKeyHex(string) (SecretKey, error)
	//DecSignature decompress a signature
	DecSignature([]byte) (Signature, error)
	//DecSignatureHex decompress a signature from a hex string
	DecSignatureHex(string) (Signature, error)
}

func NewBlsManager

func NewBlsManager() BlsManager

type CompressedPublic

type CompressedPublic [PublicKeyBytes]byte

CompressedPublic is a compressed affine representing a PublicKey

func (CompressedPublic) Bytes

func (b CompressedPublic) Bytes() []byte

func (CompressedPublic) String

func (b CompressedPublic) String() string

type CompressedSecret

type CompressedSecret [SecretKeyBytes]byte

CompressedSecret is a compressed affine representing a SecretKey

func (CompressedSecret) Bytes

func (b CompressedSecret) Bytes() []byte

func (CompressedSecret) String

func (b CompressedSecret) String() string

type CompressedSignature

type CompressedSignature [SignatureBytes]byte

CompressedSignature is a compressed affine

func (CompressedSignature) Bytes

func (b CompressedSignature) Bytes() []byte

func (CompressedSignature) String

func (b CompressedSignature) String() string

type Message

type Message []byte

Message is a byte slice

type PublicKey

type PublicKey interface {
	// Verify verifies a signature against a message and the public key.
	Verify(m Message, sig Signature) error
	// Aggregate adds an other public key to the current.
	Aggregate(other PublicKey) error
	// Compress compresses the public key to a byte slice.
	Compress() CompressedPublic
}

type SecretKey

type SecretKey interface {
	// Sign returns the BLS signature of the giving message.
	Sign(m Message) Signature
	// PubKey returns the corresponding public key.
	PubKey() (PublicKey, error)
	// Compress compresses the secret key to a byte slice.
	Compress() CompressedSecret
}

type Signature

type Signature interface {
	// Compress compresses the signature to a byte slice.
	Compress() CompressedSignature
}

Jump to

Keyboard shortcuts

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