Skip to content
ecdsa.com
Sigstore cosign (sign, sign-blob, attest, public-key with --key cosign.key)Other tools

Error message

decrypt: encrypted: decryption failed

Also printed as

  • Error: decrypt: encrypted: decryption failed
  • Error: signing artifact.txt: reading key: decrypt: encrypted: decryption failed

The prefix depends on the command, e.g. "signing artifact.txt: reading key: decrypt: …" for `sign-blob`. An empty `COSIGN_PASSWORD` is used as the password, not as "ask me".

What it means

cosign private keys (`cosign.key`, label `ENCRYPTED SIGSTORE PRIVATE KEY`) are encrypted with a password via scrypt and secretbox. cosign read the password from `COSIGN_PASSWORD` or the prompt, and decryption failed — the password is not the one used when the key was generated. The key file itself is intact; nothing was signed.

Why it happens

How to fix it

  1. 1.

    Supply key and password from the same source

    Store both as secrets of the same environment and pass the key via `env://` so they cannot drift apart.

    yaml
    # GitHub Actions: key and its password from the same secret store
    - name: Sign
      env:
        COSIGN_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
        COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
      run: cosign sign-blob --yes --key env://COSIGN_KEY --bundle dist/app.sigstore.json dist/app.tar.gz
  2. 2.

    Consider keyless signing in CI

    With an OIDC identity (GitHub Actions `id-token: write`) there is no long-lived key or password to manage; verifiers pin the workflow identity instead.

    yaml
    # Or drop the long-lived key: keyless signing with the workflow's OIDC identity
    permissions:
      id-token: write
    steps:
      - run: cosign sign-blob --yes --bundle dist/app.sigstore.json dist/app.tar.gz

Related errors

Browse the full signature error database