# A Dynamic-Routing Algorithm Based on a Virtual Quantum Key Distribution Network
## 2 Technical Foundation  
### QKD Network Framework Based on SDN  
Combining SDN and QKD can mitigate the deployment difficulties of QKD networks. This is because SDN-based QKD networks offer the advantages of reduced costs, simplified management, and increased flexibility. Traditionally, complex quantum physical equipment must be deployed at each node in a QKD network, which incurs high costs and technical complexity [15]. However, in an SDN network, the control plane has been abstracted, and operations such as routing and forwarding can be implemented through software. At the same time, utilizing the flexibility of SDN, the key distribution system can be more easily managed and maintained, thereby improving its reliability and efficiency. A QKD network framework based on SDN is designed using a four-layer architecture [16; 17; 18; 19; 20]; each layer is defined as represented in Figure 1.  
Application Layer: This layer manages the application programs in the QKD network. It can communicate with the network controller to request the generation, update, or destruction of keys.  
Control layer: This layer is responsible for resource allocation and key management in the QKD network. It receives application requests and converts them into configuration commands for the underlying network. At this layer's core, the core of the entire SDN-based QKD architecture, the controller can obtain information about network topology and links, providing a basis for implementing dynamic routing algorithms. In addition, it can collect and analyze network and link status information supplied by data layer devices and grasp network topology, traffic load conditions, and other valuable data [21]. When problems occur, it can diagnose and take appropriate measures promptly to ensure the reliability and security of the network.  
Data Transfer Layer: responsible for the transmission of keys and related information. In the SDN architecture, the data plane consists of programmable network switches and optical devices connected to the controller and processes transmission tasks according to its instructions. The data transfer layer needs to allocate independent channels for different users or applications based on the security policies of the control layer.  
Figure 1: SDN-based QKD network architecture.  
Quantum Layer: The QKD devices are located in this layer, and they generate keys between each other through specific QKD protocol BB84 [22; 23], completing the negotiation of quantum keys. The newly developed quantum keys are recorded in the control layer with corresponding session information. On the other hand, the generated keys can be distributed to trusted target devices or objects, such as digital signature algorithms used for security authentication [24]. At the same time, this layer is responsible for tracking the usage of each key, including information such as validity period and consumption rate. When a key expires or reaches the predetermined consumption threshold, a message is sent to the control layer to notify it that the renegotiation or updating of the key information is required [25].