HTTP message signatures (RFC 9421) let the sender of an HTTP message sign chosen parts of it with a private key. The receiver checks the signature with the matching public key. A valid signature shows two things: the holder of the key sent the message, and the signed parts did not change on the way. For an AI agent, the result is that a copied access token is useless without the agent’s key. The twelve comic strips below explain each core concept. Under each strip you find the details and the section of the RFC.
TL;DR
- The signer lists the parts of the message that it signs. RFC 9421 calls them covered components: header fields, plus derived components such as
@method,@authorityand@path. - Signer and verifier each build the same text from their copy of the message. This text is the signature base, and the signature is made over it.
- Two header fields carry the result.
Signature-Inputsays what was signed, when and with which key.Signatureholds the signature bytes. - With the parameters
created,expiresandnonce, a verifier can reject a recorded request that someone sends again.Content-Digest(RFC 9530) brings the body under the signature. - A signature proves the sender and protects the signed parts. It does not encrypt, and it does not protect parts outside the list. Keep TLS.
Who is in the comics?
Four characters appear in every strip. Each one stands for a role in the RFC.
| Character | Role in RFC 9421 | In a system with AI agents |
|---|---|---|
| Ava, the blue robot | Signer | An AI agent that calls APIs for a user |
| Gus, the red server | Verifier | The API or the authorization server that receives the call |
| Pip, the green courier | Intermediary | A gateway, reverse proxy, CDN or load balancer on the path |
| Mal, in the purple coat | Attacker | Anyone who can copy or change a message on the way |
Every example uses one request: Ava sends POST /payments to api.example.com with a small JSON body. The values in the strips and in the code blocks are real. You can check the signature yourself in section 7.
1. Why is a bearer token not enough?
Most APIs accept a bearer token. “Bearer” means that the API serves whoever presents the token. The API checks that the token is valid. It has no way to check who holds it.
An agent’s token passes through more places than a browser’s token does. The agent hands it to a framework and to tool calls. The token then travels through gateways and MCP servers, and each of them may write it to a log or a trace. Each of these places can leak a copy. An agent often acts for a person, so a copy carries that person’s access.
The usual answer in OAuth is a sender-constrained token: a token that works only together with a proof that the caller holds a certain key. RFC 9421 is one way to give that proof, and it protects more than the token.
2. Why does TLS not solve this?
TLS protects one connection. A request from an agent usually crosses several connections: to a CDN, then to an API gateway, then to the service. Each hop ends one TLS connection and starts the next one.
Between two hops, the message is secret and intact. At each hop, the message is open. A gateway reads it and rewrites parts of it, and that is its job. A component with a fault, or one under an attacker’s control, can change it too. The service at the end sees a TLS connection from the last hop. The connection says nothing about the original sender.
Section 1 of the RFC names this gap: TLS gives its guarantees for a single connection, and a gateway that ends TLS breaks the chain. Mutual TLS has the same limit. A client certificate proves who opened the connection to the first hop.
3. What is the fix?
The sender signs the message, not the connection. The signature is two more header fields, so it passes through every hop with the request.
- Ava makes a key pair. The private key stays with her and is never sent. A key that never travels cannot leak from a log or a proxy.
- Gus gets the public key ahead of time. Ava can register it, publish it at a URL, or a trusted party can put it in a token for her. RFC 9421 leaves this choice to the application.
- Ava signs each request. Gus verifies each signature. A valid signature shows that the holder of the private key sent this message and that the signed parts are unchanged.
Mal can still copy a token. If Gus also requires a signature from the key that belongs to the token, the copy is useless.
The RFC also allows a shared secret with HMAC. Then the verifier holds the same key and could create signatures as well. For this reason section 7.3.3 prefers a key pair.
4. What are covered components?
Ava does not sign the whole message as raw bytes. HTTP messages change on the way, and those changes are allowed. Section 1.3 of the RFC lists them. A proxy may:
- change the order of header fields
- join several fields of the same name into one
- add fields such as
ViaandForwarded - convert the message from HTTP/1.1 to HTTP/2
- change the letter case of field names
A signature over raw bytes would fail at the first proxy. So Ava picks the parts that matter and lists them, in order. This list is the covered components. Gus checks exactly those parts. Everything else may change, and the signature stays valid.
Three rules make the values the same on both sides:
- A field name is written in lower case:
content-type, notContent-Type. - Spaces before and after the value are removed.
- Several fields of the same name become one value, joined with a comma and a space.
Choose the list with care. Sign the parts that define the request:
- the method and the target
- the content type and the digest of the body
- the
Authorizationfield, when there is a token
Do not sign fields that proxies rewrite, such as Via (section 7.2.3).
5. What are derived components?
The method, the host and the path are not header fields. In HTTP/1.1 they are in the request line, and in HTTP/2 they are pseudo-header fields. RFC 9421 gives them names that start with @. Their values are computed from the message, so they are called derived components.
For POST https://api.example.com/payments?currency=EUR, the values are:
| Name | Value | Meaning |
|---|---|---|
@method |
POST |
The request method |
@target-uri |
https://api.example.com/payments?currency=EUR |
The full target URI |
@authority |
api.example.com |
Host, plus the port when it is not the default |
@scheme |
https |
The scheme of the target URI |
@request-target |
/payments?currency=EUR |
The target as written in the request line |
@path |
/payments |
The path without the query |
@query |
?currency=EUR |
The query, with the leading ? |
@query-param |
"@query-param";name="currency" gives EUR |
One named query parameter |
@status |
200 |
The status code, for responses only |
With @method, @authority and @path on the list, a signature is good for one method on one host and one path. Mal cannot move it to another endpoint.
Prefer @authority over the Host field. HTTP/2 carries the host in :authority, and @authority has the same value in every HTTP version (section 7.2.4).
A component can also take a parameter after a semicolon:
;keypicks one member of a dictionary field.;sfand;bscontrol how a field value is written.;trtakes a field from the trailers.;reqtakes a value from the request, for a signed response. Strip 11 shows it.
6. What is the signature base?
Ava and Gus need the same bytes to sign and to verify. They do not exchange those bytes. Each side builds them from its own copy of the message. The result is the signature base.
For the example request, the signature base is:
"@method": POST
"@authority": api.example.com
"@path": /payments
"content-type": application/json
"content-digest": sha-256=:Rv+LREhpDGq340VwVFrSQCeDi0wBRkR80fa0kkpryRM=:
"@signature-params": ("@method" "@authority" "@path" "content-type" "content-digest");created=1795770000;expires=1795770060;nonce="h3btwql1Lc4A0e-P";keyid="ava-key-1"
The rules are short:
- One line for each covered component, in the order of the list.
- Each line is the name in double quotes, a colon, one space, and the value.
- The last line is always
"@signature-params". It repeats the list and adds the signature parameters, so both are signed too. - Lines are joined with a single line feed. There is no line feed after the last line.
Gus never accepts a ready-made base from anyone. He builds it from the request that arrived (section 7.4.2). If one signed value differs by one byte, his base differs and the check fails.
A practical tip from section 7.4.1: when a signature fails during development, print the base on both sides and compare the two texts. The line that differs shows which component changed on the way.
7. Which header fields carry the signature?
Ava adds two header fields to the request. Here is the complete signed request:
POST /payments HTTP/1.1
Host: api.example.com
Content-Type: application/json
Content-Length: 45
Content-Digest: sha-256=:Rv+LREhpDGq340VwVFrSQCeDi0wBRkR80fa0kkpryRM=:
Signature-Input: sig1=("@method" "@authority" "@path" "content-type" "content-digest");created=1795770000;expires=1795770060;nonce="h3btwql1Lc4A0e-P";keyid="ava-key-1"
Signature: sig1=:ymwayoyPjgdYEvItb+rlqBB3ilcLAoAM7HS56ngzyFeM9Kdd+x/564g3Ipmj6YfHuMmHtMIt1+5LtPp4WE1FAg==:
{"amount":10,"currency":"EUR","to":"acct_42"}
Signature-Inputholds the list of covered components and the signature parameters. Its value is the same text as the last line of the signature base.Signatureholds the signature bytes, in base64 between two colons.- The label, here
sig1, connects the two. The signer chooses it. A message can carry several signatures, each with its own label.
Both fields use Structured Fields (RFC 8941), a strict syntax for header values. Parse them with a real parser for Structured Fields. A loose parser is a known source of attacks (section 7.5.3).
Check the example yourself
The example is signed with an Ed25519 key that was made for this post. This script for Node.js builds the signature base and verifies the signature with the public key:
import crypto from 'node:crypto';
const publicKey = crypto.createPublicKey({
key: { kty: 'OKP', crv: 'Ed25519', x: 'f6cpsIN2SFR8oXM4LEyGBFyCVl-ZzxJ1HHM10C2z6_w' },
format: 'jwk',
});
const body = '{"amount":10,"currency":"EUR","to":"acct_42"}';
const digest = crypto.createHash('sha256').update(body).digest('base64');
const base = [
'"@method": POST',
'"@authority": api.example.com',
'"@path": /payments',
'"content-type": application/json',
`"content-digest": sha-256=:${digest}:`,
'"@signature-params": ("@method" "@authority" "@path" "content-type" "content-digest")' +
';created=1795770000;expires=1795770060;nonce="h3btwql1Lc4A0e-P";keyid="ava-key-1"',
].join('\n');
const signature = Buffer.from(
'ymwayoyPjgdYEvItb+rlqBB3ilcLAoAM7HS56ngzyFeM9Kdd+x/564g3Ipmj6YfHuMmHtMIt1+5LtPp4WE1FAg==',
'base64',
);
console.log(crypto.verify(null, Buffer.from(base), publicKey, signature)); // true
Change "amount":10 to "amount":1000 and run it again. The digest changes, the base changes with it, and the script prints false.
Which algorithms can sign?
Section 3.3 defines six algorithms. The names come from the IANA registry “HTTP Signature Algorithms”.
| Name | Algorithm | Key |
|---|---|---|
ed25519 |
EdDSA with curve Ed25519 | Key pair |
ecdsa-p256-sha256 |
ECDSA with curve P-256 and SHA-256 | Key pair |
ecdsa-p384-sha384 |
ECDSA with curve P-384 and SHA-384 | Key pair |
rsa-pss-sha512 |
RSASSA-PSS with SHA-512 | Key pair |
rsa-v1_5-sha256 |
RSASSA-PKCS1-v1_5 with SHA-256 | Key pair |
hmac-sha256 |
HMAC with SHA-256 | Shared secret |
An application can also use a JSON Web Signature algorithm (section 3.3.7). The alg parameter is optional. A careful verifier takes the algorithm from what it has on record for the key, not from the message, so that an attacker cannot pick a weaker one (section 7.3.6).
8. How does a verifier stop replay?
A signature stops changes. It does not stop Mal from recording a complete request and sending the same bytes again. This is a replay, and the signature on a replay is valid.
The signature parameters are Ava’s defense. They are in the last line of the signature base, so Mal cannot edit them.
| Parameter | Meaning | What the verifier does with it |
|---|---|---|
created |
Time of signing, in seconds since 1970 | Rejects a signature that is too old |
expires |
Time after which the signer no longer stands behind the signature | Rejects the signature after that time |
nonce |
A random value that the signer uses once | Stores it and rejects a second use |
keyid |
A name for the key | Uses it to find the public key |
alg |
The algorithm, by its registry name | Checks that it fits the key |
tag |
A label that an application sets | Finds the signatures that are meant for it |
The RFC defines the parameters, and each application sets the limits. A common design accepts a signature for a short time after created and stores each nonce for that same time. Then the store of nonces stays small, and no recorded request works a second time.
9. How is the body protected?
Covered components are header fields and @ names. The body is neither, so a signature does not cover the body by itself (section 7.2.8).
The answer is a second standard, Digest Fields (RFC 9530):
- Ava computes a hash of the body.
- She puts it in the
Content-Digestfield, for examplesha-256=:Rv+LREhp…:. - She adds
"content-digest"to her covered components.
Now the signature protects the digest, and the digest stands for the body.
Gus has two jobs here, and both are required. He verifies the signature, which shows that the digest field is unchanged. He also hashes the body that arrived and compares the result with that field. A verifier that skips the second step accepts any body.
10. What happens at a proxy?
Most proxies do not break a signature, because they leave the signed values alone. One common case does break it. A reverse proxy rewrites the host to an internal name. Gus then computes a different @authority than the one that Ava signed.
There are two clean answers:
- Gus uses the public name. He is configured with the public host name of the API and uses it for
@authority. Section 7.4.3 allows this, as long as the value comes from a source that Gus trusts. - Pip signs as well. Pip verifies Ava’s signature. Then he adds a second signature with his own key and his own label, as in section 4.3. His signature covers the message as Gus will see it, including the
Forwardedfield.
Three rules apply when a message has several signatures:
- A proxy should not sign another signature’s value. Section 7.3.7 describes the weakness.
- The verifier accepts signatures only from the signers on its own list (section 7.2.6).
- A label is only a name. A proxy may change it, so do not attach meaning to it (section 7.2.5).
11. Can one side ask for a signature? Can a response be signed?
Asking. A verifier can request a signature with the Accept-Signature field (section 5). The field has the same form as Signature-Input, with the values left open:
Accept-Signature: sig1=("@method" "@target-uri" "content-digest");keyid="ava-key-1";created;nonce="b7c1e0a94f2d"
In a response, it asks the client to sign the next request this way. In a request, it asks the server to sign the response. A nonce from the verifier is a strong defense against replay, because the verifier chose the value itself.
Signing a response. A server can sign a response in the same way. The status code has its own name, @status.
Binding a response to its request. A signed response alone could be an answer to a different request. The req parameter closes this gap (section 2.4). It puts a value from the request into the signature base of the response:
"@status": 200
"@method";req: POST
"@path";req: /payments
"content-digest": sha-256=:…:
Ava builds this base with the values of the request that she sent. The signature verifies only when the response belongs to that request.
12. What does a signature not do?
Three limits matter in practice.
A signature is not encryption. Every hop can read a signed message. TLS keeps it secret, and TLS also hides the signature from people who would record it (sections 7.1.2 and 8.2).
Only the listed parts are protected. Mal can add or change any field outside the list, and the signature stays valid. A verifier must act only on signed parts, and it must require the parts that it needs (section 7.2.1). A signature with an empty list is valid for every message.
The RFC is a toolbox, not a finished protocol. Section 1.4 says what each application must define before it uses signatures:
- which components and parameters are required
- which algorithms are allowed
- how the verifier finds the key, and how it checks that the key fits the sender
- how old a signature may be, and whether a nonce is required
- which error the verifier returns when a check fails
A signature that verifies but breaks one of these rules must be rejected. The verifier’s code must also make the check on every request. Section 7.1.1 says to test with invalid signatures, to prove that the check runs.
A signature also says nothing about permission. It shows who sent the message. An access token or a policy determines what that sender may do.
How do HTTP message signatures compare with DPoP and mutual TLS?
All three bind a request to a key. They differ in what the proof covers.
| Mutual TLS (RFC 8705) | DPoP (RFC 9449) | HTTP message signatures (RFC 9421) | |
|---|---|---|---|
| Proof that the caller holds the key | The TLS handshake with a client certificate | A signed JWT in the DPoP field |
A signature over parts of the message |
| What the proof covers | The connection | Method, URI without the query, time, a unique id, a hash of the access token | Any fields that you choose, the method, the target and a digest of the body |
| Works across a proxy that ends TLS | Only when the proxy passes the certificate on | Yes | Yes |
| Protects the body | No | No | Yes, with Content-Digest |
| Binding to an access token | Defined by the standard | Defined by the standard | Defined by each application profile |
DPoP is the simpler choice when you need to bind an OAuth access token to a key. HTTP message signatures fit when the content of the request must be protected from end to end, or when no OAuth token is involved.
Why does this matter more for AI agents?
- More hops. An agent’s call often crosses a framework, a tool layer, an MCP server and a gateway. Each one can leak a token or change a message.
- Borrowed access. An agent usually acts for a person. A stolen token gives the thief that person’s access.
- Nobody is watching. An agent runs unattended, so no person notices an odd request at the time. A signature lets each API check each call by itself.
- Clear records. A signed request names one key. The audit log can then say which agent sent a request, not only which token was used.
How LumoAuth does it
LumoAuth uses HTTP message signatures in AAuth, its protocol for agents that hold their own key. In the Organization Portal, go to Agents and choose Register agent. In step 2, How it proves its identity, choose the AAuth card. You give LumoAuth the agent’s public keys, as a JWKS URL or as the key set itself. The private key stays with the agent, and LumoAuth never sees it.
From then on, the agent signs every call to LumoAuth, and LumoAuth verifies each signature under a fixed profile of RFC 9421:
- Every signature covers the method, the host and the path, and the query when there is one.
- A request with a body carries a
Content-Digest, and LumoAuth compares it with the body that arrived. - Each signature needs a recent
createdtime and a nonce that works once. - Tokens issued to the agent are bound to its key, so a copied token does not work alone.
- A signature that fails is rejected, and the failure is written to the audit log.
The SDKs sign for you. In Python:
from lumoauth import AAuthClient
private_pem, jwks = AAuthClient.generate_keypair()
client = AAuthClient(
agent_identifier="https://myagent.example.com",
private_key_pem=private_pem,
base_url="https://app.lumoauth.dev",
org_id="acme-corp",
)
headers = client.sign_request("POST", "https://api.example.com/data", body=b'{"key":"value"}')
sign_request returns the Signature, Signature-Input and Content-Digest header fields for the request.
The AAuth quickstart shows a first signed call, step by step. The signature profile lists the exact components, parameters and algorithms. For the other ways in which an agent can prove who it is, see Six ways an AI agent can prove who it is.
Standards involved
- HTTP message signatures, RFC 9421, the subject of this post
- Digest Fields, RFC 9530, for
Content-Digest - Structured Field Values for HTTP, RFC 8941, the syntax of
Signature-InputandSignature - OAuth 2.0 Demonstrating Proof of Possession (DPoP), RFC 9449, and OAuth 2.0 mutual TLS, RFC 8705, the two other ways to bind a request to a key
The full list is on the standards reference.
FAQ
What is RFC 9421?
RFC 9421, HTTP Message Signatures, is an IETF standard from February 2024. It defines how the sender of an HTTP request or response signs chosen parts of the message with a key, and how the receiver verifies that signature. The signature travels in two header fields, Signature-Input and Signature.
Do HTTP message signatures replace TLS? No. A signature shows who sent a message and that the signed parts did not change. It does not hide anything: every hop can still read the message. TLS keeps the message secret on each connection, so you use both.
How is RFC 9421 different from DPoP? DPoP (RFC 9449) proves that a client holds a key by sending a small signed JWT with the method, the URI and a hash of the access token. An HTTP message signature signs parts of the message itself, including any header fields that you choose and a digest of the body. DPoP is defined for OAuth access tokens. RFC 9421 is a general tool, and an application profile says how it is used.
Does an HTTP message signature cover the request body?
Not by itself. The sender puts a hash of the body in the Content-Digest field (RFC 9530) and adds content-digest to the signed components. The receiver must then hash the body that arrived and compare it with the signed digest.
Which signature algorithms does RFC 9421 define?
Six: rsa-pss-sha512, rsa-v1_5-sha256, hmac-sha256, ecdsa-p256-sha256, ecdsa-p384-sha384 and ed25519. An application can also use a JSON Web Signature algorithm. Each application sets the ones that it accepts.
Do HTTP message signatures replace OAuth access tokens? No. A signature answers who sent this message. An access token answers what the sender may do. Many systems use both: the token is bound to a key, and each request carries a signature made with that key, so a copied token is useless alone.
Related: AI agent identity on the solutions pages, and What is an AI agent identity? on this blog.
Sign your first agent request with the AAuth quickstart.
