uruk-project / Jwt

JSON Web Token implementation for .Net & .Net Core
MIT License
81 stars 13 forks source link

Fix error when AES-NI is not supported by the OS/CPU but supported by the dotnet sdk #515

Closed ycrumeyrolle closed 3 years ago

ycrumeyrolle commented 3 years ago

Resolves #514

ycrumeyrolle commented 3 years ago

Tests confirmed that setting SET COMPlus_EnableAES=0 environment variable raised the PlatformNotSupportedException. Added also some guard on other AES tests.

ycrumeyrolle commented 3 years ago

AesKeyWrapper was bogus, AesKeyUnwrapper was fine.

ycrumeyrolle commented 3 years ago

Added the static property EncryptionAlgorithm.EnabledAesInstructionSet which is true by default. Setting to false will switch to non-NI implementation. This produces an acceptable overhead.