RustCrypto / RustCrypto/formats

pkcs1 crate has no examples, no obvious way of using

Open
#1,611 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
338
Forks
188
Avg merge
4d 6h
Merged PRs (30d)
15

Description

The docs for pkcs1 have no examples how to use the crate to decode an RsaPrivateKey.

The crate has a DecodeRsaPrivateKey trait, but pkcs1::RsaPrivateKey does not implement it? (or if it does, then only indirectly via a blanket impl on a pkcs8 feature in another crate???)

This seems very weird. Is that a mistake? Why is the type and trait in the same crate if they don't work together?

The only apparent way of creating pkcs1::RsaPrivateKey is via TryFrom<&[u8]> implementation, which is not mentioned anywhere, and the impl itself has zero documentation, so it needs diving into the crate's source code to discover it takes DER.

It's weird that the pkcs1 crate has a pem Cargo feature, and describes possibility of using PEM format, but as far as I can tell, PEM decoding is not supported by the crate.

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.

Research direction

Start with the pkcs1 docs for RsaPrivateKey and DecodeRsaPrivateKey, then inspect the TryFrom<&[u8]> implementation and the pem Cargo feature described in the issue. Determine and document the supported decoding paths, including whether DER and PEM are handled and how the trait relates to the type. Done means the docs include a working usage example and explain the relevant feature behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cryptography, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.