Esempio n. 1
0
def main():
    connection = CQCConnection('Bob')
    q_channel = QChannel(connection, qubit, 'Alice')
    ca_channel = CAChannel(ipcCacClient('Bob'), 'Alice')
    node = DIQKDReceiverNode(q_channel, ca_channel, 0.01)

    node.share_q_states()
    if node.should_abort():
        print("Bob aborted with win probability {0} and matching error {1}".
              format(node.win_prob, node.matching_error))
    else:
        k = node.generate_key()
        print("Bob generated key:", k)

    ca_channel.receive_ack()
    ca_channel.clear()
    connection.close()
Esempio n. 2
0
 def test_receive_acknowledgement(self):
     connection = CACConnectionSpy()
     ca = CAChannel(connection, 'Bob')
     ca.receive_ack()
     self.assertTrue(connection.received_get_ack_call)
     self.assertEqual('Bob', connection.sender)