signing

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package signing holds the ML-DSA-65 signature keys of grants and tokens.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteNewKey

func WriteNewKey(out io.Writer, publicPath string) error

WriteNewKey makes an ML-DSA-65 key, writes its PEM to out and its public key to publicPath. publicPath is a new file or a device such as /dev/fd/3 or /dev/stderr, so the public key reaches a log and the private key a secret store, and no key touches a disk. It refuses to write a private key to a terminal, and it never replaces a file.

Types

type Private

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

Private signs.

func Generate

func Generate() (*Private, error)

Generate makes an ML-DSA-65 key.

func ParsePrivate

func ParsePrivate(text string) (*Private, error)

ParsePrivate reads a PKCS#8 PEM block of an ML-DSA-65 key. Any other text is refused.

func (*Private) PEM

func (p *Private) PEM() ([]byte, error)

PEM returns the PKCS#8 PEM block of the key.

func (*Private) Public

func (p *Private) Public() Public

Public returns the public key, or the zero value for an unusable key.

func (*Private) Sign

func (p *Private) Sign(context string, msg []byte) ([]byte, error)

Sign signs msg. The signature binds context, so a signature for one use does not verify for another.

type Public

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

Public verifies. The zero value verifies nothing.

func ParsePublic

func ParsePublic(text string) (Public, error)

ParsePublic reads the standard base64 of a raw ML-DSA-65 public key of 1952 bytes. Any other key is refused.

func (Public) String

func (p Public) String() string

String is the standard base64 of the raw key, or the empty text for the zero value.

func (Public) Verify

func (p Public) Verify(context string, msg, sig []byte) bool

Verify reports whether sig is a signature of msg under context.

Jump to

Keyboard shortcuts

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