I currently have this code that makes an SSL connection to a server:
using (client = new TcpClient())
{
client.Connect(Hostname, Port);
var callback = new RemoteCertificateValidationCallback(ValidateServerCertificate);
using (stream = new SslStream(client.GetStream(), false, callback))
{
stream.AuthenticateAsClient(Hostname);
}
}
However, I don't think it supports SNI because the wrong certificate is being returned from the SNI configured server. Is there anyway to make the SSL connection using SNI?
I am using .NET 2 (willing to upgrade if necessary). I am using Windows 7, but would like the software to work on other platforms such as Windows 2008 if possible.
So to conclude it seems as if the answer is: No, there is no way that you can make the TLS connection use SNI :-(
I couldn't find any C# example code making a TLS connection with SNI. Theoretically though, it should be possible to create that manually, i.e. as per How to implement Server Name Indication (SNI)
however, an attempt over here failed: TLS SNI with C#
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With