-
Notifications
You must be signed in to change notification settings - Fork 184
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
AES256GCM JWE encryption in .NET standard 2.0 using Bouncy Castle #207
Comments
Hi @shaiArn, library is using managed AES-GCM implementation on NETSTANDARD 2.1 runtime. Should work just fine on .NetCore 3.0+ Please check out yourself: https://github.com/dvsekhvalnov/jose-jwt/blob/master/jose-jwt/crypto/AesGcmNetCore.cs What exact error are you facing? Answering your questions about Bouncy Castle. It's against library design goal to be zero-dependency. There are different reasons behind it. On the other hand you can easily implement it yourself and register your own encryption implementation with: JWT.DefaultSettings.RegisterJwe(JweEncryption.A256GCM, YourBCImplementation); If i ever have time, probably can publish alternate set of implementations as separate library too. |
Hi @dvsekhvalnov, thank you for your answer. Here is the full error:
Some more context and information
Do you think we there's a chance to use |
Yeah, it looks it doesn't use .Netstandard 2.1 according to stack trace. I'm not an expert on Unity itself, but quick googling gave me https://forum.unity.com/threads/unity-future-net-development-status.1092205/ Probably you can check if Unity support .Netstandard 2.1 runtime or any plans. |
@dvsekhvalnov, thank you for your previous suggestions and for offering to help with this issue.
However, when I force it to use the 2.1. version I get the following error:
Here is the encrypt method of my implementation:
(I used Scott Brady's blog post as a reference) Is there anything that you see that I might have missed in my code? Any guidance would be greatly appreciated. |
Hi @shaiArn ,
|
@dvsekhvalnov, thank you! As for 1 - It seems like mono does not support AES GCM. So unless there's a workaround to it, I guess the Bouncy Castle lead is the one to follow. Thank you for the Java version. If I figure it out, I'll share my solution here. |
Hey @dvsekhvalnov,
I'm trying to encode a JWT with JWE encryption using AES 256 GCM.
On Windows, it works great:
JWT.Encode(payload, jwk, JweAlgorithm.RSA_OAEP, JweEncryption.A256GCM, extraHeaders: header)
The tricky part is that I need it to run on iOS, and the AES 256 GCM algorithm used is using the bcrypt dll that does not exist on iOS.
Is it possible to use Bouncy Castle's implementation instead of the .NET core one?
The text was updated successfully, but these errors were encountered: