Is there a way to force browser to accept self-signed certificate using websocket++?

265 Views Asked by At

I am using echo_server_tls example with Chrome client. It works fine when I add the certificate to "Trusted Root Certificate Authorities" in certmgr. But if the certificate is not added there, the connection fails silently.

How can I ask user to accept my certificate in case of "Certificate Authority" error?

My OS is Windows 7

2

There are 2 best solutions below

0
On BEST ANSWER

OK, solved the problem by setting an http handler using set_http_handler(). Thanks

0
On

You can't do anything once the certificate error is encountered... it's a security feature. What you can do, however, is instruct users before they attempt to use your server that they must install your root certificate. One possible solution is to have them go to an "insecure" (unencrypted) site where the instructions are, then proceed to the "secure" site.

As a side note, buying a real "signed-by-well-known-authority" certificate is not difficult nor expensive... the cost is far less then the trouble of dealing with self-signed certificates in nearly all scenarios.