Open-QKD-Network / qkd-net

Protocol stack for QKD networks with key management
https://openqkdnetwork.net/
MIT License
34 stars 31 forks source link

Save key from cqptoolkit to files #21

Closed kaiduanx closed 2 years ago

kaiduanx commented 3 years ago
  1. We need identifier for the node. In OpenQKDNetwork, the node id is defined in kms.conf in ~/.qkd/kms.conf.

  2. Assume the local node is A, The key files between local node A and remote node B are in the ~/.qkd/qnl/keys/B directory. On Node B, the key files between A and B are in the ~/.qkd/qnl/keys/A directory.

  3. In the key send from cqotoolkit add two fileds, source and destination, you need to change the protocol buffer message definition. The site id is set in siteagent.json file as below,

{ "name": "A", "id": "9893e345-d3b0-4a98-a6d2-4663190e3db9", "bindAddress":"192.168.2.254", "connectionAddress":"192.168.2.254", "listenPort": 8000, "credentials": {} }

Make sure the value is same as the setting in .qkd/kms.conf.

  1. Each file has qllBlockSz keys, each line is a key. qllBlockSz configuration is set in ~/.qkd/qnl/config.yaml. The current value is 4096.

  2. Each key file name has a number suffix in it, for example B_0, B_1. The number is equal to key sequence id/qllBlockSz. Assume qllBlockSz is 4096, then B_0 contains the keys from id 0 to 4095, B_1 contains keys from id 4096 to 8191, B_2 contains keys from 8192 to 12287.

  3. Make the change in QLLFileReader to ignore the key sequence id when reading key.

  4. Add a class QLLFileReaderWriter to read and write key. Because reading and writing are in different threads, please serialize the read/write operation with Java mutex.

  5. If other thread wants to read the key and key is not available, find a way to notify the read thread when key is available with java condition variable.