signing

package
v0.35.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: 10 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 signature keys of grants and tokens: Ed25519, which a verifier still accepts while a move is under way, and ML-DSA-65.

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 the file publicPath. It refuses to write a private key to a terminal, and it never replaces a file.

Types

type Alg

type Alg string

Alg names a signature algorithm.

const (
	Ed25519 Alg = "ed25519"
	MLDSA65 Alg = "ml-dsa-65"
)

type Private

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

Private signs.

func FromEd25519

func FromEd25519(k ed25519.PrivateKey) *Private

FromEd25519 wraps an Ed25519 key. A key whose public half does not match its seed is unusable: it signs nothing and has no public key.

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 Ed25519 or ML-DSA-65 key. Text without a PEM block is the standard base64 of an Ed25519 private key or of its 32-byte seed.

func (*Private) Alg

func (p *Private) Alg() Alg

Alg reports the algorithm of the key, or the empty text for an unusable key.

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.

func (*Private) Sign

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

Sign signs msg. An ML-DSA signature binds context, so a signature for one use does not verify for another. An Ed25519 signature ignores it.

type Public

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

Public verifies. The zero value verifies nothing.

func FromEd25519Public

func FromEd25519Public(k ed25519.PublicKey) Public

FromEd25519Public wraps an Ed25519 public key.

func ParsePublic

func ParsePublic(text string) (Public, error)

ParsePublic reads the standard base64 of a raw public key. The length tells the algorithm: 32 bytes is Ed25519 and 1952 bytes is ML-DSA-65.

func (Public) Alg

func (p Public) Alg() Alg

Alg reports the algorithm of the key, or the empty text for the zero value.

func (Public) String

func (p Public) String() string

String is the standard base64 of the raw key.

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