diff --git a/src/libraries/System.Security.Cryptography/tests/X509Certificates/DynamicChainTests.cs b/src/libraries/System.Security.Cryptography/tests/X509Certificates/DynamicChainTests.cs index 8a7d0131956790..d9c9744e7fd162 100644 --- a/src/libraries/System.Security.Cryptography/tests/X509Certificates/DynamicChainTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/X509Certificates/DynamicChainTests.cs @@ -527,7 +527,6 @@ public static void CustomTrustModeWithNoCustomTrustCerts() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/128890", TestPlatforms.Android)] public static void NameConstraintViolation_PermittedTree_Dns() { SubjectAlternativeNameBuilder builder = new SubjectAlternativeNameBuilder(); @@ -543,7 +542,6 @@ public static void NameConstraintViolation_PermittedTree_Dns() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/128890", TestPlatforms.Android)] public static void NameConstraintViolation_ExcludedTree_Dns() { SubjectAlternativeNameBuilder builder = new SubjectAlternativeNameBuilder(); @@ -600,7 +598,6 @@ public static void NameConstraintViolation_InvalidGeneralNames() } [ConditionalFact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/128890", TestPlatforms.Android)] public static void NameConstraintViolation_ExcludedTree_Upn() { if (PlatformDetection.UsesAppleCrypto && !AppleHasExcludedSubTreeHandling) @@ -638,6 +635,13 @@ public static void NameConstraintViolation_ExcludedTree_Upn() string encoded = writer.Encode(Convert.ToHexString); TestNameConstrainedChain(encoded, builder, (bool result, X509Chain chain) => { + if (PlatformDetection.IsAndroid) + { + // Android does not enforce UPN (OtherName) name constraints. + Assert.True(result, "chain.Build"); + return; + } + Assert.False(result, "chain.Build"); if (PlatformDetection.IsWindows) @@ -654,7 +658,6 @@ public static void NameConstraintViolation_ExcludedTree_Upn() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/128890", TestPlatforms.Android)] public static void NameConstraintViolation_PermittedTree_Upn() { SubjectAlternativeNameBuilder builder = new SubjectAlternativeNameBuilder(); @@ -687,6 +690,13 @@ public static void NameConstraintViolation_PermittedTree_Upn() string encoded = writer.Encode(Convert.ToHexString); TestNameConstrainedChain(encoded, builder, (bool result, X509Chain chain) => { + if (PlatformDetection.IsAndroid) + { + // Android does not enforce UPN (OtherName) name constraints. + Assert.True(result, "chain.Build"); + return; + } + Assert.False(result, "chain.Build"); if (PlatformDetection.IsWindows) @@ -1171,9 +1181,15 @@ private static X509ChainStatusFlags PlatformNameConstraints(X509ChainStatusFlags } else if (OperatingSystem.IsAndroid()) { - // Android always validates name constraints as part of building a path - // so violations comes back as PartialChain with no elements. - flags = X509ChainStatusFlags.PartialChain; + // Android always validates name constraints as part of building a path, + // but reports DNS violations as InvalidNameConstraints and other unsupported + // forms as PartialChain with no elements. + flags = flags switch + { + X509ChainStatusFlags.HasExcludedNameConstraint or X509ChainStatusFlags.HasNotPermittedNameConstraint => + X509ChainStatusFlags.InvalidNameConstraints, + _ => X509ChainStatusFlags.PartialChain, + }; } return flags;