Skip to content

RsaPrivateKey::validate() does not ensure precompute() won't fail #509

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

Open
fjarri opened this issue Apr 27, 2025 · 0 comments
Open

RsaPrivateKey::validate() does not ensure precompute() won't fail #509

fjarri opened this issue Apr 27, 2025 · 0 comments

Comments

@fjarri
Copy link
Contributor

fjarri commented Apr 27, 2025

In RsaPrivateKey::from_components(), precompute() errors are ignored because it is claimed that the previous call to validate() guarantees it succeeds.

First of all, this is not the case - there can be bugs in precompute itself. I bumped into it while working on #506. In

let q_mod_p = BoxedMontyForm::new(q_mod_p, p_params.clone());

where I accidentally typed q_params instead of p_params, so the subsequent inversion failed.

Second, what are we even achieving by ignoring the errors there? Are there valid keys for which the values cannot be precomputed? from_components() already returns a Result, we might as well just forward the precompute() error to it.

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

No branches or pull requests

1 participant