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

Update RSA's publicKeyDER method to support exponent any byte length #1029

Merged

Conversation

WFrost3
Copy link
Contributor

@WFrost3 WFrost3 commented Nov 15, 2023

Fixes #1028

The publicKeyDER method for in RSA.swift only supports the conversion of RSA keys that have a exponent that is exactly 3 bytes long.

Most commonly, exponents are either 65537 or 3 and while an exponent of 3 can be vulnerable it is a valid exponent; the common exponents have byte lengths of 3 and 1. In addition, exponents can be non standard and have a byte length that is not 3 or 1.

Checklist:

  • Correct file headers (see CONTRIBUTING.md).
  • Formatted with SwiftFormat.
  • Tests added.

Changes proposed in this pull request:

  • publicKeyDER updated to work for exponent of any size
  • Test added for 1 byte long exponent

@nathanfallet nathanfallet self-requested a review December 6, 2023 14:32
Copy link
Collaborator

@nathanfallet nathanfallet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@nathanfallet nathanfallet merged commit 3e56b61 into krzyzanowskim:main Dec 6, 2023
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