Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit 41c7ae9

Browse files
committed
Add some comments for mutual ssl authentication
1 parent caa61ee commit 41c7ae9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Titanium.Web.Proxy/CertificateHandler.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ internal bool ValidateServerCertificate(object sender, SessionEventArgsBase sess
5656
{
5757
X509Certificate? clientCertificate = null;
5858

59+
//TODO: Can we use client certificate from client socket's Sslstream.RemoteCertificate?
60+
//Because only the client can provide the correct certificate.
61+
//Proxy has no idea about client certificate when its running on a remote machine.
62+
//That would mean we need to delay AuthenticateAsServer call with client until we reach this method
63+
//and decide right here if we should set SslServerAuthenticationOptions.ClientCertificateRequired = true for clientStream.AuthenticateAsServer call.
64+
//Sounds like a very complicated change, but technically possible.
65+
66+
//fallback to the first client certificate from proxy machine certificate store
5967
if (acceptableIssuers != null && acceptableIssuers.Length > 0 && localCertificates != null &&
6068
localCertificates.Count > 0)
6169
{
@@ -69,7 +77,9 @@ internal bool ValidateServerCertificate(object sender, SessionEventArgsBase sess
6977
}
7078
}
7179

72-
if (localCertificates != null && localCertificates.Count > 0)
80+
//fallback to the first client certificate from proxy machine certificate store
81+
if (clientCertificate == null
82+
&& localCertificates != null && localCertificates.Count > 0)
7383
{
7484
clientCertificate = localCertificates[0];
7585
}

0 commit comments

Comments
 (0)