bls

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateAntiRogueCoefficients

func CalculateAntiRogueCoefficients(pubs []PublicKey) []big.Int

CalculateAntiRogueCoefficients returns an array of bigints used for subsequent key aggregations:

Ai = hash(Pi, {P1, P2, ...})

func EmptyMultisigMask

func EmptyMultisigMask() big.Int

EmptyMultisigMask returns zero bitmask

func GenerateRandomKey

func GenerateRandomKey() (PrivateKey, PublicKey)

GenerateRandomKey creates a random private and its corresponding public keys

Types

type PrivateKey

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

func UnmarshalPrivateKey

func UnmarshalPrivateKey(data []byte) (PrivateKey, error)

UnmarshalBlsPrivateKey reads the private key from the given byte array

func (PrivateKey) GenerateMembershipKeyPart

func (secretKey PrivateKey) GenerateMembershipKeyPart(index byte, aggPub PublicKey, anticoef big.Int) Signature

GenerateMembershipKeyPart generates the participant signature to be aggregated into membership key

func (PrivateKey) Marshal

func (secretKey PrivateKey) Marshal() []byte

func (PrivateKey) MarshalJSON

func (secretKey PrivateKey) MarshalJSON() ([]byte, error)

func (PrivateKey) Multisign

func (secretKey PrivateKey) Multisign(message []byte, aggPublicKey PublicKey, membershipKey Signature) Signature

Multisign generates BLS multi-signature of the given message, aggregated public key of all participants and the membership key of the signer

func (PrivateKey) PublicKey

func (priv PrivateKey) PublicKey() PublicKey

PublicKey calculates public key corresponding to the given private key

func (PrivateKey) Sign

func (secretKey PrivateKey) Sign(message []byte) Signature

Sign generates a simple BLS signature of the given message

func (*PrivateKey) UnmarshalJSON

func (secretKey *PrivateKey) UnmarshalJSON(data []byte) error

type PublicKey

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

func AggregatePublicKeys

func AggregatePublicKeys(pubs []PublicKey, anticoefs []big.Int) PublicKey

AggregatePublicKeys calculates P1*A1 + P2*A2 + ...

func UnmarshalPublicKey

func UnmarshalPublicKey(raw []byte) (PublicKey, error)

func ZeroPublicKey

func ZeroPublicKey() PublicKey

ZeroPublicKey returns zero public key (point at infinity)

func (PublicKey) Aggregate

func (pub PublicKey) Aggregate(onemore PublicKey) PublicKey

Aggregate adds the given public keys

func (PublicKey) Marshal

func (pub PublicKey) Marshal() []byte

func (PublicKey) MarshalJSON

func (publicKey PublicKey) MarshalJSON() ([]byte, error)

func (*PublicKey) UnmarshalJSON

func (publicKey *PublicKey) UnmarshalJSON(data []byte) error

type Signature

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

func AggregateSignatures

func AggregateSignatures(sigs []Signature, anticoefs []big.Int) Signature

AggregateSignatures sums the given array of signatures

func HashToPointIndex

func HashToPointIndex(pub PublicKey, index byte) Signature

func UnmarshalSignature

func UnmarshalSignature(raw []byte) (Signature, error)

func ZeroSignature

func ZeroSignature() Signature

ZeroSignature returns zero signature (point at infinity)

func (Signature) Aggregate

func (signature Signature) Aggregate(onemore Signature) Signature

Aggregate adds the given signatures

func (Signature) Marshal

func (signature Signature) Marshal() []byte

func (Signature) MarshalJSON

func (signature Signature) MarshalJSON() ([]byte, error)

func (*Signature) UnmarshalJSON

func (signature *Signature) UnmarshalJSON(data []byte) error

func (Signature) Verify

func (signature Signature) Verify(publicKey PublicKey, message []byte) bool

Verify checks the BLS signature of the message against the public key of its signer

func (Signature) VerifyMembershipKeyPart

func (signature Signature) VerifyMembershipKeyPart(aggPublicKey PublicKey, partPublicKey PublicKey, anticoef big.Int, index byte) bool

VerifyMembershipKeyPart verifies membership key part i ((a⋅pk)×H(P, i)) against aggregated public key (P) and public key of the party (pk×G)

func (Signature) VerifyMultisig

func (signature Signature) VerifyMultisig(aggPublicKey PublicKey, publicKey PublicKey, message []byte, bitmask *big.Int) bool

VerifyMultisig checks the BLS multisignature of the message against: * the aggregated public key of all its signers (whether signed or not), * the aggregated public key of participated signers (who really signed), * and the bitmask of signers

Jump to

Keyboard shortcuts

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