Sign and Attest SBOMs

AnchoreCTL can sign an SBOM file, verify that signature, and create a signed attestation that an SBOM describes a particular file, such as a release binary or tarball. This lets you prove that an SBOM you publish came from you and has not been changed since.

The cryptographic work is done by cosign, which AnchoreCTL runs for you. The commands work on local files only: they do not contact Anchore Enterprise, push nothing to a registry, and can run on an air-gapped host.

Supported SBOM formats: CycloneDX JSON, SPDX JSON and Syft JSON.

Prerequisites

  1. Install cosign v3.0.4 or later and make sure it is on your PATH. See Installing cosign. If cosign is installed somewhere else, set ANCHORECTL_COSIGN_PATH to the full path of the binary instead, for example export ANCHORECTL_COSIGN_PATH=/opt/sigstore/bin/cosign. AnchoreCTL tells you if cosign is missing or too old.

  2. For key-based signing, create a key pair:

    cosign generate-key-pair
    

    This writes cosign.key (private, password protected) and cosign.pub (public). Alternatively, use a KMS key URI (awskms://, gcpkms://, azurekms://, hashivault://) wherever a key path is accepted.

Sign and verify an SBOM with a key

export COSIGN_PASSWORD='...'          # or set cosign.password in the config file
anchorectl sbom sign sbom.cdx.json --key cosign.key
# Signed bundle written to /work/sbom.cdx.json.sigstore.json

anchorectl sbom verify sbom.cdx.json --key cosign.pub
# Verified OK: sbom.cdx.json

verify exits with a non-zero code if the SBOM was changed after signing or the bundle was signed with a different key.

Attest that an SBOM describes a file

An attestation binds the SBOM to the digest of the file it describes (the subject):

anchorectl sbom attest sbom.cdx.json --subject myapp-1.2.0.tar.gz --key cosign.key
# Attestation bundle written to /work/sbom.cdx.json.att.sigstore.json

anchorectl sbom verify sbom.cdx.json --attestation --subject myapp-1.2.0.tar.gz --key cosign.pub
# Verified OK: sbom.cdx.json against subject myapp-1.2.0.tar.gz

The attestation type is detected from the SBOM (cyclonedx, spdxjson, or https://syft.dev/bom for Syft JSON). Use --type to override it. When verifying, AnchoreCTL also checks that the SBOM inside the attestation is the SBOM file you passed.

Keyless signing

Keyless signing uses a short-lived certificate issued after an OIDC login (cosign opens a browser, or uses the ambient token in CI) and records the signature in the public Rekor transparency log:

anchorectl sbom sign sbom.cdx.json --keyless

anchorectl sbom verify sbom.cdx.json \
  --certificate-identity [email protected] \
  --certificate-oidc-issuer https://accounts.google.com

Keyless signing needs network access to Sigstore and cannot be combined with --tlog-upload=false.

Air-gapped use

With a key, signing and verification can run with no network access. Turn off the transparency log on both sides:

anchorectl sbom sign sbom.cdx.json --key cosign.key --tlog-upload=false
anchorectl sbom verify sbom.cdx.json --key cosign.pub --tlog-upload=false

To make this the default, set tlog-upload: false in the cosign section of the configuration file.

Configuration

Instead of passing flags each time, put the settings in the cosign section of the AnchoreCTL configuration file:

cosign:
  key: /keys/cosign.key        # used by sign and attest
  public-key: /keys/cosign.pub # used by verify
  tlog-upload: false

See SBOM Signing (cosign) for all settings and their environment variables. The key password is never printed in logs or in anchorectl configuration output.

Verifying with cosign directly

The bundles AnchoreCTL writes are standard Sigstore bundles, so anyone can check them with cosign alone, without AnchoreCTL:

# signature
cosign verify-blob sbom.cdx.json --bundle sbom.cdx.json.sigstore.json --key cosign.pub

# attestation (--type cyclonedx, spdxjson or https://syft.dev/bom, matching the SBOM format)
cosign verify-blob-attestation myapp-1.2.0.tar.gz \
  --bundle sbom.cdx.json.att.sigstore.json --type cyclonedx --key cosign.pub

For bundles created with --tlog-upload=false, add --insecure-ignore-tlog=true to these commands. Plain cosign checks the signature and the subject, but not that the attested SBOM matches a given SBOM file; anchorectl sbom verify --attestation does that extra check.

For the full list of flags, see the anchorectl sbom reference.

Last modified November 24, 2026