AllowUnstrustedCertificate and RemoteCertificateChainErrors

Mar 4, 2013 at 10:32 PM

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 12:43 PM
Did you run the TestCases of WebSocket4Net?
Mar 5, 2013 at 5:28 PM
I have installed WebSockets4Net as a NuGet package, so probably no.

However, I did find, 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 1: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 5:31 PM

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

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