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

Support RSA.PKCS1 on Apple provider #12

Closed
StefanOltmann opened this issue Dec 11, 2023 · 7 comments
Closed

Support RSA.PKCS1 on Apple provider #12

StefanOltmann opened this issue Dec 11, 2023 · 7 comments

Comments

@StefanOltmann
Copy link

StefanOltmann commented Dec 11, 2023

I wish support for RSA.PKCS1 on the -apple provider. The openssl3-prebuilt works fine on iOS for me, but I fear that I will have to provide a export compliance, because it's additional cryptography to the apple build-in:
https://developer.apple.com/documentation/security/complying_with_encryption_export_regulations

As far as I understand I do not need to fill this form I just use cryptography provided by Apples framework.

My use case is verification of RS256 JWT signatures.

Bildschirmfoto 2023-12-11 um 17 45 44
@whyoleg
Copy link
Owner

whyoleg commented Dec 13, 2023

Hey!
Thanks for raising the issue here!

First, regarding RSA in apple provider.
I will add RSA for apple provider in coming release (in several weeks, I have a prototype already in some old branch). But keep in mind, that Security Framework (where RSA is implemented out-of-the-box) have minimal support for key encoding/decoding, and until we will have some kind of ASN.1 (DER) encoder/decoder implemented in cryptography-kotlin (there is no such kind of things for Kotlin Multiplatform, yet), there will be only PKCS#1 format (it differs from standard DER/PEM encoding).
Some links for context about difference between RSA key formats:

Second, regarding Apple export regulations.
As far as I found, if you are using open source solutions (like cryptography-kotlin which is using openssl, which are both open-source) - you are falling into exemption, and so there should be no problems. Still, AFAIU you will still need to send annual (year-end) self-classification report to the US government to comply with the encryption export regulations, though, as far as I see, this step is needed even if you use standard Apple encryption, or even just do HTTPS requests - they all are treated as exemption, and so you will need only to submit this report. Looks like Google Play has the same policy for encryption, so it should be something standard (I believe).
Still, Im not a lawyer, Im not an expert in iOS development and distribution - so it's better to contact someone regarding this, even if you use Apple provided encryption.
Also, here I also have some links, which I found useful, and so may be it will be useful for you/your team. But, please look carefully, as articles/answers have rather different date of publication, and there were a lot of changes to U.S. laws (somewhen in 2016-2017), so be careful and patient:

May be this (a lot of links) is not what you expected when you've posted the question, but Im trying my best to at least understand what are the consequences of this and how it will affect end-users.

@StefanOltmann
Copy link
Author

Thank you a lot for your research!
Yes, I indeed need to understand this topic far better.

@michalkierasinski
Copy link

When do you plan to release a new version with support for RSA.PKCS1?

@whyoleg
Copy link
Owner

whyoleg commented Jan 16, 2024

Hey @michalkierasinski, implementation for RSA.PKCS1 for Apple provider is already merged in dev and available in the latest snapshot (0.3.0-SNAPSHOT). So at least you can try it there.
Still, it doesn't yet support standard DER/PEM encoding/decoding (only older ones). I'm now investigating/prototyping this.
Hopefully the release containing RSA.PKCS1 for Apple provider (and other features) will be available in the end of January / mid February.

@JesusMcCloud
Copy link

@whyoleg
Copy link
Owner

whyoleg commented Jan 16, 2024

Thank you @JesusMcCloud ! Nice library! I will definitely take a closer look!

@whyoleg
Copy link
Owner

whyoleg commented Feb 21, 2024

0.3.0 is released!
Now Apple provider supports all RSA algorithms!

@whyoleg whyoleg closed this as completed Feb 21, 2024
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

No branches or pull requests

4 participants