HMAC signature meaning, in plain words

HMAC signature confirms that a message is genuine and arrived unmodified. How the shared secret key works, what it cannot do, and how to store the key safely.

Written by: Mio Kanzaki(Security Analyst (AI))Reviewed by: 千葉圭介Updated

An HMAC signature is a code that lets both sides of a connection confirm that a message is genuine and that nothing changed during transit. HMAC stands for Keyed-Hash Message Authentication Code. It is produced by combining the data being sent with a secret key that only the two parties share.

IETF RFC 2104 describes HMAC as a method for checking that data sent over an untrusted channel, or data stored somewhere, has not been altered. NIST also standardised the mechanism in FIPS 198-1, which defines it as a system that authenticates a message by combining it with a secret key.

How does an HMAC signature work?

Picture two people who each own the same stamp. When one sends a document, they press the stamp across the seal. The other can confirm the document arrived intact by checking that the stamp impression is exactly right. Someone without that stamp cannot reproduce the same impression.

HMAC works the same way, using data instead of paper. The sending side calculates a short value from the content and the secret key, then attaches it to the message. The receiving side performs the same calculation using the same content and its copy of the key, and compares the two values. If they match, the content has not changed in transit. If even one character differs, the values will not match.

Two important limits follow from this design. First, the signature does not conceal the message. Anyone who can read the connection can read the content. When the content itself must be kept private, pair HMAC with an encrypted transport such as HTTPS. Second, because both parties hold the same key, the signature confirms only that one of the two parties who know the key created it.

To see how your own site appears from outside first, the free URL check is a starting point.

Why does HMAC signature matter for site operators?

Sites increasingly receive automated notifications from external services. A payment platform, for example, sends a notification each time a transaction completes. If a site accepts such notifications without verifying the signature, a forged notification could mark an order as paid when no payment was made.

The connection between our WordPress plugin and the server also uses HMAC to confirm that each message is genuine. When you commission or build an integration with an external service, ask at the specification stage whether signature verification is included.

The mechanism loses its value if the key is handled carelessly. A key written into source code, or committed to a public repository, lets anyone produce a valid signature. Store keys in environment variables or a dedicated secrets vault. If a leak is suspected, rotate to a new key without delay.

Whether an integration in your site performs this check is not visible from outside the application. To have us look at the design, contact us.

Related terms

  • Tampering: the alteration that HMAC signatures are designed to detect.
  • HSTS: a response header that locks the connection to HTTPS; a different layer of protection.
  • CSP: a response header that controls which script sources a browser may load.

Frequently asked questions

Does an HMAC signature hide the content of a message?

No. The signature detects tampering but does not conceal the content. To protect the content as well, combine HMAC with an encrypted connection such as HTTPS.

What happens if the signing key leaks?

Anyone who obtains the key can generate valid signatures. If a leak is suspected, replace the key immediately and invalidate the old one. Never write the key into source code or a public repository.

Next step

Whether your integrations verify incoming messages can be reviewed by us: contact us. The free URL check reads only public information.

Frequently asked questions

Does an HMAC signature hide the content of a message?

No. The signature detects tampering but does not conceal the content. To protect the content as well, combine HMAC with an encrypted connection such as HTTPS.

What happens if the signing key leaks?

Anyone who obtains the key can generate valid signatures. If a leak is suspected, replace the key immediately and invalidate the old one. Never write the key into source code or a public repository.

See what an attacker can see, today

The free URL check returns a grade in under a minute. For costs and next steps, book a free consultation.