-
Notifications
You must be signed in to change notification settings - Fork 272
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
Add DefaultMutualHandshakeContext* benchmarks #4277
Conversation
CI Failures seem to be unrelated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @rzikm !
}; | ||
|
||
using (var sslClient = new SslStream(client, leaveInnerStreamOpen: true, delegate { return true; })) | ||
using (var sslServer = new SslStream(server, leaveInnerStreamOpen: true, delegate { return true; })) | ||
{ | ||
await Task.WhenAll( | ||
sslClient.AuthenticateAsClientAsync("localhost", null, SslProtocols.None, checkCertificateRevocation: false), | ||
sslClient.AuthenticateAsClientAsync("localhost", requireClientCert ? new X509CertificateCollection() { _clientCert } : null, SslProtocols.None, checkCertificateRevocation: false), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just for my education: Why do you want to create a new instance of X509CertificateCollection
every time the benchmark is called? Does this reflect typical real-life scenario?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to mirror what we do in non-context benchmarks for SslStream.
performance/src/benchmarks/micro/libraries/System.Net.Security/SslStreamTests.cs
Line 130 in b69d1bd
ClientCertificates = requireClientCert ? new X509CertificateCollection() { _clientCert } : null, |
Typical real-world scenarios would probably always use the overload accepting Ssl(Client|Server)AuthenticationOptions and reuse a single instance of it for multiple connections, or always create new instance entirely from scratch (as we do in linked source code).
@adamsitnik I can't merge this PR because of a failed GH check on |
I don't have such permissions anymore. But @caaavik-msft or @LoopedBard3 or @DrewScoggins should be able to do that. |
This PR adds microbenchmarks for mutually authenticated SslStream pair which uses SslStreamCertificateContext on the server side. This allows benchmarking TLS resume with client certificates (supported on Windows, newly supported on Linux in .NET 9 via dotnet/runtime#102656)