Steps
HMAC the raw body, not JSON.stringify($json.body)
This is the main reason a webhook signature "works in testing and fails with Stripe or Shopify". The Webhook node parses the body, so spaces, newlines,
10.50(it becomes10.5) and escapes such as\/and\u00e9are gone. The HMAC ofJSON.stringify($json.body)wasbd39a0d0...while the sender signed473f7b8e.... It only matched when the sender sent compact JSON with nothing escaped. The fix that matched every time, in 6 production webhook runs: on the Webhook node turn on Options > Raw Body, then in the Crypto node (Action Hmac) turn on Binary File with Binary Property Namedata. With Raw Body off, Binary File fails:This operation expects the node's input data to contain a binary file 'data', but none was found [item 0].On n8n 2.x the secret lives in a Crypto credential
The Crypto node v2 (the default in n8n 2.x) has no Secret field, so tutorials and screenshots showing one are for v1. With no credential selected, the run failed with
Node does not have any credentials set. With a Crypto credential that has no HMAC secret:No HMAC secret set in credentials. Please add an HMAC secret to your Crypto credentials.Create a credential of type Crypto, fill the HMAC secret, and select it. v1 with the same inline secret gave the same HMAC, and with an empty secret:Parameter "Secret" is required.Check the silent mismatches: secret, algorithm, encoding, signed string
All of these gave a green run and a wrong value, with no warning. A trailing space in the secret, or a newline pasted with it, changed the HMAC. SHA1 instead of SHA256 changed it. Encoding matters: hex and base64 are the same bytes written differently, and Shopify sends base64, while GitHub and Stripe send hex. Some providers sign more than the body: for Stripe the signed string is the timestamp, a dot and the raw body (
{{ $json.t }}.{{ $json.raw }}matched our reference), and Slack documentsv0:timestamp:body. Check your provider's docs for the exact string.Compare with the right prefix and case
Even with the correct HMAC, an IF node comparison failed when the header had a prefix: GitHub sends
sha256=<hex>and the node outputs only the hex, so it went to the false branch. An UPPERCASE hex header against the node's lowercase output also went to false. Compare'sha256=' + $json.datawith the header, or lowercase both sides. The IF node has no timing-safe comparison, so if that matters to you, compare in a Code node.Make Value a string
Value must resolve to text. A number field failed with
The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (123), an object with...Received an instance of Object, and a missing field with...Received undefined. Use{{ String($json.n) }}, or{{ JSON.stringify($json.obj) }}for objects (but see step 1 for webhook bodies). An empty Value gaveParameter "Value" is required.If you type{{ $json.text }}in Fixed mode, without switching to Expression, the node hashes that literal text. A trailing newline also changes the hash.Hashing a file removes the file from the item
With Binary File on, the SHA256 matched
sha256sum, but the next node had no binary: the Crypto node outputs the item without it, in every run including all webhook runs. If you still need the file, hash it on a separate branch and join with a Merge node. Two more traps: Property Namemeta.hashcreates a flat key namedmeta.hash, not a nested field, and a Property Name that already exists (the default isdata) is overwritten.Sign, Encrypt and Decrypt errors
Sign with RSA-SHA256 verified with
openssl. A PEM pasted on one line still worked, but the key body without the BEGIN and END lines failed witherror:1E08010C:DECODER routines::unsupported, and a credential with no private key gaveNo private key set in credentials. Please add a private key to your Crypto credentials.Encrypt and Decrypt (new in v2) round-tripped AES-256-GCM. A wrong passphrase, a different cipher or a different RSA OAEP hash all gaveDecryption failed: wrong passphrase, key, cipher, or corrupted payload. A CryptoJS or openssl string startingU2FsdGVkX1gaveCiphertext is malformed or truncated: the node only decrypts what it encrypted itself. RSA with 300 characters gavePlaintext is too large for the RSA key. Use symmetric mode for larger data.Encrypting the same text twice gave two different ciphertexts, so you can't compare or deduplicate on ciphertext.Generate: don't use ASCII for tokens
Generate UUID gave a different value per item, Hex 32 gave 32 hex characters, and Base64 32 gave 32 characters. ASCII 16 produced control characters such as
\u0011, which break headers, URLs and passwords. Use Hex or UUID for tokens.
What we ran
On 24 October 2026 we ran 57 executions on self-hosted n8n 2.43.7: 51 with n8n execute (Manual Trigger, a Code node with test data, the Crypto node v2, two runs on v1) and 6 production webhook runs with Raw Body on and off, sent with curl. We checked every hash, HMAC and signature outside n8n with sha256sum, Python hmac and openssl, and n8n's outputs matched them.
| Setup | Result |
|---|---|
Hash SHA256, Encoding Hex, Value hello | 2cf24dba..., same as sha256sum |
| Hash MD5, Encoding Base64 | XUFAKrxLKna5cZ2REBfFkg== |
| Value left empty | Error: Parameter "Value" is required. |
Value {{ $json.obj }} (an object) | Error: ...Received an instance of Object |
Value {{ $json.missing }} (field doesn't exist) | Error: ...Received undefined |
Value {{ $json.n }} (the number 123) | Error: ...Received type number (123) |
Value {{ String($json.n) }} | Works: a665a459... |
| Value with a trailing newline | Different hash 5891b5b5..., no warning |
| Binary File on, 3000-byte file | Hash matched sha256sum; the next node had no binary any more |
Binary Property Name file (the file is in data) | Error: The item has no binary field 'file' [item 0] |
| Binary File on, item has no binary | Error: ...expects the node's input data to contain a binary file 'data', but none was found [item 0] |
Property Name meta.hash | A flat key literally named meta.hash, not nested |
Property Name text (an existing input field) | Input field overwritten with the hash |
Value typed without = (Fixed mode) {{ $json.text }} | Hash of the literal text {{ $json.text }}, green run |
| HMAC v2, no credential selected | Error: Node does not have any credentials set |
| HMAC v2, Crypto credential without an HMAC secret | Error: No HMAC secret set in credentials. Please add an HMAC secret to your Crypto credentials. |
| HMAC SHA256 hex of the raw body string | 473f7b8e..., same as Python hmac |
| Same HMAC, Encoding Base64 | Rz97joJp...=: the same bytes in base64 |
HMAC of JSON.stringify($json.body) after the Webhook parsed it | bd39a0d0..., not the sender's 473f7b8e... |
| Secret with a trailing space | aa82703e..., silent mismatch |
| Secret with a pasted newline | 4199c7bc..., silent mismatch |
| SHA1 instead of SHA256 | d4fe4999..., silent mismatch |
Stripe-style signed string {{ $json.t }}.{{ $json.raw }} | Matched Python |
IF: node output (hex) vs header sha256=<hex> | False branch |
| IF: lowercase hex vs UPPERCASE hex header | False branch |
| HMAC v1, inline Secret | Same 473f7b8e... as v2 |
| HMAC v1, empty Secret | Error: Parameter "Secret" is required. |
| HMAC on a binary made from the raw body | 473f7b8e..., match |
| Production webhook, Raw Body on, pretty JSON | Binary HMAC matched; stringify HMAC didn't |
| Production webhook, Raw Body off, Binary File on | Error: ...binary file 'data', but none was found |
| Production webhook, compact JSON (Raw Body on or off) | Both methods matched |
Production webhook, Raw Body on, body with \/ and \u00e9 | Binary HMAC matched; stringify HMAC didn't |
| Sign RSA-SHA256, base64 | openssl verify: Verified OK |
| Sign with the PEM pasted on one line | Same signature, works |
| Sign with the key body but no BEGIN/END lines | Error: error:1E08010C:DECODER routines::unsupported |
| Sign, Algorithm left empty | Error: Parameter "Algorithm Name or ID" is required. |
| Sign, credential without a private key | Error: No private key set in credentials. Please add a private key to your Crypto credentials. |
| Encrypt then Decrypt, AES-256-GCM | hello back |
| Decrypt with a wrong passphrase, or with aes-128-gcm | Error: Decryption failed: wrong passphrase, key, cipher, or corrupted payload |
Decrypt a CryptoJS/openssl U2FsdGVkX1... string, or short base64 | Error: Ciphertext is malformed or truncated |
| RSA encrypt 300 characters | Error: Plaintext is too large for the RSA key. Use symmetric mode for larger data. |
| RSA OAEP sha256 encrypt, sha1 decrypt | Error: Decryption failed |
| RSA decrypt with only a public key in the credential | Error: No encryption private key set in credentials |
| Encrypt the same text twice | Two different ciphertexts |
| Generate UUID / Hex 32 / Base64 32 / ASCII 16 | Distinct UUIDs / 32 hex chars / 32 chars / control characters such as \u0011 |
Signature mismatch checklist
- Webhook node Raw Body on, Crypto Binary File on, property
data. - The secret has no space or newline at either end.
- Same algorithm as the provider (usually SHA256).
- Same encoding: hex (GitHub, Stripe) or base64 (Shopify).
- The exact string the provider signs (Stripe: timestamp, dot, body).
- Prefix and case match before you compare (
sha256=, lowercase).
Good to know
- Signing or verifying a JWT instead of a raw HMAC: n8n JWT node not working (missing exp, Bearer prefix, invalid algorithm).
- The webhook itself not firing? See n8n webhook not working (404). Rather do it in code? See n8n Code node errors. Missing binary data after a node: binary data not found. Comparing in an IF node: Merge and IF nodes.
- Every error message we reproduced is in the n8n error message index.
What we didn't test
- The editor UI itself (we ran workflows from JSON), n8n Cloud, and real Stripe, GitHub, Shopify or Slack deliveries: we reproduced their documented signing schemes locally.
Start from a working agent
FAQ
Why does my n8n HMAC not match the webhook signature?
In our runs the usual cause was hashing JSON.stringify of the parsed body. n8n parses the JSON, so the text is no longer byte-for-byte what the sender signed. Turn on Raw Body in the Webhook node and HMAC the binary data property with Binary File on. Then check the secret for spaces, the algorithm, hex vs base64, and any prefix such as sha256=.
Where is the Secret field in the n8n Crypto node?
On Crypto node v2, the default in n8n 2.x, the HMAC secret is in a credential of type Crypto, not in the node. Without one you get "Node does not have any credentials set"; with an empty HMAC secret you get "No HMAC secret set in credentials".
How do I verify a Shopify webhook in n8n?
Shopify sends the HMAC in base64, so set the Crypto node Encoding to Base64, HMAC the raw body (Raw Body on, Binary File on), and compare with the X-Shopify-Hmac-Sha256 header.
How do I verify a GitHub webhook signature in n8n?
HMAC SHA256 the raw body in hex, then compare "sha256=" plus the result with the X-Hub-Signature-256 header. Comparing the bare hex with the header goes to the false branch.
Why does the n8n Crypto node lose my file?
When you hash a binary file, the output item no longer has the binary. Hash it on a separate branch and merge back, or hash after you have used the file.
What does "Ciphertext is malformed or truncated" mean in n8n?
The Decrypt action only reads ciphertext made by the Crypto node's own Encrypt action. Strings from CryptoJS or openssl (starting U2FsdGVkX1) or other tools gave this error in our runs.
Related guides
- n8n JWT node not working: missing exp, Bearer, invalid algorithm, 54 runs
- n8n GraphQL node not working: variables, errors, 401, 34 runs
- n8n Webhook file upload not working? Binary data keys, 25 tests
- n8n Supabase node errors: credentials, RLS and filter fixes, 41 runs
- n8n Python Code node not working? Task runner errors, 9 tests
New guides
- GitHub release notifications in Slack (any public repo, stable releases only)
- Send RSS feeds to Slack with a keyword filter (free, incoming webhook)
- Forward emails to a Slack channel (Gmail, Outlook, any IMAP), free with an incoming webhook
- n8n Google Sheets Trigger not working: not firing, activation errors and fixes