bls

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PopVerify added in v1.12.0

func PopVerify(pk PublicKey, sig Signature) bool

PopVerify verifies the proof-of-possession for the public key.

func SaveKey added in v1.12.0

func SaveKey(path string, sk SecretKey) error

SaveKey stores a BLS secret key to the given file.

func VerifyMultipleSignatures

func VerifyMultipleSignatures(sigs [][]byte, msgs [][32]byte, pubKeys []PublicKey) (bool, error)

VerifyMultipleSignatures verifies multiple signatures for distinct messages securely.

func VerifySignature

func VerifySignature(sig []byte, msg [32]byte, pk PublicKey) (bool, error)

VerifySignature checks a signature. To perform aggregate verify, supply the aggregate signature and aggregate public key.

Types

type PublicKey

type PublicKey = types.PublicKey

func AggregateMultiplePubkeys

func AggregateMultiplePubkeys(pks []PublicKey) (PublicKey, error)

AggregateMultiplePubkeys aggregates multiple BLS public keys. Assumes that all given public keys are previously validated. Returns error if an empty slice is given.

func AggregatePublicKeys

func AggregatePublicKeys(bs [][]byte) (PublicKey, error)

AggregatePublicKeys unmarshals and validates multiple BLS public key from bytes and then aggregates them. Returns error if an empty slice is given.

func MultiplePublicKeysFromBytes

func MultiplePublicKeysFromBytes(bs [][]byte) ([]PublicKey, error)

MultiplePublicKeysFromBytes unmarshals and validates multiple BLS public keys from bytes. Returns an empty slice if an empty slice is given.

func PublicKeyFromBytes

func PublicKeyFromBytes(b []byte) (PublicKey, error)

PublicKeyFromBytes unmarshals and validates a BLS public key from bytes.

type SecretKey

type SecretKey = types.SecretKey

func DeriveFromECDSA added in v1.12.0

func DeriveFromECDSA(priv *ecdsa.PrivateKey) (SecretKey, error)

DeriveFromECDSA generates a BLS secret key from the given EC private key. It is deterministic process. Same EC private key yields the same secret key.

func GenerateKey added in v1.12.0

func GenerateKey(ikm []byte) (SecretKey, error)

GenerateKey generates a BLS secret key from the initial key material (IKM). It is deterministic process. Same IKM yields the same secret key.

func LoadKey added in v1.12.0

func LoadKey(path string) (SecretKey, error)

LoadKey loads a BLS secret key from the given file.

func RandKey

func RandKey() (SecretKey, error)

RandKey generates a random BLS secret key.

func SecretKeyFromBytes

func SecretKeyFromBytes(b []byte) (SecretKey, error)

SecretKeyFromBytes unmarshals and validates a BLS secret key from bytes.

type Signature

type Signature = types.Signature

func AggregateCompressedSignatures

func AggregateCompressedSignatures(bs [][]byte) (Signature, error)

AggregateCompressedSignatures unmarshals and validates multiple BLS signatures from bytes and then aggregates them. Returns error if an empty slice is given.

func AggregateSignatures

func AggregateSignatures(sigs []Signature) (Signature, error)

AggregateSignatures aggregates multiple BLS signatures. Assumes that all given signatures are previously validated. Returns error if an empty slice is given.

func MultipleSignaturesFromBytes

func MultipleSignaturesFromBytes(bs [][]byte) ([]Signature, error)

MultipleSignaturesFromBytes unmarshals multiple BLS signatures from bytes. Returns an empty slice if an empty slice is given.

func PopProve added in v1.12.0

func PopProve(sk SecretKey) Signature

PopProve calculates the proof-of-possession for the secret key, which is the signature with its public key as message.

func Sign

func Sign(sk SecretKey, msg []byte) Signature

Sign calculates a signature.

func SignatureFromBytes

func SignatureFromBytes(b []byte) (Signature, error)

SignatureFromBytes unmarshals and validates a BLS signature from bytes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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