-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
std.crypto: enhance Certificate security #19759
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
Conversation
Enhanced security: - Add and use more secure DER parser which prevents previously possible buffer overflows and OOB reads. - Fail on unknown critical extensions. - Verify key usage and extended key usage (closes ziglang#14175). - Verify policy (needs future work + validation). - Verify basic constraints. - Verify that Certificates loaded into bundles are indeed CAs. - Correctly handle certificate dates before 1970. Enhanced compatibility: - Allow any SHA2 hash function with RSA and ECDSA public keys.
Putting this up for early feedback from @jedisct1 regarding crypto API changes. I feel Still need to:
|
// // check that d * e is one mod p-1 and mod q-1. Note d and e were bound | ||
// const de = secret.d.mul(public.e); // can't mul these :( |
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.
Divide de
by (p-1)
(and (q-1)
) and check that the remainder is 1
.
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.
Not sure how to compute de
when there's no FeUnit multiplication except under the modulus.
Also not sure how to divide since there's no div function in ff.zig
.
Montgomery would be ashamed of me...
This is great work, but it would be really better if you could split these changes into smaller, more scoped PRs, that would be way easier to review and discuss. |
this feels like it should be split up into multiple independently reviewed PRs. being a 10k+ line diff in a single commit makes the effort to merge this exponentially higher than otherwise. |
I spent 2 days thinking of how to split this up. I could only think of a dirty way, but I'll pursue that given the feedback.
6K of it is test files, but 4k is indeed still large. |
Closing in favor of #19771 and another Certificate PR after that. All RSA feedback has been addressed there except for how to check d * e is one mod p-1 and mod q-1, which is luckily not essential. |
Enhanced security:
Enhanced compatibility:
Added features: