HTTP Message Signatures
Demonstrating the core RFC 9421 specification. Shows how the Signature Base String is constructed using headers, pseudo-headers, and the strict newline-delimited dictionary format.
The client signs an HTTP request using RFC 9421. The signature covers the HTTP method, the path, the host authority, and the content digest of the JSON body.
• RFC 9421 introduces 'pseudo-headers' like @method and @path to allow signing parts of the HTTP request line.
• The Signature Base String is strictly formatted. Each component is lowercased, wrapped in quotes, followed by a colon and a space, and then the value. Components are separated by newlines.
• The final line of the Base String is ALWAYS '@signature-params', which exactly matches the configuration defined in the Signature-Input header.
• In this scenario, the server must already know the public key associated with keyid='test-key-rsa' (out-of-band key distribution).
Step 1: POST /transactions
api.example.com
Tue, 20 Apr 2026 09:30:00 GMT
application/json
sha-256=:X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=:
sig1=("@method" "@path" "@authority" "content-type" "content-digest");created=17…
sig1=:base64SignatureBytesHere...=:
{
"amount": 100,
"currency": "USD"
}Construction Steps
"@method": POST
"@path": /transactions
"@authority": api.example.com
"content-type": application/json
"content-digest": sha-256=:X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=:
"@signature-params": ("@method" "@path" "@authority" "content-type" "content-digest");created=1776677400;keyid="test-key-rsa"RSASSA-PSS-SHA256(BaseString, PrivateKey) → RawBytes
sig1=:base64(RawBytes):
Signature Base String
"@method": POST
"@path": /transactions
"@authority": api.example.com
"content-type": application/json
"content-digest": sha-256=:X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=:
"@signature-params": ("@method" "@path" "@authority" "content-type" "content-digest");created=1776677400;keyid="test-key-rsa"Signing Key
Client's RSA Private Key (out-of-band 'test-key-rsa')Signature Output
base64SignatureBytesHere...=