From 016b9de43f9948093574ef2558e2849caf4a7c40 Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis <12659251+teo-tsirpanis@users.noreply.github.com> Date: Tue, 7 Sep 2021 01:47:43 +0300 Subject: [PATCH 1/2] Fix Windows 8 detection. Windows 8's actual version is 6.2, not 8. The test would succeed only on Windows 10+. --- .../src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs index c72dcb4c932499..b72f01a8c1a195 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs @@ -18,7 +18,7 @@ internal static partial class Pbkdf2Implementation { // For Windows 7 we will use BCryptDeriveKeyPBKDF2. For Windows 8+ we will use BCryptKeyDerivation // since it has better performance. - private static readonly bool s_useKeyDerivation = OperatingSystem.IsWindowsVersionAtLeast(8, 0, 0); + private static readonly bool s_useKeyDerivation = OperatingSystem.IsWindowsVersionAtLeast(6, 2); // A cached instance of PBKDF2 for Windows 8, where pseudo handles are not supported. private static SafeBCryptAlgorithmHandle? s_pbkdf2AlgorithmHandle; From 13fbffb4cfc79fa37178c632bff535b29189dcba Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis <12659251+teo-tsirpanis@users.noreply.github.com> Date: Tue, 7 Sep 2021 22:15:56 +0300 Subject: [PATCH 2/2] Explain that Windows 8's version is 6.2. Co-authored-by: Jeff Handley --- .../src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs index b72f01a8c1a195..e9275bc28ae3cc 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs @@ -16,8 +16,8 @@ namespace Internal.Cryptography { internal static partial class Pbkdf2Implementation { - // For Windows 7 we will use BCryptDeriveKeyPBKDF2. For Windows 8+ we will use BCryptKeyDerivation - // since it has better performance. + // For Windows 7 we will use BCryptDeriveKeyPBKDF2. For Windows 8+ (seen as version 6.2.0) we will + // use BCryptKeyDerivation since it has better performance. private static readonly bool s_useKeyDerivation = OperatingSystem.IsWindowsVersionAtLeast(6, 2); // A cached instance of PBKDF2 for Windows 8, where pseudo handles are not supported.