Skip to content

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

Description

@wez

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

In #23 (comment) 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

Activity

  1. tarcieri commented on Jun 16, 2023

    @tarcieri
    Member

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

  2. complexspaces commented on Sep 8, 2023

    @complexspaces

    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.

  3. newpavlov commented on Mar 12, 2025

    @newpavlov
    Member

    I think we can close this issue? Exposing the method does not cause any issues.

  4. tarcieri commented on Mar 12, 2025

    @tarcieri
    Member

    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

    Or alternatively, these methods can internally call precompute() to ensure that PrecomputedValues have been populated. That would avoid the need to call it yourself, and potentially allow the accessor methods to be infallible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions