Uh oh!
There was an error while loading. Please reload this page.
Implement Signer/Verifier/Signature interfaces for the RSA signatures - #174
Conversation
e211bef to
76200c9CompareAs far as the structure goes, I'd suggest doing something similar to the https://github.com/rustcrypto/elliptic-curves crates, which define the following types inside of modules named after the signature algorithm:
See the following modules as examples:
...then For PSS, parameters like the MGF digest can be generic parameters, e.g. pubstructSigningKey<Mgf:Digest>{inner:RsaPrivateKey,mgf:PhantomData<Mgf>,[...]} |
lumag
commented
Aug 1, 2022
What about the |
tarcieri
commented
Aug 7, 2022
@lumag yep! |
Move DummyRng to the separate module to allow it to be used from PaddingScheme module. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
lumag
commented
Aug 13, 2022
@tarcieri I have mostly finished the implementation of Signer/Verifier implementations. However I now have an issue with the PSS Signer. The trait passes self as non-mutable object, while the signing function uses salt rng as mutable. |
tarcieri
commented
Aug 13, 2022
|
f1e596b to
0e507d5CompareSigned-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
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>
lumag
commented
Aug 14, 2022
@tarcieri pushed next iteration following your comments. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
tarcieri
commented
Aug 14, 2022
Looking better! |
52ad0a5 to
cea23c7Comparelumag
commented
Aug 14, 2022
@tarcieri done |
Uh oh!
There was an error while loading. Please reload this page.
tarcieri
commented
Aug 14, 2022
Looks mostly good to me now. @lumag can you update the PR description? |
Implement Signature, Signer and Verifier traits from signature crate. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
lumag
commented
Aug 14, 2022
@tarcieri updated the description |
glaeqen
commented
Aug 17, 2022
Is it necessary to couple pubstructSignature<T:AsRef<[u8]>>{bytes:T}pubmod std_alloc {pubtypeSignature = super::Signature<alloc::vec::Vec<u8>>;}// proper re-exports depending on `std` feature? |
glaeqen
commented
Aug 17, 2022
I realized that |
tarcieri
commented
Aug 17, 2022
@vccggorski the There's been some discussion of heapless support using stack-allocated bigints, e.g. via the
The constructor is fallible, so that is not a problem at all. The |
lumag
commented
Aug 17, 2022
Initially I had a separate alloc-less |
glaeqen
commented
Aug 17, 2022
Also by reading the code I got a little bit confused because my understanding of a difference between |
The The |
lumag
commented
Aug 19, 2022
I did not see a particular value of implementing the |
tarcieri
commented
Aug 19, 2022
@lumag the nice thing would be using a hardware accelerator for hashing, but given this crate isn't particularly embedded-friendly to begin with I think leaving that out would be fine for an MVP |
lumag
commented
Aug 19, 2022
@tarcieri ok, I will add them to my queue to take a look after sorting out the |
tarcieri
commented
Aug 19, 2022
I'm going to go ahead and merge this. @lumag feel free to follow up with |
sandhose
commented
Aug 25, 2022
Regarding the |
lumag
commented
Aug 25, 2022
@sandhose@tarcieri Well, I followed the previous design of signing the pre-hashed messages, since this looks to me the way how the RSA signatures usually work. However I'm fine with changing that to use raw messages and hashing them during the sign procedure. The only question is about the raw PKCS1 v1.5 signatures (which do not have the ASN.1 wrapping). |
@sandhose good catch! The @lumag it would probably be good to retain inherent methods which operate on the raw bytes of a message digest, then implement traits like Generally working directly with raw digests is an antipattern. It's much less of a problem with RSA than it is with e.g. ECDSA or Schnorr though, where it can lead to existential forgeries. |
lumag
commented
Aug 25, 2022
…RustCrypto#174) 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>
Refactor the
rsacrate to use the API defined by thesignaturecrate.This adds
pssandpkcs1v15modules, each of them providingSignature,VerifierandSigner/RandomizedSignerimplementations.