mode3aes

package
v0.0.0-...-8efed9f Latest Latest
Warning

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

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

Documentation

Overview

mode3aes implements the CRYSTALS-Dilithium signature scheme Dilithium3-AES as submitted to round3 of the NIST PQC competition and described in

https://pq-crystals.org/dilithium/data/dilithium-specification-round3-20210208.pdf

Index

Constants

View Source
const (
	// Size of seed for NewKeyFromSeed
	SeedSize = common.SeedSize

	// Size of a packed PublicKey
	PublicKeySize = internal.PublicKeySize

	// Size of a packed PrivateKey
	PrivateKeySize = internal.PrivateKeySize

	// Size of a signature
	SignatureSize = internal.SignatureSize
)

Variables

View Source
var Scheme sign.Scheme = &implMode3AES{}

Scheme is Dilithium in mode "Dilithium3-AES".

Functions

func GenerateKey

func GenerateKey(rand io.Reader) (*PublicKey, *PrivateKey, error)

GenerateKey generates a public/private key pair using entropy from rand. If rand is nil, crypto/rand.Reader will be used.

func NewKeyFromSeed

func NewKeyFromSeed(seed *[SeedSize]byte) (*PublicKey, *PrivateKey)

NewKeyFromSeed derives a public/private key pair using the given seed.

func SignTo

func SignTo(sk *PrivateKey, msg []byte, signature []byte)

SignTo signs the given message and writes the signature into signature. It will panic if signature is not of length at least SignatureSize.

func Verify

func Verify(pk *PublicKey, msg []byte, signature []byte) bool

Verify checks whether the given signature by pk on msg is valid.

Types

type PrivateKey

type PrivateKey internal.PrivateKey

PrivateKey is the type of Dilithium3-AES private key

func (*PrivateKey) Bytes

func (sk *PrivateKey) Bytes() []byte

Packs the private key.

func (*PrivateKey) Equal

func (sk *PrivateKey) Equal(other sign.PrivateKey) bool

Equal returns whether the two private keys equal.

func (*PrivateKey) MarshalBinary

func (sk *PrivateKey) MarshalBinary() ([]byte, error)

Packs the private key.

func (*PrivateKey) Pack

func (sk *PrivateKey) Pack(buf *[PrivateKeySize]byte)

Packs the private key into buf.

func (*PrivateKey) Public

func (sk *PrivateKey) Public() sign.PublicKey

Computes the public key corresponding to this private key.

Returns a *PublicKey. The type crypto.PublicKey is used to make PrivateKey implement the crypto.Signer interface.

func (*PrivateKey) Scheme

func (sk *PrivateKey) Scheme() sign.Scheme

func (*PrivateKey) UnmarshalBinary

func (sk *PrivateKey) UnmarshalBinary(data []byte) error

Unpacks the private key from data.

func (*PrivateKey) Unpack

func (sk *PrivateKey) Unpack(buf *[PrivateKeySize]byte)

Sets sk to the private key encoded in buf.

type PublicKey

type PublicKey internal.PublicKey

PublicKey is the type of Dilithium3-AES public key

func (*PublicKey) Bytes

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

Packs the public key.

func (*PublicKey) Equal

func (pk *PublicKey) Equal(other sign.PublicKey) bool

Equal returns whether the two public keys equal.

func (*PublicKey) MarshalBinary

func (pk *PublicKey) MarshalBinary() ([]byte, error)

Packs the public key.

func (*PublicKey) Pack

func (pk *PublicKey) Pack(buf *[PublicKeySize]byte)

Packs the public key into buf.

func (*PublicKey) Scheme

func (pk *PublicKey) Scheme() sign.Scheme

func (*PublicKey) UnmarshalBinary

func (pk *PublicKey) UnmarshalBinary(data []byte) error

Unpacks the public key from data.

func (*PublicKey) Unpack

func (pk *PublicKey) Unpack(buf *[PublicKeySize]byte)

Sets pk to the public key encoded in buf.

type State

type State = internal.State

State is the type of Dilithium3-AES state

func NewSigner

func NewSigner(sk *PrivateKey) *State

NewSigner creates a signature state.

func NewVerifier

func NewVerifier(pk *PublicKey) *State

NewVerifier creates a signature verification state.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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