# Wide Area Key Distribution Network Based on a Quantum Key Distribution System
## 3 Public-XOR-Key Scheme for QKD Network
### The Complex QKD Network Scheme with Multiple Endpoints  
We have described the public-XOR-key scheme in the chain network with two endpoints. The following approach is used to solve the key distribution in a wide area network with multiple endpoints. A communication chain is formed between any two endpoints, and multiple communication chains constitute all kinds of network structures. No matter how complex the structures are, there will always be a chain between the two endpoints. As long as the pair of endpoints is in a connected graph, the key distribution scheme is similar to that of Protocol 2. The difference between the communications in the chain network and other complex networks is that some relay nodes have more than two connections  
Figure 2: The model of public-XOR-key scheme with two endpoints. The dotted arrow stands for the QKD process. Relay node \(i\) calculates and publishes \(a_{i}=Qk_{i}\oplus Qk_{i+1}\), then dismisses the QKD keys immediately. The final key shared by [PERSON] and [PERSON] is \(Qk_{1}=a_{1}\oplus a_{2}\oplus...\oplus a_{n-1}\oplus Qk_{n}\). with other nodes. Additionally, the simplest model is the chain structure (each connecting relay node has only two ports). In general networks, there are not only two ports connecting the relay nodes. Since there may be various topological structures in the actual network, we abstract the complex network into simplified model with three-port relay nodes, as shown in Figure 3. The more complex multiple endpoints models are similar to this, as long as it conforms to the principle of one-time padding. Firstly, consider a simplified model that a relay node has three connections that are connected with three endpoints: [PERSON], [PERSON] and [PERSON]. Each pair of endpoints is in a chain network. When they execute the original process of Protocol 2, the communications of [PERSON] and [PERSON], [PERSON] and [PERSON] are shown in Figure 3. \(Qk_{A}\) is the QKD key shared by [PERSON] and the relay node, \(Qk_{B}\) is the QKD key shared by [PERSON] and the relay node, \(Qk_{C}\) is the QKD key shared by [PERSON] and the relay node. The relay node calculates and publishes \(Qk_{AB}=Qk_{A}\oplus Qk_{B}\), \(Qk_{AC}=Qk_{A}\oplus Qk_{C}\), \(Qk_{BC}=Qk_{B}\oplus Qk_{C}\), then dismisses the QKD keys immediately. [PERSON] calculates \(Q_{AB}\oplus Qk_{B}\), which is equal to \(Qk_{A}\). Then [PERSON] and [PERSON] share the same key \(Qk_{A}\). [PERSON] calculates \(Q_{AC}\oplus Qk_{C}\), which is equal to \(Qk_{A}\). Then [PERSON] and [PERSON] share the same key \(Qk_{A}\). However, a key distribution scheme is secure if and only if the shared keys are not known by the third party. In the above scenario, [PERSON], [PERSON] and [PERSON] share the same key \(Qk_{A}\). If [PERSON] or [PERSON] is the internal attacker, he can get the keys shared by [PERSON] and the other user, which threatens the security. In order to guarantee the security against the internal attacker, all of the QKD keys should be used only once. The improved key distribution scheme for three endpoints is shown in Figure 4. \(Qk_{A_{1}}\) and \(Qk_{A_{2}}\) are the QKD keys shared by [PERSON] and the relay node, \(Qk_{B_{1}}\) and \(Qk_{B_{2}}\) are the QKD keys shared by [PERSON] and the relay node, \(Qk_{C_{1}}\) and \(Qk_{C_{2}}\) are the QKD keys shared by [PERSON] and the relay node. Each QKD key is independent of the others. The relay node calculates and publishes \(Qk_{A_{1}B_{1}}=Qk_{A_{1}}\oplus Qk_{B_{1}}\), \(Qk_{A_{2}C_{2}}=Qk_{A_{2}}\oplus Qk_{C_{2}}\), \(Qk_{B_{2}C_{1}}=Qk_{B_{2}}\oplus Qk_{C_{1}}\), and then dismisses the QKD keys immediately. [PERSON] calculates \(Qk_{A_{2}C_{2}}\oplus Qk_{A_{2}}\) to get the key \(Qk_{C_{2}}\), which is the final key shared with [PERSON]. [PERSON] calculates \(Qk_{A_{1}B_{1}}\oplus Qk_{B_{1}}\) to get the key \(Qk_{A_{1}}\), which is the final key shared with [PERSON]. [PERSON] calculates \(Qk_{B_{2}C_{1}}\oplus Qk_{C_{1}}\) to get the key \(Qk_{B_{2}}\), which is the final key shared with [PERSON].