This project is read-only.

AllowUnstrustedCertificate and RemoteCertificateChainErrors

Mar 4, 2013 at 11:32 PM
Hi,

I am using WebSockets4Net 0.8 against a server with self-signed certificate.
I did set AllowUnstrustedCertificate = true, but I still am getting RemoteCertificateChainErrors.
The remote certificate is invalid according to the validation procedure.
   at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
   at SuperSocket.ClientEngine.SslStreamTcpSession.OnAuthenticated(IAsyncResult result)
Unfortunately, I do not control the server, so I cannot update the certificate there. Any hints on why AllowUnstrustedCertificate = true does not take any effect?

Thank you!
Mar 5, 2013 at 1:43 PM
Did you run the TestCases of WebSocket4Net?
Mar 5, 2013 at 6:28 PM
I have installed WebSockets4Net as a NuGet package, so probably no.

However, I did find https://github.com/kerryjiang/SuperSocket.ClientEngine/blob/master/Core/SslStreamTcpSession.cs, so now I am starting to understand why I am getting AllowUnstrustedCertificate. I am a bit confused though - why aren't we just doing
if (AllowUnstrustedCertificate)
{
    return true;
}
as the first line of ValidateRemoteCertificate?
Mar 6, 2013 at 2:56 AM
Please make sure your certificate's CN is same with the websocket server's host.

For example, if your websocket server can be access as "ws://gameserver/", then your certificate's CN should be "gameserver".
Dec 28, 2013 at 6:31 PM
Hi,

I am having the same issue. how can i modify my Certificate's CN?

Thanks you!
Dec 29, 2013 at 2:39 AM
Generate a new certificate with the correct dns and then use it in your server program