bls

package
v0.0.0-...-a293c92 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BLSPrivateKeyLength = 32
	BLSPublicKeyLength  = 48
	BLSSignatureLength  = 96
	BLSMsgHashSize      = 32
)

Variables

This section is empty.

Functions

func ConvertToPublicKey

func ConvertToPublicKey(pub crypto.PubKey) (*bls.PublicKey, error)

ConvertToPublicKey convert to BLS PublicKey

func ConvertToSignature

func ConvertToSignature(sig crypto.Signature) (*bls.Sign, error)

ConvertToSignature convert to BLS Signature

Types

type Driver

type Driver struct{}

Driver driver

func New

func New() *Driver

func (*Driver) Aggregate

func (d *Driver) Aggregate(sigs []crypto.Signature) (crypto.Signature, error)

func (*Driver) AggregatePublic

func (d *Driver) AggregatePublic(pubs []crypto.PubKey) (crypto.PubKey, error)

func (*Driver) GenKey

func (d *Driver) GenKey() (k crypto.PrivKey, e error)

GenKey create private key

func (*Driver) PrivKeyFromBytes

func (d *Driver) PrivKeyFromBytes(b []byte) (privKey crypto.PrivKey, err error)

PrivKeyFromBytes create private key from bytes

func (*Driver) PubKeyFromBytes

func (d *Driver) PubKeyFromBytes(b []byte) (pubKey crypto.PubKey, err error)

PubKeyFromBytes create public key from bytes

func (*Driver) SignatureFromBytes

func (d *Driver) SignatureFromBytes(b []byte) (sig crypto.Signature, err error)

SignatureFromBytes create signature from bytes

func (*Driver) Validate

func (d *Driver) Validate(msg, pub, sig []byte) error

Validate validate sign by msg and pub

func (*Driver) VerifyAggregatedN

func (d *Driver) VerifyAggregatedN(pubs []crypto.PubKey, ms [][]byte, sig crypto.Signature) error

由于cgo库的规则,需要每个ms都不大于32byte,或者后面

func (*Driver) VerifyAggregatedOne

func (d *Driver) VerifyAggregatedOne(pubs []crypto.PubKey, m []byte, sig crypto.Signature) error

type PrivKeyBLS

type PrivKeyBLS [BLSPrivateKeyLength]byte

PrivKeyBLS PrivKey

func (PrivKeyBLS) Bytes

func (privKey PrivKeyBLS) Bytes() []byte

Bytes convert to bytes

func (PrivKeyBLS) Equals

func (privKey PrivKeyBLS) Equals(other crypto.PrivKey) bool

Equals check privkey is equal

func (PrivKeyBLS) PubKey

func (privKey PrivKeyBLS) PubKey() crypto.PubKey

PubKey convert to public key

func (PrivKeyBLS) Sign

func (privKey PrivKeyBLS) Sign(msg []byte) crypto.Signature

Sign create signature

func (PrivKeyBLS) String

func (privKey PrivKeyBLS) String() string

String convert to string

type PubKeyBLS

type PubKeyBLS [BLSPublicKeyLength]byte

PubKeyBLS PubKey

func (PubKeyBLS) Bytes

func (pubKey PubKeyBLS) Bytes() []byte

Bytes convert to bytes

func (PubKeyBLS) Equals

func (pubKey PubKeyBLS) Equals(other crypto.PubKey) bool

Equals check public key is equal

func (PubKeyBLS) KeyString

func (pubKey PubKeyBLS) KeyString() string

KeyString Must return the full bytes in hex. Used for map keying, etc.

func (PubKeyBLS) String

func (pubKey PubKeyBLS) String() string

String convert to string

func (PubKeyBLS) VerifyBytes

func (pubKey PubKeyBLS) VerifyBytes(msg []byte, sig crypto.Signature) bool

VerifyBytes verify signature

type SignatureBLS

type SignatureBLS [BLSSignatureLength]byte

SignatureBLS Signature

func (SignatureBLS) Bytes

func (sig SignatureBLS) Bytes() []byte

Bytes convert signature to bytes

func (SignatureBLS) Equals

func (sig SignatureBLS) Equals(other crypto.Signature) bool

Equals check signature equals

func (SignatureBLS) IsZero

func (sig SignatureBLS) IsZero() bool

IsZero check signature is zero

func (SignatureBLS) String

func (sig SignatureBLS) String() string

String convert signature to string

type SignatureS

type SignatureS struct {
	crypto.Signature
}

SignatureS signature struct

Jump to

Keyboard shortcuts

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