RustCrypto / RSA

RSA implementation in pure Rust
Apache License 2.0
536 stars 148 forks source link

https://docs.rs/rsa/latest/rsa/struct.RsaPrivateKey.html#method.precompute is public #338

Open wez opened 1 year ago

wez commented 1 year ago

While looking at perf, I noticed this precompute method: https://docs.rs/rsa/latest/rsa/struct.RsaPrivateKey.html#method.precompute

In https://github.com/RustCrypto/RSA/issues/23#issuecomment-525251114 it mentions that this should be private and that it is implicitly called during construction.

That issue was closed, but it seems like this still needs to be resolved

tarcieri commented 1 year ago

Yeah, it should be removed from the public API. We can at least deprecate it.

complexspaces commented 1 year ago

I believe that the method should remain public so that users of the PrivateKeyParts trait can know when the different pre-computed values have been prepared (see this Zulip conversation as well). Without it, there's no other guarantees that a instance of RsaPrivateKey has these values available internally since its primarily just an implementation detail. We specifically need it to support "exporting" into a JWK format, which requires all of the additional values.