Digital signature vs MAC: when your system needs a public or shared-key check
A vendor document, standard or audit request may name both a digital signature and a message authentication code (MAC), such as HMAC, as the way a system proves a message is authentic. The two are not interchangeable. A digital signature is verified with a public key, which anyone can hold, and it lets a recipient prove to a third party who signed the data, so the signer cannot easily deny it. An HMAC needs a secret key shared by exactly two parties, and it gives no proof to anyone else, because either party could have produced the tag. RFC 2104 describes HMAC as intended for two parties who already share a secret key, and it notes that secure key exchange is essential to its security.
The question comes up for PKI and TLS engineers, security engineers, auditors and procurement reviewers, each for a different reason. In TLS 1.3, the CertificateVerify message in RFC 8446 section 4.4.3 is a signature that gives explicit proof the endpoint holds the private key for its certificate, while the Finished message in section 4.4.4 uses an HMAC over the handshake transcript to authenticate the handshake and the derived keys. Engineers reviewing a handshake design will see both in the same exchange. Certificate profiles, such as the keyUsage rules in RFC 9881 for ML-DSA certificates, also depend on whether a key is meant to sign or to establish keys. Auditors and procurement teams should check which mechanism a product uses for each message type and ask the vendor to name it.
The NIST post-quantum FAQ states that Grover's algorithm allows a brute force key search against symmetric keys, and that AES with 128, 192 or 256 bit keys can continue in use. It does not mention HMAC. FIPS 198-1 specifies HMAC, and a NIST planning note of June 2025 proposes withdrawing it in favor of SP 800-224. Confirm the current status of FIPS 198-1 and SP 800-224 before writing HMAC into a design or a compliance mapping, and record which key lengths and hash functions the product uses.
Digital signature and MAC side by side: keys, defining documents and status
This table compares a digital signature with a message authentication code (HMAC) across key model, defining document, planning status and where each appears in TLS 1.3. Read each row as a separate attribute: a signature uses a private and public key pair and can prove origin to a third party, while HMAC uses a secret key shared by two parties and cannot. The key takeaway is that the two mechanisms rely on different key models, so a post-quantum migration plan should treat them as separate items.
| Attribute | Digital signature | MAC (HMAC) |
|---|---|---|
| What it is | A value that detects changes to data, shows who signed it and lets a recipient prove the signer to a third party | A tag computed from a message and a secret key using a hash function, which detects changes to a message |
| Key model | Public and private key pair; the private key signs and the public key verifies | Shared secret key; both parties hold the same key |
| Defining document and date | FIPS 204 (ML-DSA), FIPS 205 (SLH-DSA) and FIPS 203 published 13 August 2024; RFC 9881 (ML-DSA certificates) October 2025 | RFC 2104 (February 1997); FIPS 198-1 (July 2008) |
| Status of the defining document | Current NIST standards and IETF standards track documents | FIPS 198-1 is proposed for withdrawal in a NIST planning note of June 2025, with its content moving to SP 800-224 |
| Third-party proof | Supported by design: a recipient can prove to a third party who signed | Not supported: both parties hold the key, so either can produce the tag |
| Post-quantum standard coverage | Post-quantum signature standards exist in FIPS 204 and FIPS 205 | The NIST post-quantum FAQ does not mention HMAC; confirm current guidance for your use |
| Where it appears in TLS 1.3 | CertificateVerify, which gives explicit proof of possession of the certificate's private key | Finished, which authenticates the handshake and the computed keys |
What a digital signature is and what a MAC is
A digital signature is produced with a private key and checked with a public key, so any party holding the public key can verify it. According to the abstracts of FIPS 204 and FIPS 205, digital signatures detect unauthorized changes to data, verify who signed it, and let a recipient prove to a third party who signed, so the signer cannot easily deny it. The post-quantum signature standards NIST published on 13 August 2024 are FIPS 204 (ML-DSA), a module-lattice scheme, and FIPS 205 (SLH-DSA), a stateless hash-based scheme derived from SPHINCS+. NIST SP 800-208 separately specifies the stateful hash-based schemes LMS, HSS, XMSS and XMSS^MT, which require tracking key state.
- Detection and proof: The signature detects tampering and binds the signer to the data, and a third party can check it without the signer's secret.
- Standards named in the sources: ML-DSA (FIPS 204), SLH-DSA (FIPS 205), and the stateful LMS, HSS, XMSS and XMSS^MT (SP 800-208).
- Certificate key usage: RFC 9881 requires that an ML-DSA certificate's keyUsage include at least one of digitalSignature, nonRepudiation, keyCertSign or cRLSign, and forbids keyEncipherment, dataEncipherment, keyAgreement, encipherOnly and decipherOnly. ML-DSA keys cannot be used to establish keys or encrypt data.
- Size: RFC 9881 gives ML-DSA-44 a 1312-byte public key and 2420-byte signature, and RFC 9909 gives SLH-DSA-128s a 32-byte public key and 7856-byte signature.
- Where it appears: Certificate signatures, TLS CertificateVerify messages, which RFC 8446 section 4.4.3 says prove possession of the certificate's private key, and signed documents.
Before relying on a signature in your environment, confirm which parameter set and certificate profile your PKI and TLS stack implement, since the sizes and key usage rules differ by variant.
A message authentication code (MAC) uses a secret key that the sender and receiver both hold, so only parties with that key can produce or verify the tag. RFC 2104 defines HMAC as a mechanism that combines a cryptographic hash function with a shared secret key and is intended for two parties who already share that key. Because verification needs the same secret that creates the tag, a MAC does not give a third party proof of who sent a message. FIPS 198-1 (July 2008) specifies HMAC for use with any approved iterative hash function. A NIST planning note from June 2025 proposes withdrawing FIPS 198-1 and moving its content to SP 800-224.
- Shared-secret requirement: Both parties must hold the same key, so the key exchange that establishes it is part of HMAC's security. RFC 2104 calls secure key exchange essential.
- Key-handling guidance: RFC 2104 says keys should be random or produced by a cryptographically strong pseudo-random generator, refreshed periodically, and at least as long as the hash output. Shorter keys are strongly discouraged.
- Standards status: HMAC is specified in RFC 2104 (February 1997, Informational) and FIPS 198-1. The June 2025 note proposes moving its content to SP 800-224, so check the current status before citing FIPS 198-1 in a new design.
- Post-quantum guidance: The NIST post-quantum FAQ does not mention HMAC. It says current AES key sizes of 128, 192 or 256 bits can continue, and that KMAC256 (SP 800-185) will be a good choice for pseudorandom functions.
- Where it appears: The TLS 1.3 Finished message, where RFC 8446 section 4.4.4 defines verify_data as an HMAC over the handshake transcript, and API request signing.
Confirm with your auditors and standards owners which MAC construction and key lengths they expect for your system, since the sources here do not set a post-quantum recommendation for HMAC itself.
Which differences change what a system can prove
A MAC and a digital signature both check that a message is unchanged, but they differ in who can verify and whether a third party can be shown who signed. The cards below set out the consequences of those differences for key handling, protocol design and the size of what gets sent.
Who holds the key and who can verify
HMAC uses one secret key shared by two parties, so either party could have produced the tag. A digital signature uses a private key held by the signer and a public key anyone can use to verify. Check whether your design needs verification by parties who must not be able to sign, since a shared-key MAC cannot separate those roles.
RFC 2104 textProof to a third party
The FIPS 204 and FIPS 205 abstracts state that a recipient can prove to a third party who signed, so the signer cannot easily deny it. A shared-key MAC gives the recipient no such proof, because the other key holder could have made the tag. Confirm whether your records, disputes or audits depend on this property before choosing a MAC.
FIPS 204 abstractKey establishment versus authentication
FIPS 203 describes ML-KEM as a way for two parties to establish a shared secret over a public channel, which can then be used with symmetric algorithms for encryption and authentication. That is a key establishment role, not a signature role. Keep ML-KEM and the signature algorithms separate in your design, since FIPS 203 covers key establishment only.
FIPS 203 standardHow TLS 1.3 uses both
In TLS 1.3, CertificateVerify is a signature that gives explicit proof of possession of the certificate's private key. The Finished message is an HMAC over the handshake transcript that authenticates the handshake and the derived keys. Check that a change to either mechanism is reviewed separately, since each covers a different part of the handshake.
RFC 8446 textKey distribution and exchange
RFC 2104 states that HMAC security depends on secure key exchange, that keys should be random or generated by a cryptographically strong generator, and that keys should be refreshed periodically. A MAC is only as strong as the distribution of its shared key. For a signature, verification needs an authentic copy of the public key or certificate instead of a secret.
RFC 2104 textSignature sizes against fixed MAC output
RFC 9881 lists ML-DSA-65 with a 1952-byte public key and a 3309-byte signature, and RFC 9909 lists the SLH-DSA 128s sets with a 7856-byte signature. An HMAC tag has a fixed output length set by its hash function. Check the per-message and per-handshake byte cost against your bandwidth and packet limits before substituting one for the other.
- ML-DSA-65 signature
- 3309 bytes
Where a digital signature and a MAC show up in protocols and certificates
In TLS 1.3, the two primitives split the handshake by role. The server's CertificateVerify message is a digital signature over the transcript hash, which gives explicit proof that the endpoint holds the private key for its certificate. The Finished message carries an HMAC of the transcript, keyed with a key derived from the handshake secrets, and confirms that the handshake and the computed keys are authentic to both sides. Anyone planning a post-quantum migration of a TLS stack should map each handshake message to the primitive it uses, because the signature part and the MAC part have different replacement paths. RFC 8446 defines both messages, so check the exact sections (4.4.3 and 4.4.4) when reviewing an implementation.
Certificates and PKI are where signatures bind identity to a public key. An ML-DSA certificate, for example, must set keyUsage to include at least one of digitalSignature, nonRepudiation, keyCertSign or cRLSign, and must not set keyEncipherment or keyAgreement, because ML-DSA keys cannot establish keys or encrypt data under RFC 9881. Document signing and code signing use the same signature primitives, with the signer's ability to prove authorship to a third party as the main property. HMAC does not appear in those workflows, since verification requires a shared secret that the verifier would also be able to forge with. Ask your CA or signing tool vendor which signature algorithms and certificate profiles they support, and confirm the version against their documentation.
HMAC appears in libraries and protocols wherever two parties already share a secret key. RFC 2104 defines it for that setting and says keys must be random, refreshed periodically, and at least as long as the hash output, with secure key exchange essential to its security. The NIST post-quantum FAQ does not mention HMAC; it says Grover's algorithm weakens brute-force key search and points to KMAC256 for pseudorandom functions. The sources listed on this page do not say which products, libraries or versions expose HMAC or PQ-capable signature support, so treat any claim of product-level support as unverified. Check the vendor documentation for the exact versions you run, and confirm them against your own test environment before planning a rollout.
How signature and MAC steps sit in a TLS 1.3 handshake
The diagram starts with the server sending its Certificate and then a CertificateVerify message. That message is a signature, made with the certificate's private key, over a transcript hash covering the handshake so far, which gives explicit proof of key possession under RFC 8446 section 4.4.3. Next comes the Finished message, whose verify_data is an HMAC over the transcript using a finished_key derived from the handshake secret, as RFC 8446 section 4.4.4 describes. The client checks each step in turn, so the signature is the public-key authentication and the HMAC is the shared-key check. This is a simplified illustration of those RFC 8446 sections, not a full handshake trace.
Simplified TLS 1.3 server authentication: a signature, then an HMAC, each checked by the client.
Why a signature and a MAC are used together rather than one replacing the other
A digital signature and a message authentication code solve different authentication problems, and TLS 1.3 uses both for that reason. In the handshake, the CertificateVerify message is a signature that gives explicit proof that the endpoint holds the private key matching its certificate, and its signature covers the transcript hash of the handshake context and certificate (RFC 8446, section 4.4.3). The Finished message is an HMAC over the transcript hash, and RFC 8446 section 4.4.4 describes it as essential for authenticating the handshake and the computed keys. Neither mechanism replaces the other in that protocol: the signature proves who the certificate holder is to a party that did not previously share a secret with it, while the HMAC proves integrity between two parties that already hold the derived key.
The reason the HMAC cannot stand in for the signature follows from how RFC 2104 defines it. HMAC is a mechanism for message authentication using a hash function combined with a secret shared key, intended for two parties who already share that secret. RFC 2104 also says that keys should be random or generated by a cryptographically strong pseudo-random generator, refreshed periodically, and that secure key exchange is essential to HMAC's security. A signature needs no such prior secret, which is why it can prove identity to a stranger. For a decision maker reviewing a design, the practical check is whether each authentication step has a shared secret established beforehand or a certificate the verifier can validate.
How to work out which one applies to your system
This sequence establishes whether your system needs a digital signature, a MAC, or both, by checking who must verify the sender, whether a shared secret already exists, what the protocol specification mandates, how certificate key usage rules apply, and which versions and withdrawal notices affect your configuration. Each step ends with a check you can record as evidence.
Check whether a third party must verify the signer
Start by asking whether anyone outside the two communicating parties needs to confirm who produced a message or artifact. This includes auditors, a counterparty in a dispute, a relying party that receives certificates, or any recipient who must prove to someone else that a specific signer produced the data. The FIPS 204 and FIPS 205 abstracts describe this property: a digital signature verifies who signed and lets a recipient prove the signer cannot easily deny it. If a third party must verify the signer, the design points to a digital signature, not a MAC. Record your answer and the parties who need the check. Done when each data flow in scope is marked as third-party verifiable or not.
Check for an existing shared secret between two parties
For each flow not marked third-party verifiable, determine whether the two parties already hold a shared secret key and need only integrity and authentication between themselves. RFC 2104 defines HMAC for exactly this case, intended for two parties who already share a secret key. Confirm where the key comes from, how it is generated, and how it is exchanged. RFC 2104 says keys should be random or produced by a cryptographically strong generator, refreshed periodically, and at least as long as the hash output, and that secure key exchange is essential to HMAC's security. If the secret was established over a public channel, note which key establishment method produced it, since FIPS 203 describes ML-KEM for that purpose. Done when each flow is recorded with its key source and rotation approach.
Check which primitive the protocol specification mandates
Before choosing, read the specification of the protocol or product you run and identify which primitive it names for each function. The protocol decides the answer, not your preference. For example, RFC 8446 section 4.4.3 defines the TLS 1.3 CertificateVerify message as explicit proof of possession of the certificate's private key, signing the transcript, while section 4.4.4 defines the Finished message as an HMAC over the transcript. A single protocol can therefore use a signature for one function and a MAC for another. Write down, per function, the primitive the specification requires. Done when every authentication function in scope has a named primitive and a citation to the clause that mandates it.
Check certificate key usage rules before reusing keys
If a certificate key is involved, check the key usage rules before reusing that key for another function. RFC 9881 states that the keyUsage of an ML-DSA certificate must include at least one of digitalSignature, nonRepudiation, keyCertSign or cRLSign, must not include keyEncipherment, dataEncipherment, keyAgreement, encipherOnly or decipherOnly, and that ML-DSA keys cannot be used to establish keys or encrypt data. A key certified for signatures therefore cannot be repurposed as a key-establishment or encryption key, and an ML-DSA certificate should not be treated as a MAC or key agreement key. Confirm the certificate profile your certificate authority issues against this rule. Done when each certificate in scope has its key usage extension recorded and no key is assigned to a function its extension does not allow.
Confirm versions and withdrawal status in documentation
Verify the standard versions your products implement and whether any relevant document is changing status. FIPS 198-1 specifies HMAC, and a NIST planning note of June 2025 proposes withdrawing it and moving its content to SP 800-224. Check the current status of FIPS 198-1 on the NIST publications page before relying on it in a design or an audit response. Then confirm in vendor documentation which versions of your products implement which primitives, and check your own configuration to see what is actually enabled. Note that the NIST post-quantum FAQ accessed on 4 December 2026 does not mention HMAC, so do not assume it covers your MAC choice. Done when each in-scope product has a documented version, a confirmed configuration, and a dated status check for the MAC standard it uses.
Common mix-ups between a signature and a MAC in vendor claims and tenders
Vendor documents and tender responses often use the words signature, MAC and HMAC loosely, and the difference matters for what a reviewer can prove to a third party. The cards below separate the common confusions so that a claim can be checked against the construction it actually describes.
HMAC is not a signature
Both HMAC and a digital signature produce a tag over a message, which is why vendors sometimes call an HMAC a signature. HMAC relies on a secret key shared by two parties, as RFC 2104 describes it, so either party could have produced the tag. A claim of signing should be checked against whether the scheme is public-key and whether the output can be verified by a third party without the secret.
RFC 2104 textShared-key checks are not third-party proof
A shared-key check shows that a message came from someone holding the key, but it cannot show that to a third party, because the verifier also holds the key and could have forged the tag. The NIST abstracts for FIPS 204 and FIPS 205 describe the third-party property as a feature of digital signatures. Tender questions asking who signed a record should be answered with a public-key scheme, not a shared-key tag.
FIPS 204 abstractML-DSA certificates cannot encrypt or agree keys
An ML-DSA certificate is a signing certificate, and RFC 9881 says its keyUsage must not include keyEncipherment, dataEncipherment or keyAgreement, and that ML-DSA keys cannot establish keys or encrypt data. A vendor offering one certificate for signing, encryption and key agreement is describing a design the RFC rules out. Ask which certificate carries the key establishment and which carries the signature.
RFC 9881 textML-KEM establishes keys, it does not sign
ML-KEM is a key-encapsulation mechanism, and FIPS 203 says it lets two parties agree a shared secret over a public channel, which is then used with symmetric algorithms for encryption and authentication. It does not produce a signature that a third party can verify. A tender that lists ML-KEM as its signing algorithm has mixed up the two roles, and the signing requirement should be checked against ML-DSA, SLH-DSA or another signature standard.
FIPS 203 finalThe June 2025 FIPS 198-1 note is a proposal
The June 2025 NIST planning note proposes withdrawing FIPS 198-1 and moving its HMAC content to SP 800-224. A proposal to withdraw a standard is not the same as a removal already in effect, and the sources on this page do not describe a completed withdrawal. Confirm the current status on the NIST publication pages before accepting a claim that HMAC is no longer approved.
FIPS 198-1 finalHash choice is not the MAC construction
Vendors often name a hash function such as SHA-256 or SHA-512 and present it as the authentication method, but the hash is one input to a construction. HMAC wraps an approved iterative hash with a shared key, while the NIST post-quantum FAQ names KMAC256 from SP 800-185 as a good choice for pseudorandom functions. Ask which construction is used and which key it depends on, rather than accepting the hash name alone.
NIST PQC FAQQuestions people ask about digital signatures and MACs
Is a MAC the same thing as a digital signature?
No. A message authentication code and a digital signature both check that a message has not been changed, but they rely on different keys. A MAC such as HMAC uses one secret key shared by two parties, so either party can compute the tag. A digital signature uses a private key that only the signer holds, and anyone can verify it with the public key. RFC 2104 describes HMAC as intended for two parties who already share a secret key. The FIPS 204 abstract says digital signatures also let a recipient prove to a third party who signed, so the signer cannot easily deny it. A MAC gives no such proof, because the shared key means either party could have made the tag.
Which one is newer, a MAC or a digital signature?
Neither is new in the sense of being a post-quantum invention. HMAC is defined in RFC 2104, published in February 1997, and FIPS 198-1 dates from July 2008. The post-quantum signature standards are the newer part: NIST published FIPS 204 (ML-DSA), FIPS 205 (SLH-DSA) and FIPS 203 (ML-KEM) on 13 August 2024. So the post-quantum work is about replacing public-key signatures, while HMAC has been in use for decades. The sources listed here do not describe a post-quantum successor to HMAC, so check the current NIST documents before assuming one exists.
Which one does a standard, rule or customer ask for?
It depends on the requirement, and the requirement names the mechanism. A requirement for non-repudiation, proof of origin to a third party, or a public-key certificate calls for a digital signature. A requirement to authenticate messages between two systems that already share a secret calls for a MAC. The wording in the standard, contract or audit request decides which applies, so read the control text itself rather than assuming. Do not treat the presence of one as satisfying a requirement for the other. Confirm with the customer or assessor which mechanism their document means before designing the system.
Does a system need both a MAC and a digital signature?
Some systems use both, because they do different jobs. TLS 1.3 is an example in the sources: the CertificateVerify message is a signature that proves the endpoint holds the private key for its certificate, and the Finished message is an HMAC over the handshake transcript, which authenticates the handshake and the computed keys. RFC 8446 describes both. Whether your system needs both depends on which party must be proven to, and which keys exist. The decision is architectural, so review it with your security team rather than adding a mechanism by default.
Is HMAC quantum safe?
The NIST post-quantum FAQ, accessed 4 December 2026, does not mention HMAC, so it does not say whether HMAC is quantum safe. The same FAQ discusses symmetric primitives in general. It says Grover's algorithm allows a quantum computer to perform a brute force key search, that current applications can continue to use AES with 128, 192 or 256-bit keys, and that anything with less than 112 bits of classical security should not be used. It also says SHA512 is likely sufficient for its security strength categories and names KMAC256 (SP 800-185) as a good choice for pseudorandom functions. FIPS 198-1 is proposed for withdrawal, with content moving to SP 800-224, according to a NIST planning note of June 2025. Confirm the current status of HMAC and its key lengths with NIST before relying on it for a post-quantum design.
What should I ask a vendor about signatures and MACs?
Ask which mechanism each function uses and why. For each place the product authenticates data, ask whether it uses a MAC with a shared key or a signature with a public key, and which key lengths and hash functions it uses. Ask whether it relies on HMAC, and whether it has a plan if NIST changes the status of that standard. Ask which signature algorithms it supports, the versions and parameter sets, and whether it applies the signature to a message or a hash of it. Ask how the vendor handles key distribution for shared keys, since RFC 2104 says secure key exchange is essential to HMAC's security. Ask for the vendor's documentation rather than a summary, and confirm the answers against the specific version you run.
How DeployOpen works on this
DeployOpen approaches signature and MAC choices by first mapping which authentication jobs in your environment need public verifiability and which can rely on a shared secret. We then scope, build, hand over and support the resulting configuration inside your own infrastructure, with each decision traced to the protocol or standard that defines it.
How we scope
- We inventory where your systems authenticate messages with digital signatures and where they use shared-key MACs, such as HMAC in protocol handshakes.
- We identify which flows need a third party to verify who signed, since that requirement is what separates a signature from a MAC.
- Engagements are fixed-scope, with the signature and MAC decisions, deliverables and timelines agreed in writing before work starts.
How we build
- We configure signature paths against the standards that apply to your stack, such as FIPS 204 for ML-DSA and RFC 9881 for certificate key usage.
- We configure shared-key MAC paths and document how the shared secret is generated, refreshed and exchanged, following RFC 2104 guidance.
- We test the configured flows in a staging environment, including certificate handling and the handshake steps that depend on both mechanisms.
How we hand over
- We document which authentication jobs use signatures and which use MACs, with the standard and version behind each configuration choice.
- We provide keys, certificate profiles and configuration files so your security and PKI teams can review them independently.
- We list open questions, such as whether your vendors' versions support the chosen algorithms, for you to confirm before go-live.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers after handover.
- We can revisit signature and MAC configurations when standards change, such as the planned June 2025 NIST move of FIPS 198-1 content to SP 800-224.
- We do not issue audit reports or attestations, so we prepare the configuration evidence that your independent auditor reviews.
Sources and further reading
- RFC 2104: HMAC, keyed-hashing for message authentication ↗
- RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3 ↗
- NIST FIPS 204: Module-Lattice-Based Digital Signature Standard ↗
- NIST FIPS 203: Module-Lattice-Based Key-Encapsulation Mechanism Standard ↗
- NIST PQC FAQ ↗
- RFC 9881: Use of ML-DSA in X.509 certificates ↗

