Generic digest for rsa::pkcs1v15::Signature?
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- rust
- Domain
- cryptography
Research direction
Start with the RSA signing-key implementation at src/pkcs1v15/signing_key.rs, which the issue identifies as carrying the digest information, and inspect the corresponding PKCS#1 v1.5 and PSS signature types. Determine whether the API can distinguish signatures by digest without breaking the generic signature traits. Done means reaching and documenting a clear API decision, with affected behavior and coverage identified.
Written by the indexing model from the issue text.
Description
Hey Tony, long time no chat!
I'm using RustCrypto in a project involving JOSE. I have some fairly open ended extensibility requirements, so I'm leveraging RustCrypto's generic signature traits as much as possible, to support users defining their own signing implementations, such as over WebCrypto with wasm, or using an HSM. As part of this, I've defined a trait for mapping RustCrypto signature encodings to their corresponding algorithm name in JWA.
This is generally working great, for most signature types:
pub trait JWSSignature: SignatureEncoding {
const ALGORITHM: jose_jwa::Signing;
}
impl JWSSignature for ecdsa::Signature<p256::NistP256> {
const ALGORITHM: jose_jwa::Signing = jose_jwa::Signing::Es256;
}
impl JWSSignature for ecdsa::Signature<k256::Secp256k1> {
const ALGORITHM: jose_jwa::Signing = jose_jwa::Signing::Es256K;
}
But I run into issues with RSASSA-PKCS1-v1_5 and RSASSA-PSS signatures, as implemented in the rsa crate, because their corresponding signature types don't specify the hash function used in the signature, and so there isn't a 1:1 mapping between signatures and their JWA name.
For example:
impl JWSSignature for rsa::pkcs1v15::Signature {
// Might be Rs256, Rs384, or Rs512
const ALGORITHM: jose_jwa::Signing = ???;
}
This information is available on the corresponding signing key types for both variants of RSA signatures, so I'm wondering whether it would make sense for the digest type to also be tracked on the signatures themselves, in order to differentiate between signatures which use different hash functions.
In my case, it's not the end of the world if this isn't supported, because no one should really be deploying RSASSA-PKCS1-v1_5 using SHA-512 anyway, but that I ran into this limitation in the first place had me wondering whether it was a gap in the API worth thinking about.
Thanks for all the great work here, I'm really enjoying how the whole ecosystem slots together so nicely :)
- Dominant language
- Rust
- Stars
- 673
- Forks
- 190
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RustCrypto/RSA
-
Bump MSRV to 1.89 Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
RustCrypto/RSA#707 · 2 comments · 1 reaction ·
-
Difficulty 3/5 Half a day Newbie friendliness 74/100
RustCrypto/RSA#703 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
RustCrypto/RSA#686 · 4 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
RustCrypto/RSA#647 · 9 comments · 1 reaction ·
-
broken rust docs Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
RustCrypto/RSA#641 · 3 reactions ·
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100