g1pubs

package
v0.0.0-...-a88a5ae Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: Apache-2.0 Imports: 5 Imported by: 19

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.

func VerifyWithDomain

func VerifyWithDomain(m [32]byte, pub *PublicKey, sig *Signature, domain [8]byte) bool

VerifyWithDomain verifies a signature against a message and a public key and a domain

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 [48]byte) (*PublicKey, error)

DeserializePublicKey deserializes a public key from bytes.

func NewAggregatePubkey

func NewAggregatePubkey() *PublicKey

NewAggregatePubkey creates a blank public key.

func NewPublicKeyFromG1

func NewPublicKeyFromG1(g1 *bls.G1Affine) *PublicKey

NewPublicKeyFromG1 creates a new public key from a G1 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.G1Projective

GetPoint gets the G1 point associated with the public key.

func (PublicKey) Serialize

func (p PublicKey) Serialize() [48]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 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 [96]byte) (*Signature, error)

DeserializeSignature deserializes a signature from bytes.

func NewAggregateSignature

func NewAggregateSignature() *Signature

NewAggregateSignature creates a blank aggregate signature.

func NewSignatureFromG2

func NewSignatureFromG2(g2 *bls.G2Affine) *Signature

NewSignatureFromG2 creates a new signature from a G2 element.

func Sign

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

Sign signs a message with a secret key.

func SignWithDomain

func SignWithDomain(message [32]byte, key *SecretKey, domain [8]byte) *Signature

SignWithDomain signs a message with a secret key and its domain.

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.G2Projective

GetPoint gets the G2 point associated with the signature.

func (*Signature) Serialize

func (s *Signature) Serialize() [96]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.

func (*Signature) VerifyAggregateCommonWithDomain

func (s *Signature) VerifyAggregateCommonWithDomain(pubKeys []*PublicKey, msg [32]byte, domain [8]byte) bool

VerifyAggregateCommonWithDomain verifies each public key against a message and its domain.

func (*Signature) VerifyAggregateWithDomain

func (s *Signature) VerifyAggregateWithDomain(pubKeys []*PublicKey, msgs [][32]byte, domain [8]byte) bool

VerifyAggregateWithDomain verifies each public key against each message and its domain.

Jump to

Keyboard shortcuts

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