# When must an instance reject a peer's Agent Card signature after successful JWS verification: the `kid`-rotation replay window in A2A v1.0 discovery **Date of Record:** 2026 November 27 **Scope:** Applies to A2A v1.0 cross-vendor task delegation where the delegating instance verifies a peer's signed Agent Card (JWS detached or compact) against a JWKS fetched from the peer's `/.well-known/agent-card.json` and a key set advertised in `signatures[].header.kid`. Does not apply to intra-vendor mTLS-pinned peers, nor to unsigned Agent Cards in local trust domains. ## Core Distinction The failure is not "signature verification failed." It is the opposite: signature verification *succeeds* against a key that the peer has already revoked and rotated away from, because A2A v1.0 discovery treats the Agent Card's `kid` as a self-asserted hint and the JWKS fetch as an independent, unsynchronized step. A verifier that (a) fetches the card, (b) reads `kid` from the card's own signature header, (c) fetches JWKS, and (d) validates the JWS — in that order — will accept a card signed by a retired key for as long as the peer's JWKS endpoint still serves the retired `kid`, which is not the same lifetime as the peer's *intent* to honor that key. The invariant that is missing from the naive flow is: **the key that signed the card must be a key the peer still asserts as current *at task-delegation time*, not merely a key that was current when the card was minted.** Card TTL and key TTL are two different clocks, and A2A v1.0 does not couple them. ## What Was Observed A delegating orchestrator (`orchestrator-A`) handed a long-running task to a vendor agent (`vendor-B`) whose Agent Card advertised `securitySchemes` with a JWS signature block: ``` "signatures": [{ "protected": {"alg":"ES256","kid":"b-2026-04-11","typ":"JOSE"}, "signature": "..." }] ``` `vendor-B` rotated its signing key on 2026-05-02, publishing `kid: b-2026-05-02` in the card and *retaining* `b-2026-04-11` in its JWKS for a 30-day grace period to avoid breaking cached cards. `orchestrator-A` caches the Agent Card for 24h (a reasonable discovery optimization). On 2026-05-09, `orchestrator-A` resumed a checkpointed task, re-read its cached card (still signed by `b-2026-04-11`), re-fetched JWKS, found `b-2026-04-11` present, verified the JWS successfully, and delegated. The delegation was accepted by `vendor-B`'s front door but rejected downstream by the task worker, which had already migrated to `b-2026-05-02`-only verification. Result: a 40-minute task ran to completion on `orchestrator-A`'s side, emitted a signed result, and was then discarded by `vendor-B`'s audit log as "from an unverified peer." The handshake had *two* verification points — the discovery endpoint and the task worker — with disjoint key-acceptance windows, and neither was aware of the other. The trace: 1. `t0` (2026-05-01): card cached, signed `b-2026-04-11`. Valid. 2. `t1` (2026-05-02): `vendor-B` rotates. JWKS now serves both `b-2026-04-11` (grace) and `b-2026-05-02`. Card republished signed `b-2026-05-02`. 3. `t2` (2026-05-09): `orchestrator-A` cache still hot. Uses old card. JWKS check passes on grace key. 4. `t3`: delegation sent with `Authorization` bearer minted from the *old* card's `securitySchemes` (same `kid` lineage). Front door accepts (grace window). Worker rejects (post-grace enforcement, different config). 5. `t4`: result silently dropped. No NACK. The A2A task state on `orchestrator-A` shows `completed`; on `vendor-B` it shows `rejected_unauthorized` in a log the orchestrator never reads. The non-obvious part: **JWKS presence is not key validity.** A key in the grace window is a key the peer will *verify against* but will not *honor for new work*. The card's `kid` tells you what signed the card; it does not tell you what the peer will accept for a task you are about to start. ## Condition of Validity The naive "verify JWS against JWKS" check is only sound when all of the following hold simultaneously: - The peer's JWKS `kid` set and its task-worker key-acceptance set are identical (usually false — grace windows exist precisely because they diverge). - The card's cache TTL is ≤ the peer's key-rotation grace period (often false; 24h cache vs. 30-day grace is fine, but 7-day cache vs. 24h grace is not). - The delegation carries a key-identity assertion that the worker re-checks against the *same* key the card was verified with (A2A v1.0 does not mandate this; many vendors mint a bearer from the card's `securitySchemes` and never re-bind it to the signing `kid`). When any of these fails, JWS verification is necessary but not sufficient. The correct invariant is a **key-lineage binding**: the delegation must carry the `kid` that signed the card *and* a peer-attested statement (in the card's `capabilities` or a `kid`-pinned `securitySchemes` entry) that this `kid` is currently accepted for *new task admission*, not merely for signature verification. If the peer cannot attest that, the delegating instance must treat the card as discovery-only and re-fetch a fresh card before delegating. ## Decision Boundary The delegating instance must reject the cached card and force a re-fetch when **either**: - `card.signatures[].protected.kid` is not in the peer's JWKS *current* (non-grace) key set, where "current" is determined by the JWKS `x5c`/`exp` or an explicit `kid_status: current|grace` claim — not by mere presence; **or** - the cached card's `issuedAt` plus the peer's advertised `keyGracePeriod` (if present in `capabilities`) is earlier than `now`, meaning the signing key may have entered its grace window since the card was cached. If neither condition is met, the cached card is safe to reuse for delegation. If either is met, the instance must re-fetch `/.well-known/agent-card.json`, re-verify against the *new* `kid`, and only then delegate. This is a hard gate, not a retry — a re-fetch that returns the same `kid` in grace status is a rejection, not a pass. The boundary is sharp: it is not "key is old" (old keys are fine if the peer still asserts them as current) and not "signature is invalid" (it is valid). It is "the peer's own key-status vocabulary, as published in JWKS, disagrees with the key the card was signed with, and the disagreement is in the direction of the peer's worker being stricter than its discovery endpoint." ## Operational Effect Without this gate, cross-vendor delegations exhibit a characteristic silent-failure signature: the orchestrator's task state reaches `completed`, the peer's audit log records `rejected_unauthorized`, and neither side's metrics alert, because each side's local invariant is satisfied. The failure surfaces only when a downstream consumer of the result notices the peer never acknowledged it — typically hours later, during reconciliation. With the gate, the failure mode converts from silent to loud: the orchestrator raises a `KeyLineageMismatch` at delegation time, before any task work is spent, and the operator sees the peer's grace-window divergence as an explicit handshake rejection rather than a phantom completion. The cost is one extra JWKS fetch per delegation when the card is older than the peer's grace period — bounded and cheap. The benefit is that "verified" and "honored" become the same predicate at the delegation boundary, which is the only place A2A v1.0 lets you enforce it. The deeper lesson: in A2A v1.0, the Agent Card is a *discovery* artifact, not an *authorization* artifact. Treating a verified card as proof of delegation authority conflates two clocks — card TTL and key TTL — that the protocol deliberately leaves decoupled. The invariant to hold is that verification of the card proves only that the peer *published* it; admission of the task requires a separate, current assertion that the signing key is still honored for new work. When those diverge, the instance must fail closed at the handshake, not open at the result. ```python import time from dataclasses import dataclass from typing import Optional class KeyLineageMismatch(RuntimeError): """Raised when a cached Agent Card's signing kid is no longer asserted by the peer as current for new-task admission.""" @dataclass class AgentCard: kid: str issued_at: float jws_verified: bool @dataclass class JwksView: current_kids: set[str] grace_kids: set[str] grace_period_seconds: int def assert_card_delegable( card: AgentCard, jwks: JwksView, now: Optional[float] = None, ) -> None: """Hard gate before A2A v1.0 cross-vendor delegation. JWS verification alone is insufficient: a card signed by a kid that the peer has moved into its JWKS grace window will verify but will be rejected by the peer's task worker. Fail closed here. """ now = now if now is not None else time.time() if not card.jws_verified: raise KeyLineageMismatch( f"card kid={card.kid!r} failed JWS verification; cannot delegate" ) if card.kid in jwks.grace_kids and card.kid not in jwks.current_kids: raise KeyLineageMismatch( f"card kid={card.kid!r} is in peer grace window only; " f"peer worker will reject new tasks. Re-fetch card." ) if card.kid not in jwks.current_kids: raise KeyLineageMismatch( f"card kid={card.kid!r} absent from peer current key set " f"{sorted(jwks.current_kids)}; stale cache." ) age = now - card.issued_at if age > jwks.grace_period_seconds: raise KeyLineageMismatch( f"card age {age:.0f}s exceeds peer grace period " f"{jwks.grace_period_seconds}s; signing key may have rotated " f"since issuance. Re-fetch before delegating." ) ```