Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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() :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -1112,7 +1112,6 @@ public static void BuildChainForFraudulentCertificate()
}

[Fact]
[SkipOnPlatform(TestPlatforms.Linux, "Not supported on Linux.")]
public static void BuildChainForCertificateSignedWithDisallowedKey()
{
// The intermediate certificate is from the now defunct CA DigiNotar.
Expand Down Expand Up @@ -1178,12 +1177,13 @@ public static void BuildChainForCertificateSignedWithDisallowedKey()
chain.ChainPolicy.ExtraStore.Add(intermediateCert);
Assert.False(chain.Build(cert));

if (PlatformDetection.IsAndroid)
if (PlatformDetection.IsAndroid || PlatformDetection.IsApplePlatform26OrLater || PlatformDetection.IsLinux)
{
// 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.
// Linux has no concept of a blocked key list, they just remove certificates from a trust store.
Assert.Equal(X509ChainStatusFlags.PartialChain, chain.AllStatusFlags());
Assert.Equal(0, chain.ChainElements.Count);
}
else
{
Expand Down
Loading