RFC 9421 defines how an HTTP sender signs chosen parts of a message, but leaves the concrete security rules to each application profile. In AAuth, an AI agent proves who it is by signing every call with its private key under a strict profile of RFC 9421. Every request must cover a mandatory list of components, hash its body with Content-Digest (RFC 9530), carry a created timestamp within 60 seconds and include a single-use nonce of at least 12 bytes. This guide explains a real, verifiable signed request line by line.
TL;DR
- Every AAuth signature covers
@method,@authority,@pathandsignature-key, plus@queryif and only if a query string is present, and endpoint-specific headers such ascontent-digest,content-typeandauthorization. Signature-Inputmust includecreatedas a bare integer within 60 seconds of the server’s clock and a quotednoncedecoding to at least 12 bytes (96 bits).- Each nonce works once per
(authority, key_id)and is kept for 120 seconds under a database unique constraint, written only after the signature verifies. - LumoAuth accepts three RFC 9421 algorithms:
ed25519,ecdsa-p256-sha256(raw 64-byter || s, never ASN.1 DER) andrsa-pss-sha512(SHA-512 with a 64-byte salt). Content-Digestrequires standard base64 (sha-256orsha-512).Signatureaccepts either standard base64 or unpadded base64url, and rejects mixed alphabets.
The complete signed request
If you want a high-level overview of the protocol first, read What is AAuth?. For a visual primer on how RFC 9421 works in general, read HTTP Message Signatures (RFC 9421) explained in 12 comic strips.
Below is the conformance vector that all LumoAuth SDKs test against (sdk-contract/vectors/aauth-rfc9421.json). It uses a fixed Ed25519 private key (seed bytes 0x00 through 0x1f, public JWK x value A6EHv_POEL4dcN0Y50vAmWfk1jCbpQ1fHdyGZBJVMbg), created=1750000000 and nonce bytes 0x00 through 0x0f:
POST /orgs/acme-corp/api/v1/aauth/agent/token HTTP/1.1
Host: auth.acme.test
Content-Type: application/json
Content-Digest: sha-256=:maoKTEBGVoe/uXlHmt4EeWj7K7xo71Ag/qIPObi3vPw=:
Agent-Auth: agent_token=AGENT_TOKEN_FIXED
Signature-Input: sig1=("@method" "@authority" "@path" "signature-key" "content-digest" "content-type" "authorization");created=1750000000;nonce="AAECAwQFBgcICQoLDA0ODw"
Signature: sig1=:sr5ZGEA2-LkKN4RvFrpYxhaGPB-tf1STvf1W0bl_UAFt1Rjn_wKKCouOHsFamkDAf85UpwF_HOJXLs07-bynCw:
{"request_type": "auth", "resource_token": "RESOURCE_TOKEN_FIXED", "scope": "read write"}
Two notes on this test vector:
- Ed25519 signing is deterministic (RFC 8032), so any compliant signer given the same key, inputs and timestamp reproduces the
Signaturevalue byte for byte. - The
"scope": "read write"field is part of the vector’s fixed JSON payload. In live traffic onrequest_type=auth, LumoAuth takes scopes from the resource token and ignores ascopefield in the body.
Dissecting the signature base, line by line
An RFC 9421 verifier never signs or hashes the raw HTTP bytes. Instead, both sides construct an ASCII text called the signature base from the request components, joined by single \n line feeds with no trailing newline.
Here is the exact eight-line signature base for the request above:
"@method": POST
"@authority": auth.acme.test
"@path": /orgs/acme-corp/api/v1/aauth/agent/token
"signature-key":
"content-digest": sha-256=:maoKTEBGVoe/uXlHmt4EeWj7K7xo71Ag/qIPObi3vPw=:
"content-type": application/json
"authorization":
"@signature-params": ("@method" "@authority" "@path" "signature-key" "content-digest" "content-type" "authorization");created=1750000000;nonce="AAECAwQFBgcICQoLDA0ODw"
Every line follows one rule: "<name>": <value>. Notice the single space after each colon, even on lines whose value is empty.
| Line | Component | Exact value in the vector | Formatting rule |
|---|---|---|---|
| 1 | "@method" |
POST |
HTTP method in upper case |
| 2 | "@authority" |
auth.acme.test |
Lowercased host, plus :port only when the port is not the scheme’s default (:443 omitted on https, :8080 kept on http) |
| 3 | "@path" |
/orgs/acme-corp/api/v1/aauth/agent/token |
Request path as called. On a custom domain, the agent signs the public path that it called, not an internal rewritten path |
| 4 | "signature-key" |
(empty) | Raw Signature-Key header value. This endpoint reads the key from Agent-Auth, so the value is empty, leaving one space after the colon |
| 5 | "content-digest" |
sha-256=:maoKTEBG…vPw=: |
Exact Content-Digest header value, covering the body hash |
| 6 | "content-type" |
application/json |
Exact Content-Type header value |
| 7 | "authorization" |
(empty) | Raw Authorization header value. Empty here because the credential travels in Agent-Auth, yet still required on this endpoint |
| 8 | "@signature-params" |
("@method" …);created=…;nonce="…" |
The Signature-Input inner list without the sig1= label, with no newline after this line |
Look closely at line 8. LumoAuth’s verifier rebuilds "@signature-params" directly from the Signature-Input header that arrived. It keeps the covered components in their declared order and keeps every accepted parameter in the signer’s order, with integers bare and strings quoted. No server-imposed parameter order is forced, and no accepted parameter is silently dropped from the signature base.
Which covered components are required on each endpoint?
Every AAuth signature must cover a non-empty list of plain quoted identifiers. The base set is always required, and each endpoint group adds the headers that matter for its body or credentials.
| Endpoint group | Base components | Additional required components |
|---|---|---|
| Every AAuth endpoint | @method, @authority, @path, signature-key |
@query if and only if the URL has a query string |
POST /aauth/agent/token and POST /aauth/token/revoke |
Base set | content-digest, content-type, authorization |
POST /aauth/agent/issue |
Base set | content-digest |
POST /aauth/agent/platform-token |
Base set | content-digest, content-type |
POST /aauth/resource/token, …/resource/token/verify, …/auth/token/verify |
Base set | content-digest, content-type, plus any extra components configured on that resource |
Four strict rules catch common signer bugs before cryptographic verification even runs:
- No
@target-urishortcut. Covering@target-uridoes not satisfy@authorityand@path. Both components must appear explicitly. - Exact
@queryrule. If the URL has a query string,@querymust be covered and its value starts with?(for example?foo=bar). If there is no query string, covering@queryis rejected. - No empty lists or component parameters. An empty
()list is rejected. Component parameters such as"@query-param";name="x"are outside this profile and are rejected at parse time. - Multi-valued headers. If a covered HTTP header appears more than once, its values are joined with
", "in lowercased-name form, matching RFC 9421 section 2.1.
How Signature-Input, created, expires and nonce stop replay
A valid signature proves integrity and key possession, but a recorded request would still carry a valid signature if sent a second time. AAuth closes that gap with strict parameter parsing, a tight clock window and single-use nonces.
Allowed parameters and strict typing
Signature-Input uses Structured Field Values (RFC 8941). LumoAuth accepts only six parameters and rejects any unknown parameter, any repeated parameter or any wrong value type:
| Parameter | Required | RFC 8941 type | Enforcement |
|---|---|---|---|
created |
Yes | Bare integer (no quotes) | Must satisfy abs(now - created) <= 60 seconds |
nonce |
Yes | Quoted string | Decoded base64url length must be at least 12 bytes (96 bits); single-use |
expires |
No | Bare integer (no quotes) | Binding when present: rejected if expires < now or expires < created |
alg |
No | Quoted string | Lowercased; must be in the three-algorithm allowlist and match the resolved key |
keyid |
No | Quoted string | Covered in the signature base. Never selects a key on agent flows; on resource endpoints, an unknown keyid triggers one JWKS refresh per minute |
tag |
No | Quoted string | Covered in the signature base |
Quoting an integer (created="1750000000") or leaving a string unquoted (nonce=AAECAwQFBgcICQoLDA0ODw) fails parsing immediately.
How single-use nonces stop concurrent replay
Every nonce is scoped to (authority, key_id, nonce_value) and retained for 120 seconds, which is twice the 60-second clock window. That guarantees a nonce stays in the store for the entire interval in which its created timestamp could still be accepted.
The key_id scope depends on the endpoint:
- Agent token, revoke and platform-token endpoints: the SHA-256 JWK thumbprint (RFC 7638) of the agent’s signing key.
POST /aauth/agent/issue:{agentIdentifier}#{kid}from theSignature-Keyheader.- Resource endpoints: the registered resource identifier.
Two implementation details matter for reliability under load:
- Atomic insert, not read-then-write. Checking whether a nonce exists and then inserting it leaves a race window where two parallel copies of one request both pass. LumoAuth relies on a database unique constraint on
(authority, key_id, nonce_value)usingINSERT … ON CONFLICT DO NOTHINGon PostgreSQL, so the second concurrent request gets zero affected rows and fails as a replay. - Recorded only after verification. LumoAuth writes the nonce row only after the cryptographic signature verifies. Unauthenticated traffic with random signatures therefore cannot fill the nonce table, while a replayed valid request verifies and is then rejected by the unique constraint.
What are the Content-Digest and base64 vs base64url rules?
Encoding mismatches are the most common cause of failure for a hand-written RFC 9421 signer. One header requires standard base64, another accepts both alphabets, and a third uses base64url.
| Field or value | Encoding | Padding | Notes |
|---|---|---|---|
Content-Digest |
Standard base64 (+, /, =) |
Included | RFC 9530 byte sequence between colons, for example sha-256=:maoK…vPw=: |
Signature |
Standard base64 or base64url (-, _) |
Optional on base64url | LumoAuth accepts either alphabet, but rejects mixed alphabets |
nonce |
Base64url (-, _) |
None | Decoded byte length must be ≥ 12 bytes (16 random bytes = 22 base64url chars) |
JWK fields (x, y, n, e) |
Base64url (-, _) |
None | Standard RFC 7517 / RFC 7638 representation |
Content-Digest rules (RFC 9530)
Body-bearing AAuth requests must send a Content-Digest header using sha-256 or sha-512 over the exact bytes sent on the wire:
Content-Digest: sha-256=:maoKTEBGVoe/uXlHmt4EeWj7K7xo71Ag/qIPObi3vPw=:
If a request carries multiple digests (for example both sha-256 and sha-512), LumoAuth verifies every digest present using constant-time comparison. Changing even one whitespace character in the JSON body after hashing breaks the check.
Why Signature accepts both alphabets, and when it fails
RFC 8941 defines Byte Sequences (:…:) with standard base64 (+, /, =). Earlier AAuth implementations and SDKs emitted unpadded base64url (-, _) inside Signature: sig1=:…:.
To work cleanly with both standard RFC 9421 libraries and existing AAuth SDKs, LumoAuth’s verifier accepts either alphabet on Signature and converts standard base64 to base64url internally. It fails closed in two cases:
- Mixed alphabets. A signature containing both standard base64 characters (
+,/,=) and base64url characters (-,_) is rejected immediately. - Label mismatch. Only the signature entry whose label matches the label declared in
Signature-Input(heresig1) is extracted. There is no fallback to another label in a multi-signature header. When aSignature-Keyheader is present (as on/aauth/agent/issue), all three headers (Signature-Key,Signature-InputandSignature) must carry the exact same label.
Which signature algorithms work, and why ECDSA must be raw r || s?
LumoAuth accepts three algorithm identifiers from the IANA HTTP Signature Algorithms registry. Notice that these are RFC 9421 registry names, not JOSE alg names (EdDSA, ES256, PS512):
| RFC 9421 algorithm | JWK kty / crv |
Allowed JWK alg (if declared) |
Signature wire format |
|---|---|---|---|
ed25519 |
OKP / Ed25519 |
EdDSA |
64-byte detached Ed25519 signature |
ecdsa-p256-sha256 |
EC / P-256 |
ES256 |
Raw 64-byte r || s (32-byte r + 32-byte s, big-endian, zero-padded), not ASN.1 DER |
rsa-pss-sha512 |
RSA |
PS256/384/512, RS256/384/512 |
RSASSA-PSS with SHA-512, MGF1-SHA512 and a 64-byte salt |
Three algorithm rules trip up custom signers:
- ECDSA uses raw
r || son the wire (RFC 9421 section 3.3.4). OpenSSL, Python’scryptographylibrary and Node.jscrypto.sign()default to ASN.1 DER encoding for ECDSA, which produces 70 to 72 variable-length bytes. In Node.js, passdsaEncoding: 'ieee-p1363'. In Python or Go, extractrands, pad each to 32 big-endian bytes and concatenate them into 64 bytes. LumoAuth rejects anyecdsa-p256-sha256signature that is not 64 bytes long. - RSA-PSS fixes the salt length at 64 bytes (RFC 9421 section 3.3.1). Use SHA-512 for both the digest and MGF1, with salt length equal to the SHA-512 digest length (64 bytes, matching Node’s
RSA_PSS_SALTLEN_DIGEST). - Key-type dispatch prevents algorithm downgrade. LumoAuth chooses the verifier from the resolved public key, never from the
algheader parameter. If the signer includesalginSignature-Input, it must equal the algorithm derived from the key type. Symmetricoctkeys,hmac-sha256and curves other than Ed25519 and P-256 are always rejected.
Verify the test vector yourself
You can verify the exact request from the top of this post in Node.js with zero external packages. Run this script to rebuild the Content-Digest, assemble the eight-line signature base and verify the Ed25519 signature against the vector’s public key:
import crypto from 'node:crypto';
const publicKey = crypto.createPublicKey({
key: {
kty: 'OKP',
crv: 'Ed25519',
x: 'A6EHv_POEL4dcN0Y50vAmWfk1jCbpQ1fHdyGZBJVMbg',
},
format: 'jwk',
});
const body = '{"request_type": "auth", "resource_token": "RESOURCE_TOKEN_FIXED", "scope": "read write"}';
const digest = `sha-256=:${crypto.createHash('sha256').update(body, 'utf8').digest('base64')}:`;
const sigParams =
'("@method" "@authority" "@path" "signature-key" "content-digest" "content-type" "authorization")' +
';created=1750000000;nonce="AAECAwQFBgcICQoLDA0ODw"';
const signatureBase = [
'"@method": POST',
'"@authority": auth.acme.test',
'"@path": /orgs/acme-corp/api/v1/aauth/agent/token',
'"signature-key": ',
`"content-digest": ${digest}`,
'"content-type": application/json',
'"authorization": ',
`"@signature-params": ${sigParams}`,
].join('\n');
const sigBytes = Buffer.from(
'sr5ZGEA2-LkKN4RvFrpYxhaGPB-tf1STvf1W0bl_UAFt1Rjn_wKKCouOHsFamkDAf85UpwF_HOJXLs07-bynCw',
'base64url',
);
console.log('digest:', digest);
console.log('verified:', crypto.verify(null, Buffer.from(signatureBase, 'utf8'), publicKey, sigBytes));
The script prints digest: sha-256=:maoKTEBGVoe/uXlHmt4EeWj7K7xo71Ag/qIPObi3vPw=: and verified: true. Remove the trailing space after "signature-key": or add a trailing \n to signatureBase, and it prints false.
How LumoAuth does it
Every AAuth endpoint in LumoAuth runs the same verification pipeline before acting on a request:
- Resolve the signing key (from the
agent+jwttoken’scnfclaim, fromSignature-Key: sig1=jwks_uri;id="…";kid="…"on/aauth/agent/issue, or from the resource’s registered key set on resource endpoints) and check the agent’s allowed Signing algorithms. - Parse
Signature-Input, check the parameter allowlist and types, validatecreated(±60 s) andexpires, and enforce required covered components. - Recompute and verify
Content-Digestagainst the raw body bytes. - Rebuild the signature base from the request and verify the labelled entry from
Signatureagainst the resolved JWK. - Check the registration’s state (for example active status and delegation on
/aauth/agent/issue) and atomically record the single-use nonce for 120 seconds.
In the Organization Portal, go to AI Agents → Agents (/portal/agents) and open the AAuth credentials tab. Edit the agent and select the Signing algorithms that it may use (Ed25519, ECDSA-P256-SHA256 or RSA-PSS-SHA512). Leaving all boxes unchecked allows all three.
When verification fails at the agent token endpoint, LumoAuth returns 401 with a generic Agent-Auth and WWW-Authenticate: AAuth challenge so unauthenticated callers cannot probe which check failed. The exact failure reason is written to the audit log under aauth.signature_verification_failed.
In production, use LumoAuth’s published SDK signers instead of assembling headers by hand: AAuthClient.sign_request() in Python (lumoauth[aauth]), signRequest() in Node.js (@lumoauth/agent) and SignRequest in Go. All of them are tested against the same aauth-rfc9421.json contract vector shown above.
Read the AAuth 1.0 specification, section 4 for the normative profile, or try a first signed call in the AAuth quickstart.
Standards involved
- HTTP message signatures, RFC 9421, defining covered components, the signature base,
Signature-Input,Signatureand the IANA signature algorithms (ed25519,ecdsa-p256-sha256,rsa-pss-sha512) - Digest Fields, RFC 9530, defining
Content-Digestwithsha-256andsha-512 - Structured Field Values for HTTP, RFC 8941, defining the inner-list, dictionary, integer, string and byte-sequence syntax
- Edwards-Curve Digital Signature Algorithm (EdDSA), RFC 8032, defining deterministic Ed25519 signatures
- JSON Web Key (JWK), RFC 7517, and Key thumbprint, RFC 7638, for public keys and nonce key-ID scoping
The full list is on the standards reference.
FAQ
Which components must an AAuth HTTP message signature always cover?
Every signature must cover @method, @authority, @path and signature-key, plus @query if and only if the URL has a query string. Body-bearing endpoints add content-digest, and most add content-type. The agent token and revocation endpoints also require authorization. Covering @target-uri instead of @authority and @path is rejected.
Why does signature-key appear in the signature base when there is no Signature-Key header?
AAuth requires signature-key on every call so that an attacker cannot strip or inject a Signature-Key header without breaking the signature. When the call sends no Signature-Key header, its line in the signature base has an empty value after the colon and single space.
Why do ECDSA P-256 HTTP message signatures fail when signed with OpenSSL defaults?
OpenSSL outputs ECDSA signatures in ASN.1 DER format by default. RFC 9421 section 3.3.4 requires ecdsa-p256-sha256 signatures in raw IEEE P1363 format: r concatenated with s, each as a 32-byte big-endian unsigned integer, for 64 bytes total. LumoAuth rejects any P-256 signature whose decoded length is not 64 bytes.
Should an agent encode Content-Digest and Signature with base64 or base64url?
Use standard base64 with = padding for Content-Digest (RFC 9530). For the Signature header, RFC 8941 Byte Sequences use standard base64 and LumoAuth’s AAuth SDKs emit unpadded base64url. LumoAuth accepts either alphabet on Signature, but it rejects any value that mixes characters from both alphabets.
How long does LumoAuth accept a signature and keep its nonce?
The created timestamp must be within 60 seconds of the server’s clock. Each nonce must carry at least 12 decoded bytes (96 bits) of entropy and works only once per authority and key identifier. LumoAuth stores used nonces for 120 seconds, which is twice the timestamp window, using a database unique constraint.
Can an agent declare alg in Signature-Input to choose a different algorithm?
No. The alg parameter is optional, and LumoAuth always picks the verifier from the resolved public key type (OKP Ed25519, EC P-256 or RSA). If the signer includes alg, it must be one of ed25519, ecdsa-p256-sha256 or rsa-pss-sha512 and must match the key type, or verification fails before any cryptographic check.
Related: AI agent identity on the solutions pages, What is AAuth? and HTTP Message Signatures (RFC 9421) explained in 12 comic strips on this blog.
Sign your first agent request with the AAuth quickstart.