Expand description
Claim objects: a signed payload that outlives a transport envelope.
A transport envelope (CoseEnvelope) is bound to
one request and dies with its iat skew window and its nonce. An object
signed offline by one device and delivered later by another needs the
opposite: a self-contained COSE_Sign1 whose lifetime and replay are
the application’s decision. That is this module:
sign_claims(signer, typ, claims, payload, aad) ──▶ tagged COSE_Sign1 ──▶ any channel, any delay
│
open_claims(resolver, bytes, typ, aad) ◀─────────────────┘ (signature only; caller checks exp/aud/cti)The protected header is {1: alg, 4: kid, ? 15: CWT claims, 16: typ}
(see header.rs for the CDDL); the parser accepts exactly what the
signer writes. The mandatory typ (RFC 9596) is the domain separator:
the envelope’s parser refuses label 16 and this one refuses its absence,
so neither format opens as the other (tests/claims_domain_separation.rs).
Algorithms are the envelope’s signature algorithms, Ed25519 and ESP256;
HMAC / COSE_Mac0 is refused.
Replay: nothing here remembers anything. To make an object single-use,
give it a cti and record the ones accepted.
Structs§
- CwtClaims
- The CWT claims (RFC 8392 §3.1) a claim object may carry in protected
label
15(RFC 9597). Only the claims that areSomeare written. - Opened
Claims - A claim object whose signature verified.
Enums§
- Claims
Error - A failure of
sign_claimsoropen_claims.
Constants§
- MAX_
AUD_ LEN - The longest
aud(bytes of UTF-8) a claim object carries. - MAX_
CTI_ LEN - The longest
cti(bytes) a claim object carries. - MAX_
TYP_ LEN - The longest
typ(bytes of UTF-8) a claim object carries.
Functions§
- open_
claims - Open a claim object: parse it strictly, check its
typ, and verify its signature with the keyresolverreturns for itskid. - sign_
claims - Sign
payloadas a claim object: a taggedCOSE_Sign1(tag 18) whose protected header is{1: alg, 4: kid, ? 15: claims, 16: typ}, whose unprotected header is empty and whose payload is embedded.