How does proxy re-encryption work?¶
A quick glossary: Alice is the person sharing a file. Bob is the person she is sharing the file with. Peter is a proxy who does re-encryption tasks.
Alice can give a delegation which lets a proxy re-encrypt a capsule for a particular reader. For example Alice gives a delegation to Peter that lets Peter re-encrypt stuff for Bob.
Delegations can be partial. For example, the delegation could specify that five proxies are needed to complete the task. This means that each proxy is only about to do 1/5 of the re-encryption. This is helpful because reduces the risk of bad proxies who don't follow the rules.
The capsule is the per-file key which is encrypted with Alice's private key.
Steps in proxy re-encryption¶
- Alice symmetrically encrypts the file with a new key, and encrypts this key with her public key (this is the "capsule")
- Alice uploads the capsule to the contract along with the URI for the file
- Alice creates delegations for Bob and N proxies.
- There is access-control in the contract that specifies which capsules can be re-encrypted for Bob.
- Alice can add another file by following steps 1 and 2 again (or someone else can add a file on her behalf by encrypting the capsule with her public key)
- Bob sends a transaction to the contract requesting the keys to a file
- The proxies are waiting for tasks.
- If Peter the proxy has a delegation from Alice for Bob, and access to the file is permitted by the access-control policy, then Peter can perform part of the re-encryption and get a reward.
- Once N proxies have generated a re-encryption fragment then the task is complete
- Bob can get the key and access the file
How DabbaFlow works for proxies¶
- Peter registers with the contract, locks up stake and waits for tasks
-
When Bob requests the keys for a file, Peter checks if:
- He has a delegation from Alice for Bob
- Bob is allowed by the access control to access the file
-
If both conditions are true then Peter makes a key fragment for Bob
- Peter submits the key fragment and gets a reward
Staking and slashing¶
Peter stakes FET in order to register as a proxy, and gets rewards by doing re-encryption tasks. Peter gets slashed if the fragments he submits are not correct. Peter also gets slashed if he doesn't respond to re-encryption tasks.