Drop internal implementation of `AssociatedHash` and use `AssociatedOid`
trait from `const_oid` to get the OID corresponding to the `Digest` and to
format the ASN.1 prefix.
Also removes the previous `Hash` enum as it was used for looking up OIDs.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
- Change the `SigningKey` and `VerifiyingKey` implementations accept raw
message rather than pre-hashed message.
- Implement the experimental (preview) `DigestSigner` and `DigestVerifier`
traits for the PKCS1v15 structs.
- Implement the experimental (preview) `RandomizedDigestSigner` and
`DigestVerifier` traits for the PSS structs.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Refactor the `rsa` crate to use the API defined by the signature crate.
This adds `pss` and `pkcs1v15` modules, each of them providing
`Signature`, `Verifier` and `Signer`/`RandomizedSigner` implementations.
Add tests for pkcs1v15 and pss signature verification functions to check
that verifying invalid signatures returns an error.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Adds an error case in the event the number of `primes` provides is fewer
than 2, which prevents panics when invoking methods which expect primes
to always be present at indices 0 and 1 (i.e. `p` and `q`)
Fixes#163
The `zeroize_derive` crate has quite a few dependencies, and in
particular `syn` is a fairly large one with not-insignificant compile
times.
Together with dignifiedquire/num-bigint#35, this will remove the
following dependencies from the dependency tree:
- `proc-macro2`
- `quote`
- `syn`
- `synstructure`
- `zeroize_derive`
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