sign

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSignature = errors.New("invalid signature")
	ErrSeedSize  = errors.New("invalid seed size")
	ErrKeySize   = errors.New("invalid key size")
)

errors.

Functions

func Generate

func Generate(s Scheme, rand io.Reader) (PrivateKey, PublicKey, error)

Generate derives a key-pair from a seed generated by provided rand.

If rand is nil, crypto/rand is used.

Types

type PrivateKey

type PrivateKey interface {
	Scheme() Scheme

	Equal(PrivateKey) bool

	// Bytes allocates a new slice of bytes with Scheme().PrivateKeySize() length
	// and writes the private key to it.
	Bytes() []byte

	Sign(msg []byte) ([]byte, error)
}

PrivateKey represents a signing private key.

type PublicKey

type PublicKey interface {
	Scheme() Scheme

	Equal(PublicKey) bool

	// Bytes allocates a new slice of bytes with Scheme().PublicKeySize() length
	// and writes the public key to it.
	Bytes() []byte

	Verify(msg []byte, signature []byte) (bool, error)
}

PublicKey represents a signing public key.

type Scheme

type Scheme interface {
	// DeriveKey derives a key-pair from a seed.
	DeriveKey(seed []byte) (PrivateKey, PublicKey, error)

	// Unpacks a PublicKey from the provided bytes.
	UnpackPublic(key []byte) (PublicKey, error)

	// Unpacks a PrivateKey from the provided bytes.
	UnpackPrivate(key []byte) (PrivateKey, error)

	// Size of packed public keys.
	PublicKeySize() int

	// Size of packed private keys.
	PrivateKeySize() int

	// Size of signatures.
	SignatureSize() int

	// Size of seed.
	SeedSize() int
}

Scheme represents signature scheme.

func Dilithium2 added in v0.1.1

func Dilithium2() Scheme

Dilithium2 returns the Dilithium2 signature scheme.

func Dilithium2AES added in v0.1.1

func Dilithium2AES() Scheme

Dilithium2AES returns the Dilithium2-AES signature scheme.

func Dilithium3 added in v0.1.1

func Dilithium3() Scheme

Dilithium3 returns the Dilithium3 signature scheme.

func Dilithium3AES added in v0.1.1

func Dilithium3AES() Scheme

Dilithium3AES returns the Dilithium3-AES signature scheme.

func Dilithium5 added in v0.1.1

func Dilithium5() Scheme

Dilithium5 returns the Dilithium5 signature scheme.

func Dilithium5AES added in v0.1.1

func Dilithium5AES() Scheme

Dilithium5AES returns the Dilithium5-AES signature scheme.

func EDDilithium2 added in v0.2.0

func EDDilithium2() Scheme

EDDilithium2 returns the hybrid signature scheme ed25519 with Dilithium2.

func EDDilithium3 added in v0.2.0

func EDDilithium3() Scheme

EDDilithium3 returns the hybrid signature scheme ed448 with Dilithium3.

func Falcon1024

func Falcon1024() Scheme

Falcon1024 returns the Falcon1024 signature scheme.

Jump to

Keyboard shortcuts

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