Skip to main content
In this lesson you’ll install the cosign binary and generate the key pair required to sign OCI (Open Container Initiative) artifacts. Cosign is part of the Sigstore project and is used to sign, verify, and store signatures for container images and other OCI artifacts. Quick checklist:
  • Confirm cosign is not installed
  • Install cosign (choose one method)
  • Generate a key pair (private + public)
  • Store the public key in your cluster (Flux example)
Verify cosign is not installed
If you need more installation options or platform-specific instructions, see the official Sigstore cosign installation page: https://docs.sigstore.dev/cosign/installation/
A screenshot of the Sigstore documentation site showing the Sigstore logo and an overview description in the center. A dark-themed layout displays a left navigation menu of topics and a right sidebar with page links.
Installation options (examples)
  • Using Go (when you have a Go toolchain):
  • Download a prebuilt Linux binary, or install from rpm/deb packages. Example commands (using v2.0.0 as an example):
Installation methods at a glance Verify the installation
Generate a key pair Create a private/public key pair locally. By default this writes cosign.key (private) and cosign.pub (public) into your current directory.
Interactive behavior and passphrase options:
  • If you enter a passphrase, the private key will be encrypted; you must provide that passphrase when signing.
  • If you leave the passphrase empty (press Enter), the private key will be created unencrypted (passwordless).
Example interactive output:
Files created Store the public key in Flux Flux verifies signed OCI artifacts using a public key available in the cluster. To let Flux validate signatures, create a Kubernetes secret in the flux-system namespace containing your public key:
This creates a secret named cosign-pub in the flux-system namespace. Flux can reference this secret when validating signed artifacts. Next steps
  • Build or pull an OCI artifact (container image).
  • Use the private key (cosign.key) to sign the artifact with cosign.
  • Configure Flux to verify the artifact using the public key stored in the cluster.
References
Keep your cosign.key (private key) secure. Anyone with access to the private key can sign artifacts as you. For production, consider using a managed Key Management Service (KMS) or a hardware-backed key storage solution rather than storing a plaintext private key on disk.

Watch Video