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

AesGcm support is missing #19285

Open
trampster opened this issue Mar 23, 2020 · 8 comments
Open

AesGcm support is missing #19285

trampster opened this issue Mar 23, 2020 · 8 comments

Comments

@trampster
Copy link

Steps to Reproduce

  1. Try and construct a AesGcm instance
  2. Notice you get a PlatformNotSupportedException

Current Behavior

AesGcm is not supported

Expected Behavior

AesGcm is part of dotnet standard 2.1 which is officially supported, so I would except this to work.

On which platforms did you notice this

Xamarin.Android

Version Used:
Xamarin.Android 10.1.4.0

@trampster
Copy link
Author

trampster commented Mar 23, 2020

I can confirm that the .dotnet core code for this work great on linux, I'm not sure at what level the mono project can reuse code from dotnet core, but just taking there implementation would seem like a good idea.

@trampster
Copy link
Author

trampster commented Mar 24, 2020

As far as I'm aware there is no platform reason this should be missing, openssl has support for AesGcm and that is what dotnet core uses successfully on linux.

@ngarside
Copy link

I ran into this issue while trying to port a .net core app to android. It's been pretty straightforward so far with the lack of aesgcm support being the only major pain point.

@trampster
Copy link
Author

As a temporary work around I've created a OpenSSL wrapper for AesGcm, which you can find here: https://www.nuget.org/packages/Ropu.AesGcm/

However I would much rather this was implemented in mono as part of .net Standard 2.1

@ognamala
Copy link

ognamala commented May 19, 2020

I can confirm that this issue with also happens on iOS

at System.Security.Cryptography.AesGcm..ctor (System.Byte[] key) [0x00006] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/corefx/AesGcm.cs:9

@DanGould
Copy link

DanGould commented Apr 21, 2021

I'm running into this issue too, after assuming 2.1 was supported and writing a bunch of crypto code for iOS and testing on MacOS where it fails with No usable version of libssl was found. Considering the viability of wrapping AesGcm from the browser to get it cross platform 🥴 I will consider the iOS workaround, but I'd really love and dream for this to work on android too, so mono support is ideal

@Liam2349
Copy link

Just ran into the same issue when testing a project on Android - PlatformNotSupported Exception when trying to use the AesGcm class. For example, attempting to access the AesGcm.NonceByteSizes.MaxSize property throws this exception.

I am using Xamarin.Android SDK 11.4.0.5 with Visual Studio Community 16.11.2.

I selected this class because according to the docs, Xamarin.Android 10 is .NET Standard 2.1 compliant, which I believe requires AesGcm compatibility, so I was under the impression it would work.

To anyone looking for an alternative, there is a detailed CBC-HMAC example here: https://docs.microsoft.com/en-us/dotnet/standard/security/vulnerabilities-cbc-mode

@shaiArn
Copy link

shaiArn commented Dec 5, 2022

I also ran into this issue when trying to use the AesGcm class in a Unity project. I was using jose-jwt library and got a PlatformNotSupportedException when trying to use AesGcm.

I would really appreciate it if you could look into supporting AesGcm.

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

6 participants