g2pubs

package
v0.0.0-...-3fdeb17 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Verify

func Verify(m []byte, pub *PublicKey, sig *Signature) bool

Verify verifies a signature against a message and a public key.

Types

type PublicKey

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

PublicKey is a public key.

func AggregatePublicKeys

func AggregatePublicKeys(p []*PublicKey) *PublicKey

AggregatePublicKeys adds public keys together.

func DeserializePublicKey

func DeserializePublicKey(b [96]byte) (*PublicKey, error)

DeserializePublicKey deserializes a public key from bytes.

func NewAggregatePubkey

func NewAggregatePubkey() *PublicKey

NewAggregatePubkey creates a blank public key.

func NewPublicKeyFromG2

func NewPublicKeyFromG2(g2 *bls.G2Affine) *PublicKey

NewPublicKeyFromG2 creates a new public key from a G2 element.

func PrivToPub

func PrivToPub(k *SecretKey) *PublicKey

PrivToPub converts the private key into a public key.

func (*PublicKey) Aggregate

func (p *PublicKey) Aggregate(other *PublicKey)

Aggregate adds two public keys together.

func (*PublicKey) Copy

func (p *PublicKey) Copy() *PublicKey

Copy copies the public key and returns it.

func (PublicKey) Equals

func (p PublicKey) Equals(other PublicKey) bool

Equals checks if two public keys are equal

func (*PublicKey) GetPoint

func (p *PublicKey) GetPoint() *bls.G2Projective

GetPoint gets the G2 point associated with the public key.

func (PublicKey) Serialize

func (p PublicKey) Serialize() [96]byte

Serialize serializes a public key to bytes.

func (PublicKey) String

func (p PublicKey) String() string

type SecretKey

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

SecretKey represents a BLS private key.

func DeriveSecretKey

func DeriveSecretKey(b [32]byte) *SecretKey

DeriveSecretKey derives a secret key from bytes.

func DeserializeSecretKey

func DeserializeSecretKey(b [32]byte) *SecretKey

DeserializeSecretKey deserializes a secret key from bytes.

func KeyFromFQRepr

func KeyFromFQRepr(i *bls.FRRepr) *SecretKey

KeyFromFQRepr returns a new key based on a FQRepr in FR.

func NewSecretKeyFromFR

func NewSecretKeyFromFR(fr *bls.FR) *SecretKey

NewSecretKeyFromFR creates a new secret key from FR element.

func RandKey

func RandKey(r io.Reader) (*SecretKey, error)

RandKey generates a random secret key.

func (SecretKey) GetFRElement

func (s SecretKey) GetFRElement() *bls.FR

GetFRElement gets the underlying FR element.

func (SecretKey) Serialize

func (s SecretKey) Serialize() [32]byte

Serialize serializes a secret key to bytes.

func (SecretKey) String

func (s SecretKey) String() string

type Signature

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

Signature is a message signature.

func AggregateSignatures

func AggregateSignatures(s []*Signature) *Signature

AggregateSignatures adds up all of the signatures.

func DeserializeSignature

func DeserializeSignature(b [48]byte) (*Signature, error)

DeserializeSignature deserializes a signature from bytes.

func NewAggregateSignature

func NewAggregateSignature() *Signature

NewAggregateSignature creates a blank aggregate signature.

func NewSignatureFromG1

func NewSignatureFromG1(g1 *bls.G1Affine) *Signature

NewSignatureFromG1 creates a new signature from a G1 element.

func Sign

func Sign(message []byte, key *SecretKey) *Signature

Sign signs a message with a secret key.

func (*Signature) Aggregate

func (s *Signature) Aggregate(other *Signature)

Aggregate adds one signature to another

func (*Signature) Copy

func (s *Signature) Copy() *Signature

Copy returns a copy of the signature.

func (*Signature) GetPoint

func (s *Signature) GetPoint() *bls.G1Projective

GetPoint gets the G1 point associated with the signature.

func (*Signature) Serialize

func (s *Signature) Serialize() [48]byte

Serialize serializes a signature in compressed form.

func (*Signature) String

func (s *Signature) String() string

func (*Signature) VerifyAggregate

func (s *Signature) VerifyAggregate(pubKeys []*PublicKey, msgs [][]byte) bool

VerifyAggregate verifies each public key against each message.

func (*Signature) VerifyAggregateCommon

func (s *Signature) VerifyAggregateCommon(pubKeys []*PublicKey, msg []byte) bool

VerifyAggregateCommon verifies each public key against a message. This is vulnerable to rogue public-key attack. Each user must provide a proof-of-knowledge of the public key.

Jump to

Keyboard shortcuts

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