Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interfacing with Python #41

Merged
merged 21 commits into from
May 5, 2021
Merged

Interfacing with Python #41

merged 21 commits into from
May 5, 2021

Conversation

fjarri
Copy link
Contributor

@fjarri fjarri commented Mar 13, 2021

Necessary adjustments to reach binary compatibility with PyUmbral. See the related nucypher/pyUmbral#263

  • stopped bundling Parameters with objects and decoupled u from g (as decided in Do we need to carry around UmbralParameters? #3)
  • renamed UmbralDEM to DEM (we have namespaces for that)
  • replaced ChaCha with XChaCha for DEM
  • used domain separation tags for all instances of hashing
  • exposed serialization via __bytes__() and from_bytes() in Python bindings (part of Expose serialization in bindings #11)
  • added SecretKeyFactory for secret key derivation
  • changed order of parameters in CapsuleFrag.verify() to match the rest of the library (and the Python version)
  • various internal naming changes

Effectively fixes #27, although nothing really changed in the binary format on the Rust side (except for domain tags, missing Parameters and XChaCha); most of the work is done on the Python side

Note for reviewers:

  • It may be more convenient to review commit by commit

Notes:

  • In PyUmbral UmbralSecretKey is (de)serialized using nacl's SecretBox with the password expanded in nucypher. This behavior can be replicated by using xsalsa20poly1305 crate if necessary. But since we are breaking capsule compatibility anyway, users probably won't want to hold on to their UmbralPrivateKeys, so we can use the preferred chacha20poly1305 + password expansion with SHA256 (our hash of choice), which is already exposed via UmbralDEM (renamed to DEM in this PR)

@fjarri fjarri added API Related to public API Python Related to Python bindings labels Mar 13, 2021
@fjarri fjarri mentioned this pull request Mar 13, 2021
6 tasks
@codecov-io
Copy link

codecov-io commented Mar 15, 2021

Codecov Report

Merging #41 (3830188) into master (128eb0c) will increase coverage by 1.00%.
The diff coverage is 93.60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #41      +/-   ##
==========================================
+ Coverage   94.64%   95.65%   +1.00%     
==========================================
  Files          10       11       +1     
  Lines         766      759       -7     
==========================================
+ Hits          725      726       +1     
+ Misses         41       33       -8     
Impacted Files Coverage Δ
umbral-pre/src/key_frag.rs 89.24% <85.18%> (+2.84%) ⬆️
umbral-pre/src/capsule_frag.rs 95.08% <85.71%> (+2.32%) ⬆️
umbral-pre/src/dem.rs 94.44% <91.66%> (ø)
umbral-pre/src/keys.rs 95.18% <95.18%> (ø)
umbral-pre/src/capsule.rs 100.00% <100.00%> (ø)
umbral-pre/src/curve.rs 95.55% <100.00%> (+0.04%) ⬆️
umbral-pre/src/hashing.rs 97.87% <100.00%> (-0.31%) ⬇️
umbral-pre/src/hashing_ds.rs 100.00% <100.00%> (ø)
umbral-pre/src/params.rs 100.00% <100.00%> (ø)
umbral-pre/src/pre.rs 100.00% <100.00%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 128eb0c...3830188. Read the comment docs.

@fjarri fjarri changed the title [WIP] Interfacing [WIP] Interfacing with Python Mar 16, 2021
@fjarri fjarri changed the title [WIP] Interfacing with Python Interfacing with Python Mar 18, 2021
@fjarri fjarri marked this pull request as ready for review March 18, 2021 17:21
@fjarri fjarri force-pushed the interfacing branch 3 times, most recently from 3a9ac8b to ec32655 Compare March 21, 2021 22:13
@fjarri fjarri force-pushed the interfacing branch 2 times, most recently from cd2eb82 to 62dda02 Compare March 26, 2021 03:51
Copy link
Contributor

@piotr-roslaniec piotr-roslaniec left a comment

Choose a reason for hiding this comment

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

LGTM 👍
Looks very solid. I had no issues with running Python bindings locally.

@fjarri fjarri added this to the v0.1.0 milestone Apr 22, 2021
umbral-pre/src/capsule_frag.rs Show resolved Hide resolved
umbral-pre/src/dem.rs Show resolved Hide resolved
umbral-pre/src/hashing.rs Show resolved Hide resolved
@fjarri fjarri merged commit 45b2b85 into nucypher:master May 5, 2021
@fjarri fjarri deleted the interfacing branch May 5, 2021 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to public API Python Related to Python bindings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Binary compatibility with PyUmbral
4 participants