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
- Variables
- func DecodeStrict(data []byte, v any) error
- func Open(envelope []byte, payloadType string, maxBytes int) (*scannertemplate.Envelope, error)
- func Sign(priv ed25519.PrivateKey, payloadType string, payload []byte) ([]byte, error)
- func SignKeySet(root ed25519.PrivateKey, typ KeySetType, version uint64, ...) ([]byte, error)
- func VerifiedBy(env *scannertemplate.Envelope, pub ed25519.PublicKey) bool
- func VerifyWith(ks *KeySet, raw []byte, payloadType string, maxBytes int, v any) error
- type KeySet
- type KeySetType
Constants ¶
const ( MaxKeySetBytes = 64 << 10 MaxKeySetKeys = 8 MaxClockSkew = 5 * time.Minute )
Bounds.
Variables ¶
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 ¶
DecodeStrict decodes one JSON value, refusing unknown fields and trailing data.
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.
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 ¶
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.