Skip to content

Commit 306ced2

Browse files
authored
Relax encrypted cert requirement for Windows with Pkcs12Export tests
1 parent 7e5e573 commit 306ced2

File tree

1 file changed

+10
-2
lines changed
  • src/libraries/System.Security.Cryptography/tests/X509Certificates

1 file changed

+10
-2
lines changed

src/libraries/System.Security.Cryptography/tests/X509Certificates/ExportTests.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,9 +834,17 @@ internal static (int certs, int keys) VerifyPkcs12(
834834
AssertEncryptionAlgorithm(epki.EncryptionAlgorithm);
835835
keys++;
836836
}
837-
else if (safeBag is Pkcs12CertBag && wasEncryptedSafe)
837+
else if (safeBag is Pkcs12CertBag)
838838
{
839-
certs++;
839+
if (wasEncryptedSafe)
840+
{
841+
certs++;
842+
}
843+
else if (PlatformDetection.IsWindows10OrLater && !PlatformDetection.IsWindows10Version1703OrGreater)
844+
{
845+
// Windows 10 before RS2 / 1703 did not encrypt certs, but count them anyway.
846+
certs++;
847+
}
840848
}
841849
}
842850
}

0 commit comments

Comments
 (0)