kilic

package
v0.0.0-...-b9de96a Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorSecSize returned when the secrete key size is wrong
	ErrorSecSize = errors.New("secret key size is wrong")
	// ErrorSecUnmarshal returned when the secret key is not valid
	ErrorSecUnmarshal = errors.New("secret key bytes are not on curve")
	// ErrorPubKeySize returned when the pubkey size is wrong
	ErrorPubKeySize = errors.New("pub key size is wrong")
	// ErrorPubKeyUnmarshal returned when the pubkey is not valid
	ErrorPubKeyUnmarshal = errors.New("could not unmarshal bytes into public key")
	// ErrorSigSize returned when the signature bytes doesn't match the length
	ErrorSigSize = errors.New("signature should be 96 bytes")
	// ErrorSigUnmarshal returned when the pubkey is not valid
	ErrorSigUnmarshal = errors.New("could not unmarshal bytes into signature")
)

Functions

func NewKilicInterface

func NewKilicInterface() common.Implementation

Types

type Kilic

type Kilic struct {
}

func (Kilic) Aggregate

func (k Kilic) Aggregate(sigs []common.Signature) common.Signature

func (Kilic) AggregatePublicKeys

func (k Kilic) AggregatePublicKeys(pubs [][]byte) (common.PublicKey, error)

func (Kilic) AggregateSignatures

func (k Kilic) AggregateSignatures(sigs []common.Signature) common.Signature

func (Kilic) NewAggregateSignature

func (k Kilic) NewAggregateSignature() common.Signature

func (Kilic) PublicKeyFromBytes

func (k Kilic) PublicKeyFromBytes(pubKey []byte) (common.PublicKey, error)

func (Kilic) RandKey

func (k Kilic) RandKey() (common.SecretKey, error)

func (Kilic) SecretKeyFromBytes

func (k Kilic) SecretKeyFromBytes(privKey []byte) (common.SecretKey, error)

func (Kilic) SignatureFromBytes

func (k Kilic) SignatureFromBytes(sig []byte) (common.Signature, error)

type PublicKey

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

PublicKey used in the BLS signature scheme.

func (*PublicKey) Aggregate

func (p *PublicKey) Aggregate(p2 common.PublicKey) common.PublicKey

Aggregate two public keys.

func (*PublicKey) Copy

func (p *PublicKey) Copy() common.PublicKey

Copy the public key to a new pointer reference.

func (*PublicKey) Hash

func (p *PublicKey) Hash() ([20]byte, error)

Hash calculates the hash of the public key.

func (*PublicKey) Marshal

func (p *PublicKey) Marshal() []byte

Marshal a public key into a LittleEndian byte slice.

type SecretKey

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

SecretKey used in the BLS signature scheme.

func (*SecretKey) IsZero

func (s *SecretKey) IsZero() bool

func (*SecretKey) Marshal

func (s *SecretKey) Marshal() []byte

Marshal a secret key into a LittleEndian byte slice.

func (*SecretKey) PublicKey

func (s *SecretKey) PublicKey() common.PublicKey

PublicKey obtains the public key corresponding to the BLS secret key.

func (*SecretKey) Sign

func (s *SecretKey) Sign(msg []byte) common.Signature

Sign a message using a secret key - in a beacon/validator client.

In IETF draft BLS specification: Sign(SK, message) -> signature: a signing algorithm that generates

a deterministic signature given a secret key SK and a message.

In ETH2.0 specification: def Sign(SK: int, message: Bytes) -> BLSSignature

type Signature

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

Signature used in the BLS signature scheme.

func (*Signature) AggregateVerify

func (s *Signature) AggregateVerify(pubKeys []common.PublicKey, msgs [][32]byte) bool

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

In IETF draft BLS specification: AggregateVerify((PK_1, message_1), ..., (PK_n, message_n),

signature) -> VALID or INVALID: an aggregate verification
algorithm that outputs VALID if signature is a valid aggregated
signature for a collection of public keys and messages, and
outputs INVALID otherwise.

In ETH2.0 specification: def AggregateVerify(pairs: Sequence[PK: BLSPubkey, message: Bytes], signature: BLSSignature) -> boo

func (*Signature) Copy

func (s *Signature) Copy() common.Signature

Copy returns a full deep copy of a signature.

func (*Signature) FastAggregateVerify

func (s *Signature) FastAggregateVerify(pubKeys []common.PublicKey, msg [32]byte) bool

FastAggregateVerify verifies all the provided public keys with their aggregated signature.

In IETF draft BLS specification: FastAggregateVerify(PK_1, ..., PK_n, message, signature) -> VALID

or INVALID: a verification algorithm for the aggregate of multiple
signatures on the same message.  This function is faster than
AggregateVerify.

In ETH2.0 specification: def FastAggregateVerify(PKs: Sequence[BLSPubkey], message: Bytes, signature: BLSSignature) -> bool

func (*Signature) Marshal

func (s *Signature) Marshal() []byte

Marshal a signature into a LittleEndian byte slice.

func (*Signature) Verify

func (s *Signature) Verify(pubKey common.PublicKey, msg []byte) bool

Verify a bls signature given a public key, a message.

In IETF draft BLS specification: Verify(PK, message, signature) -> VALID or INVALID: a verification

algorithm that outputs VALID if signature is a valid signature of
message under public key PK, and INVALID otherwise.

In ETH2.0 specification: def Verify(PK: BLSPubkey, message: Bytes, signature: BLSSignature) -> bool

Jump to

Keyboard shortcuts

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