diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs index db6f7b863a0891..0cca6d05c59143 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs @@ -44,6 +44,7 @@ public static partial class PlatformDetection public static bool IsNotMacOsAppleSilicon => !IsMacOsAppleSilicon; public static bool IsAppSandbox => Environment.GetEnvironmentVariable("APP_SANDBOX_CONTAINER_ID") != null; public static bool IsNotAppSandbox => !IsAppSandbox; + public static bool IsApplePlatform26OrLater => IsApplePlatform && Environment.OSVersion.Version.Major >= 26; public static Version OpenSslVersion => !IsApplePlatform && !IsWindows && !IsAndroid ? GetOpenSslVersion() : diff --git a/src/libraries/System.Security.Cryptography/tests/X509Certificates/ChainTests.cs b/src/libraries/System.Security.Cryptography/tests/X509Certificates/ChainTests.cs index 34ce9021b14b51..a9b209003ec496 100644 --- a/src/libraries/System.Security.Cryptography/tests/X509Certificates/ChainTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/X509Certificates/ChainTests.cs @@ -288,13 +288,13 @@ public static void SystemTrustCertificateWithCustomRootTrust(bool addCertificate // Check some known conditions. - if (PlatformDetection.UsesAppleCrypto) + if (OperatingSystem.IsLinux() || PlatformDetection.IsApplePlatform26OrLater) { - Assert.Equal(3, chain.ChainElements.Count); + Assert.Equal(2, chain.ChainElements.Count); } - else if (OperatingSystem.IsLinux()) + else if (PlatformDetection.IsApplePlatform) { - Assert.Equal(2, chain.ChainElements.Count); + Assert.Equal(3, chain.ChainElements.Count); } } } @@ -1179,12 +1179,12 @@ public static void BuildChainForCertificateSignedWithDisallowedKey() chain.ChainPolicy.ExtraStore.Add(intermediateCert); Assert.False(chain.Build(cert)); - if (PlatformDetection.IsAndroid) + if (PlatformDetection.IsAndroid || PlatformDetection.IsApplePlatform26OrLater) { // Android always validates trust as part of building a path, // so violations comes back as PartialChain with no elements + // Apple 26 no longer block these SKIs since the roots are no longer trusted at all and are expired. Assert.Equal(X509ChainStatusFlags.PartialChain, chain.AllStatusFlags()); - Assert.Equal(0, chain.ChainElements.Count); } else {