sign

package
v0.0.0-...-4223e8c Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package sign provides unified interfaces for signature schemes.

A register of schemes is available in the package

github.com/cloudflare/circl/sign/schemes

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTypeMismatch is the error used if types of, for instance, private
	// and public keys don't match.
	ErrTypeMismatch = errors.New("types mismatch")

	// ErrSeedSize is the error used if the provided seed is of the wrong
	// size.
	ErrSeedSize = errors.New("wrong seed size")

	// ErrPubKeySize is the error used if the provided public key is of
	// the wrong size.
	ErrPubKeySize = errors.New("wrong size for public key")

	// ErrPrivKeySize is the error used if the provided private key is of
	// the wrong size.
	ErrPrivKeySize = errors.New("wrong size for private key")
)

Functions

This section is empty.

Types

type PrivateKey

type PrivateKey interface {
	// Returns the signature scheme for this private key.
	Scheme() Scheme
	Public() PublicKey
	Equal(PrivateKey) bool

	encoding.BinaryMarshaler
}

PrivateKey allows one to create signatures.

type PublicKey

type PublicKey interface {
	// Returns the signature scheme for this public key.
	Scheme() Scheme
	Equal(PublicKey) bool

	encoding.BinaryMarshaler
}

PublicKey is used to verify a signature set by the corresponding private key.

type Scheme

type Scheme interface {
	// Name of the scheme.
	Name() string

	// GenerateKey creates a new key-pair.
	GenerateKey() (PublicKey, PrivateKey, error)

	// Creates a signature using the PrivateKey on the given message and
	// returns the signature.
	//
	// Panics if key is nil or wrong type.
	Sign(sk PrivateKey, message []byte) []byte

	// Checks whether the given signature is a valid signature set by
	// the private key corresponding to the given public key on the
	// given message.
	//
	// Panics if key is nil or wrong type.
	Verify(pk PublicKey, message []byte, signature []byte) bool

	// Deterministically derives a key-pair from a seed. If you're unsure,
	// you're better off using GenerateKey().
	//
	// Panics if seed is not of length SeedSize().
	DeriveKey(seed []byte) (PublicKey, PrivateKey)

	// Unmarshals a PublicKey from the provided buffer.
	UnmarshalBinaryPublicKey([]byte) (PublicKey, error)

	// Unmarshals a PublicKey from the provided buffer.
	UnmarshalBinaryPrivateKey([]byte) (PrivateKey, error)

	// Size of binary marshalled public keys.
	PublicKeySize() int

	// Size of binary marshalled public keys.
	PrivateKeySize() int

	// Size of signatures.
	SignatureSize() int

	// Size of seeds.
	SeedSize() int
}

A Scheme represents a specific instance of a signature scheme.

Directories

Path Synopsis
dilithium implements the CRYSTALS-Dilithium signature schemes as submitted to round3 of the NIST PQC competition and described in
dilithium implements the CRYSTALS-Dilithium signature schemes as submitted to round3 of the NIST PQC competition and described in
mode2
mode2 implements the CRYSTALS-Dilithium signature scheme Dilithium2 as submitted to round3 of the NIST PQC competition and described in
mode2 implements the CRYSTALS-Dilithium signature scheme Dilithium2 as submitted to round3 of the NIST PQC competition and described in
mode2aes
mode2aes implements the CRYSTALS-Dilithium signature scheme Dilithium2-AES as submitted to round3 of the NIST PQC competition and described in
mode2aes implements the CRYSTALS-Dilithium signature scheme Dilithium2-AES as submitted to round3 of the NIST PQC competition and described in
mode3
mode3 implements the CRYSTALS-Dilithium signature scheme Dilithium3 as submitted to round3 of the NIST PQC competition and described in
mode3 implements the CRYSTALS-Dilithium signature scheme Dilithium3 as submitted to round3 of the NIST PQC competition and described in
mode3aes
mode3aes implements the CRYSTALS-Dilithium signature scheme Dilithium3-AES as submitted to round3 of the NIST PQC competition and described in
mode3aes implements the CRYSTALS-Dilithium signature scheme Dilithium3-AES as submitted to round3 of the NIST PQC competition and described in
mode5
mode5 implements the CRYSTALS-Dilithium signature scheme Dilithium5 as submitted to round3 of the NIST PQC competition and described in
mode5 implements the CRYSTALS-Dilithium signature scheme Dilithium5 as submitted to round3 of the NIST PQC competition and described in
mode5aes
mode5aes implements the CRYSTALS-Dilithium signature scheme Dilithium5-AES as submitted to round3 of the NIST PQC competition and described in
mode5aes implements the CRYSTALS-Dilithium signature scheme Dilithium5-AES as submitted to round3 of the NIST PQC competition and described in
Package ed25519 implements Ed25519 signature scheme as described in RFC-8032.
Package ed25519 implements Ed25519 signature scheme as described in RFC-8032.
Package ed448 implements Ed448 signature scheme as described in RFC-8032.
Package ed448 implements Ed448 signature scheme as described in RFC-8032.
Package eddilithium2 implements the hybrid signature scheme Ed25519-Dilithium2.
Package eddilithium2 implements the hybrid signature scheme Ed25519-Dilithium2.
Package eddilithium3 implements the hybrid signature scheme Ed448-Dilithium3.
Package eddilithium3 implements the hybrid signature scheme Ed448-Dilithium3.
Package schemes contains a register of signature algorithms.
Package schemes contains a register of signature algorithms.

Jump to

Keyboard shortcuts

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