This project is read-only.

How to disable ssl certificate validation check

Apr 13, 2016 at 4:56 PM
Hi to all,

while connecting to Web Socket server my web scoket client gets next error:

System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure. ...

Is there a way to disable certificate validation check? I added AllowUnstrustedCertificate = true, because Web Socket Server uses self-signed certificate, but does it solve the validation problem?
Apr 13, 2016 at 5:15 PM

You can use the global hook: ServicePointManager.ServerCertificateValidationCallback

Apr 13, 2016 at 6:10 PM
Edited Apr 13, 2016 at 6:28 PM
Kerryjiang, I read topics more and found out that there is a rule: "if your websocket server can be access as "ws://gameserver/", then your certificate's CN should be "gameserver". Actually my error was exactly about that: wss server was: and I used sertificate "test". I got validation error in this case. Then i did certificate: and all work correct. So I can't avoid this rule, right? and certificate name must always match wss server name?
I'm using self-signed certificate.