-
-
Notifications
You must be signed in to change notification settings - Fork 714
feat: implement minimum key length validation for HMAC and RSA algorithms #1085
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
base: master
Are you sure you want to change the base?
feat: implement minimum key length validation for HMAC and RSA algorithms #1085
Conversation
f640139
to
be2fe1b
Compare
Hi @auvipy , |
hopefully very soon. |
…thms for more information, see https://pre-commit.ci
be2fe1b
to
366ee13
Compare
for more information, see https://pre-commit.ci
Note the build fails because the "docs/index.rst" have examples which are not updated. The key length is too short. |
I wont be able to review this for a couple of days. Whatever we do should have the option of just a warning vs enforcement. |
I'll implement two methods to give users the option to enable or disable enforcement as needed. |
… configurable enforcement API
for more information, see https://pre-commit.ci
@jpadilla I made the enforcement configurable, added two new APIs, included comments in the code, and updated the documentation. |
@amanjolhe when you merge main back into your branch, the tests should turn green |
Thanks @amanjolhe for taking this up! |
Security Fix: CVE-2025-45768 – Enforce Minimum Key Length Validation with Configurable API
This PR resolves CVE-2025-45768 by enforcing minimum key length requirements for HMAC and RSA algorithms, with a professional function-based API for configuration, in compliance with RFC 7518 and NIST SP800-117.
🔒 Security Enhancements
prepare_key()
andfrom_jwk()
methods🚀 New API Functions
set_min_key_length_enforcement(enforce: bool)
– Configure validation behaviorTrue
(default): RaisesInvalidKeyError
for weak keysFalse
(deprecated): Issues security warnings but allows operationget_min_key_length_enforcement() -> bool
– Get current enforcement mode📚 Documentation & Testing
InvalidKeyError
Example Usage