{"record":{"id":"cfabb0f9e4833a10","repo":"hashicorp/packer","slug":"signature-verification-failed","errorCode":null,"errorMessage":"signature verification failed","messagePattern":"signature verification failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/attestation/signer.go","lineNumber":93,"sourceCode":"\t}\n\n\tpayload, err := DecodeEnvelopePayload(envelope)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, signature := range envelope.Signatures {\n\t\tdecodedSignature, decodeErr := DecodeEnvelopeSignature(signature)\n\t\tif decodeErr != nil {\n\t\t\treturn decodeErr\n\t\t}\n\n\t\tif verifyErr := verifier.Verify(ctx, envelope.PayloadType, payload, decodedSignature); verifyErr == nil {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"signature verification failed\")\n}\n","sourceCodeStart":75,"sourceCodeEnd":95,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/internal/attestation/signer.go#L75-L95","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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"],"exampleFix":"// before: verifier built from wrong key\nverifier, _ := attestation.LoadPEMVerifier(\"other-key.pub\")\nerr := attestation.VerifyEnvelope(ctx, envelope, verifier) // signature verification failed\n\n// after: use the public key matching the signer\nverifier, _ := attestation.LoadPEMVerifier(\"signing-key.pub\")\nerr := attestation.VerifyEnvelope(ctx, envelope, verifier)","handlingStrategy":"try-catch","validationCode":"if len(envelope.Signatures) == 0 { return errors.New(\"envelope has no signatures\") }\nif _, err := attestation.DecodeEnvelopePayload(envelope); err != nil { return err }\n// confirm the verifier's key is the intended signer's public key before calling","typeGuard":null,"tryCatchPattern":"if err := attestation.VerifyEnvelope(ctx, envelope, verifier); err != nil {\n    if strings.Contains(err.Error(), \"signature verification failed\") {\n        return fmt.Errorf\"attestation not signed by the expected key: %w\", err)\n    }\n    return err\n}","preventionTips":["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"],"tags":["attestation","signature","dsse","crypto"],"backgroundTag":"signature-verification-failed","analyzedSha":"eb36e3c3e48a036f3e8cc94087636ee72e1303c9","analyzedAt":"2026-09-05T13:20:43.127Z","contentChangedAt":"2026-09-05T13:20:43.127Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}