signer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 17 Imported by: 0 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 signer holds the service's signing keys behind crypto.Signer and the public key material it publishes. Production keys live in a KMS; development keys are generated on first start and stored in the database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddKey

func AddKey(root crypto.Signer, list []byte, kid string, pub crypto.PublicKey, now time.Time, overlap time.Duration) ([]byte, error)

AddKey returns list (nil starts a new one) re-signed by root with pub added as the active key kid. Keys active until now are retired with not_after = now + overlap, which leaves time to deploy the new key. They stay listed, so earlier evidence keeps verifying.

func CertPEM

func CertPEM(c *x509.Certificate) []byte

CertPEM encodes a certificate as PEM.

func KeyPEM

func KeyPEM(k crypto.Signer) ([]byte, error)

KeyPEM encodes a private key as PKCS#8 PEM.

func MarkCompromised

func MarkCompromised(root crypto.Signer, list []byte, kid string, at, now time.Time) ([]byte, error)

MarkCompromised returns list re-signed by root with kid marked compromised from at. Evidence timestamped before at remains assessable; later evidence signed with kid fails verification.

func ParseCerts

func ParseCerts(b []byte) ([]*x509.Certificate, error)

ParseCerts reads one or more PEM certificates.

func ParseKey

func ParseKey(b []byte) (crypto.Signer, error)

ParseKey reads a PKCS#8 PEM private key.

func Publish

func Publish(ctx context.Context, st storage.Store, p *Published) error

Publish validates and stores key material. Nil fields keep their stored value.

func SamePublic

func SamePublic(a, b crypto.PublicKey) bool

SamePublic reports whether two public keys are equal.

func Secret

func Secret(ctx context.Context, st storage.Store) ([]byte, error)

Secret returns the server secret used to hash signing codes, creating it on first use.

Types

type Keys

type Keys struct {
	// Seal signs the PDF seal; its public key is SealChain[0]'s.
	Seal crypto.Signer
	// SealChain is the seal certificate followed by its intermediates.
	SealChain []*x509.Certificate
	// Evidence signs evidence packages.
	Evidence crypto.Signer
	// EvidenceKID is the key-list ID of Evidence.
	EvidenceKID string
	// KeyList is the signed key list served at /.well-known/inkless/keys.json.
	KeyList []byte
	// RootThumbprint is the thumbprint of the key that signed KeyList.
	RootThumbprint string
	// SealRoots and TSARoots are the trust anchors for the seal and timestamp
	// chains; nil when none are published.
	SealRoots, TSARoots *x509.CertPool
	// DevTSA is set only for development keys.
	DevTSA *devpki.Cert
}

Keys is everything the service signs with, plus the public trust data it serves and uses for POST /v1/verify.

func Dev

func Dev(ctx context.Context, st storage.Store) (*Keys, error)

Dev returns development keys, generating and storing a synthetic key set on first use. They must never be used in production.

func DevKeys

func DevKeys(pki *devpki.Set, now time.Time) (*Keys, error)

DevKeys builds in-memory keys from a development PKI.

func Production

func Production(ctx context.Context, st storage.Store, k crypto.Signer) (*Keys, error)

Production loads keys for a KMS-backed signer k: the published seal certificate and a key-list entry valid now must both be for k's public key. The same key seals PDFs and signs evidence.

type Published

type Published struct {
	// KeyList is the signed key list JSON.
	KeyList []byte
	// SealChain is the PEM seal certificate followed by its intermediates.
	SealChain []byte
	// SealRoots and TSARoots are PEM trust anchors.
	SealRoots, TSARoots []byte
}

Published is the public key material stored in the database.

func LoadPublished

func LoadPublished(ctx context.Context, st storage.Store) (*Published, error)

LoadPublished reads the published key material.

Directories

Path Synopsis
Package awskms provides a crypto.Signer backed by AWS KMS.
Package awskms provides a crypto.Signer backed by AWS KMS.

Jump to

Keyboard shortcuts

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