How Much Encryption Error Can a Secret-Keeping Controller Absorb?

A controller can be designed so that an outside observer watching a robot or vehicle cannot tell where it started or whether it visited a sensitive place. Formal methods researchers call this property opacity. A controller can also run on an untrusted cloud server under homomorphic encryption, which computes directly on encrypted numbers so the server never sees the plant's state. Engineers who want both protections face a problem nobody has addressed. Encrypted arithmetic is slightly wrong: it rounds, approximates nonlinear functions with polynomials, and adds error every time it refreshes a ciphertext. Those small errors move the physical trajectory, and a moved trajectory can break the careful matching between secret and non-secret behaviors that opacity relies on. Today, encryption parameters are chosen to keep the loop stable and decryption correct. Nobody checks whether the encrypted system still keeps its secrets.

We propose to choose encryption parameters with opacity as an explicit constraint. The mechanism is simple. Treat each encrypted control step as the plaintext step plus a bounded error whose size depends on the parameters. Use a differentiable simulator of the closed loop to compute exactly how errors injected at each step move the observed outputs, including for nonlinear and open-loop unstable plants where existing theory does not apply. The result is a computable "opacity error budget." The cheapest parameter set that fits inside it is the one to deploy.

Core Claim

The claim is that the right parameters for an encrypted, opacity-preserving controller can be different from, and sometimes stricter than, the parameters that guarantee stability and correctness. The parameters in question are the ring dimension $N$, the ciphertext modulus $q$, the scaling factor $\Delta$, and the degree and period of the bootstrapping polynomial (bootstrapping is the noise-refreshing step). We further claim that the gap between the two choices can be computed for nonlinear plants by adjoint sensitivity analysis through a differentiable simulator. That analysis replaces the incremental input-to-state stability (δ-ISS) assumption, a strong contraction condition on the dynamics, and the linear-time-invariant restriction of current analyses.

The bridge comes from the theory of approximate opacity-preserving simulation relations. On Approximate Opacity of Cyber-Physical Systems and its stochastic extension On Approximate Opacity of Stochastic Control Systems show the following. If two systems are related by such a relation with precision $\hat\varepsilon$, an opacity guarantee on one transfers to the other with its precision loosened by $2\hat\varepsilon$. Those papers use the relation to connect a continuous plant to a finite grid abstraction. We use it a second time, to connect the plaintext closed loop to its encrypted implementation. The encryption precision then enters as a single scalar. With $\theta$ the encryption parameters, $X_0$ the initial set, $e_t$ the arithmetic error at step $t$ with $|e_t| \le \eta_t(\theta)$ given by standard noise-growth models, and $y_k$ versus $y_k^{\mathrm{enc}}$ the plaintext and encrypted outputs at step $k$, the quantity is

$$ \varepsilon(\theta) = \sup_{x_0 \in X_0}\ \sup_{|e_t| \le \eta_t(\theta)}\ \max_{k \le T} \lVert y_k^{\mathrm{enc}} - y_k \rVert , $$

and the deployment rule is to minimize latency subject to 128-bit security, decryption correctness, and $2\varepsilon(\theta) \le m$. Here $m$ is the spare opacity margin of the plaintext design. To first order, the inner supremum equals $\sum_{t<k} \lVert \partial y_k / \partial e_t \rVert_{*}\, \eta_t(\theta)$, where $\lVert\cdot\rVert_*$ is the dual norm. That sum is a weighted sum of exactly the Jacobians a differentiable simulator returns in one backward pass. It also identifies the worst-case alignment of error signs, which random noise injection will almost never hit.

Research Program

The first component is the encrypted-implementation simulation relation. Starting from the InitSOP and CurSOP relations (relations that preserve initial-state and current-state opacity) in On Approximate Opacity of Cyber-Physical Systems, we prove that an encrypted implementation with output deviation at most $\varepsilon(\theta)$ is related to its plaintext loop. The proof must handle two error types that differ from ordinary disturbances. The first is CKKS fixed-point rounding, which has an absolute bound. The second is bootstrapping error. Bootstrapping Guarantees: Stability and Performance Analysis for Dynamic Encrypted Control shows that bootstrapping error is sector-bounded: its size scales with the state, and it occurs periodically. We reuse that paper's sector model and its lifted, periodic view, but we push them through an opacity relation rather than a stability inequality. Piecewise actuation of the kind in FHECAP, where saturation and dead zones are evaluated exactly through homomorphic comparison and multiplexing, adds no approximation error away from switching boundaries. Near those boundaries we treat it as a bounded set-valued perturbation.

The second component is the sensitivity engine. We implement the closed loop (plant, controller, and error injection points) in JAX, building on the differentiable-primitives design of JAX MD. This yields both the first-order budget and a gradient-ascent falsifier, which searches over error sequences and initial states for the largest output deviation. For soundness on low-dimensional plants, we bound the second-order remainder using Lipschitz bounds on the Jacobian over a covering of $X_0$. That gives a certified $\varepsilon$. For higher-dimensional plants we report the first-order estimate paired with the falsifier's lower bound, and we label it as unverified. Long-horizon gradient instability, a known weakness of differentiable simulation noted in gradSim, is mitigated here because we differentiate with respect to small additive errors around a fixed nominal trajectory, not with respect to physical parameters across a whole optimization.

The third component is the parameter search. The candidate space contains a handful of ring dimensions, modulus and scale bit-widths, and bootstrapping degrees and periods. Security feasibility comes from the lattice tables in Security Guidelines for Implementing Homomorphic Encryption. Each candidate needs one sensitivity evaluation, so exhaustive search is cheap. Gradients are used to compute $\varepsilon$, not to search over $\theta$.

Baselines

The naive reference point is maximal parameters: the largest standard ring dimension with generous modulus and scale. This makes $\varepsilon$ essentially zero and costs the most latency. It is run with the same plant, controller, and encryption library, and it defines the latency we try to cut while keeping the same certified opacity.

The strongest existing method is stability- and correctness-driven parameter selection. It combines the noise-tracking derivation of FHECAP with the lifted sector-bound analysis of Bootstrapping Guarantees. On its own second-order LTI benchmark, that paper reports an $\ell_2$-gain bound of 3.97 from the lifted test, 5.13 from the basic test, and an empirical lower bound of 1.88 over 10,000 steps. We rerun this selector on every plant, for linear plants and for local linearizations of nonlinear ones, with the same security level and library. We then check whether the parameters it picks preserve opacity. The proposal beats this baseline in either of two ways. It may expose plants where stability-driven parameters silently break the opacity certificate, demonstrated by our falsifier or by an inference attack. Or it may certify opacity at lower latency than the maximal-parameter reference. As a sanity check, on the LTI plant our first-order budget is exact, so the computed gain should sit no higher than the 3.97 lifted bound, and the gap to 1.88 should be explainable by worst-case error alignment. We found no reported result on Lacuna for opacity preservation under encrypted control, so there is no prior number to beat on the opacity metric itself.

The key ablation replaces our adjoint-based $\varepsilon$ with a global Lipschitz bound of the kind implied by δ-ISS constructions. For unstable plants such a bound diverges with the horizon, and for stable plants it should be loose. A second ablation replaces the worst-case error alignment with randomly sampled CKKS noise, to measure how much leakage Monte Carlo testing misses.

Why not just…?

Why not just use the largest parameters and stop worrying? For some plants this is the right answer, and we will report those cases rather than hide them. It fails where latency matters. FHECAP reports latency differences of 4x to 1000x across encrypted controller designs for linear transformations, which shows that parameter and architecture choices dominate real-time feasibility. The maximal-parameter baseline measures directly whether the proposal saves anything on each benchmark.

Why not just reuse the stability bound, since a stable loop with small error stays close to the plaintext loop? Stability bounds an energy-type gain, while opacity needs the pointwise output deviation to stay inside a margin for every initial state. The two can disagree in either direction. Existing analyses are also linear-only: Bootstrapping Guarantees is restricted to LTI systems. The baseline comparison above tests exactly whether stability-chosen parameters break opacity.

Why not just simulate the encrypted loop with random noise and check opacity empirically? Encryption error behaves like random noise on average, but opacity is a worst-case, all-trajectories property. As Secure-by-Construction Synthesis of Cyber-Physical Systems stresses, empirical testing cannot certify it. The Monte Carlo ablation quantifies the gap. If random sampling reliably finds the same worst cases as the adjoint falsifier, the soundness argument still stands, but we would concede that the falsifier adds little in practice.

Why not just add deliberate dithering noise to recover any lost margin? Dithering helps if the observer cannot model it. But it also perturbs the mimic trajectories the opacity relation depends on, and it consumes encryption noise budget. It changes the plaintext design rather than answering how much encryption error a given design tolerates, so we treat it as a design choice outside our scope.

Proposed Experiments

We use four plants. Two are low-dimensional and give certified results: the second-order LTI plant with an LQG controller from Bootstrapping Guarantees, and a DeepRacer-style vehicle model with a secret initial region, following Secure-by-Construction Synthesis of Cyber-Physical Systems, which reports no numerical results. The other two are nonlinear and give estimates: the spacecraft rendezvous task with piecewise thruster actuation from FHECAP, and an open-loop unstable cart-pole of the kind used in Accelerated Learning with Linear Temporal Logic using Differentiable Simulation, chosen because δ-ISS fails there.

For each plant, we first certify initial-state opacity of the plaintext loop on a grid abstraction. We then compute $\varepsilon(\theta)$ across the parameter grid, select parameters, and run the real encrypted loop with a CKKS/TFHE implementation, using GPU acceleration in the style of cuHE.

The metrics are latency per control step; certified and falsified $\varepsilon$; whether the transferred opacity certificate holds; and the accuracy of a learned observer that tries to classify the secret initial region from encrypted-loop outputs.

Two checks decide whether the idea is worth pursuing. The first is whether, on at least one nonlinear plant, stability-chosen parameters admit an error sequence that breaks the margin, together with a measurable rise in observer accuracy. The second is whether the certified budget lets parameters fall below the maximal setting with real latency savings and no observer gain. If neither check succeeds, then opacity adds no constraint beyond stability, and we will report that as a negative result.