Skip to content

Commit

Permalink
Merge pull request nucypher#72 from piotr-roslaniec/fix-python-example
Browse files Browse the repository at this point in the history
Fix Python example
  • Loading branch information
fjarri authored Nov 1, 2021
2 parents fbf7ea8 + 73917c8 commit 17bee9d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions umbral-pre-python/example/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,25 @@
# in order to open the capsule.

# Simulate network transfer
kfrag0 = KeyFrag.from_bytes(bytes(verified_kfrags[0]))
kfrag1 = KeyFrag.from_bytes(bytes(verified_kfrags[1]))
kfrag0 = umbral_pre.KeyFrag.from_bytes(bytes(verified_kfrags[0]))
kfrag1 = umbral_pre.KeyFrag.from_bytes(bytes(verified_kfrags[1]))

# Ursulas must check that the received kfrags
# are valid and perform the reencryption.

# Ursula 0
verified_kfrag0 = kfrag0.verify(verifying_pk, alice_pk, bob_pk)
verified_cfrag0 = umbral_pre.reencrypt(capsule, kfrags[0])
verified_cfrag0 = umbral_pre.reencrypt(capsule, verified_kfrag0)

# Ursula 1
verified_kfrag1 = kfrag1.verify(verifying_pk, alice_pk, bob_pk)
verified_cfrag1 = umbral_pre.reencrypt(capsule, kfrags[1])
verified_cfrag1 = umbral_pre.reencrypt(capsule, verified_kfrag1)

# ...

# Simulate network transfer
cfrag0 = CapsuleFrag.from_bytes(bytes(verified_cfrag0))
cfrag1 = CapsuleFrag.from_bytes(bytes(verified_cfrag1))
cfrag0 = umbral_pre.CapsuleFrag.from_bytes(bytes(verified_cfrag0))
cfrag1 = umbral_pre.CapsuleFrag.from_bytes(bytes(verified_cfrag1))

# Finally, Bob opens the capsule by using at least `threshold` cfrags,
# and then decrypts the re-encrypted ciphertext.
Expand Down

0 comments on commit 17bee9d

Please sign in to comment.