signing

package
v0.2.2-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: MIT Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VRFVerify added in v0.1.34

func VRFVerify(pub, msg, sig []byte) bool

VRFVerify verifies a message and signature, given a public key

func Verify

func Verify(pubkey *PublicKey, message []byte, sign []byte) bool

Verify verifies the provided message

Types

type EDVerifier

type EDVerifier struct{}

EDVerifier is a verifier for ED purposes.

func NewEDVerifier

func NewEDVerifier() EDVerifier

NewEDVerifier returns a new EDVerifier.

func (EDVerifier) Extract

func (EDVerifier) Extract(msg, sig []byte) (*PublicKey, error)

Extract public key from signature.

func (EDVerifier) Verify

func (EDVerifier) Verify(pub *PublicKey, msg, sig []byte) bool

Verify that signature matches public key.

type EdSigner

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

EdSigner represents an ED25519 signer

func NewEdSigner

func NewEdSigner() *EdSigner

NewEdSigner returns an auto-generated ed signer

func NewEdSignerFromBuffer

func NewEdSignerFromBuffer(buff []byte) (*EdSigner, error)

NewEdSignerFromBuffer builds a signer from a private key as byte buffer

func (*EdSigner) LittleEndian

func (es *EdSigner) LittleEndian() bool

LittleEndian indicates whether byte order in a signature is little-endian.

func (*EdSigner) PublicKey

func (es *EdSigner) PublicKey() *PublicKey

PublicKey returns the public key of the signer

func (*EdSigner) Sign

func (es *EdSigner) Sign(m []byte) []byte

Sign signs the provided message

func (*EdSigner) ToBuffer

func (es *EdSigner) ToBuffer() []byte

ToBuffer returns the private key as a byte buffer

type PublicKey

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

PublicKey is the type describing a public key

func NewPublicKey

func NewPublicKey(pub []byte) *PublicKey

NewPublicKey constructs a new public key instance from a byte array

func (*PublicKey) Bytes

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

Bytes returns the public key as byte array

func (*PublicKey) Equals

func (p *PublicKey) Equals(o *PublicKey) bool

Equals returns true iff the public keys are equal

func (*PublicKey) Field added in v0.1.15

func (p *PublicKey) Field() log.Field

Field returns a log field. Implements the LoggableField interface.

func (*PublicKey) ShortString

func (p *PublicKey) ShortString() string

ShortString returns a representative sub string

func (*PublicKey) String

func (p *PublicKey) String() string

String returns the public key as a hex representation string

type Signer

type Signer interface {
	Sign([]byte) []byte
	PublicKey() *PublicKey
	LittleEndian() bool
}

Signer is a common interface for signature generation.

type VRFSigner added in v0.1.34

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

VRFSigner is a signer for VRF purposes

func NewVRFSigner added in v0.1.34

func NewVRFSigner(seed []byte) (*VRFSigner, []byte, error)

NewVRFSigner creates a new VRFSigner from a 32-byte seed

func (VRFSigner) LittleEndian added in v1.0.0

func (s VRFSigner) LittleEndian() bool

LittleEndian indicates whether byte order in a signature is little-endian.

func (VRFSigner) PublicKey added in v1.0.0

func (s VRFSigner) PublicKey() *PublicKey

PublicKey of the signer.

func (VRFSigner) Sign added in v0.1.34

func (s VRFSigner) Sign(msg []byte) []byte

Sign signs a message for VRF purposes

type VRFVerifier added in v1.0.0

type VRFVerifier struct{}

VRFVerifier is a verifier for VRF purposes.

func (VRFVerifier) Verify added in v1.0.0

func (VRFVerifier) Verify(pub *PublicKey, msg, sig []byte) bool

Verify that signature matches public key.

type Verifier

type Verifier interface {
	Verify(pub *PublicKey, msg, sig []byte) bool
}

Verifier is a common interface for signature verification.

type VerifyExtractor

type VerifyExtractor interface {
	Verifier
	Extract(msg, sig []byte) (*PublicKey, error)
}

VerifyExtractor is a common interface for signature verification with support of public key extraction.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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