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

Fixup CryptoExtras RSA public key formats #151

Merged
merged 1 commit into from Mar 10, 2023

Conversation

Lukasa
Copy link
Collaborator

@Lukasa Lukasa commented Mar 10, 2023

Motivation

CryptoExtras RSA public keys support being exported in DER and PEM form. These exports work great, but it turns out they are inconsistent between the Darwin and non-Darwin implementations. Darwin platforms would export the public keys in PKCS1 format, while non-Darwin was exporting them as SPKI. This isn't great!

Modifications

  • Make the two consistent. .derRepresentation should export SPKI formatted public keys, because that's what it does for all the EC keys.
  • Add .pkcs1DERRepresentation and .pkcs1PEMRepresentation for those users that require the PKCS1 formatted key.

Result

Key export types are now consistent on all platforms.

Motivation

CryptoExtras RSA public keys support being exported in DER and PEM form.
These exports work great, but it turns out they are inconsistent between
the Darwin and non-Darwin implementations. Darwin platforms would export
the public keys in PKCS1 format, while non-Darwin was exporting them as
SPKI. This isn't great!

Modifications

- Make the two consistent. `.derRepresentation` should export SPKI
    formatted public keys, because that's what it does for all the EC
    keys.
- Add `.pkcs1DERRepresentation` and `.pkcs1PEMRepresentation` for those
    users that require the PKCS1 formatted key.

Result

Key export types are now consistent on all platforms.
@Lukasa Lukasa added the 🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0 label Mar 10, 2023
@Lukasa Lukasa merged commit da0fe44 into apple:main Mar 10, 2023
@Lukasa Lukasa deleted the cb-rsa-key-format branch March 10, 2023 11:38
@Sajjon Sajjon mentioned this pull request Mar 25, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants