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 AES-GCM for iOS-like platforms #91523

Closed
tipa opened this issue Sep 3, 2023 · 9 comments · Fixed by #104383
Closed

Support AES-GCM for iOS-like platforms #91523

tipa opened this issue Sep 3, 2023 · 9 comments · Fixed by #104383
Labels
area-System.Security in-pr There is an active PR which will close this issue when it is merged os-ios Apple iOS os-maccatalyst MacCatalyst OS os-tvos Apple tvOS
Milestone

Comments

@tipa
Copy link

tipa commented Sep 3, 2023

AES-GCM algorithm (as well as ChaCha20Poly1305 and AES-CCM) are available for macOS, powered by CryptoKit, but not on iOS.

As CryptoKit is also available on iOS (iOS 13+), maybe there is an easy way to also bring support to iOS?

Motivation: I am building a cross-platform app for Windows, iOS, Android & macOS. Missing support for AES-GCM on iOS forces me to either pull in an additional dependency (e.g. BouncyCastle) or use AES-CBC (which seemingly the whole internet is advising against in favor of AES-GCM)

NOTE: once this is implemented we should update the docs: https://github.com/dotnet/docs/blob/main/docs/standard/security/cross-platform-cryptography.md

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Sep 3, 2023
@ghost
Copy link

ghost commented Sep 3, 2023

Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

AES-GCM algorithm (as well as ChaCha20Poly1305) as available for macOS, powered by CryptoKit, but not on iOS.

As CryptoKit is also available on iOS (iOS 13+), maybe there is an easy way to also bring support to iOS?

Motivation: I am building a cross-platform app for Windows, iOS, Android & macOS. Missing support for AES-GCM on iOS forces me to either pull in an additional dependency (e.g. BouncyCastle) or use AES-CBC (which seemingly the whole internet is advising against in favor of AES-GCM)

Author: tipa
Assignees: -
Labels:

area-System.Security, untriaged

Milestone: -

@EgorBo EgorBo added the os-ios Apple iOS label Sep 3, 2023
@ghost
Copy link

ghost commented Sep 3, 2023

Tagging subscribers to 'os-ios': @steveisok, @akoeplinger, @kotlarmilos
See info in area-owners.md if you want to be subscribed.

Issue Details

AES-GCM algorithm (as well as ChaCha20Poly1305) as available for macOS, powered by CryptoKit, but not on iOS.

As CryptoKit is also available on iOS (iOS 13+), maybe there is an easy way to also bring support to iOS?

Motivation: I am building a cross-platform app for Windows, iOS, Android & macOS. Missing support for AES-GCM on iOS forces me to either pull in an additional dependency (e.g. BouncyCastle) or use AES-CBC (which seemingly the whole internet is advising against in favor of AES-GCM)

Author: tipa
Assignees: -
Labels:

area-System.Security, untriaged, os-ios

Milestone: -

@tipa
Copy link
Author

tipa commented Sep 3, 2023

Yes, available for macOS, but not iOS - that's why I opened this issue :)
PlatformNotSupportedException is still thrown on net8.0-ios

@EgorBo
Copy link
Member

EgorBo commented Sep 3, 2023

Yes, available for macOS, but not iOS - that's why I opened this issue :) PlatformNotSupportedException is still thrown on net8.0-ios

Yep, sorry, didn't notice 🙂

@vcsjones
Copy link
Member

vcsjones commented Sep 3, 2023

As CryptoKit is also available on iOS (iOS 13+), maybe there is an easy way to also bring support to iOS?

The last time @filipnavara and I looked in to this, there were challenges for mobile Apple platforms. This comment for ChaCha20Poly1305 summarizes things: #52482 (comment)

That issue also tracks ChaCha20Poly1305 for iOS / tvOS as well.

@vcsjones
Copy link
Member

vcsjones commented Sep 3, 2023

@filipnavara has the state of this changed with _MainLinkerFlags? You're more well versed on the iOS side of things.

@vcsjones vcsjones added this to the Future milestone Sep 3, 2023
@filipnavara
Copy link
Member

We discussed it in June with @akoeplinger. The current situation is that we still support iOS versions without built-in Swift. That may change in .NET 9 but nothing is set in stone yet. The old workaround to weakly link against system Swift libraries no longer works because Apple decided to move parts of swiftFoundation into Foundation framework. Thus you need to additionally tell the linker to weakly link to Foundation framework itself. It's doable but fragile and likely not worth the effort. If we are targeting .NET 9 at this point then we may as well get the necessary minimum iOS version bump and do it the proper/simple way.

@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Sep 3, 2023
@vcsjones
Copy link
Member

Cross referencing this: #91736

I believe that is the major blocker for this. Once this is addressed we can link to the swift runtime.

CryptoKit is still iOS 13 though. We can use if #available in the swift shim to return an error code that the platform is not supported.

@vcsjones vcsjones changed the title Support AES-GCM for iOS Support AES-GCM for iOS-like platforms Nov 16, 2023
@vcsjones vcsjones added os-tvos Apple tvOS os-maccatalyst MacCatalyst OS labels Nov 16, 2023
@ghost
Copy link

ghost commented Nov 16, 2023

Tagging subscribers to 'os-tvos': @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.

Issue Details

AES-GCM algorithm (as well as ChaCha20Poly1305 and AES-CCM) are available for macOS, powered by CryptoKit, but not on iOS.

As CryptoKit is also available on iOS (iOS 13+), maybe there is an easy way to also bring support to iOS?

Motivation: I am building a cross-platform app for Windows, iOS, Android & macOS. Missing support for AES-GCM on iOS forces me to either pull in an additional dependency (e.g. BouncyCastle) or use AES-CBC (which seemingly the whole internet is advising against in favor of AES-GCM)

Author: tipa
Assignees: -
Labels:

area-System.Security, os-ios, os-tvos, os-maccatalyst

Milestone: Future

@akoeplinger akoeplinger modified the milestones: Future, 9.0.0 Nov 19, 2023
akoeplinger added a commit to akoeplinger/runtime that referenced this issue Jul 3, 2024
…via CryptoKit

Now that we support minimum OS versions that ship with Swift we can enable CryptoKit and pal_swiftbindings.swift.

Fixes dotnet#91523
@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label Jul 3, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Security in-pr There is an active PR which will close this issue when it is merged os-ios Apple iOS os-maccatalyst MacCatalyst OS os-tvos Apple tvOS
Projects
None yet
5 participants