Split-key re-encryption: tests pass

pull/66/head^2
Michael Egorov 2017-09-30 20:01:11 -07:00
parent 2c102ed384
commit 5763615b6c
2 changed files with 3 additions and 3 deletions

View File

@ -156,12 +156,12 @@ class EncryptingKeypair(object):
ekey=ec.deserialize(self.pre.ecgroup, share[0][0][0]),
re_id=share[0][0][1])
for share in shares]
ekey = self.pre.combine(shares)
ekey = self.pre.combine(ekeys)
ekey = (ec.serialize(ekey.ekey), ekey.re_id)
# Everything except ekey is the same for all shares!
# TODO instead of trusting the first share, trust the majority
return (ekey, ekeys[0][0][1]), ekeys[0][1]
return (ekey, shares[0][0][1]), shares[0][1]
def split_rekey(self,
pubkey: bytes,

View File

@ -40,7 +40,7 @@ def test_reencrypt_m_n(num_shares, min_shares):
data = b'Hello Bob'
alice = EncryptingKeypair()
bob = EncryptingKeypair()
ursulas = [EncryptingKeypair() for i in min_shares]
ursulas = [EncryptingKeypair() for i in range(min_shares)]
e = alice.encrypt(data)
re_ab = alice.split_rekey(bob.pub_key, min_shares, num_shares)