# A Dynamic-Routing Algorithm Based on a Virtual Quantum Key Distribution Network
## 2 Technical Foundation
### Relay-Based Networks  
There is a practical distance limitation for QKD systems, i.e., key transmission distance. Moreover, the point-to-point QKD system is only suitable for communication between two nodes [26; 27]. To solve these problems, trusted relay schemes are introduced. The advantages of trusted relaying are that longer communication distances can be achieved, complex topologies can be built, and high reliability is available. Therefore, trusted relaying schemes can be applied to various scenarios to meet different application needs [28; 29; 30]. In addition, QKD networks based on trusted relays employ a variety of security mechanisms to ensure the confidentiality and integrity of keys. These include using quantum channels to transmit quantum bits for key security and authentication mechanisms to verify the legitimacy of the communicating parties. QKD networks based on trusted relays extend the communication distance through trusted quantum relays and adopt appropriate security mechanisms to prevent attacks and eavesdropping [31].  
In communication in trusted relays, both parties use the quantum channel for QKD protocol to generate a shared quantum key. The key transmits to a trusted relay node, which authenticates, processes, and forwards to the other communicating party using classical encryption algorithms. Once the receiver receives the key, it is again confirmed and verified using the QKD protocol to ensure the correctness and security of the key [32]. In this way, a secure communication connection establishes between the communicating parties. The trusted relay method (TRM) is a network security protocol [33] used to enhance communications' security and privacy. As users in different geographical locations, it allows [PERSON] and [PERSON] to establish secure communication even when there are intermediate nodes or attackers between the communicating entities. They can resort to trusted relay methods to address the problem of a potential attacker, [PERSON], who may listen in or interfere with the communication. The communication process is shown in Figure 2.  
Step 1: [PERSON] transmits the quantum state to the relay node through the quantum channel, i.e., [PERSON] and node 1 share the communication key \(\mathrm{K_{A}}\).  
Step 2: Node 1 and node 2 share the link key \(\mathrm{K_{12}}\), and node 1 calculates \(\mathrm{K_{A}}\oplus\mathrm{K_{12}}\) by One-Time Password (QTP) encryption, encodes and stores the measurement results, and transmits them to relay node 2.  
Figure 2: Key relay process in QKD network communication based on trustworthy relays.  
Step 3: Node 2 receives K\({}_{\rm A}\)\(\oplus\)K\({}_{\rm I2}\), calculates (K\({}_{\rm A}\)\(\oplus\)K\({}_{\rm I2}\))\(\oplus\)K\({}_{\rm I2}\) to obtain K\({}_{\rm A}\), and then calculates K\({}_{\rm A}\)\(\oplus\)K\({}_{\rm ZB}\) to transmit to the destination node [PERSON].  
Step 4: [PERSON] receives K\({}_{\rm A}\)\(\oplus\)K\({}_{\rm ZB}\) and computes (K\({}_{\rm A}\)\(\oplus\)K\({}_{\rm ZB}\))\(\oplus\)K\({}_{\rm ZB}\) to obtain the shared communication key K\({}_{\rm A}\) with [PERSON].  
After steps (1-4), [PERSON] and [PERSON] can obtain the same communication key K\({}_{\rm A}\). When [PERSON] and [PERSON] transmit data in the classical network, they can encrypt the shared data information using communication key K\({}_{\rm A}\).