Skip to content
ecdsa.com
Sigstore cosign (verify-blob / verify with --key)Other tools

Error message

invalid signature when validating ASN.1 encoded signature

Also printed as

  • Error: failed to verify signature: could not verify message: invalid signature when validating ASN.1 encoded signature
  • invalid signature when validating IEEE_P1363 encoded signature

Printed as "Error: …" and again as "error during command execution: …". With a bundle (`--bundle`) cosign 3 prefixes "failed to verify signature: could not verify message:". Signatures in IEEE P1363 form fail with "…when validating IEEE_P1363 encoded signature". The core text is the same in cosign 2.6 and 3.1.

Sigstore cosign (verify-blob / verify with --key) — sigstore-go signature verifier

What it means

cosign verified the ECDSA signature (DER/ASN.1 encoded, hence the wording) over the artifact's digest with the public key you supplied, and it did not match. Either the key is not the one that signed, or the artifact differs from what was signed. Unlike keyless verification, nothing about identities or the transparency log is involved — this is the raw signature check failing.

Why it happens

How to fix it

  1. 1.

    Compare the digest and the key

    Check the artifact's SHA-256 against the published digest and the public key against the one derived from the signing key.

    bash
    sha256sum artifact.txt                             # compare with the digest published with the release
    cosign public-key --key release.key > derived.pub   # (key holder) public half of the signing key
    diff <(openssl pkey -pubin -in derived.pub -outform DER | sha256sum) \
         <(openssl pkey -pubin -in cosign.pub -outform DER | sha256sum)
  2. 2.

    Ship bundles instead of loose signatures

    A Sigstore bundle keeps signature and verification material together, which avoids most mix-ups.

    bash
    # Prefer bundles: signature, verification material and the log entry travel together
    cosign sign-blob --yes --key release.key --bundle artifact.sigstore.json artifact.txt   # uploads to Rekor
    cosign verify-blob --key release.pub --bundle artifact.sigstore.json artifact.txt

Related errors

Browse the full signature error database