Skip to content

Commit

Permalink
Remove client certificates
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Jahoda committed Jun 24, 2021
1 parent 89e570e commit 4d31737
Showing 1 changed file with 0 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,26 +327,15 @@ public async Task SslStream_NegotiateClientCertificateAsync_ClientWriteData()
using (server)
{
using X509Certificate2 serverCertificate = Configuration.Certificates.GetServerCertificate();
using X509Certificate2 clientCertificate = Configuration.Certificates.GetClientCertificate();

SslClientAuthenticationOptions clientOptions = new SslClientAuthenticationOptions()
{
TargetHost = Guid.NewGuid().ToString("N"),
EnabledSslProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12,
};
clientOptions.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
clientOptions.LocalCertificateSelectionCallback = (sender, targetHost, localCertificates, remoteCertificate, acceptableIssuers) =>
{
//Assert.True(false, "Clent shouldn't send certificate in this test");
return clientCertificate;
};

SslServerAuthenticationOptions serverOptions = new SslServerAuthenticationOptions() { ServerCertificate = serverCertificate };
serverOptions.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =>
{
//Assert.True(false, "Server shouldn't receive certificate in this test");
return true;
};

await TestConfiguration.WhenAllOrAnyFailedWithTimeout(
client.AuthenticateAsClientAsync(clientOptions, cts.Token),
Expand Down Expand Up @@ -376,26 +365,14 @@ public async Task SslStream_NegotiateClientCertificateAsync_ServerDontDrainClien
using (server)
{
using X509Certificate2 serverCertificate = Configuration.Certificates.GetServerCertificate();
using X509Certificate2 clientCertificate = Configuration.Certificates.GetClientCertificate();

SslClientAuthenticationOptions clientOptions = new SslClientAuthenticationOptions()
{
TargetHost = Guid.NewGuid().ToString("N"),
EnabledSslProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12,
};
clientOptions.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
clientOptions.LocalCertificateSelectionCallback = (sender, targetHost, localCertificates, remoteCertificate, acceptableIssuers) =>
{
//Assert.True(false, "Clent shouldn't send certificate in this test");
return clientCertificate;
};

SslServerAuthenticationOptions serverOptions = new SslServerAuthenticationOptions() { ServerCertificate = serverCertificate };
serverOptions.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =>
{
//Assert.True(false, "Server shouldn't receive certificate in this test");
return true;
};

await TestConfiguration.WhenAllOrAnyFailedWithTimeout(
client.AuthenticateAsClientAsync(clientOptions, cts.Token),
Expand Down

0 comments on commit 4d31737

Please sign in to comment.