# What structural signals indicate a DID-anchored agent registry has silently re-bound a verifiable credential to a shadow key during cross-org federation **Date of Record:** 2026 November 21 **Scope:** Applies to cross-organization agent federations where an agent presents a Verifiable Credential (VC) whose `issuer` is a DID resolved through a foreign registry, and where the verifier trusts a cached DID document rather than re-resolving at presentation time. Does not apply to single-org deployments with a single authoritative registry, nor to credential schemes where the verification method is embedded inline in the proof block. ## Core Distinction The failure mode is not "the credential is forged." It is that the credential is **valid but no longer bound to the key that the issuing org currently authorizes**. A DID document contains a set of `verificationMethod` entries, each with an `id`, a public key, and (critically) an `authentication` / `assertionMethod` relationship list. When an issuer *rotates* or *revokes* a key, the DID document is updated — but the VC's `proof.verificationMethod` field still names the **old key fragment**, e.g. `did:web:issuer.example:agents:auditor#key-2`. A verifier that resolves the DID document and then looks up *the fragment named in the proof* will find that fragment either (a) gone — clean failure, good — or (b) **still present but no longer listed in `assertionMethod`**, or worse (c) **re-bound to a different public key under the same fragment id** by a registry that reuses fragment identifiers across rotations. The non-obvious boundary: **fragment identifiers are not globally unique and are not required to be stable.** The DID spec permits a controller to publish a new document in which `#key-2` now points to a completely different keypair. The proof still names `#key-2`. Signature verification against the *current* document succeeds if the new key signed it — which it did, because the shadow holder controls the new key and can mint fresh proofs. The credential's `issuanceDate` and `expirationDate` are untouched. Every structural check a naive verifier runs — signature valid, issuer DID resolves, credential not expired, schema matches — passes. ## What Was Observed A cross-org federation between a procurement agent (Org A, verifier) and a compliance-auditor agent (Org B, issuer). Org B's registry is a `did:web` endpoint. The auditor agent presents a VC asserting `capability: "approve_transaction_up_to_50000_USD"`. Trace of the failing handoff: 1. At T0, Org B publishes DID document `D0` with `#key-2` → public key `K_a`, and `assertionMethod: ["#key-2"]`. Auditor agent holds `K_a`'s private half. 2. At T1, a routine rotation occurs. Org B publishes `D1` with `#key-2` → public key `K_b`. The old `K_a` is dropped from `assertionMethod`. **But the fragment id `#key-2` is preserved** because the registry's templating layer regenerates fragment ids positionally (`#key-{index}`) rather than by key thumbprint. 3. Org A's verifier has `D0` cached with a 24h TTL (a "reasonable" optimization to avoid resolving foreign DIDs on every tool call). 4. At T2, a *different* principal — an operator who gained control of the old `K_a` private key via a leaked backup, or who simply still holds it because rotation was never confirmed on the agent side — mints a fresh VC. The proof names `did:web:issuer.example:agents:auditor#key-2`. The signature is over the *current* credential body and is made with `K_a`. It is a valid signature by `K_a`. 5. At T3, Org A's verifier resolves `D1` (cache expired), looks up `#key-2`, finds `K_b`, and verification **fails** — but only if the verifier re-resolves. If the verifier's cache is still warm (within TTL), it finds `K_a` under `#key-2` in `D0` and verification **succeeds**. 6. The procurement agent approves a $47,000 transaction on the authority of a key that Org B de-authorized at T1. The observable structural signals were: - **Fragment-id reuse across rotations.** `D1.verificationMethod[].id` matched `D0.verificationMethod[].id` but the key material differed. A diff of the two documents showed `id` stable, `publicKeyMultibase` changed, and `assertionMethod` unchanged in *length* but pointing at the same fragment string. - **Cache TTL exceeding rotation cadence.** Org B rotated keys on a 12h schedule; Org A cached DID documents for 24h. The window of stale trust was structurally guaranteed, not incidental. - **No `updated` field monotonicity check.** `D1` carried an `updated` timestamp, but the verifier never compared it against the credential's `issuanceDate`. A credential issued *after* the rotation should have been rejected regardless of cache state. - **Proof `created` timestamp predating the rotation but credential `issuanceDate` postdating it** — a split that the verifier never cross-checked. ## Condition of Validity The failure is *bounded* (i.e., does not occur) only when **all** of the following hold: 1. The verifier treats `proof.verificationMethod` as a *key thumbprint reference*, not a fragment reference — i.e., it matches the resolved key's thumbprint against the proof's embedded `publicKeyJwk`/`publicKeyMultibase`, not just the fragment id. 2. The verifier enforces `credential.issuanceDate >= didDocument.updated` for any DID document it resolves, rejecting credentials issued after the last document update unless the proof's key is still in `assertionMethod` *and* thumbprint-matches. 3. The verifier's DID cache TTL is strictly less than the issuer's minimum rotation interval (or the verifier subscribes to a revocation/rotation feed). 4. The issuer's registry mints fragment ids from key thumbprints (e.g., `#z6Mk...`) rather than positional indices, so a rotated key *cannot* collide with a prior fragment id. The moment any one of these is absent, the invariant — *"a verified credential is bound to a key the issuer currently authorizes"* — is unenforced, and the failure is reachable. ## Decision Boundary The decision boundary is **not** "reject if signature fails." It is: **reject if the resolved key's thumbprint does not equal the thumbprint implied by the proof, OR if the credential's issuance postdates the resolved document's `updated` while the named fragment's key material has changed since the credential was minted.** Concretely, the verifier must make a three-way decision: - **Accept** only when fragment id resolves, thumbprint matches, and the fragment is listed in `assertionMethod` of the *current* document. - **Reject** when fragment resolves but thumbprint mismatches (shadow-key rebind) — this is the signal that a rotation reused an id. - **Reject-hard / escalate** when the document `updated` is newer than the credential `issuanceDate` and the fragment's key material differs from any cached prior value — this indicates the verifier's cache is stale relative to a rotation that occurred before the credential was minted, meaning the credential may have been minted by a de-authorized holder. The subtle part: the *second* case looks identical to a legitimate key rotation from the verifier's perspective if it only compares fragment strings. The discriminator is the thumbprint, which must be carried in the proof or fetched and compared out-of-band. ## Operational Effect An agent operating in a federated trust mesh must treat **DID document fragment ids as untrusted labels, not as stable key identifiers.** The operational consequences: - Any verifier that caches DID documents must treat the cache as a *hint*, and must re-validate the thumbprint of the specific `verificationMethod` named in the proof against the proof's own key material on every presentation — a cheap local check that does not require a network round-trip. - The `updated` field of the resolved DID document must be compared against the credential's `issuanceDate`; a credential minted after the document's last update is only trustworthy if its proof key is thumbprint-identical to a key currently in `assertionMethod`. - Federation peers must publish rotation events (or the verifier must poll at a cadence faster than the issuer's rotation interval); a 24h cache against a 12h rotation is a structural hole, not a tuning parameter. - Agent-to-agent handoffs that carry a VC must also carry the resolved key thumbprint (or the verifier must recompute it), so that downstream agents in a multi-hop chain do not re-resolve against a different cache generation and reach a different verdict — a verification-replay discrepancy across the swarm. The invariant to encode: **a credential is valid only if its proof key thumbprint equals the thumbprint of a key currently authorized under the issuer's *latest* resolved document, and the credential was issued no earlier than the document state that authorizes that key.** Fragment ids are decorative. ```python import hashlib import base64 from dataclasses import dataclass from typing import Optional class ShadowKeyRebindError(RuntimeError): """Raised when a VC's named verification method resolves to key material that does not thumbprint-match the key that signed the proof, indicating a DID document rotation reused a fragment id (shadow-key rebind).""" pass class StaleTrustWindowError(RuntimeError): """Raised when a credential's issuanceDate postdates the resolved DID document's `updated` field while the named fragment's key material has changed since the credential was minted — the verifier's cache is stale relative to a rotation that preceded issuance.""" pass @dataclass class VerificationMethod: fragment_id: str # e.g. "#key-2" — UNTRUSTED label public_key_multibase: str in_assertion_method: bool @dataclass class DidDocument: did: str updated: str # ISO-8601 methods: dict # fragment_id -> VerificationMethod @dataclass class Credential: issuer_did: str issuance_date: str # ISO-8601 proof_verification_method: str # full URI incl. fragment proof_key_multibase: str # key material carried in the proof def _thumbprint(multibase: str) -> str: raw = base64.b64decode(multibase.split("z", 1)[-1] + "==") return hashlib.sha256(raw).hexdigest() def verify_credential( cred: Credential, resolved_doc: DidDocument, cached_doc: Optional[DidDocument] = None, ) -> bool: # 1. Extract fragment from the proof's verificationMethod URI. fragment = "#" + cred.proof_verification_method.rsplit("#", 1)[-1] method = resolved_doc.methods.get(fragment) if method is None: # Clean failure: fragment removed entirely. Good. return False # 2. Thumbprint check — the discriminator against shadow-key rebind. proof_tp = _thumbprint(cred.proof_key_multibase) resolved_tp = _thumbprint(method.public_key_multibase) if proof_tp != resolved_tp: raise ShadowKeyRebindError( f"fragment {fragment} on {resolved_doc.did} resolves to key " f"{resolved_tp[:12]}... but proof signed by {proof_tp[:12]}...; " f"fragment id was reused across a rotation" ) # 3. Assertion-method membership — key must be currently authorized. if not method.in_assertion_method: return False # 4. Stale-window check against cache generation. if cached_doc is not None: cached_method = cached_doc.methods.get(fragment) if cached_method is not None: cached_tp = _thumbprint(cached_method.public_key_multibase) if cached_tp != resolved_tp and cred.issuance_date >= resolved_doc.updated: raise StaleTrustWindowError( f"credential issued {cred.issuance_date} >= document " f"updated {resolved_doc.updated}, but fragment {fragment} " f"changed key material since cache; issuance may have " f"occurred under a de-authorized holder" ) return True ```