sign

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: AGPL-3.0, AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package sign implements signature scheme interfaces and implementations.

Index

Constants

View Source
const PublicKeyHashSize = 32

PublicKeyHashSize indicates the hash size returned from the PublicKey's Sum256 method.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key interface {

	// KeyType is a string indicating the key type.
	KeyType() string

	// Reset resets the key material to all zeros.
	Reset()

	// Bytes serializes key material into a byte slice.
	Bytes() []byte

	// FromBytes loads key material from the given byte slice.
	FromBytes(data []byte) error
}

Key is an interface for types encapsulating key material.

type PrivateKey

type PrivateKey interface {
	Key

	// Sign signs the given message and returns the signature.
	Sign(message []byte) (signature []byte)
}

PrivateKey is an interface for types encapsulating private key material.

type PublicKey

type PublicKey interface {
	encoding.TextMarshaler
	encoding.TextUnmarshaler
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler

	Key

	// Equal deterministically compares the two keys and returns true
	// if they are equal.
	Equal(PublicKey) bool

	// Verify checks whether the given signature is valid.
	Verify(signature, message []byte) bool

	// Sum256 returns the Blake2b 256-bit checksum of the key's raw bytes.
	Sum256() [32]byte
}

PublicKey is an interface for types encapsulating public key material.

type Scheme

type Scheme interface {

	// NewKeypair returns a newly generated key pair.
	NewKeypair() (PrivateKey, PublicKey)

	// NewEmptyPublicKey returns an empty public key.
	NewEmptyPublicKey() PublicKey

	// Name of the scheme.
	Name() string

	// SignatureSize returns the size in bytes of the signature.
	SignatureSize() int

	// PublicKeySize returns the size in bytes of the public key.
	PublicKeySize() int

	// PrivateKeySize returns the size in bytes of the private key.
	PrivateKeySize() int
}

Scheme is our signature scheme.

Directories

Path Synopsis
Package eddsa implements interface wrapper around ed25519 wrapper.
Package eddsa implements interface wrapper around ed25519 wrapper.
Package sphincsplus implements interface wrapper around a specific parameterization of Sphincs+.
Package sphincsplus implements interface wrapper around a specific parameterization of Sphincs+.

Jump to

Keyboard shortcuts

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