bdn

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

README

This package makes use of bn256, a curve which is supposed to provide 128 bits security but have been found to offer less (about 100-bits).

https://moderncrypto.org/mail-archive/curves/2016/000740.html

TODO:

  • Replace with BLS-based aggregated signature scheme.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregateSignatures

func AggregateSignatures(pubKeys []*PublicKey, sig [][]byte) ([]byte, error)

AggregateSignatures takes a slice of PublicKeys and their corresponding signatures to create an aggregate signature

func NewKey

func NewKey(reader io.Reader) (*PrivateKey, *PublicKey)

NewKey creates a bn256 private and public key pair.

func NewKeyFromSeed

func NewKeyFromSeed(seed []byte) (*PrivateKey, *PublicKey)

NewKeyFromSeed creates a bn256 private and public key pair from the given seed. Seed must be 32 bytes; If more, seed is truncated.

Types

type PrivateKey

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

PrivateKey represents a bn256 private key

func (*PrivateKey) Bytes

func (sk *PrivateKey) Bytes() []byte

Bytes returns the binary form of the key

func (*PrivateKey) Public

func (sk *PrivateKey) Public() *PublicKey

Public return the corresponding public key

func (*PrivateKey) Sign

func (sk *PrivateKey) Sign(msg []byte) ([]byte, error)

Sign creates a BLS signature on the given message

type PublicKey

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

PublicKey represents a bn256 public key

func AggregatePublicKeys

func AggregatePublicKeys(pubKeys []*PublicKey) (*PublicKey, error)

AggregatePublicKeys takes a slice of PublicKeys to create an aggregate public key

func BytesToPublicKey

func BytesToPublicKey(bz []byte) (*PublicKey, error)

BytesToPublicKey converts the byte slice of a marshaled public key to a PublicKey object

func (*PublicKey) Bytes

func (pk *PublicKey) Bytes() []byte

Bytes returns the binary form of the key

func (*PublicKey) Verify

func (pk *PublicKey) Verify(sig, msg []byte) error

Verify checks the given BLS signature on the message

Jump to

Keyboard shortcuts

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