# QESIF: A Lightweight Quantum-Enhanced IoT Security Framework for Smart Cities
## 3 System Design and Components
### Quantum Key Distribution in IoT  
To securely integrate QKD into resource-constrained IoT environments, a novel entropy-weighted dynamic QKD protocol tailored to heterogeneous device capabilities is proposed. Traditional QKD protocols such as BB84 assume uniform photon emission, idealized error rates, and unrestricted processing power--assumptions that do not hold in practical IoT deployments, especially in urban smart cities.  
The proposed method introduces an adaptive key generation algorithm that weights quantum entropy against device-specific computational and communication limitations. The entropy of the received photon stream is modulated dynamically based on both channel state and device entropy buffers, yielding a secure yet efficient key distribution strategy.  
A hybrid entropy-weighted key rate function \(\mathcal{K}_{\text{IoT}}\) for a device \(d_{i}\) is defined as follows:  
\[\mathcal{K}_{\text{IoT}}(d_{i},t)=\frac{H_{q}(t)\cdot\gamma(d_{i})}{1+\eta(d_{ i},t)\cdot\delta(\theta)} \tag{1}\]  
where  
* \(H_{q}(t)\) is the measured quantum entropy at time \(t\), computed from the Shannon entropy of the polarization basis mismatch.  
Figure 1: System architecture of the proposed QESIF, illustrating the interaction between IoT devices, edge QKD gateways, quantum networks, and the smart city control center.  
* \(\gamma(d_{i})\) is the trust-adjusted security factor for device \(d_{i}\), computed using device integrity metrics and historical authentication scores.
* \(\eta(d_{i},t)\) is the energy-normalized communication complexity function for \(d_{i}\) at time \(t\).
* \(\delta(\theta)\) is the decoherence impact function, modeled as an increasing function of environmental photon noise \(\theta\).  
This function allows the system to generate keys with variable lengths and confidence intervals depending on both physical (quantum) and cyber (resource-aware) properties. Unlike fixed-rate key generation in traditional QKD, the proposed model supports quantum entropy modulation, enhancing resistance to both channel-based eavesdropping and energy exhaustion attacks. Furthermore, the protocol introduces a quantum-aware session scoring function \(S_{\text{QKD}}(t)\):  
\[S_{\text{QKD}}(t)=\int_{t_{0}}^{t}\Big{[}\frac{H_{q}(\tau)}{\delta(\theta_{\tau })}-\lambda\cdot\mathcal{L}(\tau)\Big{]}d\tau \tag{2}\]  
where \(\mathcal{L}(\tau)\) represents packet loss in the quantum channel and \(\lambda\) is a tunable security-to-performance trade-off coefficient.  
If \(S_{\text{QKD}}(t)\) falls below a threshold \(\Psi_{\text{secure}}\), the key is discarded, and the session is flagged by the Q-IDS module. The entropy-weighted quantum key generation process is outlined in Algorithm 1, enabling adaptive key rates based on device trust levels, communication cost, and quantum decoherence factors.  
```
Input: Device ID \(d_{i}\), Time Window \([t_{0},t]\), Decoherence Index \(\theta\), Loss Function \(\mathcal{L}(t)\), Trust Factor \(\gamma(d_{i})\) Output: Valid Quantum Key \(K_{d}\) or Session Termination
1 Initialize \(K_{d}\leftarrow\emptyset\), \(S_{\text{QKD}}\gets 0\);
2 foreachtime slot \(\tau\in[t_{0},t]\)do
3 Measure quantum entropy \(H_{q}(\tau)\) from photon basis mismatch;
4 Compute communication cost \(\eta(d_{i},\tau)\) from channel logs;
5 Estimate decoherence factor \(\delta(\theta_{\tau})\); // Compute dynamic key rate (Equation (1)) \(\mathcal{K}_{\text{IoT}}(d_{i},\tau)\leftarrow\frac{H_{q}(\tau)\cdot\gamma(d_{ i})}{1+\eta(d_{i},\tau)\cdot\delta(\theta_{\tau})}\);
6 if\(\mathcal{K}_{\text{IoT}}(d_{i},\tau)>e_{min}\)then
7 Append quantum bits to \(K_{d}\); // Update session score (Equation (2)) \(S_{\text{QKD}}\gets S_{\text{QKD}}+\Big{(}\frac{H_{q}(\tau)}{\delta( \theta_{\tau})}-\lambda\cdot\mathcal{L}(\tau)\Big{)}\);
8 if\(S_{\text{QKD}}\geq\Psi_{\text{secure}}\)then
9 return\(K_{d}\)// Valid QKD key
10 else
11 Flag session for Q-IDS, discard \(K_{d}\);
12 return NULL
```  
**Algorithm 1**Entropy-Weighted QKD Key Generation for IoT Devices