* feat: decouple key generation and random generation
Make generate_multi_prime_key_with_exp() generic enough to generate
abstract key structure. Rewrite RsaPrivateKey constructors to use
RsaPrivateKey::from_components().
* feat: move key-related traits to separate module
Move PublicKeyParts to the separate module.
* feat: stop using RsaPrivateKey in internals.rs
Make internals.rs generic enough to be moved to the algorithms module.
* feat: move soft RSA implementation to crate::algorithms::rsa.rs
Separate software RSA implementation to separate module under
crate::algorithms.
* key: drop raw_int_*_primitive wrappers
Now as raw_int_encryption_primitive() and raw_int_decryption_primitive()
became simple wrappers around properly defined functions we can inline
them and always use software RSA algorithm from src::algorithms::rsa.rs.
* feat: move internals.rs to src/algortihms/pad.rs
internals.rs now contains only small functions related to BigUint to
Vec<u8> conversion. Move them to src/algorithms/pad.rs and get rid of
internals.rs
* algorithms: protect all functions with pub(crate)
While it is expected that the functions inside algorithms crates might
be useful (and used) by other parties, they are low level functions and
as such impose a high risk of being misused. Protect all of them with
pub(crate) to prevent them from being exposed by mistake.
Also add big fat warnings to raw RSA functions, which should never be
used unless authors knows exactly what they are using.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Basically all of the `actions-rs/*` actions are unmaintained. See
<https://github.com/actions-rs/toolchain/issues/216> for more
information. Due to their age they generate several warnings in
CI runs.
To get rid of some of those warnings the occurrences of
`actions-rs/toolchain` are replaced by `dtolnay/rust-toolchain`.
Reverts-the-revert from #254, reinstating #251
This reverts commit 26f38ad66a09fc42ed6d73e3b1864f0251db4e2d.
Since we need to upgrade `pkcs1` and `pkcs8`, which are MSRV 1.65, now
is a good time to start making brekaing changes again.
This reverts commit da1997d0b786181f3e3375e3eef09899486a3833.
I was probably over-eager on this: it's a breaking change.
There are probably some non-breaking changes we can make first, and when
we're ready to make breaking changes again, we can revert the revert.
- Fixes some broken links to the `pkcs1`/`pkcs8` crate traits
- Fixes other rustdoc warnings
- Adds rustdoc CI job to ensure docs build without warnings
Updates the `pkcs1` and `pkcs8` crates to their latest versions.
These releases reversed the blanket impl relationship between the traits
in the two respective crates.
The names of the traits have changed:
- `From*Key` => `Decode*Key` (e.g. `DecodePrivateKey`)
- `To*Key` => `Encode*Key` (e.g. `EncodePrivateKey`).
Previously there was a blanket impl of `pkcs8` traits for the `pkcs1`
crates, e.g. `DecodePrivateKey` was impl'd for `DecodeRsaPrivateKey`.
This relationship has been reversed in the latest releases, and as such
this commit now implements the `pkcs8` traits instead of the `pkcs1`
traits (even though this internally involves decoding a PKCS#1 document
as part of PKCS#8 decoding).
The reasoning is this was necessary to make it possible for traits for
multiple formats to have blanket impls for the PKCS#8 traits. Concretely
this was needed to allow blanket impls of the traits in the `sec1` crate
for types which impl traits from the `pkcs8` crate.
Both of these crates are MSRV 1.56 and hard dependencies, so the MSRV of
the `rsa` crate is accordingly bumped to 1.56.
* No-std support
* Fix tests
* Cleanly error out when building without the alloc feature
* Run no-std tests on arm-linux-gnu target
* Fix nostd tests
* Attempt 2 at fixing nostd tests
* Fix warnings when running tests in nostd mode
* fixup! No-std support