AesUtilities.cs 713 B

123456789101112131415161718192021222324252627
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines;
  4. namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto
  5. {
  6. public static class AesUtilities
  7. {
  8. public static IBlockCipher CreateEngine()
  9. {
  10. #if NETCOREAPP3_0_OR_GREATER
  11. if (AesEngine_X86.IsSupported)
  12. return new AesEngine_X86();
  13. #endif
  14. return new AesEngine();
  15. }
  16. #if NETCOREAPP3_0_OR_GREATER
  17. public static bool IsHardwareAccelerated => AesEngine_X86.IsSupported;
  18. #else
  19. public static bool IsHardwareAccelerated => false;
  20. #endif
  21. }
  22. }
  23. #pragma warning restore
  24. #endif