hashicorp/packer · error
signature verification failed
Error message
signature verification failed
What it means
VerifyEnvelope tries every signature in the DSSE envelope against the supplied Verifier and returns this generic error only when none of them validate. It means the verifier's key material does not correspond to any signer of the envelope (or the payload/signature bytes were altered). Because it is the terminal error after exhausting all signatures, it carries no per-signature detail by design.
Source
Thrown at internal/attestation/signer.go:93
}
payload, err := DecodeEnvelopePayload(envelope)
if err != nil {
return err
}
for _, signature := range envelope.Signatures {
decodedSignature, decodeErr := DecodeEnvelopeSignature(signature)
if decodeErr != nil {
return decodeErr
}
if verifyErr := verifier.Verify(ctx, envelope.PayloadType, payload, decodedSignature); verifyErr == nil {
return nil
}
}
return fmt.Errorf("signature verification failed")
}
View on GitHub (pinned to eb36e3c3e4)
Solutions
- Regenerate the attestation with the signer whose public key you are loading, or load the correct public key for the signer that produced the envelope
- Confirm the envelope was not modified after signing (compare payload bytes/digests against the signer output)
- Ensure the verifier supports the signature algorithm and payload type recorded in the envelope
- For keyless attestations, switch to keyless_identity/keyless_oidc_issuer verification or a Sigstore bundle instead of a raw public key
Example fix
// before: verifier built from wrong key
verifier, _ := attestation.LoadPEMVerifier("other-key.pub")
err := attestation.VerifyEnvelope(ctx, envelope, verifier) // signature verification failed
// after: use the public key matching the signer
verifier, _ := attestation.LoadPEMVerifier("signing-key.pub")
err := attestation.VerifyEnvelope(ctx, envelope, verifier) Defensive patterns
Strategy: try-catch
Validate before calling
if len(envelope.Signatures) == 0 { return errors.New("envelope has no signatures") }
if _, err := attestation.DecodeEnvelopePayload(envelope); err != nil { return err }
// confirm the verifier's key is the intended signer's public key before calling Try / catch
if err := attestation.VerifyEnvelope(ctx, envelope, verifier); err != nil {
if strings.Contains(err.Error(), "signature verification failed") {
return fmt.Errorf"attestation not signed by the expected key: %w", err)
}
return err
} Prevention
- Keep signing and verification key material in lockstep (same source of truth)
- Never mutate an envelope after signing; treat it as read-only bytes
- Log the key fingerprint used for verification alongside failures
- Test sign+verify round-trips in CI with the same fixtures
When it happens
Trigger: VerifyEnvelope is called with a Verifier whose public key differs from the key used to sign; envelope.Payload or Signatures bytes were modified after signing; the signature was base64-decoded but produced with a different algorithm than the verifier expects; callers reach it via verifyEnvelopeSignature inside VerifyAttestationFile with a mismatched key/verifier configuration.
Common situations: Pointing verifier/key at a rotated or unrelated PEM public key; verifying an attestation produced in another pipeline or environment; hand-editing or re-serializing the envelope JSON so the payload no longer matches the signature; testing with the TestPEMSignerAndVerifier/KMS/keyless fixtures using mixed keys (e.g. TestVerifierOverrideMismatchFails).
Related errors
- decode envelope signature: %w
- verify attestation envelope %q: %w
- signing_mode %q does not support Sigstore bundle emission
- decode envelope payload: %w
- sign payload: %w
AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05).
Data as JSON: /api/errors/cfabb0f9e4833a10.
Report an issue: GitHub.