From 732815f3d90c812b1a7d06a4492cb69306d7274c Mon Sep 17 00:00:00 2001 From: udip Date: Wed, 25 Nov 2020 21:16:11 +0200 Subject: [PATCH] wrote encrypted shares --- fb_bls_key_generator.py | 18 +++--- utils/__pycache__/genver.cpython-38.pyc | Bin 0 -> 5439 bytes utils/__pycache__/recover.cpython-38.pyc | Bin 9331 -> 9331 bytes utils/{generate.py => genver.py} | 73 +++++++++++++++++------ 4 files changed, 64 insertions(+), 27 deletions(-) create mode 100644 utils/__pycache__/genver.cpython-38.pyc rename utils/{generate.py => genver.py} (67%) diff --git a/fb_bls_key_generator.py b/fb_bls_key_generator.py index 4645578..aba4018 100755 --- a/fb_bls_key_generator.py +++ b/fb_bls_key_generator.py @@ -10,7 +10,7 @@ from termcolor import colored from utils import recover -from utils import generate +from utils import genver pubkey_descriptions = { 'MPC_ECDSA_SECP256K1': 'MPC_ECDSA_SECP256K1 XPUB', @@ -64,28 +64,30 @@ def main(): # Set party ids for each RSA key file (allows duplicate, will get different shares+id) # ids shouldn't be more then 255 bits - parties = dict() + rsa_keys = dict() + print("Setting ids:") id = 1 for f in args.RSA_keys: if not os.path.exists(f): print(f'RSA key: {f} not found.') exit(-1) # TODO: open and read rsa_key from file - parties[id] = f + rsa_keys[id] = f + print(f'id: {id}\tfile: {f}') id += 1 - - num_parties = len(parties) + + num_parties = len(rsa_keys) - # If no threshold arg, set all parties + # If no threshold arg, set all rsa_keys threshold = num_parties if args.threshold is not None: threshold = args.threshold if threshold > num_parties or threshold < 1: - print(f'Invalid threshold {threshold} for {num_parties} parties') + print(f'Invalid threshold {threshold} for {num_parties} rsa_keys') exit(-1) try: - bls_pubkey = generate.sample_bs12381_shares_with_verificaion(parties, threshold) + bls_pubkey = genver.sample_bs12381_shares_with_verificaion(rsa_keys, threshold) except ValueError: print("ValueError") diff --git a/utils/__pycache__/genver.cpython-38.pyc b/utils/__pycache__/genver.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2c6376de2597d8a3813b28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