nucypher / nucypher-pre-python

NuCypher proxy re-encryption library in Python
28 stars 15 forks source link

What's the best way to represent a ReKeyFrag over the wire? #9

Open jMyles opened 7 years ago

jMyles commented 7 years ago

Currently, kFrags are very simple objects:

namedtuple('RekeyFrag', ['id', 'key'])

But how best to represent this object over the wire?

Currently, we imagine the payload for a policy in NuCypher-KMS as:

msgpack.dumps({b"kf": bytes(self.kfrag), b"cp": msgpack.dumps(self.challenge_pack)})

However, we can't easily cast the kFrag to bytes. What's the one obvious way to do this?

cygnusv commented 7 years ago

Both id and key are integers modulo the order of the curve. If right now we are using curve secp256k1, then both could be represented with 256 bits, so the whole kFrag can fit in 64 bytes, without delimiters.