Skip to content

fix: handle odd keys#459

Merged
dignifiedquire merged 2 commits into
masterfrom
fix-small-keys
Dec 17, 2024
Merged

fix: handle odd keys#459
dignifiedquire merged 2 commits into
masterfrom
fix-small-keys

Conversation

@dignifiedquire
Copy link
Copy Markdown
Member

@dignifiedquire dignifiedquire commented Nov 13, 2024

Ther are two issues with oddly formed keys that were not properly handled

  • avoid using - to avoid a subtraction with overflow for pkcs
  • always validate the key in from_components to avoid errors in the internal precompute

@tarcieri
Copy link
Copy Markdown
Member

I’m reminded of #445

@dignifiedquire
Copy link
Copy Markdown
Member Author

yes, but the goal here is not general security, but rather for a first step remove unusable keys

once we have a solution for #445 this can be folded in

@dignifiedquire dignifiedquire changed the title fix: handle tiny keys fix: handle odd keys Nov 18, 2024
@dignifiedquire dignifiedquire merged commit 9956b8f into master Dec 17, 2024
@dignifiedquire dignifiedquire deleted the fix-small-keys branch December 17, 2024 11:06
@dignifiedquire
Copy link
Copy Markdown
Member Author

already published on the 0.9.x branch, so merging

takumi-earth pushed a commit to earthlings-dev/RSA that referenced this pull request Jan 27, 2026
Ther are two issues with oddly formed keys that were not properly
handled

- avoid using `-` to avoid a subtraction with overflow for pkcs
- always validate the key in `from_components` to avoid errors in the
internal `precompute`
tarcieri pushed a commit that referenced this pull request Jan 27, 2026
Adds a `hazmat`-gated method to `RsaPrivateKey` to allow construction of
keys with large public exponents, which was removed in #459.

These are a potential DoS vector ("RSADoS") hence gating on `hazmat`:

https://www.imperialviolet.org/2012/03/17/rsados.html
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