feedsign

package
v0.0.0-...-27e7fae Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: GPL-3.0 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 feedsign verifies the signed bundles that platform feeds publish (the program feed of RFC-065 §16; the same envelope as the vulnerability feed of RFC-066 §5.5): DSSE envelopes signed with Ed25519, an offline root that signs an expiring, versioned key set, and online keys from that key set that sign the bundle's pointer and manifests. Each feed names its own payload types; the cryptography and the checks are shared.

Index

Constants

View Source
const (
	MaxKeySetBytes = 64 << 10
	MaxKeySetKeys  = 8
	MaxClockSkew   = 5 * time.Minute
)

Bounds.

Variables

View Source
var ErrKeySetRollback = errors.New("key set rolled back")

ErrKeySetRollback: a key set older than one applied before (a rollback that would bring a revoked key back).

Functions

func DecodeStrict

func DecodeStrict(data []byte, v any) error

DecodeStrict decodes one JSON value, refusing unknown fields and trailing data.

func Open

func Open(envelope []byte, payloadType string, maxBytes int) (*scannertemplate.Envelope, error)

Open decodes an envelope of the expected payload type and size.

func Sign

func Sign(priv ed25519.PrivateKey, payloadType string, payload []byte) ([]byte, error)

Sign signs payload as a DSSE envelope (collectors and tests).

func SignKeySet

func SignKeySet(root ed25519.PrivateKey, typ KeySetType, version uint64, issuedAt, notAfter time.Time, online ...ed25519.PublicKey) ([]byte, error)

SignKeySet signs a key set of typ listing online with the offline root (feed generators and tests; an instance never holds a root).

func VerifiedBy

func VerifiedBy(env *scannertemplate.Envelope, pub ed25519.PublicKey) bool

VerifiedBy reports whether pub signed the envelope.

func VerifyWith

func VerifyWith(ks *KeySet, raw []byte, payloadType string, maxBytes int, v any) error

VerifyWith checks that a key of the key set signed the envelope and decodes its payload strictly into v.

Types

type KeySet

type KeySet struct {
	Kind          string              `json:"kind"`
	Version       uint64              `json:"version"`
	IssuedAt      time.Time           `json:"issued_at"`
	NotAfter      time.Time           `json:"not_after"`
	Keys          []jobsign.PublicKey `json:"keys"`
	RootKeyID     string              `json:"root_keyid"`
	RootPublicKey string              `json:"root_public_key"`
}

KeySet lists the online keys an offline root allows.

func VerifyKeySet

func VerifyKeySet(envelope []byte, typ KeySetType, pinnedRoot string, minVersion uint64, now time.Time) (*KeySet, error)

VerifyKeySet checks a key set envelope: signed by its root, the root is the pinned one, valid at now, version not below minVersion (a key set cannot be rolled back to bring a revoked key back).

type KeySetType

type KeySetType struct {
	PayloadType string
	Kind        string
	MaxValidity time.Duration
}

KeySetType names a feed's key set: its payload type and kind, and the longest validity (not_after - issued_at) a key set of this feed may have. MaxValidity must be set: a zero value refuses every key set.

Jump to

Keyboard shortcuts

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