pkcs1v15: use AssociatedOID for getting the RSA prefix#183
pkcs1v15: use AssociatedOID for getting the RSA prefix#183tarcieri merged 4 commits intoRustCrypto:masterfrom
Conversation
|
This depends on RustCrypto/traits#1098 and RustCrypto/hashes#405 to be merged first. |
4dcee07 to
6c62f69
Compare
Add tests using RSA-SHA1 and RSA-SHA3-256 signature schemes. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Bump digest, sha1 and sha2 crates versions to resolve the OID/AssociatedOId implementations. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Drop internal implementation of AssociatedHash and use AssociatedOID trait to get the OID corresponding to the Digest and to format the ASN.1 prefix. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fully replace rsa::Hash with AssociatedOid usage. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
|
@tarcieri @newpavlov Note, this pull request contains breaking change, it drops |
|
@lumag breaking changes are fine as there are already ones merged ( |
|
It would be nice to update the changelog. It's easier to edit "unreleased" section, than to collect all changes introduced since previous release. |
|
@newpavlov unfortunately there is no changelog! (#151) But I'm happy to add one and document all of the changes in this (upcoming) release. |
|
I'm going to go ahead and merge this as there are several people asking for an RC. Can wait for feedback from @dignifiedquire before cutting a final release. And in the meantime, I can get a changelog added. |
Ah, true. I think the next breaking release is a good opportunity to add one then. |
|
Uhm, I am not sure I can support this, but from first glance this means I can't change the hash function at runtime, which is functionality I need. Or am I missing something? |
| ]; | ||
| let pub_key: RsaPublicKey = priv_key.into(); | ||
| let verifying_key = VerifyingKey::<Sha256>::new_with_prefix(pub_key); | ||
| let verifying_key = VerifyingKey::<Sha1>::new_with_prefix(pub_key); |
There was a problem hiding this comment.
why did these get changed?
There was a problem hiding this comment.
It was a revert of previous commit which changed Sha1 to Sha256.
Unfortunately changing the hash function at runtime doesn't match the |
|
@dignifiedquire we could ensure the low-level APIs (defined in terms of Re: An enum could be used to select the concrete |
|
@dignifiedquire The |
|
This is the code that I need to support: https://github.com/rpgp/rpgp/blob/master/src/crypto/rsa.rs#L67-L82 |
This specifically needs to support prehashed input. The linked api usage is 80% of the reason that I originally wrote this library. 😅 |
|
@dignifiedquire ack, I see the issue. I'll send a pull request in one of the forthcoming days. |
|
thanks @lumag! |
|
@dignifiedquire I've sketched rpgp/rpgp#193. However it might be easier to just restore the rsa::Hash struct and use old API as you have been using it up to now. |
) 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>
Drop internal implementation of AssociatedHash and use AssociatedOID
trait to get the OID corresponding to the Digest and to format the ASN.1
prefix.