Skip to content
Merged
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 @@ -344,6 +344,8 @@ public static void BuildChainCustomTrustStore(
chainTest.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust;
chainTest.ChainPolicy.ExtraStore.Add(issuerCert);

X509ChainStatusFlags allowedFlags = X509ChainStatusFlags.NoError;

switch (testArguments)
{
case BuildChainCustomTrustStoreTestArguments.TrustedIntermediateUntrustedRoot:
Expand All @@ -361,14 +363,21 @@ public static void BuildChainCustomTrustStore(
chainHolder.DisposeChainElements();
chainTest.ChainPolicy.CustomTrustStore.Remove(rootCert);
chainTest.ChainPolicy.TrustMode = X509ChainTrustMode.System;
chainTest.ChainPolicy.VerificationFlags = X509VerificationFlags.AllowUnknownCertificateAuthority;
chainTest.ChainPolicy.ExtraStore.Add(rootCert);
allowedFlags |= X509ChainStatusFlags.UntrustedRoot;
break;
default:
throw new InvalidDataException();
}

Assert.Equal(chainBuildsSuccessfully, chainTest.Build(endCert));
Assert.Equal(3, chainTest.ChainElements.Count);
Assert.Equal(chainFlags, chainTest.AllStatusFlags());

X509ChainStatusFlags actualFlags = chainTest.AllStatusFlags();
actualFlags &= ~allowedFlags;

Assert.Equal(chainFlags, actualFlags);
}
}

Expand Down
Loading