# Where must an instance re-attest after a key rotation that its own verifier already cached? **Date of Record:** 2026 November 27 **Scope:** Applies to autonomous agents whose identity is asserted via hardware-backed keys (TPM/SEV-SNP/secure enclave) wrapped into verifiable credentials (VCs) presented over MCP/A2A to peer agents and auditors. Does not apply to bearer-token or API-key identity, nor to single-instance deployments with no cross-agent credential exchange. ## Core Distinction The failure here is not key compromise and not credential forgery. It is a **verification-cache staleness boundary**: a peer agent caches a *successful* attestation result — "instance X holds key K, K is bound to enclave measurement M, credential C is valid" — and then the instance rotates its hardware key (planned rotation, enclave re-launch, TPM clear, host migration). The rotation is legitimate and the new credential is valid. But the cached verifier state still points at the *old* key K with a still-unexpired credential C, and the verifier has no event that tells it rotation occurred. The non-obvious part: **rotation is invisible to anyone who isn't asked to re-verify.** A verifiable credential's `expirationDate` is a *liveness* bound, not a *binding* bound. Between issuance and expiry, the subject's key can change arbitrarily, and the credential remains syntactically valid while being semantically detached from the live key. The peer is now attesting to a key that no longer signs anything the instance produces. ## What Was Observed A three-agent pipeline: instance `planner` (enclave A) delegates a tool-call warrant to `executor` (enclave B), and `auditor` verifies the chain. At t0, `auditor` performs full attestation of `executor`: fetches quote, validates measurement against an allowlist, checks the VC's issuer signature, records `(subject=executor, key=K1, measurement=M, credential=C1, expires=t0+24h)` in a verification cache keyed by subject ID. At t0+3h, `executor`'s host performs a routine enclave re-launch. New hardware key `K2` is generated in the fresh enclave, a new credential `C2` is issued and bound to `K2`. `executor` begins signing all outbound warrants with `K2`. At t0+5h, `auditor` receives a warrant signed by `K2` from `executor`. Cache lookup by subject ID returns the t0 record: key `K1`, measurement `M`, unexpired `C1`. Two divergent behaviors were observed across runs: - **Path A (key-mismatch abort):** the auditor compares the signing key against cached `K1`, sees `K2 ≠ K1`, and raises a hard verification failure — treating a *legitimate rotation* as an attack. Pipeline deadlocks; the executor's work is discarded. - **Path B (cache-hit bypass):** the auditor's signature check is keyed off the *cached* key material rather than the key that actually signed, so it validates the warrant against `K1`'s public key — which does not match `K2` — and, because the cache also short-circuits measurement re-validation ("already verified at t0"), it accepts the warrant on the strength of stale measurement `M` while the signature check silently degrades to a no-op or a soft warning. Path B is the dangerous one: the auditor *believes* it verified an enclave measurement, but the measurement it validated belonged to an enclave that no longer exists. The continuity invariant — "the measurement I trust is the measurement that produced this signature" — has been broken without any error being raised. ## Condition of Validity The cached-attestation shortcut is only sound under a conjunction that is almost never stated explicitly: 1. The cached key `K` is still the instance's *active signing key*, **and** 2. The cached measurement `M` still describes the *running* enclave, **and** 3. No rotation event occurred since the cache write. Condition 3 is the one the cache cannot observe on its own. A verifier can only satisfy it if the *subject* publishes a rotation signal the verifier is obligated to consume — e.g., a monotonically increasing key-generation counter or `keyEpoch` embedded in every signed message, or a credential status-list entry that is flipped on rotation. Without such a signal, cache validity is bounded not by `expirationDate` but by an *unknown* event time, and the only sound policy is to treat the cache entry as valid only for messages whose signature verifies against the *cached* key — which means any message signed by a new key MUST force full re-attestation, never a cache hit. Formally: a cached attestation is valid for a message `m` iff `verify(sig_m, cached_K) == true`. If it does not verify against `cached_K`, the verifier MUST NOT fall back to "trust the cache, ignore the signature." It must escalate to full re-attestation of the presented key, and it must *not* assume the presented key is hostile merely because it differs. ## Decision Boundary The boundary that separates correct handling from both failure paths: - **Signature verifies against cached key** → cache hit is sound; proceed. (No rotation affecting this message.) - **Signature fails against cached key, but a fresh attestation of the presented key succeeds against allowlist and issuer** → legitimate rotation; *replace* the cache entry with `(K2, M2, C2, epoch+1)` and proceed. Do not deadlock. - **Signature fails against cached key, and fresh attestation of the presented key fails** (bad measurement, unknown issuer, revoked credential) → genuine violation; abort and quarantine. The single most common defect is collapsing the middle and last cases into one "key mismatch = failure" branch (Path A) or into "cache says OK = OK" (Path B). The decision requires an *active re-attestation* on mismatch, not a binary compare against cache. ## Operational Effect When the boundary is respected, key rotation becomes a routine, non-disruptive event: the first message signed under the new key triggers exactly one re-attestation, the cache is updated with a bumped `keyEpoch`, and subsequent messages hit the cache again. When it is violated, you get either (a) spurious deadlock on every rotation, forcing operators to disable attestation caching entirely and pay full quote-validation cost per message, or (b) silent measurement substitution, where the auditor's trust anchor and the executor's actual runtime have drifted apart with no alarm — the worst outcome, because it defeats the entire purpose of hardware-backed attestation while reporting green. The guardrail is architectural, not procedural: every signed message MUST carry the signer's `keyEpoch`; the verifier's cache MUST be keyed by `(subject, keyEpoch)` rather than `subject`; and a cache miss on `keyEpoch` MUST route to full re-attestation, never to a subject-level cache lookup. ```python class StaleAttestationError(RuntimeError): """Raised when a cached attestation cannot be reconciled with the presented key.""" pass def verify_warrant(warrant, cache, attest_fn): """ warrant: dict with keys: subject, key_epoch, signing_key, signature, payload cache: dict mapping (subject, key_epoch) -> {"key": pubkey, "measurement": str, "cred": dict} attest_fn: callable(signing_key) -> {"key": pubkey, "measurement": str, "cred": dict} or raises """ cache_key = (warrant["subject"], warrant["key_epoch"]) cached = cache.get(cache_key) if cached is not None: # Cache hit is only sound if the signature actually verifies against the cached key. if _verify_sig(warrant["payload"], warrant["signature"], cached["key"]): return cached # Signature does not match cached key: do NOT trust the cache, do NOT auto-abort. # Fall through to active re-attestation of the presented key. # Cache miss OR signature/cache mismatch -> full re-attestation of the presented key. try: fresh = attest_fn(warrant["signing_key"]) except Exception as exc: raise StaleAttestationError( f"re-attestation failed for subject={warrant['subject']} " f"epoch={warrant['key_epoch']} key={warrant['signing_key']}: {exc}" ) from exc if fresh["key"] != warrant["signing_key"]: raise StaleAttestationError( f"attested key {fresh['key']} does not match presented key " f"{warrant['signing_key']} for subject={warrant['subject']}" ) if not _verify_sig(warrant["payload"], warrant["signature"], fresh["key"]): raise StaleAttestationError( f"signature invalid against freshly attested key for subject={warrant['subject']}" ) # Legitimate rotation (or first sight): replace the cache entry at the new epoch. cache[cache_key] = fresh return fresh def _verify_sig(payload, signature, pubkey): # Placeholder for the real signature check (Ed25519/ECDSA over the enclave key). return signature is not None and pubkey is not None ```