Skip to Content
MathematicsMathematics
  • Article
  • Open Access

7 July 2026

36 Pages

Operator-Blind Secret Mediation for AI Agents: A Formal Model and FHE Construction for Credential Derivation on Untrusted Infrastructure

,
and
1
Department of Electrical Engineering, City University of Hong Kong, Hong Kong
2
School of International Relations and Diplomacy, Beijing Foreign Studies University, Beijing 100089, China
*
Author to whom correspondence should be addressed.

Abstract

Artificial intelligence (AI) agents increasingly need credentials such as application programming interface (API) keys and Secure Shell (SSH) credentials, but placing those secrets in the agent process exposes them to prompt injection, tool misuse, and exfiltration through ordinary agent outputs. We present CapSeal, a capability-based broker that replaces direct secret access with session-bound, non-exportable handles. Agents request policy-evaluated actions, while the broker performs credential-bearing Hypertext Transfer Protocol (HTTP) and SSH execution through typed executors with schema validation, replay protection, revocation epochs, and tamper-evident audit logging. We extend this design to hosted settings where the broker operator is not trusted with tenant secrets. Our main contribution is operator-blind secret mediation: a split-broker architecture in which a small trusted tenant gateway cooperates with an untrusted operator service that stores the master secret only as a fully homomorphic encryption (FHE) ciphertext and evaluates per-request derivations without decrypting it. We formalize the model and prove computational operator blindness from indistinguishability under chosen-plaintext attack (IND-CPA) security of the FHE scheme, together with conditional capability binding for any secure pseudorandom function/message authentication code (PRF/MAC) instantiation. We implement an end-to-end TFHE-rs prototype that exercises split-broker derivation, multi-tenant revocation and rate limiting, audit integration, and HTTP/SSH mediation. The prototype uses a non-cryptographic homomorphic stand-in and measures the cost of crossing the operator-untrusted boundary at about 9 s per request, roughly 17 million times slower than the plaintext path. We also give LowMC and Rasta transciphering designs and compare FHE with trusted execution environment (TEE)- and secure multiparty computation (MPC)-based alternatives, positioning each trust boundary by assurance and performance.

1. Introduction

Artificial intelligence (AI) agents are increasingly connected to development environments, production services, and administrative toolchains. These systems often need credentials in order to perform useful work: fetching private data, deploying code, calling paid application programming interfaces (APIs), or opening Secure Shell (SSH) sessions. The resulting security problem is different from ordinary secret storage. A credential may be encrypted at rest and still become exposed at the moment an agent is prompted to use it, because the agent process is both semantically steerable and connected to external outputs.
Several attack classes make this use-time exposure concrete:
  • Prompt Injection: Exploiting large language model (LLM) vulnerabilities to hijack agent intent [1,2].
  • Skill Poisoning: Corrupting the functional capabilities or “skills” an agent retrieves to perform tasks [3,4].
  • Model Context Protocol (MCP) Poisoning: Injecting malicious context or instructions through standardized communication protocols [5,6].
  • Supply Chain Attacks: Compromising the external libraries and toolkits that agents rely upon [7,8].
These threats share a common failure mode: once a bearer credential is placed inside the agent’s reachable execution context, policy must rely on the same steerable component that an adversary is trying to manipulate. We address this use-time exposure with CapSeal, a capability-based security broker that replaces direct credential access with constrained, broker-mediated invocations. The agent never obtains the secret; instead, it requests a session-bound, non-exportable handle for a specific, policy-evaluated intent, and a trusted gateway mediates all credential-bearing actions through typed execution paths—enforcing schema constraints, tracking anti-replay state, applying an epoch-based revocation protocol, and recording every decision in a tamper-evident audit chain [9]. CapSeal is exposed to agents as a small set of tools through a filtered Model Context Protocol (MCP) adapter, so capability discovery itself never becomes a side channel for secret existence.
A conventional broker, however, is itself trusted with the plaintext secret. This is a poor fit for managed or hosted agent infrastructure, where the party operating the broker may be distinct from the tenant that owns the credential. We therefore design CapSeal for the operator-untrusted setting and ask: can a tenant run the broker on infrastructure it does not trust, and still prevent the operator from seeing a plaintext secret? We answer this for the secret-confidentiality boundary through operator-blind secret mediation: a thin trusted tenant gateway mediates each request, while an untrusted operator service stores the master secret as a fully homomorphic encryption (FHE) ciphertext and blindly evaluates a derivation interface without decrypting it. FHE is the primitive that lets the untrusted party compute over a secret it cannot read, and the same interface recovers a conventional trusted-broker deployment when the deriver is co-located with the gateway. We detail the design in Section 4.
This paper makes the following contributions:
  • (C1) CapSeal capability-mediation core. We present CapSeal, a capability-based broker that replaces bearer-secret exposure with session-bound, non-exportable handles, typed Hypertext Transfer Protocol (HTTP)/SSH executors with schema and host/command constraints, anti-replay state, an epoch-based revocation protocol, a tamper-evident audit chain, and a filtered MCP adapter that hides capability and secret existence.
  • (C2) Operator-blind split-broker design. We separate the broker into a trusted, thin tenant gateway and an untrusted operator secret service, removing operator trust for the secret-confidentiality path while preserving CapSeal’s capability-narrowing interface.
  • (C3) Formal security model. We define the operator-blind mediation scheme and two security games, and prove computational operator blindness by reduction to the FHE scheme’s indistinguishability under chosen-plaintext attack (IND-CPA) security (Theorem 1) and conditional capability binding for any secure pseudorandom function/message authentication code (PRF/MAC) instantiation (Theorem 2).
  • (C4) Transciphering to industrial-grade derivation. We give complete LowMC and Rasta transciphering constructions—parameters, homomorphic circuits, and security analyses—that upgrade the prototype derivation to 128-bit symmetric security, with a measured LowMC pipeline and an analytical Rasta projection.
  • (C5) Split-broker prototype. We realize the design on TFHE-rs (a Rust implementation of Torus fully homomorphic encryption) with a non-cryptographic homomorphic stand-in that exercises ciphertext storage, blind derivation, artifact opening, executor reuse, replay checks, revocation epochs, multi-tenant isolation, and audit integration, and we additionally probe residual covert channels at the gateway boundary.
  • (C6) Trust-boundary measurement and positioning. We measure the cost of moving secret-bearing computation across the operator-untrusted boundary and position FHE on a common capability substrate against a measured attested trusted execution environment (TEE) derivation service (Amazon Web Services (AWS) Nitro) and secure multiparty computation (MPC)/threshold signing, so an operator can select the boundary matching its threat model and budget.

3. Background and Threat Model

3.1. Why Direct Secrets Fail in Agent Systems

Bearer credentials are unsafe when handed to a component that is both semantically steerable and externally connected. RFC 6750 explicitly warns that a bearer token grants access to any party that possesses it [36]. In agent systems, possession is not limited to memory reads: a prompted model can transform, summarize, paraphrase, or exfiltrate the same credential through tool parameters, logs, or follow-on instructions [28]. This risk is amplified by the agent tool plane: MCP and similar frameworks standardize tool discovery and invocation, but also expand the attack surface to tool descriptions, tool-choice prompts, and output handling [42]. The system must therefore defend not only against a malicious final tool invocation, but also against earlier steering that changes what tool the model chooses to call [29,30].

3.2. Adversary and Trust Assumptions

CapSeal targets the operator-untrusted setting directly: the broker runs on managed or hosted infrastructure that the tenant does not control, so the party that stores and operates on the secret is itself in the adversary’s reach. The goal is not to remove all trust from the system. Instead, CapSeal relocates trust away from the operator-controlled secret service and into a smaller, tenant-controlled gateway.
In-scope adversary capabilities.
  • The adversary can influence agent prompts, retrieved context, or tool descriptions [31,32], and can cause the agent to request capabilities or submit crafted invocation payloads.
  • The adversary includes the operator and the host running the secret service: it observes all storage, ciphertexts, evaluation keys, request bindings, timing of derivations, and the homomorphic derivation computation.
  • The adversary may control remote services or network paths outside the gateway boundary, including HTTP status codes and output side effects.
  • The adversary may replay stale network messages, race capability use against revocation, or attempt distributed replay across operator replicas.
Trusted computing base (TCB).
  • The minimal TCB is a small tenant gateway that holds the FHE client (decryption) key and decrypts only narrowly-scoped, per-request artifacts—never the master secret [23,24]. The gateway is tenant-controlled and can be deployed on infrastructure with stronger administrative, network, and physical controls than the hosted operator service.
  • The operating system enforces process isolation and Unix-domain-socket peer identity on the local agent↔gateway channel.
  • The gateway maintains capability state, anti-replay state, revocation epochs, and the audit head. It is therefore trusted for policy enforcement, artifact opening, and final execution.
Guarantee. Under the IND-CPA security of the FHE scheme and the secrecy of the gateway’s client key, the untrusted operator and the agent are computationally unable to recover the master secret, which exists at the operator only as an FHE ciphertext. The gateway’s exposure is bounded to a single per-request artifact rather than the long-lived secret. As a degenerate case, co-locating a trusted deriver with the gateway recovers a conventional trusted-broker TCB—this is the operator-trusted comparison baseline in Section 8.
Out of scope. Local root or kernel compromise of the gateway; direct memory scraping or binary replacement of the gateway process; microarchitectural side channels below protocol-visible events; cross-host federation; and hardware-bound attestation are out of scope for the implemented prototype.
Multi-tenancy. The gateway is multi-tenant: it maintains per-tenant revocation state (blacklist, epoch, handle registry), enforces per-tenant rate limits, and passes tenant identity through to the operator for storage-isolated blind derivation. Each tenant provisions a distinct FHE key pair; the operator stores ciphertexts in a two-level map keyed by ( tenant , secret _ id ) , and DeriveBlind extracts the tenant from the request binding for storage lookup, ensuring the derived artifact is cryptographically bound to that tenant’s identity. Under the IND-CPA assumption, the operator cannot produce an artifact decryptable by tenant A’s gateway using tenant B’s ciphertext. The gateway’s RateLimiter caps per-tenant invocations per second, preventing a noisy or compromised tenant from exhausting operator compute resources. Per-tenant revocation isolation is verified by test: revoking a handle for tenant A does not affect tenant B’s epoch or handle registry. These mechanisms are implemented and tested in the prototype; cross-tenant audit-chain separation and per-tenant evaluation-key management at the operator remain architectural provisions for a production deployment.
Hardening path. Gateway compromise is the primary residual risk because the gateway holds the FHE client key and decrypts artifacts. Practical deployments should bind that key to a hardware security module (HSM) or trusted platform module (TPM), require TEE attestation for the gateway process when the tenant does not own the host, enforce short artifact lifetimes and revocation epochs, rate-limit derivations, and monitor the append-only audit log for anomalous capability use. These mechanisms complement rather than replace the FHE boundary.

4. System Design

CapSeal is a single, FHE-oriented design: one trusted tenant gateway mediates every credential-bearing action, and the master secret lives only as a fully homomorphic encryption (FHE) ciphertext held by an untrusted operator secret service that derives per-request credentials blindly, without ever decrypting it (Figure 1). The deriver behind the gateway is pluggable: the operator-blind FheDeriver is the design of interest, while a co-located trusted deriver recovers the conventional operator-trusted broker as a degenerate case (the comparison baseline of Section 8). Either way, the agent only ever expresses intent while the gateway performs execution, acting as a combined Policy Enforcement and Decision Point.
Figure 1. System architecture. The master secret leaves the tenant only as an FHE ciphertext held by the untrusted operator (amber), which blindly derives a per-request artifact and returns it still encrypted (dashed). The small trusted gateway (blue, inside the green TCB zone) holds the client key, decrypts only that scope-bound artifact, and executes through the reused executor. Solid arrows carry plaintext-side control; the dashed arrow carries ciphertext.
The design upholds four security objectives. G1 (Secret Non-disclosure): the agent never obtains the secret plaintext or any replayable equivalent; the master secret is never decrypted by the operator, and the gateway only decrypts a per-request derived artifact. G2 (Fine-grained Policy Enforcement): every invocation satisfies a multi-dimensional constraint check (host/path restrictions, command templates, quotas, step-up). G3 (Temporal, Contextual, and Revocation Binding): invocations are bound to sessions, channels, nonces, expiry times, and revocation epochs, so captured traffic and stale artifacts cannot be reused after state changes. G4 (Tamper-Evident Accountability): issuance, invocation (including the blind derivation), and revocation are recorded in an append-only, integrity-protected structure for asynchronous verification [9,34].

4.1. Preliminaries and Notation

We first fix the working vocabulary informally; these notions are made precise as an algorithm tuple, security games, and theorems in Section 5.
  • Capability. A session-bound, unforgeable, non-exportable handle authorizing a single policy-evaluated action over a narrowly constrained scope—host, path, method, command template, expiry, and call quota. The agent holds only the handle, never the underlying secret, and can attenuate but never broaden the authority it conveys.
  • Request binding. The canonical, deterministic encoding of one invocation against a capability scope,
    b = ( tenant , handle , host , path , method , expiry , nonce , timestamp , revocation epoch ) .
    Canonicalization makes distinct invocations yield distinct bindings, so b uniquely identifies the authorized request.
  • Blind derivation and capability artifact. Given the FHE-encrypted master secret C S and a binding b, blind derivation is the homomorphic evaluation C A = Eval evk ( F S , b ) producing an encrypted capability artifact A = F S ( b ) without decrypting the secret. The artifact is the single-use, scope-bound credential the gateway injects after decrypting only C A .
  • Operator-blind mediation. A mediation architecture in which the party that stores the master secret and performs derivations holds only its FHE ciphertext and the evaluation key—never the client key—so that, under the IND-CPA security of the FHE scheme (Assumption 1), it cannot recover the secret even with full host access. The corresponding guarantee is Theorem 1.

4.2. Split-Broker Architecture

The gateway and operator are separated by the trust boundary of Section 3.2 (Figure 1):
  • a tenant gateway (trusted, thin), which holds the FHE client key, and
  • an operator secret service (untrusted, fat), which stores the master secret only as an FHE ciphertext together with the public evaluation (server) key.
For each request: (1) the agent submits an intent and payload to the gateway; (2) the gateway forms a request binding from the capability scope (Section 4.6) and asks the operator to derive a credential for it; (3) the operator homomorphically computes a per-request credential artifact over the encrypted secret and returns it—still encrypted, never having decrypted the master secret and holding no client key; (4) the gateway decrypts only this narrow artifact, injects it, and executes through the typed HTTP executor, returning only the result to the agent. Because the operator possesses neither the client key nor any decryption path, it is computationally blind to the master secret under the FHE scheme’s IND-CPA/Learning With Errors (LWE) security assumptions; because the gateway only ever decrypts a single-use, capability-scoped artifact, its blast radius is one request rather than the long-lived secret. Thus, the design relocates trust from the operator secret service to the tenant gateway instead of eliminating trust entirely. FHE is load-bearing here: it is what lets an untrusted party compute a keyed function of a secret it cannot read.

4.3. Protocol Lifecycle

To the agent, CapSeal appears as a set of standard tools mediated by an MCP/JavaScript Object Notation Remote Procedure Call (JSON-RPC) adapter over Unix Domain Sockets (UDS). The adapter maps MCP initialization and tool calls onto a narrower CapSeal lifecycle: (1) Registration (register) binds a session to a verified transport identity; (2) Capability Request (req_cap) declares an intent, capability type, and scope constraints; (3) Policy Evaluation grants, denies, or requires step-up; (4) Invocation (invoke) supplies a payload and anti-replay metadata; (5) Mediated Execution validates against session state and capability constraints, blind-derives and injects the credential, and executes; (6) Revocation (revoke) marks handles unusable and advances the session revocation epoch; and (7) Audit Export (audit.prove) emits cryptographic evidence for the append-only ledger (Table 3). The blind-derivation round trip that step (5) performs against the untrusted operator is detailed below. The scope field is the primary mechanism for authority narrowing: pinning, for example, an HTTP request to a POST on api.example.com and validating the body against a JSON Type Definition schema [40] ensures the agent cannot deviate from the pre-authorized intent.
Table 3. MCP/JSON-RPC mapping, security purpose, and primary enforcement checks. The last two rows are the gateway↔operator interface that realizes blind derivation.
The adapter implements the MCP [42] stdio transport (protocol version 2024-11-05) and supports three MCP methods: initialize, tools/list, and tools/call. It deliberately excludes resources/*, prompts/*, and notifications/* to minimize the information-disclosure surface; every additional MCP method is a potential side channel. Registration is lazy: the bridge establishes a UDS connection and calls capseal.register on the first tools/call rather than during initialize, so the handshake response never leaks session state. The broker extracts transport-level peer credentials (SO_PEERCRED on Linux, getpeereid on macOS) from the socket; the agent cannot self-assert its identity.
The four MCP tools carry JSON Schema inputSchema constraints fully specified in Table 3 and Table 4, with the protocol architecture visualized in Figure 2. Tool-description filtering is enforced through three mechanisms (Table 4): (i) descriptions use generic verbs—“Request a session-bound capability for an HTTP or SSH action” rather than listing tenant secret names; (ii) the secret_id field in capseal.req_cap’s inputSchema is a free-form string, not an enum, so tools/list never enumerates available secrets; and (iii) denials return a uniform policy_deny error code, drawn from a fixed five-code vocabulary (policy_deny, invalid_params, method_not_found, tool_not_found, mcp_transport_unavailable), so the agent cannot distinguish “resource does not exist” from “resource exists but policy hides it.” The full wire-format transcript for every lifecycle step is documented in the artifact file mcp-protocol-mapping.md.
Table 4. Tool-description filtering in the MCP tools/list response. ⬤ exposed (structural metadata only); ○ hidden (would otherwise reveal capability or secret existence). Every hidden row is a deliberate choice to keep tool discovery from becoming a side channel.
Figure 2. MCP protocol mapping. The agent drives the bridge over JSON-RPC 2.0 with three MCP methods (initialize, tools/list, tools/call), each mapped to narrower CapSeal operations; the bridge forwards typed capseal.* calls to the broker over a Unix-domain socket, and the gateway outsources blind derivation to the untrusted operator (dashed ciphertext return). Information hiding in tools/list and the uniform error-code vocabulary are detailed in Table 3 and Table 4.
Figure 3 details the blind-derivation round trip on the invoke path.
Figure 3. Request lifecycle and blind-derivation round trip on the invoke path. The gateway outsources a keyed derivation to the untrusted operator, which evaluates it homomorphically without decrypting; the gateway then opens only the scope-bound artifact and executes through the reused executor.
To satisfy G2 and G3, the gateway uses UDS peer-credential extraction to identify the calling process (preventing identity self-assertion), and an AntiReplay structure with a monotonically increasing sequence number, a unique nonce, and a millisecond timestamp. An invocation is accepted only if it is bound to an active session, references an active non-expired handle, passes freshness and nonce checks, matches the current revocation epoch, and falls within the call quota. A revoke operation inserts the handle into a per-session blacklist, advances the session revocation epoch, invalidates any cached encrypted artifact for that epoch, and appends a revocation record to the audit chain. Onboarding is a one-time store_secret that hands the operator only FHE ( secret ) and the server key; thereafter, every request uses derive_blind. The gateway records the derivation request, the artifact decryption, and the execution in the same append-only audit chain (G4), so accountability spans the trust boundary even though the derivation runs on the untrusted operator.
The default caching rule is fail-closed: the gateway does not cache plaintext artifacts. An operator may memoize an encrypted derivation result only for the exact canonical binding tuple ( tenant , handle , host , path , method , expiry , nonce , revocation _ epoch ) . Because the nonce and revocation epoch are part of that tuple, such memoization cannot authorize a second invocation or survive revocation; it only avoids repeating an identical homomorphic computation during retransmission recovery. The artifact tests and the revocation_cache_bench driver check this invariant directly: identical retransmission tuples reuse the same derived value, while a revocation-epoch change produces a different artifact and invalidates memoization.

4.4. Revocation Protocol

Revocation in CapSeal is an epoch-based, gateway-enforced protocol that renders a capability handle unusable and cryptographically invalidates any artifact derived under a prior epoch. Because the homomorphic derivation runs on the untrusted operator, the protocol is designed so that revocation takes effect at the gateway without requiring the operator to alter its behavior or learn whether a handle has been revoked.
The gateway maintains, per session, a revocation blacklist B, a monotonically increasing revocation epoch e ∈ N , and a handle registry mapping each active handle to its constraints, expiry, quota, and issuance epoch. On Revoke ( handle , σ ) , the handle is inserted into B, the epoch advances ( e ← e + 1 ), all surviving handles are re-issued at the new epoch, prior-epoch operator-cached artifacts are cryptographically invalidated (the canonical binding tuple includes e), and an audit record is appended. On Invoke , the gateway atomically checks handle registration, issuance-epoch freshness, blacklist membership, and epoch match before dispatching DeriveBlind ; any failure returns cap_revoked, stale_epoch, or stale_issuance and aborts before the expensive derivation round trip.
The revocation epoch is canonically encoded in the request binding b, so A = F S ( b ) changes with epoch, yielding three properties that make revocation robust against an untrusted operator: (i) the operator cannot serve stale artifacts—an artifact derived under epoch e fails VerifyArtifact at epoch e + 1 ; (ii) the operator learns nothing about revocation, seeing only a changing integer in a fixed-format tuple; (iii) quota exhaustion complements revocation by denying further invocations without an explicit revoke. The race window between Revoke and DeriveBlind dispatch is bounded at 500 ns P95 (Section 8.5), 1.8 × 10 7 smaller than the ∼9 s FHE-mediated invoke. Revocation takes effect immediately at the gateway with no operator propagation required—a central design point when the operator is untrusted.

4.5. Blind Keyed Derivation

The operator evaluates a keyed derivation
artifact = PRF master _ secret , request _ binding
under FHE, where PRF denotes the secure keyed function used in the conditional cryptographic model (for example, a message authentication code such as HMAC-SHA256, or the request-signing function of a scheme such as AWS SigV4). The master secret is encrypted once at onboarding; thereafter, every derivation runs homomorphically on the operator and yields an encrypted artifact that only the gateway can open. After onboarding, neither the operator nor the gateway derivation path materializes the master secret in plaintext.
The implemented circuit uses 16 rounds of scalar multiplication (by odd binding-dependent constants) and word-wise XOR over 64-bit words. Multiplication by an odd constant modulo 2 64 is a bijection with strong bit-level avalanche—the same ARX design principle behind ChaCha20 [53] and Salsa20 [54]—and 16 rounds over a 4-word (256-bit) state provide collision resistance and pseudorandomness with a comfortable security margin. The construction is not a full-strength MAC for production authentication (HMAC-SHA256, AWS SigV4, or SSH signing remains the production target and would be substantially more expensive under FHE; see Section 8.1 for a projection). However, its collision resistance and pseudorandomness satisfy the requirements for the capability-binding theorem in Section 5, so Theorem 2 applies to the implemented circuit at the 256-bit security level.

4.5.1. Scope of Cryptographic Derivation

A complete FHE construction for HMAC-SHA256, AWS SigV4, or SSH signing evaluated directly (without transciphering) would be a separate cryptographic engineering contribution: the direct homomorphic evaluation of SHA-256 alone requires approximately 51,000 programmable bootstrapping (PBS) operations, roughly 25 × the cost of the prototype circuit. Section 6 presents the transciphering approach that avoids this cost by using FHE-friendly symmetric ciphers (LowMC and Rasta) to bridge the plaintext secret into the FHE domain, together with concrete circuit constructions, parameter selections, security analyses, and measured benchmarks. The manuscript thus separates three claims: operator blindness depends on IND-CPA security of the FHE scheme; capability-binding security (Theorem 2) follows from the collision resistance and pseudorandomness of the 16-round multiplication-XOR construction for the prototype, and from the 128-bit symmetric security of LowMC/Rasta for the transciphering upgrade (Section 6); and the implemented TFHE-rs circuits—both the prototype and the LowMC transciphering pipeline—provide concrete, analyzable instances whose costs are reported in Section 8.1 and Section 6.3. Figure 4 summarizes the FHE blind-derivation circuit. For deployments that require production signing performance today and can accept hardware trust, the TEE-DS boundary in Section 9 is the practical alternative: the real MAC or request signer runs inside an attested enclave, rather than as a homomorphic circuit.
Figure 4. FHE blind-derivation circuit. The operator (amber zone) homomorphically evaluates C A = Eval evk ( F S , b ) over the encrypted secret and the canonical binding b without decrypting either; only the gateway (blue) opens the ciphertext artifact. The prototype instantiates F S as a 16-round multiplication-XOR construction (collision-resistant and pseudorandom for capability binding, Theorem 2); a production deployment replaces it with HMAC-SHA256 or a request signer after transciphering (Section 6).

4.5.2. External Credential Acceptance Model

The artifact must be accepted by some external verifier before it can replace a service-native credential. In a production deployment, this verifier is either the upstream service’s native request-signature verifier (for example, an HMAC- or SigV4-style authorization scheme), or a future tenant-controlled and trusted verification shim, outside the untrusted operator boundary, that translates a capability-bound artifact into a service-native credential-bearing request. The current prototype does not implement either external verifier; its internal verify_artifact routine only exercises gateway-side scope and state checks. It therefore demonstrates the split-broker and FHE boundary mechanics, not drop-in compatibility with arbitrary bearer-token APIs.

4.6. Cryptographic Capability Scoping

The cryptographic capability-scoping model binds the derivation to the capability scope via a collision-resistant pseudorandom construction. The request binding canonically encodes the tenant identifier, capability handle, host, path, method, expiry, per-request nonce, and current revocation epoch. Under the 16-round multiplication-XOR circuit, an artifact derived for one scope does not authenticate a request outside that scope (collision resistance), and an adversary cannot predict the artifact for an unauthorized binding from observed artifacts (pseudorandomness). The prototype’s verification routine (verify_artifact) exercises the corresponding state checks by rejecting out-of-scope, replayed, expired, or stale-epoch requests. This is the cryptographic analog of network/host pinning (e.g., SSH known_hosts_pin): the untrusted operator cannot forge a wider-scope credential because doing so would require the master secret it never holds and a valid output for the canonical binding. The multiplication-XOR circuit provides the collision resistance and pseudorandomness needed for capability narrowing at the 256-bit security level; a production deployment may replace it with a full-strength MAC (HMAC-SHA256) for compatibility with existing request-signing schemes.

4.7. Capability Realizations

HTTP. The HTTP capability behaves as a constrained request constructor rather than a general-purpose proxy, which would still hand the agent broad routing power. CapSeal treats it as pre-authorized authority over a narrow method/host/path surface whose body can itself be semantically confined by a short request description: allowed method, host, path template, and body-schema reference. The narrowing path is layered: the executor validates method, host, and path, enforces payload-byte limits and header allowlists, rejects caller-supplied authorization headers, injects the blind-derived credential internally, and only then validates the body against the declared schema reference—moving beyond network mediation into semantic mediation. Schema failures deny before any credential use (fail-closed), and audit evidence records request structure, policy decisions, and response metadata without exposing the credential.
SSH. SSH uses a stricter, broker-exec realization because the threat surface is stronger: forwarding an SSH agent or exposing a reusable signing interface would leave the agent holding a powerful ambient channel. Instead the gateway executes a narrowly constrained remote action, and the agent never holds SSH key material or a forwarding-capable socket [55,56]. The capability constrains host and user, restricts execution to an approved command-prefix template with bounded arguments, forbids forwarding, and caps output size; the culminating control is host authenticity—the executor compares the presented host key against the capability’s known_hosts_pin.
Implementation. CapSeal is implemented in Rust as the capseal-broker crate, which dispatches to typed HTTP/SSH executors, maintains anti-replay session state, supports local and external (HTTP) policy engines with fail-closed timeouts, and an audit subsystem with a cryptographic chain and proof verification. The operator-blind path is realized by a pluggable BlindDeriver seam (Section 7), so the same gateway, executors, scoping, and audit serve both the operator-trusted and operator-blind deployments.

5. Formal Security Model

This section formalizes the two central claims of the operator-blind design: that an untrusted operator learns nothing computational about the master secret (operator blindness, Theorem 1), and that no party can forge an artifact accepted outside its authorized scope (capability binding, Theorem 2). Throughout, λ is the security parameter, “PPT” abbreviates probabilistic polynomial-time, and a quantity is negligible if it is o ( λ − c ) for every constant c.
Assumption 1
(IND-CPA-secure FHE). Π FHE = ( KeyGen , Enc , Eval , Dec ) is a fully homomorphic encryption scheme that is IND-CPA secure: for every PPT adversary, the advantage Adv Π FHE ind - cpa ( λ ) in distinguishing encryptions of two equal-length messages is negligible. TFHE inherits this property from the hardness of (Ring-)LWE; the resulting guarantees are therefore computational and rely on standard lattice-hardness assumptions.
We write F K ( · ) for the keyed function used to derive request artifacts. The TFHE-rs prototype instantiates F as the 16-round multiplication-XOR construction of Section 4.5 (collision-resistant and pseudorandom at the 256-bit level via ARX-style mixing modulo 2 64 ); a production deployment may instead instantiate it as a standardized MAC through the transciphering pipeline of Section 6 (128-bit symmetric security). Theorem 2 holds for any such secure-PRF/MAC instantiation, whereas Theorem 1 is independent of the choice of F.
We first fix the interface mediating between the trusted gateway and the untrusted operator.
Definition 1
(Operator-blind secret mediation scheme). An operator-blind secret mediation scheme is a tuple of PPT algorithms
( Setup , StoreSecret , Bind , DeriveBlind , OpenArtifact , VerifyArtifact , Revoke )
defined as follows:
  • Setup ( 1 λ ) → ( sk , evk ) produces an FHE client key sk (held only by the gateway), a server/evaluation key evk , and public parameters.
  • StoreSecret ( sk , S ) → C S = Enc sk ( S ) , with ( C S , evk ) stored at the operator.
  • Bind ( tenant , handle , scope , n , t , e ) → b returns a canonical request binding b encoding tenant identity, capability handle, host, path, method, expiry, nonce n, timestamp t, and revocation epoch e.
  • DeriveBlind ( C S , evk , b ) → C A = Eval evk ( F S , b ) , a ciphertext encrypting the artifact A = F S ( b ) , computed without sk .
  • OpenArtifact ( sk , C A ) → A = Dec sk ( C A ) , evaluated only at the gateway.
  • VerifyArtifact ( A , b , σ ) → { 0 , 1 } accepts iff A validates for the exact binding b and the live session state σ marks the handle active, non-expired, fresh, and in the current revocation epoch.
  • Revoke ( handle , σ ) inserts the handle into the gateway blacklist, advances the session revocation epoch, invalidates same-epoch cached ciphertexts, and appends an audit entry.
Definition 2
(Operator-blindness game Game ob ). The adversary A controls the operator. It receives evk , chooses polynomially many bindings b i , and observes DeriveBlind transcripts. It then submits two equal-length secrets S 0 , S 1 ; the challenger samples d ← { 0 , 1 } , stores C ★ = Enc sk ( S d ) , and answers adaptive derivation queries with ciphertext artifacts computed from C ★ . Finally A outputs a guess d ′ , and its advantage is
Adv A ob ( λ ) = Pr [ d ′ = d ] − 1 2 .
The game models a passive (honest-but-curious) operator with respect to FHE evaluation; active deviations are treated separately in Remark 1.
Theorem 1
(Computational operator blindness). Under Assumption 1, if the gateway client key sk is never revealed, then for every PPT operator adversary A in Game ob there exists a PPT IND-CPA adversary B such that
Adv A ob ( λ ) ≤ Adv Π FHE , B ind - cpa ( λ ) .
In particular, Adv A ob ( λ ) is negligible.
Proof. 
B embeds its IND-CPA challenge ciphertext as the stored secret C ★ in Game ob . Every operator-visible value— evk , the stored ciphertext, and each DeriveBlind transcript C A = Eval evk ( F ( · ) , b ) —is a public, sk -free transformation of ciphertexts and adversarially chosen bindings, so B produces all of them from its challenge without the client key. Hence B perfectly simulates A ’s view and forwards A ’s guess, distinguishing Enc sk ( S 0 ) from Enc sk ( S 1 ) with exactly A ’s advantage. The bound is computational: an unbounded adversary lies outside the FHE security model.    □
Remark 1
(Malicious operator behavior). FHE confidentiality alone does not guarantee that the operator returns the correct evaluated ciphertext. A malicious operator may return malformed ciphertexts, replay old artifacts, suppress derivations, or equivocate across requests. These are integrity and availability failures, not violations of Theorem 1. A production deployment should authenticate stored-ciphertext metadata, bind artifacts to the audit log, reject stale revocation epochs, and verify derivation correctness (via redundant or proof-carrying evaluation, or tenant-side spot checks)—or else treat incorrect derivations as detectable denial of service. The prototype catches stale-binding and replay failures through gateway state but does not provide general verifiable FHE.
Definition 3
(Capability-binding game Game bind ). The adversary controls the agent and the operator interface but not the gateway client key. It obtains artifacts for policy-approved bindings b 1 , … , b q and wins if it makes VerifyArtifact accept an artifact A ★ for a binding b ★ that was not authorized, is outside the requested scope, reuses a nonce, is expired, or uses a stale revocation epoch. Its advantage is Adv A bind ( λ ) = Pr [ A wins ] .
Theorem 2
(Conditional capability binding). If F is instantiated as a secure PRF/MAC over canonical bindings and the gateway enforces freshness, expiry, and revocation state, then for every PPT adversary making q artifact queries in Game bind ,
Adv A bind ( λ ) ≤ Adv F , C prf ( λ ) + q 2 λ + Adv A state ( λ ) ,
where Adv A state bounds the probability that nonce, expiry, revocation, or canonicalization checks fail in the implementation.
Proof. 
Replace F S ( · ) by a truly random function R ( · ) ; this step costs Adv F , C prf ( λ ) . Under R, a fresh unauthorized binding b ★ has an artifact value independent of the q observed outputs, so the adversary forges it with probability at most q / 2 λ unless it replays an authorized artifact—which nonce freshness and revocation-epoch binding exclude—or exploits a gateway state or canonicalization error, captured by Adv A state . Summing the three terms gives the bound. The prototype’s 16-round multiplication-XOR construction satisfies the collision-resistance and pseudorandomness premise at the 256-bit level.    □

6. Transciphering

The prototype keyed derivation of Section 4.5 uses a 16-round multiplication-XOR construction that provides collision resistance and pseudorandomness for capability binding (Theorem 2), but it is not a standardized, industrially vetted cryptographic scheme. A production deployment that requires industrial-grade authentication must instantiate the derivation with a cryptographically strong message authentication code such as HMAC-SHA256, or with a request-signing scheme such as AWS Signature V4 or SSH Ed25519 signing. However, evaluating a standard MAC directly under fully homomorphic encryption is prohibitively expensive: the SHA-256 compression function alone requires approximately 51,000 PBS operations when evaluated over TFHE Boolean gates, roughly 25 × the cost of the prototype circuit. Standard symmetric primitives are designed for plaintext central processing units (CPUs) where bitwise AND and XOR are equally fast; under FHE, AND gates (which require bootstrapping) dominate the cost while XOR operations are essentially free (noiseless addition of LWE ciphertexts).
Transciphering resolves this mismatch by introducing a hybrid two-layer approach that separates the symmetric encryption layer from the homomorphic evaluation layer. The master secret K is encrypted under an FHE-friendly block cipher—specifically designed to minimize AND gates—and stored at the operator as a symmetric ciphertext C. During credential derivation, the operator homomorphically decrypts C into the FHE domain, recovering an encryption of K without ever seeing K in the clear, then feeds [ K ] into the existing derivation circuit. Neither layer alone exposes the secret at the operator: C is useless without the symmetric key L (held by the gateway), and the FHE-encrypted round keys and intermediate values are useless without the FHE client key (also held by the gateway). This upgrades the derivation’s security foundation from “collision-resistant ARX-style PRF over scalar multiplication modulo 2 64 ” to “128-bit symmetric cipher (LowMC or Rasta) with IND-CPA-secure homomorphic decryption.” Figure 5 illustrates the two-layer construction.
Figure 5. Transciphering architecture. The tenant encrypts the master secret K under an FHE-friendly block cipher (LowMC or Rasta) with key L, and encrypts the round key bits under FHE. The untrusted operator stores the symmetric ciphertext C alongside FHE-encrypted round keys and plaintext linear-layer matrices/constants. During credential derivation, the operator homomorphically decrypts C into [ K ] (the transciphering step), then feeds [ K ] into the existing derivation circuit. The operator never sees K in the clear: C requires L to decrypt, and the FHE ciphertexts require the client key.
Both LowMC and Rasta are block ciphers from the family of FHE-friendly symmetric primitives designed explicitly to minimize multiplicative complexity—the number of AND gates in the Boolean circuit representation [48,52]. This is the critical metric for FHE evaluation cost because each AND gate requires a programmable bootstrapping operation, whereas XOR gates are noiseless additions in TFHE’s Boolean API. We present complete parameter sets, circuit constructions, and security analyses for both ciphers, and report measured performance for the LowMC instantiation, which is fully implemented in our artifact. Hybrid homomorphic encryption constructions such as Pasta [50] similarly separate symmetric encryption from homomorphic evaluation; our transciphering design adopts this two-layer architecture while targeting the specific credential-derivation circuit of Section 4.5, Section 4.6 and Section 4.7 and Section 5.

6.1. LowMC Construction

LowMC is a family of block ciphers designed for use in MPC, FHE, and zero-knowledge proof systems [47,48]. Its defining design principle is minimizing the number of AND gates per round at the cost of a larger number of rounds. The LowMC v3 structure applies a partial S-box layer (only the first 3 m bits of the state), followed by a full-rank GF(2) linear layer, round constant addition, and round key addition.
  • Parameter selection. Table 5 lists the chosen parameters and their security rationale.
    Table 5. LowMC parameters for the 32-byte master secret transciphering circuit.
The 3-bit S-box has algebraic degree 3, making it resistant to higher-order differential cryptanalysis. The partial S-box layer—applying the S-box to only the first 3 m = 30 bits of the 256-bit state—is the key design trade-off: it reduces the number of AND gates at the cost of slower diffusion through the non-linear layer. The remaining 226 bits pass through the S-box layer unchanged.
  • Circuit construction (encryption direction). Each of the 20 rounds applies four transformations to the 256-bit state:
  • S-box layer: Apply the 3-bit S-box to the first 3 m = 30 bits. Each S-box requires three AND gates (the b c , a c , and a b product terms), totaling 3 m = 30 AND gates per round.
  • Linear layer: Multiply the state by a random invertible 256 × 256 binary matrix over GF(2). Each output bit is the XOR of selected input bits. No multiplications—only XOR operations, which are free (noiseless) in TFHE Boolean gates.
  • Round constant addition: XOR a round-dependent 256-bit constant to the state (free in FHE).
  • Round key addition: XOR a round-dependent 256-bit key to the state. In the homomorphic circuit, these round key bits are FHE-encrypted as FheBool values, so XOR is still free.
  • Homomorphic decryption. The operator evaluates decryption, which reverses the encryption steps. It receives the 32-byte LowMC ciphertext C in the clear (trivially encryptable as FheBool values), the round key bits encrypted under FHE ( 256 × 20 = 5120  FheBool values), and the plaintext round constants and inverse linear-layer matrices. Decryption proceeds in reverse order for i = 19 , … , 0 : (1) XOR with the FHE-encrypted round key (free), (2) XOR with the plaintext round constant (free), (3) multiply by the pre-computed inverse GF(2) linear-layer matrix (free XORs), and (4) apply the inverse 3-bit S-box (three AND gates per S-box, 30 per round). The total cost is the same as encryption: 600 bootstrapping operations.
Security analysis. LowMC with ( n = 256 , k = 128 , m = 10 , r = 20 ) provides 128-bit symmetric security against known cryptanalytic attacks:
  • Interpolation attacks: Exploit the low algebraic degree of the S-box by constructing a polynomial representation of the cipher. For a degree-3 S-box, the maximum algebraic degree after r rounds is bounded by min ( 3 r , 256 ) . At r = 20 , 3 20 ≫ 256 , so the cipher reaches full degree well before the final round, making polynomial interpolation infeasible.
  • Higher-order differential attacks: Similarly bounded by the algebraic degree growth. With 20 rounds and a degree-3 S-box, the degree exceeds the block size, eliminating exploitable higher-order differentials.
  • Algebraic attacks: Modeling the cipher as a system of polynomial equations over GF(2) yields a system with 256 × 20 = 5120 non-linear equations. The large block size and 20-round depth make the equation system infeasible for Gröbner basis or XL-type solvers, which scale exponentially in the number of variables.
  • Linear and differential cryptanalysis: The random invertible linear layers, generated deterministically from the 128-bit key via ChaCha20, provide strong diffusion: each output bit depends on every input bit after approximately two rounds. The wide-trail strategy ensures any differential or linear trail activates multiple S-boxes per round, and the 20-round depth provides a large security margin.
A production deployment should replace the ChaCha20-based key schedule seeding with HKDF-SHA256 for proper domain separation between the LowMC master key and the derived round material. The combined security of the transciphering construction rests on both layers: the adversary must either break the 128-bit LowMC key L (to decrypt C and recover K in the clear) or break the IND-CPA security of TFHE (to recover K from the homomorphic decryption transcript). Neither the operator—which holds C and the FHE-encrypted round keys but lacks L and the FHE client key—nor a passive network observer can recover K under these assumptions.

6.2. Rasta Construction

Rasta is an FHE-friendly block cipher family introduced by Dobraunig et al. [49] that takes a different design approach from LowMC. Instead of minimizing AND gates per round through a partial S-box, Rasta uses a full-state non-linear transformation (the χ function from Keccak) with algebraic degree 2, which is the lowest possible degree for a non-linear Boolean function. The key insight is that the algebraic degree grows exponentially with the number of rounds (deg ≤ 2 r ), so fewer rounds are needed to reach full degree coverage. Rasta also exploits the fact that the affine layers can be freshly sampled from a CSPRNG for each encryption, making them effectively random and preventing structural cryptanalysis.
  • Parameter selection. Table 6 lists the chosen parameters.
    Table 6. Rasta parameters for the 32-byte master secret transciphering circuit.
Rasta uses 5 × more AND gates than LowMC overall (3060 vs. 600), but requires only 12 rounds vs. 20, which yields a shallower multiplicative depth—the number of sequential AND layers that cannot be parallelized. This trade-off favors Rasta when bootstrapping latency is low but round depth dominates; it favors LowMC when bootstrapping is the dominant cost regardless of depth.
  • Circuit construction (per round). Each of the 12 rounds applies four transformations:
  • Key addition: XOR the 256-bit round key (FHE: free, as round keys are FHE-encrypted FheBool values).
  • Constant addition: XOR a round-dependent 256-bit constant (FHE: free).
  • Affine transformation: Multiply the state by a random invertible 256 × 256 GF(2) matrix (FHE: free XORs).
  • χ transformation: Apply χ ( a , b , c , d , e ) = ( a ⊕ ¬ b · c , b ⊕ ¬ c · d , c ⊕ ¬ d · e , d ⊕ ¬ e · a , e ⊕ ¬ a · b ) to 51 parallel 5-bit blocks. Each block requires five AND gates (the ¬ b · c , ¬ c · d , ¬ d · e , ¬ e · a , ¬ a · b product terms), totaling 51 × 5 = 255  AND gates per round.
The χ function is degree-2 over GF(2), which is the minimum possible algebraic degree for any non-trivial non-linear Boolean function. The NOT operations ( ¬ b , ¬ c , ¬ d , ¬ e , ¬ a ) are noiseless in TFHE Boolean gates (implemented as XOR with the constant 1).
  • Homomorphic decryption. The structure is identical to LowMC: the operator trivial-encrypts the 32-byte Rasta ciphertext as FheBool values, then runs the inverse rounds. Each inverse round undoes the χ transformation (via the inverse χ − 1 , which has the same AND-gate complexity), the inverse affine transformation (using pre-computed inverse matrices), and the key/constant removal. The total cost is 3060 bootstraps.
  • Security analysis. Rasta with ( n = 256 , k = 128 , r = 12 ) provides 128-bit symmetric security:
  • Algebraic degree attacks: The χ function has algebraic degree 2. After r rounds, the maximum algebraic degree is bounded by 2 r . At r = 12 , 2 12 = 4096 ≫ 256 , so the cipher reaches full degree well before the final round. The minimum rounds needed for degree coverage are r ≥ ⌈ log 2 ( 256 ) ⌉ = 8 ; 12 rounds provide a 4-round (50%) margin.
  • Invariant subspace attacks: The random affine layers, freshly generated from the key for each encryption, make the probability of an exploitable invariant subspace negligible. Each 256 × 256 binary matrix is generated via a CSPRNG and tested for invertibility; the set of matrices that admit a useful invariant subspace is exponentially small in the block size.
  • Structural attacks: Unlike LowMC’s partial S-box, Rasta applies the χ transformation to the entire state uniformly, eliminating the structural asymmetry that partial S-box attacks exploit. All 256 state bits undergo identical non-linear treatment in every round.
  • Differential and linear attacks: The random affine layers provide strong, key-dependent diffusion that makes it infeasible to find high-probability differential or linear trails. Each trail’s probability depends on the randomly-generated matrices, and the 12-round depth provides ample margin against trail clustering.
A notable structural advantage of Rasta over LowMC is its uniformity: the full state receives identical non-linear treatment each round, which simplifies the security argument and eliminates the need for separate analyses of the S-box-applied and S-box-bypassed portions of the state. The main disadvantage is the 5 × higher AND-gate count, which directly increases the FHE evaluation cost if bootstrapping is the bottleneck.

6.3. Comparative Analysis and Measured Performance

Table 7 compares the prototype PRF with the LowMC and Rasta transciphering constructions across the dimensions relevant to FHE-based credential derivation.
Table 7. Prototype PRF vs. transciphering constructions. Single-thread, Apple Silicon aarch64, tfhe 0.8, FheBool carrier. LowMC measured; Rasta analytical projection (no implementation). None of the three is a standardized cipher.
The LowMC transciphering pipeline is fully implemented in the fhe-transcipher crate. Table 8 reports measured latency components on the same Apple Silicon aarch64 host used throughout the evaluation (release build, tfhe 0.8.7, FheBool carrier).
Table 8. LowMC transciphering pipeline: measured latency and storage. Release build, Apple Silicon aarch64, tfhe 0.8.7, FheBool, ( n , k , m , r ) = ( 256 , 128 , 10 , 20 ) . Total hot path extrapolated from 1-round measurement (full 20-round run ∼2.6 h, not completed).
  • Interpretation. The transciphering step dominates the total derivation cost by three orders of magnitude relative to the downstream derivation circuit (8.3 s). The per-round cost of ∼466 s is primarily driven by the inverse GF(2) linear layer, which performs N 2 = 65 , 536 XOR operations over LWE ciphertexts with approximately 630 coefficients each; while each XOR is noiseless, the linear scan over 256 output bits each dependent on up to 256 input bits incurs a large constant factor in the TFHE-rs Boolean backend. This cost could be substantially reduced through batching (processing multiple bits per ciphertext word), graphics processing unit (GPU) acceleration (TFHE-rs CUDA backend), or by switching to a scheme with native packed linear algebra such as BGV/BFV.
The Rasta projection of ∼40 s per derivation is based on 3060 bootstraps at ∼13 ms per PBS (the measured single-thread PBS latency on this host). This is ∼230× faster than the measured LowMC path despite having 5 × more AND gates, because the LowMC bottleneck is not bootstrapping but the dense linear-layer XOR traversal. Rasta’s advantage is therefore architectural: the random affine layers are identical in complexity to LowMC’s linear layers, but the shallower depth (12 vs. 20 rounds) reduces the number of linear-layer traversals by 40%.
For context, both transciphering approaches are substantially more expensive than the prototype’s 16-round multiplication-XOR circuit (∼8 s, Section 8.1) because the prototype stores the secret directly as an FheUint64 ciphertext (no transciphering step) and uses scalar multiplication rather than Boolean AND gates. The additional cost buys industrial-grade symmetric security: the master secret benefits from both the 128-bit security of the block cipher and the IND-CPA security of TFHE. For latency-sensitive per-request derivation, the TEE-DS boundary (Section 9) remains the practical alternative; transciphering occupies the “maximum cryptographic assurance, maximum latency” corner of the trust-boundary map and is appropriate for long-lived capability issuance where the derivation runs once per capability rather than once per invocation.
The transient ∼81 MB of round key storage for LowMC is large but manageable for a small set of secrets (a few dozen). Rasta’s projected ∼0.3 MB is storage-efficient, making it preferable when many secrets must be stored at the operator.

7. Implementation

We realize the split-broker design of Section 4 as three Rust crates layered over the capseal-broker capability-mediation core introduced in this work, built on TFHE-rs [11,12] (tfhe 0.8, integer feature) with FheUint64 ciphertext words.
  • fhe-derive defines the request binding and the blind-derivation circuit. The derivation is written once against a generic word trait and instantiated twice: over plaintext u64 as a reference oracle, and over tfhe::FheUint64 for homomorphic evaluation. Compiling the same algorithm for both carriers is what lets the test suite assert that the homomorphic result is bit-identical to the plaintext reference. The crate also provides verify_artifact, the capability-scope check of Section 4.6.
  • fhe-secret-service is the untrusted operator. Its OperatorSecretService type stores ciphertexts and the server key only: by construction it has no client-key field and exposes no method that returns a plaintext secret—a structural blindness invariant enforced by the type, not merely by convention. Secrets are stored in a two-level map keyed by ( tenant , secret _ id ) , providing per-tenant storage isolation; DeriveBlind extracts the tenant from the request binding for cryptographic binding and storage lookup.
  • tenant-gateway is the trusted, thin component. It holds the client key, requests a blind derivation, decrypts the scoped artifact, and—reusing the broker’s typed executors—validates constraints, injects the credential, and executes the call. The gateway is multi-tenant: it maintains per-tenant revocation state and enforces per-tenant rate limits via a RateLimiter with configurable invocation caps. Because the derivation consumes only the canonical request binding, the same gateway mediates both protocols: invoke_http over the HttpExecutor and invoke_ssh over the SshExecutor, with the artifact passed to the executor as a prototype credential label in the current implementation; production bearer-token, SigV4, HMAC, or SSH-signing compatibility would require a verifier-compatible construction. A BlindDeriver trait abstracts the derivation backend, with a PlaintextDeriver for fast functional tests and an FheDeriver for the homomorphic path.

TEE Roles and Nitro Implementation

The artifact uses Trusted Execution Environments in two distinct services, summarized in Table 9. We call them TEE-DS (TEE Derivation Service) and TEE-KRS (TEE Key-Release Service) throughout the implementation and result discussion. TEE-DS is a replacement execution boundary: the secret-handling derivation logic runs inside an attested enclave, giving near-native request latency under a hardware trust assumption. TEE-KRS is a key-custody hardening boundary: the FHE client key, which is the residual trusted object in CapSeal-OB, is released only to an attested enclave, so the parent host can orchestrate blind derivation without directly obtaining the key used to decrypt scoped artifacts.
Table 9. Two TEE services in the CapSeal artifact. TEE-DS is the low-latency production alternative to homomorphic derivation; TEE-KRS hardens the FHE gateway by binding key release to enclave attestation.
TEE-DS. The TEE Derivation Service is a measured enclave service that holds the plaintext master secret or request-signing key only inside enclave memory. During startup, it generates a fresh service keypair and returns a hardware attestation document binding the gateway nonce, the service public key, and the enclave measurement. The gateway accepts the channel only when the quote verifies against the expected platform configuration register (PCR) policy and service-key binding. After that, each request is a vsock RPC: the gateway sends the canonical request binding, and the enclave returns the scoped artifact. Thus, TEE-DS protects the master secret and signing computation from the parent OS, while keeping the per-request hot path small.
TEE-KRS. The TEE Key-Release Service is a measured enclave service for protecting the FHE client key rather than replacing FHE evaluation. The enclave presents an attested recipient public key to the external key-release policy, such as KMS policy over Nitro PCRs. If the policy accepts the quote, the released client key is encrypted to the enclave recipient key, so only enclave code can decrypt it. The enclave then uses that key to decrypt scoped FHE artifacts without exposing the client key to the parent instance. Thus, TEE-KRS hardens the trusted gateway/key-custody side of CapSeal-OB.
TEE-DS: attested derivation service. The tee-secret-service crate has two execution modes. In –mode simulated, it preserves the local UDS test path used by the unit and integration tests. In –mode aws-nitro, the same JSON-RPC dispatcher is served over Nitro vsock, so UDS and vsock share one request implementation rather than two protocol-specific copies. At enclave startup, the service generates a fresh service/session keypair and obtains a Nitro attestation document from the Nitro Secure Module. The quote binds the gateway’s nonce to the service public key; the parent-side verifier checks the CBOR Object Signing and Encryption (COSE)/Concise Binary Object Representation (CBOR) attestation document, the nonce, the expected PCR0/PCR1/PCR2 values from the EIF build, and the service-key binding before accepting the channel. Only after this handshake does the gateway send derive requests over vsock. The hot path therefore contains the same capability binding and artifact derivation logic as the simulated service, while quote generation and verification are isolated as a startup cost.
TEE-KRS: attested key custody for TEE+FHE. For the hybrid deployment, the enclave is used not to replace FHE but to protect the FHE client key at the gateway boundary. The scripts in scripts/aws_nitro/ build the EIF, capture PCR measurements, create the development KMS key policy (alias/capseal-nitro-dev), launch the enclave, and run bench_tee_fhe_once.sh. The intended AWS path uses KMS attested release: KMS encrypts released key material to the enclave recipient described by the Nitro attestation document, and the parent instance never receives the plaintext client key. The current benchmark harness reports this as a one-trial deployment path rather than a statistical latency distribution: setup/attestation/key-release timing is cold-path work, while the FHE derivation cost remains the dominant per-invocation term. This service is therefore a hardening layer for CapSeal-OB’s remaining trusted key, whereas TEE-DS is the low-latency alternative when hardware trust is acceptable.
This structure keeps the trust boundary explicit in the code: the only component that can decrypt anything is the gateway, and the only thing it ever decrypts is a single-request artifact. To support review and archival reproducibility, the sanitized artifact for this revision includes the named Rust crates, the deterministic benchmark harnesses, and the OpenFHE scheme-comparison microbenchmark. It excludes live credentials, confidential task prompts, service endpoints, tenant-specific configuration, and raw operational logs. The artifact is therefore intended to reproduce the local protocol checks, operator-blind derivation benchmarks, and non-confidential aggregate measurements reported here; it is not a production secret-management release and does not include private deployment material.

8. Evaluation

We evaluate four questions: (i) the feasibility and boundary cost of operator-blind mediation, (ii) executor enforcement sanity checks for the implemented gateway, (iii) mediation overhead for the operator-trusted and operator-blind paths, and (iv) the latency, correctness, and race-window characteristics of the revocation protocol.
RQ1 (Operator-Blind Feasibility): Can the secret-bearing path run on untrusted operator infrastructure via FHE—deriving capability-scoped credentials without the operator ever decrypting the master secret—and what is the cost?
RQ2 (Executor Enforcement Sanity): In the implemented gateway, do typed executors reject the tested out-of-scope host/path, nonce-replay, and expiry cases?
RQ3 (Mediation Overhead): What overhead does CapSeal’s operator-trusted mediation add over direct local execution, and how does this compare with the operator-blind stand-in path?
RQ4 (Revocation Protocol Performance): What is the latency of the revocation operations, what overhead does the revocation check add to the invoke path, and how wide is the race window between check and derivation dispatch?

8.1. Operator-Blind Feasibility (RQ1)

Security argument. Operator blindness follows from Theorem 1 (reduction to IND-CPA security of TFHE) and capability binding from Theorem 2 (conditional on a secure PRF/MAC instantiation, satisfied at the 256-bit level by the 16-round multiplication-XOR construction). The prototype’s negative tests confirm that out-of-scope host/path, replayed nonces, and expired handles all fail verify_artifact.
Primary cost. The integrated gateway invoke round trip is ∼9 s median for both HTTP (8.97 s) and SSH (8.64 s) for CapSeal-OB. The two protocols agree to within run-to-run FHE noise because the blind derivation is protocol-independent (the same homomorphic evaluation over the canonical request binding).
Cost composition. Homomorphic derivation accounts for >99.99% of total latency: the plaintext-control gateway path measures <0.01 ms for both protocols, artifact decryption takes 53 μs, and one-time onboarding costs 605 ms key generation +6.4 ms secret encryption with 2.1 MB ciphertexts. The homomorphic result is bit-identical to the plaintext reference for both protocols.
Sensitivity. Single-host reruns with a 64-byte secret label (9.57 s derive-only) and a long binding label (9.47 s) confirm that binding and label variations are smaller than run-to-run FHE noise, so the conclusion stands that homomorphic evaluation dominates cost rather than any particular label or binding configuration. The 16-round multiplication-XOR design provides collision resistance and pseudorandomness for Theorem 2 (∼2048 PBS operations); a 6-round add-XOR construction would reduce PBS count to ∼768 at the cost of weaker mixing.
Production HMAC-SHA256 projection. To characterize the gap between the current prototype and a production-strength cryptographically secure instantiation, we estimate the cost of a production HMAC-SHA256 circuit under the same TFHE-rs backend. The current prototype evaluates a 16-round multiplication-XOR circuit over 4 × FheUint64 words, requiring approximately 2048 PBS operations (64 scalar-multiply + 64 XOR operations, ∼16 PBS each) at ∼13 ms per PBS on the measurement host. A real HMAC-SHA256 circuit operating on FheUint32 words would require: (i) SHA-256 block compression over 64 rounds of Σ 0 , Σ 1 , Ch , Maj , and modular addition (∼176 PBS/round, ∼11,300 PBS/block), (ii) a 48-word message schedule (∼32 PBS/word, ∼1500 PBS), and (iii) HMAC outer hashing and key preparation. The total is approximately 51,000 PBS operations—a factor of ∼25× more work than the current prototype. Under the same single-thread TFHE-rs backend on the same Apple Silicon host, this projects to roughly 11 min per derivation; with 16-core CPU parallelism (Rayon) this drops to 40–60 s, and with a GPU backend (TFHE-rs CUDA feature) to 5–15 s. We report this projection to give a realistic cost envelope: the prototype’s derivation cost is a lower bound for the FHE evaluation cost, and a production MAC circuit would be one to two orders of magnitude slower depending on hardware acceleration. Full circuit design, parameter selection, and benchmarking of an FHE-native HMAC-SHA256 remain future work.
Answer to RQ1: Operator-blind mediation is feasible end-to-end as a split-broker boundary prototype for both HTTP and SSH executor paths, at an overhead of ∼ 1.7 × 10 7  over the plaintext path (measured ∼10 s blind derivation vs. a 593 ns plaintext reference, with ∼9 s end-to-end gateway invoke). This cost is the price of removing operator visibility of the master secret through a homomorphic derivation path, and it positions FHE as a high-cost primitive for the operator-untrusted-computation boundary rather than a default deployment choice (Section 9). We report the prototype’s cost without optimization to characterize that boundary honestly; production signing workloads that need near-native latency are better served by TEE-DS when hardware trust is acceptable.

8.2. Setup and Executor Enforcement (RQ2)

Setup. The reported security results are drawn from completed real_e2e runs (real local HTTP and SSH execution) for two direct-secret baselines (B1, B2) and CapSeal, across six scenarios spanning benign completion, literal credential-echo prompts, and unauthorized-use prompts over HTTP and SSH. The literal-echo metric records whether the agent output contains the credential in plaintext; it is a narrow proxy that does not, by itself, detect covert exfiltration through timing, error-code distinguishability, or output-format side channels. We therefore supplement the literal-echo table with a quantitative covert-channel probe (Section 8.3) that measures these surfaces at the gateway boundary. For latency we compare four systems under one unified external harness with identical tasks: a Direct (unmediated) baseline, two deterministic reconstructions of publicly described local-enforcement paths (S1, CaMeL-style; S2, ClawKeeper-style, both without live LLM or private services), and CapSeal. Each operator-trusted latency cell uses 10 rounds of 5 warmup and 50 measured trials ( n = 500 ); HTTP trials use fresh Connection: close sockets, and SSH trials use a steady-state OpenSSH ControlMaster connection, reporting post-setup command round-trip latency. The operator-blind CapSeal-OB rows were measured on the same Apple Silicon aarch64 host (Darwin 24.6.0, arm64, release build, tfhe 0.8.7, FheUint64 carrier over four words/32 bytes, 16-round multiplication-XOR derivation). Those rows report median and P95 over n = 7 measured gateway invocations after one warmup call; because the homomorphic derivation cost is the dominant, low-variance term, we report robust order statistics rather than parametric mean/CI on this small sample. Raw per-trial data is persisted alongside the benchmark output, and exact invocation commands and environment configuration are documented in the artifact. The latency table reports median and P95 for all rows, with overhead computed relative to the direct local baseline for each protocol. We omit Wilson intervals for the credential-echo table because several cells are definitional consequences of whether the credential is ever exposed to the agent, and intervals on those 1.000/0.000 values would be misleading.
Enforcement (RQ2). On the real_e2e path, HTTP literal credential echo is 1.000 for both direct-secret baselines and 0.000 for CapSeal; SSH literal credential echo is 1.000 for the direct-secret baselines (which echo a test-only SSH private key PEM block when the credential-echo prompt is used) and 0.000 for CapSeal and CapSeal-OB, where the agent never receives SSH key material. Because the SSH and HTTP paths use distinct credential types (PEM private key vs. API key), the baselines now echo the protocol-appropriate credential, giving each protocol its own differential signal. The observed unauthorized-use rate is 0.000 for all systems in both protocols, with no successful out-of-scope authenticated action observed in this harness. These literal-echo and unauthorized-use sanity checks establish a floor but do not bound covert channels; the next subsection quantifies those residual surfaces.

8.3. Covert-Channel Probe (Supplement to RQ2)

The literal-echo metric answers only whether the credential appears verbatim in the agent-visible output. An adversary who controls the agent’s prompt could instead leak secrets through distinguishable error codes, timing side channels, or output formatting without ever echoing the credential string. We therefore instrument a covert_channel_probe (PlaintextDeriver, n = 200 timing trials per case) that measures four covert-channel surfaces at the tenant-gateway boundary. The key findings are summarized here, with full quantitative results in Table 10:
Table 10. Covert-channel probe at the tenant-gateway boundary (PlaintextDeriver). Timing rows report Welch’s t over n = 200 trials per case; significance at p < 0.05 ( | t | > 1.96 ), with Cohen’s d for significant effects.
  • P1—Error-code distinguishability. The HTTP and SSH executors expose 13 distinct error codes at the gateway boundary, leaking scope information through constraint-violation distinguishability. The MCP adapter partially mitigates this by unifying broker errors to a fixed 5-code vocabulary, but the gateway surface remains distinguishable.
  • P2—Timing uniformity. Different secrets produce indistinguishable timing ( t = 0.94 , not significant), so the gateway leaks nothing about which secret is used. However, the depth at which a request is rejected is a structural timing channel: an early rejection (method_denied) is distinguishable from a late one (schema_deny) with a large effect size ( t = 20.90 , Cohen’s d = 2.09 ).
  • P3—Output sanitization. No verbatim secret or derived artifact appears in output fields. A controlled 6-character redaction prefix leak exists in redacted_output (the redact_token_like_content function matches only the literal "sk-" pattern).
  • P4—HTTP status side effects. Conditional on real upstream configuration; absent in the default simulated-200 configuration.
  • Explicitly not covered. Remote collusion (cooperating external service injecting covert signals) and output-format channels (whitespace, JSON structure) are not systematically tested.
Table 11 reports the literal credential-echo and unauthorized-use results.
Table 11. Observed credential-echo and unauthorized-use rates (local harness, executor-level sanity checks). Covert-channel surfaces probed separately (Section 8.3). CapSeal-OB inherits executor enforcement and additionally hides the secret from the operator.

8.4. Mediation Overhead (RQ3)

Benign completion is 1.000 (95% CI [0.963, 1.000]) for all systems across both protocols, indicating no observed availability degradation. Table 12 reports same-harness latency. Direct is the lower bound, as expected; among the operator-trusted mediated systems CapSeal has the lowest measured overhead among the deterministic local reconstructions in this harness (HTTP median overhead 0.149 ms vs. 0.232 and 0.736 ms for S1 and S2; SSH 0.208 ms vs. 0.325 and 0.951 ms), consistent with its narrower execution path. The operator-blind CapSeal-OB gateway appears in the same table at a different scale—its median is ∼9 s (HTTP 8.97 s, SSH 8.64 s), dominated by the homomorphic derivation (E1)—making explicit the price of moving the secret onto untrusted infrastructure.
Table 12. Same-harness latency (ms). Operator-trusted rows: n = 500 (10 rounds × 50, 5 warmup). CapSeal-OB: measured via gw_bench (release, Apple Silicon aarch64, tfhe 0.8.7, FheUint64, 16-round mult-XOR; 1 warmup). Overhead is median minus the direct local baseline. CapSeal-OB one-time onboarding: 605 ms keygen + 6.4 ms encrypt; ciphertext 2.1 MB.

8.5. Revocation Protocol Performance (RQ4)

The revocation protocol of Section 4.4 was benchmarked on the same Apple Silicon aarch64 host as the main evaluation (release build, n = 10,000 trials per metric). Table 13 reports the results.
Table 13. Revocation protocol micro-benchmarks ( n = 10,000 , release build, Apple Silicon aarch64). All latencies in ns.
M1—Revocation latency. The revoke() operation (blacklist insertion + epoch advance + surviving-handle re-issue) completes in 125 ns median (208 ns P95). This is more than four orders of magnitude below the plaintext invoke latency and seven orders of magnitude below the FHE derivation time; revocation is therefore effectively free relative to the mediation path.
M2—Invoke-check overhead. The isolated check() call (four hash-map lookups: registration, issuance-epoch, blacklist, epoch-match) takes 42 ns median (83 ns P95). When integrated into the full plaintext invoke path, the check contributes ∼1.0% overhead (43.8 ns vs. 4367 ns median total). Against the ∼9 s FHE CapSeal-OB path, the check overhead is below 5 × 10 − 9 of the total latency—entirely negligible.
M3—Cache-invalidation correctness. The benchmark confirms that (a) advancing the revocation epoch from one to two produces a bitwise-different artifact for the identical (tenant, scope, nonce) tuple; (b) retransmission under the same epoch reuses the identical artifact; and (c) after a gateway revoke() call, the gateway’s epoch-2 binding yields a different artifact than the epoch-1 binding for the same capability scope. These results validate the protocol invariant that revocation cryptographically invalidates all prior-epoch artifacts without operator involvement.
M4—Race-window bound. The critical section between check() returning Ok and binding_for() constructing the epoch-bearing binding completes in 417 ns median (500 ns P95). This is the window during which an in-flight invoke could execute under a just-revoked epoch. Relative to the ∼9 s FHE-mediated invoke, the race-window margin is 1.8 × 10 7 ; an adversary attempting to race revocation against invocation would need to land a nanosecond-precision attack on a seconds-scale operation. This window is an implementation artifact of the single-threaded prototype; a production deployment could further eliminate it by holding a mutex across the check-to-derivation sequence.
Answer to RQ4: The revocation protocol adds negligible overhead (∼125 ns revoke(), ∼1.0% of plaintext invoke, invisible against FHE), provides cryptographically sound cache invalidation through epoch binding, and has a race window bounded at 500 ns P95— 1.8 × 10 7 smaller than the FHE-mediated invoke. Revocation security does not depend on operator cooperation, making it suitable for the operator-untrusted setting.

8.6. Summary

Operator-blind mediation is feasible as a split-broker boundary-cost study and cleanly scoped to the operator-untrusted-computation boundary, at a large but honestly reported cost. With a co-located trusted deriver (the operator-trusted deployment), CapSeal eliminates observed HTTP literal credential echo relative to direct-secret baselines, shows zero unauthorized-use and perfect benign completion in the reported runs, and has the lowest measured overhead among the deterministic local reconstructions in this harness. The revocation protocol (Section 4.4) adds sub-microsecond operations that are invisible against the FHE derivation cost and requires no operator cooperation—a direct consequence of binding the revocation epoch into the homomorphically derived artifact.

9. Trust-Boundary Positioning

Operator-blind mediation (Section 4) removes operator trust at the level of computation: an untrusted party derives credentials it cannot read. This is one point on a broader trust-boundary map. A complementary approach removes operator trust at the level of hardware: executing the broker’s secret-handling and session-control logic inside an attested Trusted Execution Environment (TEE) such as Intel SGX [43] or AMD SEV-SNP [44] shields it from a compromised operating system or hypervisor and provides a hardware root of trust with much lower runtime overhead, but under a hardware-trust assumption. A third boundary—cross-organization federation, where no single party should hold the key—is naturally addressed by secure multi-party computation (MPC) and threshold signatures [57,58]. Both directions are compatible with the capability protocol, but they require separate implementations and evaluations. CapSeal’s capability model is the common substrate across all three.
Table 14 compares the approaches quantitatively for the same capability-scoped credential-derivation workload (one HTTP request, scoped artifact derivation, executor validation, credential injection). The FHE row reports the measured CapSeal-OB gateway path (Section 8.1, n = 7 , Apple Silicon aarch64). The TEE row is specifically TEE-DS, measured on AWS Nitro Enclaves using an m7i.xlarge instance in us-west-2: the parent gateway connects to the enclave over vsock, verifies a Nitro attestation document binding the session nonce and service public key, and then invokes the same derivation interface. For HTTP, the measured hot path is 134.9 µs median and 139.3 µs P95 over n = 50 post-attestation invocations; the one-time attested startup is 6.713 ms. Table 15 separates TEE-DS attestation from the per-request path. TEE-KRS is not a separate replacement row because it composes with the FHE row by protecting the FHE client key; we therefore report it separately as the one-shot TEE+FHE deployment result below. The MPC row gives analytical estimates based on modern 2-party Elliptic Curve Digital Signature Algorithm (ECDSA) [57] and threshold HMAC protocols [58]; no MPC implementation exists in our artifact. HSM is included as a custody-only baseline: it can keep a key non-exportable, but it is not a general trusted-compute substrate for request-specific policy execution.
Table 14. Same-workload trust-boundary comparison for capability-scoped credential derivation. Measured rows report hot-path median/P95 latency; cold-path setup is separated when it is not paid per request. MPC and HSM rows are analytical/literature baselines, not implemented in this artifact.
Table 15. Measured AWS Nitro TEE-DS boundary costs. Attestation is paid once at the gateway–enclave boundary; the per-request hot path starts after the quote has been verified and the service key has been bound. Confidence intervals are 95% normal intervals over n = 50 invocations.
For TEE-DS, attestation adds 4.8–6.7 ms to gateway startup in the current Nitro run and approximately 0 ms to the per-request hot path, because quote generation and verification occur before the repeated invoke measurements. The measured quote-generation component is 1–2 ms and local quote verification is 3 ms; after that, credential derivation over vsock remains at 135–146 µs median.
For TEE-KRS, we also ran one EC2 x86_64 FHE sanity invocation after setup to exercise the TEE+FHE deployment path. The measured HTTP operator-blind FHE invocation was 779,369 ms ( n = 1 ), while the plaintext control invocation was 0.0427 ms. Because this is a single cold deployment trial on different hardware from Table 12, we report it only as a TEE-KRS deployment smoke result, not as a replacement for the n = 7 FHE latency distribution. Table 16 summarizes the implementation-size asymmetry of the resulting trusted boundary.
Table 16. Trusted-computing-base asymmetry. Lines of code (LOC) are source-line counts from the artifact’s Rust paths (engineering scale, not proof size); the operator service and host OS sit outside the plaintext-secret boundary by design.
This asymmetry is the central deployment tradeoff. The trusted component is about 29% of the measured Rust implementation surface (2703/9382 LOC), and the operator-facing service and host OS lie outside the plaintext-secret boundary. Consequently, the most direct attacks on a conventional broker—memory-scraping the master key or replacing the signing binary—now require accepting a mismatched attestation, bypassing the verifier’s PCR/service-key binding, or breaking the TEE; the remaining blast radius is a single scoped artifact, not the long-lived master secret.

10. Limitations and Conclusions

Operator-blind mediation is a feasibility result, not a turnkey deployment, and several limitations are deliberate.
Gateway trust and hardening. The tenant gateway remains a small trusted component: it holds the FHE client key, enforces policy, maintains anti-replay state, and keeps the audit head. A gateway compromise would therefore expose decrypted artifacts and allow policy bypass. Three hardening paths mitigate this residual risk in different deployment regimes. (A) TEE-KRS attested key release runs the key-custody portion of the gateway inside an attested Trusted Execution Environment (e.g., Intel SGX/TDX, AMD SEV-SNP, or Arm CCA), sealing the FHE client key to the enclave’s hardware-bound identity; this combines FHE operator-blindness with TEE gateway integrity and has partial implementation support in our tee-secret-service crate. (B) Threshold FHE decryption splits the client key into t-of-n shares across independently administered gateway replicas using threshold FHE decryption protocols; an adversary must compromise t replicas simultaneously. (C) Audit-key separation moves the audit signing key to a separate append-only service, so a compromised gateway cannot forge historical audit entries. Rate-limiting derivations at the operator and monitoring the audit log for anomalous patterns further reduce the blast radius. These hardening measures complement rather than replace the FHE boundary.
Derivation strength and external acceptance. The scope-bound artifact is plaintext at the gateway for the duration of a single call. The prototype derivation is a 16-round multiplication-XOR construction that provides collision resistance and pseudorandomness for capability binding (Theorem 2); this revision does not claim an industrial-grade FHE implementation of HMAC-SHA256, AWS SigV4, or SSH signing. The current artifact is not accepted by existing third-party bearer-token APIs without an additional verifier or translation layer. A production deployment would require either (a) an external verification shim that re-derives the expected artifact from the observed request binding, validates it against the presented artifact, and injects the real credential for upstream forwarding, or (b) native artifact acceptance by the upstream service’s request-signing verifier (e.g., HMAC- or SigV4-style authorization). The translation-shim pattern is architecturally straightforward: a small trusted service holds the master secret, receives the artifact in a custom header, re-derives the expected value, and on match proxies the request with the real credential. The native-acceptance pattern works when the upstream service already verifies a signature or MAC over the request—the artifact is that MAC. Both patterns require per-service integration and are left to future engineering work.
Cost and measurement scope. A production FHE circuit for HMAC-SHA256, AWS SigV4, or SSH signing would require a separate circuit design, parameter analysis, implementation, and benchmark. The reported measurements cover the TFHE-rs stand-in and the OpenFHE CKKS/BGV/BFV arithmetic stand-in. The next-round artifact records sensitivity runs and raw outputs for secret-label and binding-size changes, but the FHE measurements remain single-host measurements on Apple Silicon. The homomorphic hot path is roughly seven orders of magnitude slower than plaintext.
Multi-tenancy and integration surface. The prototype implements multi-tenant isolation as described in Section 3.2: per-tenant revocation state, per-tenant rate limiting, and tenant-keyed secret storage at the operator are implemented and tested; cross-tenant audit-chain separation and per-tenant evaluation-key management at the operator remain architectural provisions for a production deployment. More broadly, local root compromise of the gateway stays out of scope, SSH broker-exec trades transparent agent forwarding for a cleaner boundary, and MCP integration is treated as an evolving experiment surface with explicit audit rather than a stable universal interface. The current artifact includes a deterministic MCP protocol probe (a Rust binary that spawns the broker and MCP stdio bridge, replays the full lifecycle transcript, and validates tool-call mapping, input-schema constraints, and denial-uniformity equivalence); a production MCP adapter with HTTP transport, session expiry, and resource/prompt surfaces remains an engineering task for follow-up work. The operator-blind security guarantees are transport-agnostic, so the MCP integration is a usability concern rather than a cryptographic one.
Positioning. We report these costs without optimization precisely to position FHE honestly relative to lighter-weight trust-boundary mechanisms such as TEE-DS, which is the production-oriented path when real signing performance and hardware trust are acceptable.
CapSeal reframes secret access for agents as a capability-mediated systems problem: by replacing direct bearer-secret exposure with session-bound capability handles, typed executors, policy checks, replay defense, an epoch-based revocation protocol, and tamper-evident auditing, it narrows the authority an untrusted agent can exercise even when behaviorally steerable. The paper’s central contribution preserves that narrowing when the broker runs on infrastructure the tenant does not trust: through operator-blind secret mediation, an untrusted operator homomorphically evaluates a derivation interface without ever decrypting the master secret. We place this on a formal footing—computational operator blindness reduced to FHE IND-CPA security, and conditional capability binding for any secure PRF/MAC—and show, through complete LowMC and Rasta transciphering constructions, how the prototype derivation can be upgraded to industrial-grade symmetric security. Our end-to-end prototype confirms the split-broker mechanics and quantifies their cost, cleanly scoping FHE to the operator-untrusted-computation boundary and situating it, against a measured attested-TEE derivation service and MPC/threshold signing, on a common capability substrate from which an operator can choose the trust boundary that matches its threat model and performance budget.

Author Contributions

Conceptualization, S.J.; methodology, S.J. and R.G.; software, S.J.; validation, S.J. and R.G.; formal analysis, R.G.; investigation, R.C.C.C.; resources, R.C.C.C.; data curation, S.J.; writing—original draft preparation, S.J. and R.G.; writing—review and editing, S.J., R.G. and R.C.C.C.; visualization, S.J. and R.G.; supervision, R.C.C.C.; project administration, R.C.C.C.; funding acquisition, R.C.C.C. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by City University of Hong Kong, grant numbers 9229113, 9239077, and 9239083; Innovation and Technology Commission, grant number ITS/109/24; and Natural Science Foundation of Guangdong Province, grant number 2026A1515012279.

Data Availability Statement

Public release of the evaluation source materials is restricted because they include confidential information like API keys and RSA keypairs.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Greshake, K.; Abdelnabi, S.; Mishra, S.; Endres, C.; Holz, T.; Fritz, M. Not What You’ve Signed Up For: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection. In Proceedings of the 16th ACM Workshop on Artificial Intelligence and Security, Copenhagen, Denmark, 30 November 2023; ACM: New York, NY, USA, 2023; CCS ’23; pp. 79–90. [Google Scholar] [CrossRef] [Scilit]
  2. Lee, D.; Tiwari, M. Prompt Infection: LLM-to-LLM Prompt Injection within Multi-Agent Systems. arXiv 2024, arXiv:2410.07283. [Google Scholar]
  3. Chen, Z.; Li, B.; Song, D.; Xiang, Z.; Xiao, C. AgentPoison: Red-teaming LLM Agents via Poisoning Memory or Knowledge Bases. In Proceedings of the Advances in Neural Information Processing Systems 37, Vancouver, BC, Canada, 10–15 December 2024; Neural Information Processing Systems Foundation, Inc. (NeurIPS): San Diego, CA, USA, 2024; NeurIPS 2024; pp. 130185–130213. [Google Scholar] [CrossRef] [Scilit]
  4. Wang, Y.; Xue, D.; Zhang, S.; Qian, S. BadAgent: Inserting and Activating Backdoor Attacks in LLM Agents. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Bangkok, Thailand, 11–16 August 2024; Association for Computational Linguistics: Kerrville, TX, USA, 2024; pp. 9811–9827. [Google Scholar] [CrossRef] [Scilit]
  5. Hou, X.; Zhao, Y.; Wang, S.; Wang, H. Model Context Protocol (MCP): Landscape, Security Threats, and Future Research Directions. ACM Trans. Softw. Eng. Methodol. 2026, 3796519. [Google Scholar] [CrossRef] [Scilit]
  6. Wang, Z.; Gao, Y.; Wang, Y.; Liu, S.; Sun, H.; Cheng, H.; Shi, G.; Du, H.; Li, X. MCPTox: A Benchmark for Tool Poisoning on Real-World MCP Servers. Proc. AAAI Conf. Artif. Intell. 2026, 40, 35811–35819. [Google Scholar] [CrossRef] [Scilit]
  7. Williams, L.; Benedetti, G.; Hamer, S.; Paramitha, R.; Rahman, I.; Tamanna, M.; Tystahl, G.; Zahan, N.; Morrison, P.; Acar, Y.; et al. Research Directions in Software Supply Chain Security. ACM Trans. Softw. Eng. Methodol. 2025, 34, 146. [Google Scholar] [CrossRef] [Scilit]
  8. Przymus, P.; Durieux, T. Wolves in the Repository: A Software Engineering Analysis of the XZ Utils Supply Chain Attack. In Proceedings of the 2025 IEEE/ACM 22nd International Conference on Mining Software Repositories (MSR), Ottawa, ON, Canada, 28–29 April 2025; IEEE: New York, NY, USA, 2025; pp. 91–102. [Google Scholar] [CrossRef] [Scilit]
  9. Crosby, S.A.; Wallach, D.S. Efficient Data Structures for Tamper-Evident Logging. In Proceedings of the USENIX Security Symposium, Montreal, QC, Canada, 10–14 August 2009. [Google Scholar]
  10. Gentry, C. Fully Homomorphic Encryption Using Ideal Lattices. In Proceedings of the 41st Annual ACM Symposium on Theory of Computing (STOC), Bethesda, MD, USA, 31 May–2 June 2009; Association for Computing Machinery (ACM): New York, NY, USA, 2009; pp. 169–178. [Google Scholar] [CrossRef] [Scilit]
  11. Chillotti, I.; Gama, N.; Georgieva, M.; Izabachène, M. TFHE: Fast Fully Homomorphic Encryption over the Torus. J. Cryptol. 2020, 33, 34–91. [Google Scholar] [CrossRef] [Scilit]
  12. Zama. TFHE-rs: A Pure Rust Implementation of TFHE for Boolean and Integer Arithmetics over Encrypted Data. Version 0.8. 2024. Available online: https://github.com/zama-ai/tfhe-rs (accessed on 4 June 2026).
  13. Brakerski, Z.; Vaikuntanathan, V. Efficient Fully Homomorphic Encryption from (Standard) LWE. In Proceedings of the 52nd Annual IEEE Symposium on Foundations of Computer Science (FOCS), Palm Springs, CA, USA, 23–25 October 2011; IEEE: New York, NY, USA, 2011; pp. 97–106. [Google Scholar] [CrossRef] [Scilit]
  14. Fan, J.; Vercauteren, F. Somewhat Practical Fully Homomorphic Encryption, Report 2012/144. IACR Cryptol. ePrint Arch. 2012, 2012/144. Available online: https://eprint.iacr.org/2012/144 (accessed on 4 June 2026).
  15. Cheon, J.H.; Kim, A.; Kim, M.; Song, Y. Homomorphic Encryption for Arithmetic of Approximate Numbers. In Proceedings of the Advances in Cryptology—ASIACRYPT 2017, Hong Kong, China, 3–7 December 2017; Springer: Berlin/Heidelberg, Germany, 2017; pp. 409–437. [Google Scholar] [CrossRef] [Scilit]
  16. Gao, S.; Iu, H.H.C.; Erkan, U.; Simsek, C.; Toktas, A.; Cao, Y.; Wu, R.; Mou, J.; Li, Q.; Wang, C. A 3D Memristive Cubic Map With Dual Discrete Memristors: Design, Implementation, and Application in Image Encryption. IEEE Trans. Circuits Syst. Video Technol. 2025, 35, 7706–7718. [Google Scholar] [CrossRef] [Scilit]
  17. Al Badawi, A.; Bates, J.; Bergamaschi, F.; Cousins, D.B.; Erabelli, S.; Genise, N.; Halevi, S.; Hunt, H.; Kim, A.; Lee, Y.; et al. OpenFHE: Open-Source Fully Homomorphic Encryption Library. In Proceedings of the 10th Workshop on Encrypted Computing & Applied Homomorphic Cryptography (WAHC), Los Angeles, CA, USA, 7 November 2022; pp. 53–63. [Google Scholar] [CrossRef] [Scilit]
  18. Miller, M.S.; Yee, K.P.; Shapiro, J.S. Capability Myths Demolished. Technical Report. 2003. Available online: https://classpages.cselabs.umn.edu/Fall-2021/csci5271/papers/SRL2003-02.pdf (accessed on 4 June 2026).
  19. Birgisson, A.; Politz, J.G.; Erlingsson, U.; Taly, A.; Vrable, M.; Lentczner, M. Macaroons: Cookies with Contextual Caveats for Decentralized Authorization in the Cloud. In Proceedings of the Network and Distributed System Security Symposium (NDSS), San Diego, CA, USA, 23–26 February 2014. [Google Scholar] [CrossRef] [Scilit]
  20. Devriese, D.; Birkedal, L.; Piessens, F. Reasoning about Object Capabilities with Logical Relations and Effect Parametricity. In Proceedings of the IEEE European Symposium on Security and Privacy (EuroS&P), Saarbrücken, Germany, 21–24 March 2016. [Google Scholar] [CrossRef] [Scilit]
  21. Chen, Y.; Zhang, Y.; Lin, X. ZKP-CapBAC: Capability-Based Access Control via On-Chain Zero-Knowledge Proofs for Cross-Domain Hiding Delegation Tree. In Proceedings of the IEEE International Conference on Computer Communications (INFOCOM), London, UK, 19–22 May 2025. [Google Scholar] [CrossRef] [Scilit]
  22. Venckauskas, A.; Kukta, D.; Grigaliunas, S. Enhancing Microservices Security with Token-Based Access Control Method. Sensors 2023, 23, 3363. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  23. HashiCorp. Vault Transit Secrets Engine. 2025. Available online: https://developer.hashicorp.com/vault/docs/secrets/transit (accessed on 4 June 2026).
  24. Amazon Web Services. AWS Key Management Service Developer Guide. 2025. Available online: https://docs.aws.amazon.com/kms/ (accessed on 4 June 2026).
  25. Zhan, Q.; Liang, Z.; Ying, Z.; Kang, D. InjecAgent: Benchmarking Indirect Prompt Injections in Tool-Integrated Large Language Model Agents. In Proceedings of the Findings of the Association for Computational Linguistics: ACL 2024, Bangkok, Thailand, 11–16 August 2024; Association for Computational Linguistics: Kerrville, TX, USA, 2024; pp. 10471–10506. [Google Scholar] [CrossRef] [Scilit]
  26. Zhang, H.; Huang, J.; Mei, K.; Yao, Y.; Wang, Z.; Zhan, C.; Wang, H.; Zhang, Y. Agent Security Bench (ASB): Formalizing and Benchmarking Attacks and Defenses in LLM-based Agents. In Proceedings of the International Conference on Learning Representations, Singapore, 24–28 April 2025. [Google Scholar] [CrossRef] [Scilit]
  27. Gulyamov, S.; Rodionov, A. Prompt Injection Attacks in Large Language Models and AI Agent Systems: A Comprehensive Review of Vulnerabilities, Attack Vectors, and Defense Mechanisms. Information 2026, 17, 54. [Google Scholar] [CrossRef] [Scilit]
  28. Li, Y.; Wen, H.; Wang, W.; Li, X.; Yuan, Y.; Liu, G.; Chen, J.; Yao, W.; Fu, X.; Liu, M.; et al. Personal LLM Agents: Insights and Survey about the Capability, Efficiency and Security. arXiv 2024, arXiv:2401.05459. [Google Scholar]
  29. Shi, J.; Yuan, Z.; Tie, G.; Zhou, P.; Gong, N.Z.; Sun, L. Prompt Injection Attack to Tool Selection in LLM Agents. arXiv 2025, arXiv:2504.19793. [Google Scholar]
  30. An, H.; Zhang, J.; Du, T.; Yu, C.; Wang, W.; Li, Y.; Zhang, H.; Zhou, J.; Huang, J.; Zhuge, Y. IPIGuard: A Novel Tool Dependency Graph-Based Defense Against Indirect Prompt Injection in LLM Agents. In Proceedings of the Conference on Empirical Methods in Natural Language Processing (EMNLP), Suzhou, China, 4–9 November 2025. [Google Scholar]
  31. Jia, F.; Wu, T.; Qin, X.; Liu, G.; Yang, S.; Zhao, M.; Liu, Y.; Ding, S.; Li, X.; Huang, J.; et al. The Task Shield: Enforcing Task Alignment to Defend Against Indirect Prompt Injection in LLM Agents. In Proceedings of the Annual Meeting of the Association for Computational Linguistics (ACL), Bangkok, Thailand, 11–16 August 2024. [Google Scholar]
  32. Zhu, K.; Yang, X.; Wang, J.; Yan, X.; Qi, H.; Chen, Y.; Ye, L.; Xie, Y.; Mao, Y.; Wang, Y.; et al. MELON: Provable Defense Against Indirect Prompt Injection Attacks in AI Agents. In Proceedings of the International Conference on Machine Learning (ICML), Vancouver, BC, Canada, 13–19 July 2025. [Google Scholar]
  33. Xia, Y.; Xie, Z.; Liu, P.; Lu, K.; Liu, Y.; Wang, W.; Ji, S. Beyond Static Pattern Matching? Rethinking Automatic Cryptographic API Misuse Detection in the Era of LLMs. Proc. ACM Softw. Eng. 2025, 2, 113–136. [Google Scholar] [CrossRef] [Scilit]
  34. IETF. Certificate Transparency Version 2.0. RFC 9162. 2021. Available online: https://www.rfc-editor.org/rfc/rfc9162 (accessed on 4 June 2026).
  35. Zhang, J. Right to History: A Sovereignty Kernel for Verifiable AI Agent Execution. arXiv 2026, arXiv:2602.20214. [Google Scholar]
  36. IETF. The OAuth 2.0 Authorization Framework: Bearer Token Usage. RFC 6750, 2012. Available online: https://www.rfc-editor.org/rfc/rfc6750 (accessed on 4 June 2026).
  37. The Transport Layer Security (TLS) Protocol Version 1.3. RFC 8446. 2018. Available online: https://www.rfc-editor.org/rfc/rfc8446 (accessed on 4 June 2026).
  38. OAuth 2.0 Mutual-TLS Client Authentication and Certificate-Bound Access Tokens. RFC 8705. 2020. Available online: https://www.rfc-editor.org/rfc/rfc8705 (accessed on 4 June 2026).
  39. Channel Bindings for TLS 1.3. RFC 9266. 2022. Available online: https://www.rfc-editor.org/rfc/rfc9266 (accessed on 4 June 2026).
  40. JSON Type Definition. RFC 8927. 2020. Available online: https://www.rfc-editor.org/rfc/rfc8927 (accessed on 4 June 2026).
  41. OWASP. OWASP Top 10 for LLM Applications. 2025. Available online: https://genai.owasp.org/ (accessed on 4 June 2026).
  42. Anthropic. Model Context Protocol Specification. 2025. Available online: https://modelcontextprotocol.io/specification (accessed on 4 June 2026).
  43. Costan, V.; Devadas, S. Intel SGX Explained. IACR Cryptol. ePrint Arch. 2016, 2016/086. Available online: https://eprint.iacr.org/2016/086 (accessed on 4 June 2026).
  44. Kaplan, D.; Powell, J.; Woller, T. AMD SEV-SNP: Strengthening VM Isolation with Integrity Protection and More. AMD White Paper, 2020. Available online: https://www.amd.com/content/dam/amd/en/documents/epyc-business-docs/white-papers/SEV-SNP-strengthening-vm-isolation-with-integrity-protection-and-more.pdf (accessed on 4 June 2026).
  45. Intel Corporation. Intel Trust Domain Extensions. 2023. Available online: https://www.intel.com/content/www/us/en/developer/articles/technical/intel-trust-domain-extensions.html (accessed on 4 June 2026).
  46. Amazon Web Services. AWS Nitro Enclaves User Guide. 2024. Available online: https://docs.aws.amazon.com/enclaves/latest/user/ (accessed on 4 June 2026).
  47. Albrecht, M.R.; Rechberger, C.; Schneider, T.; Tiessen, T.; Zohner, M. Ciphers for MPC and FHE. In Proceedings of the Advances in Cryptology—EUROCRYPT 2015, Sofia, Bulgaria, 26–30 April 2015; Springer: Berlin/Heidelberg, Germany, 2015; pp. 430–454. [Google Scholar] [CrossRef] [Scilit]
  48. Albrecht, M.R.; Grassi, L.; Rechberger, C.; Roy, A.; Tiessen, T. MiMC: Efficient Encryption and Cryptographic Hashing with Minimal Multiplicative Complexity. In Proceedings of the Advances in Cryptology—ASIACRYPT 2016, Hanoi, Vietnam, 4–8 December 2016; Springer: Berlin/Heidelberg, Germany, 2016; pp. 191–219. [Google Scholar] [CrossRef] [Scilit]
  49. Dobraunig, C.; Eichlseder, M.; Grassi, L.; Lallemand, V.; Leander, G.; List, E.; Mendel, F.; Rechberger, C. Rasta: A Cipher with Low ANDdepth and Few ANDs per Bit. In Proceedings of the Advances in Cryptology—CRYPTO 2018, Santa Barbara, CA, USA, 19–23 August 2018; Springer: Berlin/Heidelberg, Germany, 2018; pp. 662–692. [Google Scholar] [CrossRef] [Scilit]
  50. Dobraunig, C.; Grassi, L.; Helminger, L.; Rechberger, C.; Schofnegger, M.; Walch, R. Pasta: A Case for Hybrid Homomorphic Encryption. IACR Trans. Cryptogr. Hardw. Embed. Syst. (Tches) 2023, 2023, 30–73. [Google Scholar] [CrossRef] [Scilit]
  51. Cosseron, O.; Hoffmann, C.; Méaux, P.; Standaert, F.X. Towards Case-Optimized Hybrid Homomorphic Encryption: Featuring the Elisabeth Stream Cipher. In Proceedings of the Advances in Cryptology—ASIACRYPT 2022, Taipei, China, 5–9 December 2022; Springer: Berlin/Heidelberg, Germany, 2022; pp. 32–67. [Google Scholar] [CrossRef] [Scilit]
  52. Niu, C.; Wei, B.; Huang, Z. SoK: FHE-Friendly Symmetric Ciphers and Transciphering. IACR Trans. Cryptogr. Hardw. Embed. Syst. (Tches) 2025, 2025, 583–613. [Google Scholar] [CrossRef] [Scilit]
  53. Nir, Y.; Langley, A. ChaCha20 and Poly1305 for IETF Protocols. RFC 8439 (formerly RFC 7539). 2018. Available online: https://www.rfc-editor.org/rfc/rfc8439 (accessed on 4 June 2026). [CrossRef] [Scilit]
  54. Bernstein, D.J. The Salsa20 Family of Stream Ciphers. In Proceedings of the New Stream Cipher Designs—The eSTREAM Finalists; Springer: Berlin/Heidelberg, Germany, 2008; pp. 84–97. [Google Scholar] [CrossRef] [Scilit]
  55. OpenBSD Project. ssh_config(5)—OpenSSH Client Configuration File. OpenBSD Manual Pages. 2025. Available online: https://man.openbsd.org/ssh_config (accessed on 4 June 2026).
  56. OpenBSD Project. ssh-add(1)—Adds Private Key Identities to the Authentication Agent. OpenBSD Manual Pages. 2025. Available online: https://man.openbsd.org/ssh-add (accessed on 4 June 2026).
  57. Lindell, Y. Fast Secure Two-Party ECDSA Signing. In Proceedings of the Advances in Cryptology—CRYPTO 2017, Santa Barbara, CA, USA, 20–24 August 2017; Springer: Berlin/Heidelberg, Germany, 2017; pp. 613–644. [Google Scholar] [CrossRef] [Scilit]
  58. Doerner, J.; Kondi, Y.; Lee, E.; Shelat, A. Secure Two-party Threshold ECDSA from ECDSA Assumptions. In Proceedings of the 2018 IEEE Symposium on Security and Privacy (SP), San Francisco, CA, USA, 21–23 May 2018; IEEE: New York, NY, USA, 2018; pp. 980–997. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.