`trait ValidatedRsaPrivateComponents` over `struct RsaPrivateKey`

Open
#640 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
rust
Domain
cryptography

Research direction

Start by reviewing the current RsaPrivateKey representation and the no-alloc work referenced in pull request #636. Determine whether a ValidatedRsaPrivateComponents trait can replace the existing struct while supporting borrowed PKCS#8 data and the proposed variants. Done would require a settled design and explicit scope, which this issue does not currently define.

Written by the indexing model from the issue text.

Description

The current RsaPrivateKey is just a validated construct essentially.

Are there any reasons on

a) why it can't be just expressed as a trait benefiting no-alloc impl ? e.g. why do we need hold copies ?

b) why that can't be handed over to end-user e.g. hazmat unchecked or validating PKCS#8 wrapper ?

Given no-alloc will require memory efficient representation for it

type PKCS8Rsa impl VerifiedRsaPrivateKey
  type [..]: Unsigned // Can be optimised across exp & modulus over largest variant of say just one generic `U`
  ..

Pros:

  • hazmat End-users can provide unchecked / checked construct as-is without specialised API surface
  • Generalize impls around that in no-alloc and alloc
  • Could provide conditional for Multi Prime (MP-RSA)
  • Could provide conditional for precomputed
  • Optimised memory pressure given usage-scenario/s
  • Direct PKCS#8 (or other containers) borrowed layout into validated type
  • Associated types can be optimized for it's intended use in algorithms

Cons:

  • Complexity ?
  • Harder ?
  • .. ?
Dominant language
Rust
Stars
673
Forks
190
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RustCrypto/RSA

All issues in RustCrypto/RSA

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.