Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/8.0] Fix failing CertificateValidationRemoteServer.ConnectWithRevocation_WithCallback test (#99915) #99950

Merged
merged 1 commit into from
Mar 20, 2024
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
@@ -179,7 +179,7 @@ internal X509Certificate2 CreateOcspSigner(string subject, RSA publicKey)
subject,
publicKey,
TimeSpan.FromSeconds(1),
new X509ExtensionCollection() { s_eeConstraints, s_eeKeyUsage, s_ocspResponderEku},
new X509ExtensionCollection() { s_eeConstraints, s_eeKeyUsage, s_ocspResponderEku },
ocspResponder: true);
}

@@ -950,12 +950,10 @@ private static string BuildSubject(
PkiOptions pkiOptions,
bool includePkiOptions)
{
if (includePkiOptions)
{
return $"CN=\"{cn}\", O=\"{testName}\", OU=\"{pkiOptions}\"";
}
string testNamePart = !string.IsNullOrWhiteSpace(testName) ? $", O=\"{testName}\"" : "";
string pkiOptionsPart = includePkiOptions ? $", OU=\"{pkiOptions}\"" : "";

return $"CN=\"{cn}\", O=\"{testName}\"";
return $"CN=\"{cn}\"" + testNamePart + pkiOptionsPart;
}
}
}
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
using System.Net.Sockets;
using System.Net.Test.Common;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography.X509Certificates.Tests.Common;
@@ -188,7 +189,8 @@ static bool CertificateValidationCallback(
private async Task ConnectWithRevocation_WithCallback_Core(
X509RevocationMode revocationMode,
bool? offlineContext = false,
bool noIntermediates = false)
bool noIntermediates = false,
[CallerMemberName] string testName = null)
{
string offlinePart = offlineContext.HasValue ? offlineContext.GetValueOrDefault().ToString().ToLower() : "null";
string serverName = $"{revocationMode.ToString().ToLower()}.{offlinePart}.server.example";
@@ -201,6 +203,7 @@ private async Task ConnectWithRevocation_WithCallback_Core(
out CertificateAuthority rootAuthority,
out CertificateAuthority[] intermediateAuthorities,
out X509Certificate2 serverCert,
testName: testName,
intermediateAuthorityCount: noIntermediates ? 0 : 1,
subjectName: serverName,
keySize: 2048,
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ public static async Task Create_OcspDoesNotReturnOrCacheInvalidStapleData()
out CertificateAuthority rootAuthority,
out CertificateAuthority[] intermediateAuthorities,
out X509Certificate2 serverCert,
testName: nameof(Create_OcspDoesNotReturnOrCacheInvalidStapleData),
intermediateAuthorityCount: 1,
subjectName: serverName,
keySize: 2048,