Skip to content
Draft
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 @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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();
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
Loading