Skip to content

Updates for the new Umbral API#2612

Merged
KPrasch merged 12 commits intonucypher:mainfrom
fjarri:new-umbral
Jun 23, 2021
Merged

Updates for the new Umbral API#2612
KPrasch merged 12 commits intonucypher:mainfrom
fjarri:new-umbral

Conversation

@fjarri
Copy link
Copy Markdown
Contributor

@fjarri fjarri commented Mar 24, 2021

Type of PR:

  • Feature

Required reviews:

  • 3

What this does:
Makes nucypher use the new Umbral API.

umbral_adapter.py is out in the top commit, although the intermediate commit with the adapter and the minimal changes is still present, for reference.

Notable changes on on top of API adjustments:

  • scrypt-based key generation moved from umbral (and from config/keyring.py) to crypto/passwords.py.
  • since Capsule objects are immutable, keys and cfrags are now accumulated in UmbralMessageKit objects. Some functions called by Bob.retrieve() were modified accordingly (see the changes in lawful.py).
  • In particular, Bob._reencrypt() now has a bit of an awkward signature (takes an additional message_kits_dict), which I propose to fix in a separate PR addressing the changes from Define format for re-encryption metadata #259 (and the whole data flow in retrieve())
  • Using splitters defined in crypto/splitters.py to use Umbral objects in larger splitters, instead of passing the types directly
  • ecdsa_sign() and verify_ecdsa() removed from crypto/api.py (using Umbral's Signer and Signature for that).
  • assertions checking for specific fields in Umbral objects removed from test_umbral_deserializer.py

The highperf tests were broken before (see #2715), and now they are probably broken even more - I tried to modify the mocks accordingly, but it's likely I forgot something. I think they should be dealt with separately.

fjarri added a commit to fjarri/nucypher that referenced this pull request Mar 25, 2021
fjarri added a commit to fjarri/nucypher that referenced this pull request Mar 29, 2021
fjarri added a commit to fjarri/nucypher that referenced this pull request Jun 1, 2021
@fjarri fjarri force-pushed the new-umbral branch 3 times, most recently from cec4044 to 47fe15d Compare June 1, 2021 21:07
fjarri added a commit to fjarri/nucypher that referenced this pull request Jun 1, 2021
@fjarri fjarri force-pushed the new-umbral branch 3 times, most recently from 9399521 to d094b8b Compare June 3, 2021 21:49
@fjarri fjarri force-pushed the new-umbral branch 2 times, most recently from 14937ca to 2f356ae Compare June 3, 2021 22:05
Copy link
Copy Markdown
Member

@derekpierre derekpierre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎸 Looks good - the adapter isolation definitely made it easier to look through.

fjarri added a commit to fjarri/nucypher that referenced this pull request Jun 7, 2021
@fjarri fjarri changed the title [WIP] Updates for the new Umbral API Updates for the new Umbral API Jun 11, 2021
@fjarri fjarri marked this pull request as ready for review June 11, 2021 06:06

print("The policy public key for "
"label '{}' is {}".format(label.decode("utf-8"), policy_pubkey.to_bytes().hex()))
"label '{}' is {}".format(label.decode("utf-8"), bytes(policy_pubkey).hex()))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You love to see it.

delegating_power = self._crypto_power.power_ups(DelegatingPower)
return delegating_power.generate_kfrags(bob_pubkey_enc=bob_encrypting_key,
signer=self.stamp,
signer=self.stamp.as_umbral_signer(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reasoning here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signer has to go inside Umbral, so it has to be an Umbral object. We have an arbitrary Python callable inside Rust code

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify my question:

Why pass the umbral signer instead of the stamp and then use its __call__ like we were doing? What's the advantage of the signer object that the stamp itself can't satisfy?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's called inside generate_kfrags(), which is a Rust function. There is no Python available at that level. The signer object is a wrapped Rust object, so it can go through.

@KPrasch KPrasch merged commit 1a997cf into nucypher:main Jun 23, 2021
@fjarri fjarri deleted the new-umbral branch June 23, 2021 21:49
KPrasch added a commit to KPrasch/nucypher that referenced this pull request Jun 24, 2021
KPrasch added a commit to KPrasch/nucypher that referenced this pull request Jun 24, 2021
KPrasch added a commit to KPrasch/nucypher that referenced this pull request Jun 25, 2021
KPrasch added a commit to KPrasch/nucypher that referenced this pull request Jun 25, 2021
KPrasch added a commit to KPrasch/nucypher that referenced this pull request Jun 25, 2021
KPrasch added a commit to KPrasch/nucypher that referenced this pull request Jun 28, 2021
KPrasch added a commit to KPrasch/nucypher that referenced this pull request Jun 30, 2021
KPrasch added a commit to KPrasch/nucypher that referenced this pull request Jul 4, 2021
@derekpierre derekpierre mentioned this pull request Jul 28, 2021
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants