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 RSA.Encryption.PublicKey unsafePEMRepresentation incorrect keySizeInBits #234

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

anotheren
Copy link

In version 3.4, the _RSA.Encryption.PublicKey introduced a set of unsafe APIs to handle cases where keySizeInBits is less than 2048. However, in the implementation, the boundary check for keySizeInBits in init(unsafePEMRepresentation:) was incorrectly set as self.keySizeInBits >= 2048. Similar APIs indicate that it should actually be self.keySizeInBits >= 1024. This PR attempts to correct this issue.

Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

Thanks, this is a really good catch. Are you interested in adding a quick unit test to prevent further regression?

@anotheren
Copy link
Author

Just added.

@Lukasa
Copy link
Collaborator

Lukasa commented May 29, 2024

@swift-server-bot test this please

@Lukasa Lukasa added the semver/patch No public API change. label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants