Skip to content
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

Fix 2049 bit RSA issues and roundtrip PKCS#1 and PKCS#8 #462

Merged

Conversation

Fethbita
Copy link

@Fethbita Fethbita commented Dec 1, 2024

Fixes issues in tests in #394

The problem exists because BigUint usually have leading zeroes and the equality checks fail because of that. Now the PKCS#1 and PKCS#8 tests parse the hex number into a BigUint and the equality is checked between them. As for the 2049 bit RSA signing/verification issue, that also was caused by leading zeroes in the left_pad method.

The `n` in both cases is 257 bytes, with first element being 0
Re-encoded the number into 256 bytes and now the decoding works.

Note that ff you want to keep the previous Base64 `n`, then the
BoxedUint must take 2056 as the `bits_precision` parameter
@dignifiedquire
Copy link
Member

thanks a lot! will take a closer look when back on my computer

@dignifiedquire dignifiedquire merged commit e15b6a4 into RustCrypto:const-crypto-biguint Dec 1, 2024
4 of 11 checks passed
@dignifiedquire
Copy link
Member

merged manually, thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants