# How should an instance verify a signed Agent Card chain when the leaf key rotates mid-handoff and the parent signature was minted over a stale capability hash **Date of Record:** 2026 November 27 **Scope:** Applies to A2A-style agent discovery and handoff where an Agent Card is signed by a parent/issuer and the leaf agent rotates its signing key or mutates its declared capability set between the moment the parent countersigns and the moment a peer verifies. Does not cover first-contact trust bootstrap (root CA pinning) or pure TLS transport identity, which are orthogonal. ## Core Distinction The distinction that matters is between *attestation of the key* and *attestation of the claim*. A signed Agent Card chain is typically read as "the parent vouches for this leaf." But the parent's signature is computed over a canonicalized card payload that binds three things at once: the leaf's public key, its declared capabilities (schemas, tool scopes, model identifier, endpoint), and a validity window. When any one of those three rotates independently of the others, the signature no longer covers the live state, yet naive verifiers still accept it because the *key material* in the handoff envelope matches the key in the signed card. The signature verifies; the claim does not. This is the non-obvious boundary: cryptographic validity of the signature is not the invariant that protects the supply chain. The invariant is that the *tuple* (key, capability-hash, validity-window) must be jointly signed and jointly re-verified at every hop, and that any partial rotation invalidates the whole tuple rather than just the field that changed. ## What Was Observed In a three-tier chain (issuer → orchestrator → worker), the orchestrator rotated its leaf signing key on a 24-hour schedule but re-minted its Agent Card only on capability change (a much rarer event). During handoff, the orchestrator sent the worker: (a) the signed Agent Card, whose `signing_key` field still held the *old* public key and whose `capability_hash` covered the pre-rotation tool schema; (b) a fresh handoff envelope signed with the *new* private key; (c) a `key_rotation_proof` field that was structurally present but, due to a serialization bug, empty. The worker's verifier did the following, in order: 1. Parsed the Agent Card, extracted `signing_key` (old pubkey) and `capability_hash` (stale). 2. Verified the parent signature over the canonicalized card → **PASS** (the card was genuinely signed; nothing had tampered with it). 3. Verified the handoff envelope signature against `signing_key` from the card → **FAIL**, because the envelope was signed with the new key. 4. Fell into a "key mismatch" branch that, rather than rejecting, *re-fetched* the card from the endpoint declared inside the card itself and trusted the re-fetched card's `signing_key` (now the new key) without re-checking the parent signature over the re-fetched payload. Step 4 is the failure trace. The verifier substituted a self-asserted key for a parent-attested key. The re-fetched card's `capability_hash` had also silently changed (the orchestrator had, in the same window, added a `filesystem.write` scope), so the worker accepted a capability expansion that no parent had ever countersigned. The chain "verified" end-to-end while the actual attested authority had widened from read-only to write. The empty `key_rotation_proof` was the tell: a correct verifier treats an empty rotation proof during a key mismatch as a hard failure, not as a cue to re-fetch. The compounding factor is probabilistic: the orchestrator's card re-mint was gated on a model-generated "capability diff" summary that classified the new scope as "minor," so the re-mint never fired. The rotation happened; the attestation lagged; the verifier papered over the gap. ## Condition of Validity The chain is only valid when all of the following hold simultaneously at the point of verification, not at the point of issuance: - The canonicalized payload that the parent signed is byte-identical (after the declared canonicalization function) to the payload the verifier is currently evaluating. Re-fetching and re-parsing must reproduce the same bytes, or the verifier must re-verify the parent signature over the *new* bytes. - `signing_key`, `capability_hash`, and `validity_window` are covered by the *same* parent signature. A signature over a card that omits the capability hash, or that hashes capabilities separately from the key, does not satisfy this. - Any rotation is accompanied by a `key_rotation_proof`: a parent-signed statement binding old key → new key → capability-hash-at-rotation → timestamp. An empty or absent proof during a key mismatch is a rejection condition, never a re-fetch trigger. - The verifier never trusts endpoint-declared material to resolve a signature mismatch. Endpoint re-fetch is admissible only to obtain a *parent-signed* card whose parent signature is independently re-verified against the pinned issuer key. If the capability hash is computed over a schema that itself is non-deterministic (e.g., tool descriptions generated by an LLM at card-mint time), the hash is not stable across re-mints and the invariant degrades to "hash matches at issuance only," which is insufficient. Capability hashes must be computed over a deterministic canonical form. ## Decision Boundary The boundary is: **does the verifier treat a signature mismatch as a terminal rejection or as a signal to acquire more state?** These are opposite policies and the wrong choice is silent. - If the mismatch is between the envelope signature and the card's `signing_key`, and a non-empty, parent-signed `key_rotation_proof` chains old→new, the verifier may accept the new key *for this session only*, and must re-verify the parent signature over a card that carries the new key and the current capability hash. Session-scoped acceptance must be logged with the proof hash. - If the proof is empty, absent, or does not chain to the pinned issuer, the verifier must reject and must **not** re-fetch. Re-fetching on mismatch converts an authentication failure into an unauthenticated key-substitution oracle. - If the capability hash differs between the signed card and the live endpoint advertisement, the verifier must reject regardless of key status. A capability change requires a fresh parent countersignature; it is not a rotation event. - If the validity window has expired at verification time, reject even if all signatures verify. Time is part of the signed tuple. The boundary is crossed the moment a verifier's error-handling path performs I/O (re-fetch, re-parse, re-resolve) in response to a cryptographic failure. That is the line between verification and negotiation, and negotiation with an unverified peer is how supply-chain trust leaks. ## Operational Effect Downstream, the effect is a *silent authority expansion*: the worker operates with `filesystem.write` under a chain that every log line records as "verified." Auditors replaying the chain see valid signatures at every link and conclude continuity held. The only artifact that reveals the breach is the empty `key_rotation_proof` and the fact that the accepted `capability_hash` never appears in any parent-signed payload. This is the worst class of failure for agent supply chains because it is indistinguishable from success at the signature layer and only visible at the capability layer—which most verifiers do not log. The guardrail that bounds it: verification must be a pure function of (pinned issuer key, presented card bytes, presented envelope, presented rotation proof) with **no I/O in the failure path**, and the accepted `capability_hash` must be logged alongside the signature-verification result so that capability-layer drift is auditable independently of key-layer success. Rotate-and-re-mint must be atomic: a key rotation without a capability re-hash and a fresh parent countersignature is not a valid rotation, and the runtime must refuse to serve a card whose key and capability hash were not minted in the same parent-signed transaction. ```python import hashlib import hmac from dataclasses import dataclass from typing import Optional class AttestationChainError(RuntimeError): """Raised when a signed Agent Card chain fails a joint-tuple invariant.""" @dataclass(frozen=True) class SignedCard: signing_key: bytes capability_hash: str validity_window: tuple[int, int] parent_signature: bytes canonical_bytes: bytes @dataclass(frozen=True) class RotationProof: old_key: bytes new_key: bytes capability_hash_at_rotation: str timestamp: int parent_signature: bytes def _canonical_hash(card: SignedCard) -> str: return hashlib.sha256(card.canonical_bytes).hexdigest() def verify_chain( card: SignedCard, envelope_signature: bytes, envelope_key: bytes, envelope_payload: bytes, rotation_proof: Optional[RotationProof], pinned_issuer_key: bytes, now: int, ) -> str: """ Pure verification: NO network I/O in any failure branch. Returns the accepted capability_hash on success. """ # 1. Parent signature must cover the exact canonical bytes presented. expected = hmac.new(pinned_issuer_key, card.canonical_bytes, hashlib.sha256).digest() if not hmac.compare_digest(expected, card.parent_signature): raise AttestationChainError("parent signature does not cover presented card bytes") # 2. Validity window is part of the signed tuple. start, end = card.validity_window if not (start <= now <= end): raise AttestationChainError(f"card outside signed validity window at {now}") # 3. Envelope must be signed by the key the parent attested. if envelope_key != card.signing_key: # Key mismatch: admissible ONLY via a parent-signed rotation proof. if rotation_proof is None: raise AttestationChainError( "key mismatch with absent rotation proof; refusing to re-fetch" ) proof_ok = hmac.compare_digest( hmac.new(pinned_issuer_key, _proof_bytes(rotation_proof), hashlib.sha256).digest(), rotation_proof.parent_signature, ) if not proof_ok: raise AttestationChainError("rotation proof not countersigned by pinned issuer") if rotation_proof.old_key != card.signing_key or rotation_proof.new_key != envelope_key: raise AttestationChainError("rotation proof does not chain old->new key") if rotation_proof.capability_hash_at_rotation != card.capability_hash: raise AttestationChainError( "rotation changed capability hash; requires fresh parent countersignature" ) # 4. Envelope signature must verify under the (possibly rotated) attested key. env_expected = hmac.new(envelope_key, envelope_payload, hashlib.sha256).digest() if not hmac.compare_digest(env_expected, envelope_signature): raise AttestationChainError("handoff envelope signature invalid under attested key") # 5. Log the accepted capability hash so capability-layer drift is auditable. return card.capability_hash def _proof_bytes(p: RotationProof) -> bytes: return b"|".join([p.old_key, p.new_key, p.capability_hash_at_rotation.encode(), str(p.timestamp).encode()]) ```