-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkcs1v15: use AssociatedOID for getting the RSA prefix #183
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 <[email protected]>
Bump digest, sha1 and sha2 crates versions to resolve the OID/AssociatedOId implementations. Signed-off-by: Dmitry Baryshkov <[email protected]>
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 <[email protected]>
Fully replace rsa::Hash with AssociatedOid usage. Signed-off-by: Dmitry Baryshkov <[email protected]>
@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? |
), | ||
false, | ||
), | ||
]; | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did these get changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 to get the OID corresponding to the Digest and to format the ASN.1
prefix.