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

Add .NET 8.0 TFM and use new AesGcm constructor #249

Closed
wants to merge 5 commits into from

Conversation

zzyzy
Copy link
Contributor

@zzyzy zzyzy commented Jul 9, 2024

Closes #248

@dvsekhvalnov
Copy link
Owner

@zzyzy it's failing bunch test targets.

@@ -13,7 +13,7 @@ public class JwtSettings
{
public JwtSettings()
{
#if NET472 || NETSTANDARD2_1
#if NET472 || NETSTANDARD2_1 || NET
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be NET8_0 ? What NET specifically targets?

Copy link
Contributor Author

@zzyzy zzyzy Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NET targets .NET 5.0 and above.

It's just for convenience like e.g. if in the future we want to target .NET 9.0 and beyond, we just need to update the csproj file with net9.0 and NET will cover it automatically without adding NET9_0 to every file.

@zzyzy
Copy link
Contributor Author

zzyzy commented Sep 30, 2024

@zzyzy it's failing bunch test targets.

@dvsekhvalnov Sorry for the late response, I've fixed them.

@@ -37,7 +45,14 @@ public static byte[][] Encrypt(byte[] key, byte[] iv, byte[] aad, byte[] plainTe
/// <exception cref="CryptographicException">if decryption failed by any reason</exception>
public static byte[] Decrypt(byte[] key, byte[] iv, byte[] aad, byte[] cipherText, byte[] authTag)
{
#if NET
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess we can just collapse both branches together now? No need to use .NET 8.0 specific AesGcm() constructor as you check auth tag length explicitly now. And you can leverage Ensure.BitSize(..) helper right at the start of the method.

And after just clean up all NET targeting, cause no need to and PR will become nice & small, just of couple files :)

@@ -58,7 +58,7 @@ public JwtSettings()
{ JwsAlgorithm.ES256, new EcdsaUsingSha(256) },
{ JwsAlgorithm.ES384, new EcdsaUsingSha(384) },
{ JwsAlgorithm.ES512, new EcdsaUsingSha(521) }
#elif NETSTANDARD || NET461 || NET472
#elif NETSTANDARD || NET461 || NET472 || NET
Copy link
Owner

@dvsekhvalnov dvsekhvalnov Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as mentioned in AesGcmNetCore.cs comment, no need to touch all project fuke with with extra targeting || NET as fix is just checking length and should work just fine on every plarform.

@dvsekhvalnov
Copy link
Owner

Closed in favor of #255

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

Successfully merging this pull request may close these issues.

Add .NET 8.0 TFM and use new AesGcm constructor
2 participants