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
The verified data differs from the signed data
commonA modified file, a different line ending (`\r\n` vs `\n`), a trailing newline added by an editor, or verifying the wrong file. SSHSIG signs a hash of the exact bytes.
Wrong namespace
commonSignatures created with `-n file` cannot be verified with `-n git`, and Git always uses `git`. Namespaces stop a signature made for one purpose from being reused for another.
Identity or key not in allowed_signers
occasional`-I` names a principal that the allowed signers file does not associate with the signing key, or the key was rotated and the file still lists the old one.
How to fix it
- 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.
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
error: gpg.ssh.allowedSignersFile needs to be configured and exist for ssh sign…Git (verify-commit, log --show-signature, merge --verify-signatures) with gpg.format=sshinvalid signature when validating ASN.1 encoded signatureSigstore cosign (verify-blob / verify with --key)gpg: BAD signature from "Release Bot <release@example.com>" [ultimate]GnuPG (gpg --verify, git verify-commit / verify-tag)