1

I have a window dotnet application which is used a websocket server. We could connect to the websocket server using WS:// protocol. I want to enable WSS:// protocol as well.

I am aware that we need to create self signed certificate, but where to install and configure the certificate for my window app and how to enable SSL/TLS for a window app?

Could you please help how to enable WSS protocol. Thanks in advance.

Bruno
  • 37
  • 8

1 Answers1

0

add this function to your code

public static bool ValidateServerCertificate(
                object sender,
                X509Certificate certificate,
                X509Chain chain,
                SslPolicyErrors sslPolicyErrors)
            {
                return true; 
            }

and call it once like this

RemoteCertificateValidationCallback remote = ValidateServerCertificate;
ServicePointManager.ServerCertificateValidationCallback = remote;

on need for accepting the SSL certificate of the websocket the callback will be invoked and it will return true so you app will be fine. please note that I have not tested on windows application also supposing you have used ClientWebSocket

Ali Alp
  • 691
  • 7
  • 10