public static void CheckIsSupported() { bool expectedIsSupported = false; // assume not supported unless environment advertises support if (PlatformDetection.IsWindows) { // Runtime uses a hardcoded OS version to determine support. // The test queries the OS directly to ensure our version check is correct. expectedIsSupported = CngUtility.IsAlgorithmSupported("CHACHA20_POLY1305"); } else if (PlatformDetection.IsAndroid) { // Android with API Level 28 is the minimum API Level support for ChaChaPoly1305. expectedIsSupported = OperatingSystem.IsAndroidVersionAtLeast(28); } else if (PlatformDetection.IsMariner) { // OpenSSL is present, and a high enough version, // but the distro build options turned off ChaCha/Poly. } else if (PlatformDetection.OpenSslPresentOnSystem && (PlatformDetection.IsOSX || PlatformDetection.IsOpenSslSupported)) { const int OpenSslChaChaMinimumVersion = 0x1_01_00_00_F; //major_minor_fix_patch_status expectedIsSupported = SafeEvpPKeyHandle.OpenSslVersion >= OpenSslChaChaMinimumVersion; } Assert.Equal(expectedIsSupported, ChaCha20Poly1305.IsSupported); }
public static void CheckIsSupported() { bool expectedIsSupported = false; // assume not supported unless environment advertises support if (PlatformDetection.IsWindows) { // Runtime uses a hardcoded OS version to determine support. // The test queries the OS directly to ensure our version check is correct. expectedIsSupported = CngUtility.IsAlgorithmSupported("CHACHA20_POLY1305"); } Assert.Equal(expectedIsSupported, ChaCha20Poly1305.IsSupported); }
public static void CheckIsSupported() { bool expectedIsSupported = false; // assume not supported unless environment advertises support if (PlatformDetection.IsWindows) { // Runtime uses a hardcoded OS version to determine support. // The test queries the OS directly to ensure our version check is correct. expectedIsSupported = CngUtility.IsAlgorithmSupported("CHACHA20_POLY1305"); } else if (PlatformDetection.IsOSX || PlatformDetection.IsOpenSslSupported) { const int OpenSslChaChaMinimumVersion = 0x1010000F; expectedIsSupported = SafeEvpPKeyHandle.OpenSslVersion >= OpenSslChaChaMinimumVersion; } Assert.Equal(expectedIsSupported, ChaCha20Poly1305.IsSupported); }