def test_ot(): commu.init(fed_conf_guest) ot_protocol = make_ot_protocol(1, 10, 'zhibang-d-014010') for times in range(10): server_msg = [str(i) for i in range(10)] ot_protocol.server(server_msg)
def test_key_exchange(): commu.init(fed_conf_host) var_chan = make_variable_channel('test_key_exchange', fed_conf_host["federation"]["host"][0], fed_conf_host["federation"]["guest"][0]) for times in range(5): for each in [2048, 3072, 4096, 6144, 8192]: k = make_agreement(remote_id='zhibang-d-014011', key_size=each) var_chan.send(k, tag="k")
def __init__(self, federal_info: dict, sec_param: dict, algo_param: dict = None): self._read_federal_info(federal_info) self._read_sec_param(sec_param) self._read_algo_param(algo_param) commu.init(federal_info)
def test_ot(): commu.init(fed_conf_host) ot_protocol = make_ot_protocol(1, 10, 'zhibang-d-014011') server_msg = [str(i) for i in range(10)] for i in range(10): msg = ot_protocol.client(index=i) assert msg == server_msg[i]
from flex.crypto.oblivious_transfer.api import make_ot_protocol from flex.tools.ionic import commu if __name__ == '__main__': federal_info = { "server": "localhost:6001", "session": { "role": "guest", "local_id": "zhibang-d-014011", "job_id": 'test_job', }, "federation": { "host": ["zhibang-d-014010"], "guest": ["zhibang-d-014011"], } } commu.init(federal_info) ot_protocol = make_ot_protocol(1, 10, 'zhibang-d-014010') msg = [str(i) for i in range(10)] ot_protocol.server(msg)
import os import json from flex.tools.ionic import commu from flex.crypto.key_exchange.api import make_agreement from test.fed_config_example import fed_conf_host if __name__ == '__main__': commu.init(fed_conf_host) k = make_agreement(remote_id='zhibang-d-014011', key_size=2048) print(k)
import os import json from flex.tools.ionic import commu from flex.crypto.key_exchange.api import make_agreement from test.fed_config_example import fed_conf_guest if __name__ == '__main__': commu.init(fed_conf_guest) k = make_agreement(remote_id='zhibang-d-014010', key_size=2048) print(k)