Skip to content

cosign verify “Error: no matching signatures”: wrong key?

CI/CDtested on cosign v2/v3 mit lokaler Registry

“no matching signatures” does not necessarily mean “unsigned”. There are signatures, but none matches the key you verify with. Exactly this counter-check belongs in every pipeline: a check that never fails is no check.

Symptom

cosign generate-key-pair --output-key-prefix fremd
cosign verify --key fremd.pub --insecure-ignore-tlog=true "$IMAGE"
echo "Exit-Code: $?"
Error: no matching signatures: ...
Exit-Code: 1

Counter-check with a freshly generated foreign key (fremd = “foreign”).

Diagnosis

Check whether and where the signature is stored: with cosign v2 as a tag sha256-<hex>.sig, with cosign v3 as a referrer on the image.

crane ls localhost:5001/demo-app

Causes

KeyWrong public key

The image was signed with a different private key than the one matching the public key you verify with.

TagSigned by tag, tag now points elsewhere

Signatures are attached to the digest. If it was signed by tag and the tag was moved later, the signature belongs to a different image.

Fix

Verify with the matching public key and by digest; always sign images by digest. A non-zero exit code means: do not use it in the pipeline.
cosign verify --key cosign.pub --insecure-ignore-tlog=true "$IMAGE" | jq .
WARNING: Skipping tlog verification is an insecure practice that lacks transparency
and auditability verification for the signature.

Verification for localhost:5001/demo-app@sha256:3f1c... --
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - The signatures were verified against the specified public key

Don't: Do not downgrade the pipeline check to a “warning” because it fails now and then – otherwise unsigned or foreign images end up in production.

▶
Break it yourself and find it – free
Secure supply chains hands-on, Chapter 5: offline signing and your own PKI – cosign without a transparency log, certificate chain, counter-check.
Go to day 0 →

FAQ

Is the warning “Skipping tlog verification” a problem?

In the course it is intended: without the public transparency log only your own key is checked, on purpose.

What does x509: certificate signed by unknown authority mean?

For certificate-based signatures: the chain is incomplete or in the wrong order (chain.pem = intermediate, then root).

Related error patterns

More