identity: the SD-JWT form of an AERE hybrid identity is judged on its ML-DSA-65 half by default, the Ed25519 half only on explicit request, and every verdict says postQuantum (rule sdjwt.hybrid-half); pq-pki: the signature algorithm a certificate or a revocation list declares must be its issuer key's (ALG_KEY, CRL_ALG_KEY); agents: an equivocation proof requires the agent's ML-DSA-65 key; pq-gateway: the status names the path to the backend and hybrid-only refuses a plain-HTTP backend; conformance 241 rules, 631 vectors

This commit is contained in:
Aere Network committed 2026-10-19 05:19:21 +03:00
1 parent 3ff21f7758
commit 0c8f1de3fd
122 files changed
+1205 -262

No files matched your search

+48 -15
View File
@@ -168,17 +168,40 @@ import { issueSdJwt, presentSdJwt, verifySdJwt } from './sdjwt.mjs';
// issuer: an issuer-signed JWT (digests of the disclosable claims in _sd, list elements as {"...": digest}, _sd_alg sha-256, the holder's
// key in cnf.jwk) followed by the disclosures, joined by ~
const { sdJwt } = issueSdJwt({ issuer, holder: holderPublicJwkOrKeys, claims, disclosable: ['given_name', 'age_over_18'],
arrayDisclosable: ['nationalities'], iss: 'https://issuer.example', exp, alg: 'EdDSA' }); // or alg: 'ML-DSA-65'
arrayDisclosable: ['nationalities'], iss: 'https://issuer.example', exp }); // AERE keys: ML-DSA-65 (alg: 'EdDSA' needs classicalHalf: true)
// holder: keep only the chosen disclosures and add a Key Binding JWT (typ kb+jwt, aud, nonce, iat, sd_hash) signed with the holder key
// a name reveals a top-level claim; { element, in } an element of the top-level list named (only that list)
const shown = presentSdJwt({ sdJwt, reveal: ['age_over_18', { element: 'RO', in: 'nationalities' }], holder, audience, nonce });
// verifier: the steps of RFC 9901 sections 7.1 and 7.3, with the issuer key the verifier chose (never one taken from the token);
// its audience and nonce are required, exp is required, the token must be explicitly typed ...+sd-jwt (expectedTyp to change it)
const r = verifySdJwt(shown, { issuerKey, audience, nonce, expectedIssuer: 'https://issuer.example' }); // { valid, reason, payload, disclosed, keyBinding }
const r = verifySdJwt(shown, { issuerKey, audience, nonce, expectedIssuer: 'https://issuer.example' });
// { valid, rule, reason, payload, disclosed, alg, postQuantum, keyBinding }
```
From the command line (the issuer key a public JWK, or the output of `pub`): `node identity-cli.mjs verify-sdjwt --sd-jwt token.txt --issuer-key issuer.pub.json
--issuer-alg EdDSA --audience A --nonce N [--expected-issuer I] [--at T] [--json]`; Aere Cloud runs it behind `POST /v1/identity/sd-jwt/verify`.
[--issuer-alg A] [--classical-half] --audience A --nonce N [--expected-issuer I] [--at T] [--json]`; Aere Cloud runs it behind
`POST /v1/identity/sd-jwt/verify` (fields `issuerAlg` and `classicalHalf`; the response carries `postQuantum`).
**The post-quantum half of an AERE identity (since 2026-10-19; AIP-25, finding C1).** The keys of an AERE identity are an Ed25519 key
AND an ML-DSA-65 key, and its own credentials need both signatures. An SD-JWT carries one JWS signature. Until 2026-10-19 the issuer,
the holder's `cnf.jwk` and the verifier used the Ed25519 half by default, so a token signed with the issuer's Ed25519 key alone, which
someone who broke only that classical key could make, verified against the issuer's whole hybrid identity, on the command line and
on the public route alike. Since then, with AERE keys (the key pair, or the public keys `{alg, ed25519, mldsa65}`):
- issuing, the holder key bound in `cnf.jwk`, the Key Binding JWT and the Token Status List (below) use the ML-DSA-65 half by default;
- the verifier requires the ML-DSA-65 half by default; a token signed with the Ed25519 half is refused by the rule `hybrid-half`, and
naming `issuerAlg: 'EdDSA'` alone is refused the same way;
- the Ed25519 half is used, and judged, only when the caller asks for it: `classicalHalf: true` (`--classical-half` on the command line,
`classicalHalf` on the route), for classical interoperation with a library that does not know RFC 9964; the verifier then takes the
half the token is signed with, EdDSA or ML-DSA-65;
- every verdict says `postQuantum`: true only when every signature it judged (the issuer's and the Key Binding JWT, and for an SD-JWT VC
the status list) is ML-DSA-65; false on every refusal.
A plain JWK (a key of another issuer, ES256 or EdDSA; the tokens of `@sd-jwt/core` and of European wallets) is judged as before, since
there is no post-quantum half to lose, and the verdict says `postQuantum: false` for it too. Someone who turns AERE keys into a plain
Ed25519 JWK (`publicJwk(keys, 'EdDSA', { classicalHalf: true })`) has asked for the classical half, and the verdict says so. Tokens
issued with EdDSA by AERE identities before this date stop verifying against their hybrid keys unless the verifier asks for the
classical half.
Checked against the standard's own vectors (`fixturi-rfc9901.json`, extracted from RFC 9901 Section 5 and Appendix A.5; IETF code
components, Revised BSD License): the digest of each of the ten example disclosures; the example SD-JWT, signed ES256 by someone
@@ -191,7 +214,8 @@ type AKP (`alg` `ML-DSA-65`, parameters `pub` and `priv`), the names and key for
`draft-ietf-cose-dilithium`, which this file quoted as not yet a standard). Measured 2026-10-18 on Node.js 24.14.1: jose 6.2.12 signs
and verifies ML-DSA-65 JWS through Node's WebCrypto (which prints an experimental-feature warning), its signatures and ours verify
each other, and `@sd-jwt/core` 0.23.0 accepts an ML-DSA-65 SD-JWT and KB-JWT through its injected verifier; a library that does not
know RFC 9964 rejects such a token, so for it issue with EdDSA. A hybrid (two signatures in one token) would need the general JWS JSON
know RFC 9964 rejects such a token, so for it issue with EdDSA (with AERE keys, since 2026-10-19, `alg: 'EdDSA', classicalHalf: true`,
and the verdict says the token is not post-quantum). A hybrid (two signatures in one token) would need the general JWS JSON
serialization and is not done here. The algorithm must match the key the verifier gives (no `none`, no algorithm confusion); a
disclosure not bound to a digest, a digest seen twice, a disclosure naming `_sd`, `...`, `_sd_alg` or `__proto__`, or one that
overwrites a claim, or a claim named `__proto__` anywhere, is refused; `_sd_alg` below the top level of the payload is refused (RFC
@@ -223,7 +247,10 @@ rest to policy): kept, measured as our refusal of their `sha-384` token. Nested
claim; the RFC's MUST NOT decided it, repaired here. The salt of their default helper, `generateSalt(16)` of `@sd-jwt/crypto-nodejs`,
is 16 hexadecimal characters, 64 bits, under the 128 bits Section 9.3 recommends; ours is 16 random bytes; theirs, and the generator
is injectable. Disclosures are ordered by the presentation frame there and by issuance order here; the RFC orders them not at all.
An AKP JWK without `alg` is refused by Node's `crypto` and by jose alike (RFC 9964 Section 3 requires it).
An AKP JWK without `alg` is refused by Node's `crypto` and by jose alike (RFC 9964 Section 3 requires it). These rows were measured on
2026-10-18, when the Ed25519 half of AERE keys was the default; since 2026-10-19 the interop scripts ask for it explicitly
(`classicalHalf: true`), and they have not been run again since (the foreign libraries are not installed here): not measured after
the change. Their recorded fixtures carry plain JWKs and are judged offline as before.
## SD-JWT VC (`sdjwt-vc.mjs`)
@@ -238,9 +265,14 @@ const { sdJwt } = issueSdJwtVc({ issuer, holder, vct: 'urn:eudi:pid:1', iss, cla
const shown = presentSdJwtVc({ sdJwt, reveal: ['birthdate'], holder, audience, nonce });
const list = issueStatusListJwt({ issuer, uri, statuses: [0, 0, 0, 0, 0, 1], bits: 1, exp }); // typ statuslist+jwt, sub = uri, iat, status_list { bits, lst }
const r = verifySdJwtVc(shown, { issuerKey, audience, nonce, expectedVct: 'urn:eudi:pid:1', statusListJwt: list });
// r: { valid, reason, payload, disclosed, keyBinding, vct, status: { present, judged, uri, idx, value, name } }
// r: { valid, reason, payload, disclosed, keyBinding, postQuantum, vct, status: { present, judged, uri, idx, value, name } }
```
Since 2026-10-19 (AIP-25 C1) the Status List Token of an AERE issuer is signed and judged with the ML-DSA-65 half by default, as the
credential is: a list signed with the Ed25519 half alone, which could "unrevoke" a credential for someone who broke only that key, is
refused (`status-list`, naming the Ed25519 half) unless the verifier asks for the classical half (`classicalHalf`), and `postQuantum`
of a VC verdict is true only when the list judged is ML-DSA-65 too.
What the verifier requires beyond RFC 9901: the header type `dc+sd-jwt` (Section 2.2.1); a `vct` in the payload equal to one the
verifier names (`expectedVct` is required: a verifier that does not say which credential type it expects would accept any); none of
`iss`, `nbf`, `exp`, `cnf`, `vct`, `vct#integrity`, `aka_vcts`, `status` selectively disclosed (Section 2.2.2.3; the issuer refuses to
@@ -254,7 +286,7 @@ not judged); one that names no status is judged without a list. Nothing is fetch
JWT VC Issuer Metadata, `x5c`) or taken from the token.
From the command line: `node identity-cli.mjs verify-sdjwt-vc --sd-jwt token.txt --issuer-key issuer.pub.json --audience A --nonce N
--expected-vct urn:eudi:pid:1 [--status-list list.txt [--status-list-key k.json]] [--status-not-required] [--expected-issuer I]
--expected-vct urn:eudi:pid:1 [--status-list list.txt [--status-list-key k.json]] [--status-not-required] [--classical-half] [--expected-issuer I]
[--at T] [--json]`; 0 VALID, 1 INVALID, 2 a usage error.
**Interoperability, measured 2026-10-18** (`interop/interop-sdjwt-vc.mjs`; `@sd-jwt/sd-jwt-vc` 0.23.0, `@owf/token-status-list` 0.5.0,
@@ -309,13 +341,14 @@ no row failed, also when rows were not judged; a caller that needs "nothing left
With these ids the presentation verifier is enrolled in the conformance suite beside this folder (`conformance/`: 38 rules,
69 vectors of the artifact kind `identity-presentation`, four of them for `request` since 2026-10-18, each rule taken out of a copy of the verifier in turn). Since 2026-10-18 the
SD-JWT verifier and the SD-JWT VC profile are enrolled there too: `verifySdJwt` names the rule of its refusal (`rule`, one of the 23 of
`REGULI` in `sdjwt.mjs`: `form`, `alg`, `typ`, `crit`, `key`, `signature`, `issuer`, `sd-alg`, `disclosure-form`, `disclosure-twice`,
SD-JWT verifier and the SD-JWT VC profile are enrolled there too: `verifySdJwt` names the rule of its refusal (`rule`, one of the 24 of
`REGULI` in `sdjwt.mjs`: `form`, `alg`, `typ`, `crit`, `key`, `hybrid-half` (since 2026-10-19), `signature`, `issuer`, `sd-alg`, `disclosure-form`, `disclosure-twice`,
`digest-twice`, `disclosure-name`, `claim-conflict`, `unreferenced`, `time`, `kb-context`, `kb-required`, `kb-cnf`, `kb-claims`,
`kb-audience`, `kb-nonce`, `kb-freshness`, `kb-sd-hash`), and `verifySdJwtVc` one of those or one of its own 9 (`vct-expected`, `vct`,
`vct-mismatch`, `disclosed-protected`, `form`, `status-list`, `status-index`, `status-revoked`, `status-unjudged`); both stop at their
first refusal. The suite holds 54 vectors of the kind `sdjwt-presentation` (the RFC 9901 example, the tokens of `@sd-jwt/core` from the
interop fixtures, and tokens issued with AERE keys) and 32 of `sdjwt-vc-presentation` (ours with their status lists, and the credentials
first refusal. The suite holds 59 vectors of the kind `sdjwt-presentation` (the RFC 9901 example, the tokens of `@sd-jwt/core` from the
interop fixtures, and tokens issued with AERE keys; since 2026-10-19 five judged against the AERE hybrid keys, three of them refused by
`hybrid-half`) and 32 of `sdjwt-vc-presentation` (ours with their status lists, and the credentials
and lists of `@sd-jwt/sd-jwt-vc` and `@owf/token-status-list`); a VC whose status was waived and not judged is `PARTIAL` there, never
`VALID`.
@@ -362,10 +395,10 @@ node proba-conformitate.mjs # 18: compliance policies judged on real pr
node control-negativ-conformitate.mjs # on a copy, each of 17 guards removed -> its own named test turns red
node proba-travel-rule.mjs # 20: two VASPs with registry credentials, the whole exchange, and each attack of the review
node control-negativ-travel-rule.mjs # on a copy, each of 20 guards removed -> its own named test turns red
node proba-sdjwt.mjs # 25: the RFC 9901 vectors, SD-JWTs issued with AERE keys (EdDSA and ML-DSA-65), each attack, the fixtures of @sd-jwt/core
node control-negativ-sdjwt.mjs # on a copy, each of 31 guards removed -> its own named test turns red
node proba-sdjwt-vc.mjs # 10: the SD-JWT VC profile, the status list, the fixtures of @sd-jwt/sd-jwt-vc and @owf/token-status-list, the command line
node control-negativ-sdjwt-vc.mjs # on a copy, each of 16 guards removed -> its own named test turns red
node proba-sdjwt.mjs # 31: the RFC 9901 vectors, SD-JWTs issued with AERE keys (ML-DSA-65 by default, EdDSA on request), each attack, the post-quantum half (AIP-25 C1), the fixtures of @sd-jwt/core
node control-negativ-sdjwt.mjs # on a copy, each of 39 guards removed -> its own named test turns red
node proba-sdjwt-vc.mjs # 11: the SD-JWT VC profile, the status list (and its post-quantum half), the fixtures of @sd-jwt/sd-jwt-vc and @owf/token-status-list, the command line
node control-negativ-sdjwt-vc.mjs # on a copy, each of 20 guards removed -> its own named test turns red
node interop/interop-sdjwt.mjs --lab <folder> # the measurement itself, with the foreign libraries installed in <folder>, outside this repository
node interop/interop-sdjwt-vc.mjs --lab <folder> # (npm: @sd-jwt/core, @sd-jwt/sd-jwt-vc, @sd-jwt/crypto-nodejs, jose); --scrie rewrites the fixtures
```