Skip to content
ecdsa.com
OpenSSH ssh-keygen -Y verify (SSHSIG)SSH

Error message

Signature verification failed: incorrect signature

Also printed as

  • Couldn't verify signature: namespace does not match
  • Could not verify signature.

A principal that is not listed in the allowed signers file for this key fails with only "Could not verify signature." (no preceding detail line).

OpenSSH ssh-keygen -Y verify (SSHSIG) — also used by Git for SSH-signed commits

What it means

`ssh-keygen -Y verify` checked an SSHSIG signature and the cryptographic verification failed: the data read from standard input is not exactly what was signed, or the signature was made by another key. SSH signatures also bind a namespace (`file`, `git`, `email`…); a signature verified under a different namespace fails with "namespace does not match" before the cryptographic check. Each failure is followed by "Could not verify signature.".

Why it happens

How to fix it

  1. 1.

    Verify the exact bytes with the right namespace

    Pipe the original file into `ssh-keygen -Y verify` and use the namespace from signing. `find-principals` shows which identity the key maps to.

    bash
    # Verify exactly the bytes that were signed, with the namespace used at signing time
    ssh-keygen -Y verify -f allowed_signers -I release@example.com -n file -s release.txt.sig < release.txt
    # Which principal does the allowed_signers file map this signature's key to?
    ssh-keygen -Y find-principals -f allowed_signers -s release.txt.sig
  2. 2.

    Separate cryptography from trust

    `check-novalidate` verifies the signature without consulting allowed signers. If it passes, the problem is identity mapping; if it fails, the data or the signature is wrong.

    bash
    ssh-keygen -Y check-novalidate -n file -s release.txt.sig < release.txt   # signature valid at all (no trust check)?

Related errors

Browse the full signature error database