# In-Field Quantum-Protected Control-Based Key Distribution with a Lossy Urban Fiber Link
## 4 System Configuration  
In this section, we explain the particular selection of these parameters in our setup based on how signal and postprocessing parameters affect the secret key generation rate. In the case where postselection yields the outcomes 0 and 1 with equal probability and postprocessing includes advantage distillation with block length \(M\), the secret key rate (in bits per channel use) is given by the Devetak-Winter formula [34] as follows:  
\[R=\frac{p_{\text{cr}}}{M}\Big{(}p_{\text{err}}^{M}+(1-p_{\text{err}})^{M} \Big{)}[1-f(\hat{p}_{\text{err}})h_{2}(\hat{p}_{\text{err}})-I_{M}(\text{A}, \text{E})], \tag{1}\]  
Figure 2: OTDR trace of the transmission line. This reflectogram, plotting backscattered power as a function of distance, allows one to isolate localized leakages exploitable by [PERSON] from the natural, uniformly distributed losses caused by Rayleigh scattering on density fluctuations in the fiber. The natural losses are responsible for the trace’s linear decay. The start and end points of the localized leaks are highlighted by the green markers. The blue and red regions of the plot lie within [PERSON]’s and [PERSON]’s respective controlled environments, making the respective leakages inaccessible to [PERSON]. In total, the interceptible localized leakage amounts to 20.4% (0.993 dB), while the natural losses account for 13.6% (0.635 dB). where \(p_{\zeta^{\prime}}\) is the proportion of bits that are not discarded at the postselection stage, \(h_{2}(\cdot)\) is the binary entropy function, \(p_{\text{err}}\) and \(\tilde{p}_{\text{err}}=p_{\text{err}}^{M}/\left(p_{\text{err}}^{M}+(1-p_{\text{ err}})^{M}\right)\) are the BERs before and after advantage distillation, respectively, \(f(\tilde{p}_{\text{err}})\geq 1\) is the efficiency factor for the employed error-correcting code, and \(I_{M}(A,E)\) is mutual information between [PERSON] and [PERSON] after postselection and advantage distillation. In its explicit form, provided in Section 7.2 in Methods, \(I_{M}(A,E)\) depends on \(r_{\text{E}}\), the intensities \(\mu_{0}\) and \(\mu_{1}\) of the signals encoding bits 0 and 1, respectively, and the choice of \(M\). As we mentioned above, \(M\) is the length of blocks into which [PERSON] and [PERSON] split their raw bit strings. A detailed derivation of Equation (1) can be found in Ref. [22]. The resulting analytical expression defines the set of system parameters--namely, the intensities \(\mu_{0}\) and \(\mu_{1}\), the advantage distillation block size \(M\), and the privacy amplification compression factor--that ensure a positive secret key rate at the specified value of \(r_{\text{E}}\). In principle, all of these parameters could be adaptively selected to maximize \(R\) each time users update the value of \(r_{\text{E}}\). In the present experiment, however, we adopt a simpler strategy: we only adapt the privacy amplification compression factor when \(r_{\text{E}}\) changes, while keeping the other parameters fixed throughout all protocol runs. The signal intensities \(\mu_{0}\) and \(\mu_{1}\) are selected to ensure that, for a \(r_{\text{E}}\) of around 20% (as observed in the experiment), the secret key rate \(R\) from Equation (1) remains positive, which corresponds to an informational advantage over [PERSON]. Specifically, using Equation (1), for various \(\mu_{0}\) and \(\mu_{1}\) we calculate the critical value of \(r_{\text{E}}\) that sets \(R=0\). Then, for the experiment, we choose \(\mu_{0}\) and \(\mu_{1}\) such that the corresponding critical \(r_{\text{E}}\) is above 20% with about 10% overhead. If, at any point during the experiment, the measured \(r_{\text{E}}\) exceeds the critical value, the corresponding bits are discarded. Conversely, if \(r_{\text{E}}\) is below the critical value, the users evaluate the corresponding amount of [PERSON]'s information, apply appropriate privacy amplification, and generate the corresponding amount of secret key as prescribed by Equation (1).