cosign

package
v0.0.0-...-b25b90c Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package cosign verifies cosign-style OCI signatures against a static PKIX public key. It is intentionally limited to the simple-signing envelope (the deterministic, offline-verifiable case); keyless verification via Fulcio + Rekor is out of scope and tracked as a TODO.

Wire-level flow

  • Given an image manifest ref R, fetch the manifest bytes and digest D.
  • Look up the signature manifest at R's repo, tag "<algo>-<hex>.sig" (the cosign "legacy" tag scheme). The OCI 1.1 referrers API is not used here; it requires extra server support and isn't ubiquitous yet.
  • Pick the first layer whose mediaType is application/vnd.dev.cosign.simplesigning.v1+json.
  • Fetch that layer's blob — it is the "simple signing" JSON envelope.
  • Base64-decode the annotation dev.cosignproject.cosign/signature on the same layer descriptor and verify it against SHA-256 of the envelope using the configured public key.
  • Decode the envelope and confirm critical.image.docker-manifest-digest == D.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Verifier

type Verifier struct {
	PublicKey crypto.PublicKey
}

Verifier holds a parsed public key.

func ParsePublicKey

func ParsePublicKey(pemBytes []byte) (*Verifier, error)

ParsePublicKey accepts a PEM-encoded PKIX public key (the format produced by `cosign generate-key-pair`).

func (*Verifier) Verify

func (v *Verifier) Verify(c *oci.Client, ref *oci.Ref) error

Verify fetches the cosign signature for the manifest at ref, checks it against v.PublicKey, and confirms the signed digest matches the manifest's digest. It returns nil iff at least one usable signature layer verified.

Jump to

Keyboard shortcuts

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