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

multiprime support #207

Merged
merged 5 commits into from Jan 30, 2024
Merged

multiprime support #207

merged 5 commits into from Jan 30, 2024

Conversation

myheroyuki
Copy link
Collaborator

This PR adds multiprime support to help this library meet PKCS#1 v2.1. It's a big one! I didn't want to break existing user API to keep it backwards compatible. While this means it could be merged into the current library version, it also means the code gets more complicated at times (see __repr__ and __getstate__ for examples).

I also realized that some users may be depending on return type guarantees. For example, if a user is using gen_keys directly (which I think is supposed to be an internal method, but it doesn't have a leading _) then their code would break because I made it behave differently for multiprime vs conventional key generation. To prevent this, I changed the return type to typing.Tuple, which will stop it from breaking but makes the typing less useful. I could've made it typing.Union[typing.Tuple[int, int, int, int],typing.Tuple[int, int, int, int, typing.List[int]] but I don't think anyone would've appreciated that! I also have the changes from #205 and #206 since I found them in this branch first.

added fast CRT-based decryption to core
added multiprime key support
correction (see issue sybrenstuvel#205, PR sybrenstuvel#206)
added multiprime tests
@myheroyuki
Copy link
Collaborator Author

To clarify, this PR only adds API support. If this PR is approved then I will be happy to work on extending the CLI to support multiprime encryption.

@mdotbrag
Copy link

mdotbrag commented Dec 6, 2022

This would be very useful, are there any updates on getting this merged in?

@myheroyuki myheroyuki merged commit 63772a6 into sybrenstuvel:main Jan 30, 2024
7 checks passed
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.

None yet

2 participants