Skip to content

Commit

Permalink
Add support for AesGcm.IsSupported on .NET 6.0 and higher
Browse files Browse the repository at this point in the history
  • Loading branch information
EraYaN authored and brentschmaltz committed Apr 14, 2023
1 parent e65930f commit 85fa86a
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ public AuthenticatedEncryptionProvider(SecurityKey key, string algorithm)
{
if (SupportedAlgorithms.IsAesGcm(algorithm))
{
#if NETSTANDARD2_0 || NET6_0
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
throw LogHelper.LogExceptionMessage(new PlatformNotSupportedException(LogHelper.FormatInvariant(LogMessages.IDX10713, LogHelper.MarkAsNonPII(algorithm))));
#if NETSTANDARD2_0
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
throw LogHelper.LogExceptionMessage(new PlatformNotSupportedException(LogHelper.FormatInvariant(LogMessages.IDX10713, LogHelper.MarkAsNonPII(algorithm))));
#elif NET6_0_OR_GREATER
if(!System.Security.Cryptography.AesGcm.IsSupported)
throw LogHelper.LogExceptionMessage(new PlatformNotSupportedException(LogHelper.FormatInvariant(LogMessages.IDX10713, LogHelper.MarkAsNonPII(algorithm))));
#endif
InitializeUsingAesGcm();
}
Expand Down

0 comments on commit 85fa86a

Please sign in to comment.