microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
8.01k stars 1.66k forks source link

No api to pass ca cert to http_client_config #542

Open hyiyang opened 7 years ago

hyiyang commented 7 years ago

My http_client needs to connect to a https server, currently, this https server uses a self-signed certificate.

On Linux, the http_client works fine by calling below API to set the ca certificate:

config.set_ssl_context_callback([=](boost::asio::ssl::context &ctx){
            ctx.load_verify_file("cacert.pem");
        });

But there is no such API on Windows, how to pass cacert.pem to http_client_config on Windows?

PBRCW commented 6 years ago

AFAIK there is no such functionality (correct me if I'm wrong). The solution is to import your certificate into the windows keystore. The internally used Winhttp will then automatically find the certificate.

matra774 commented 6 years ago

@PBRCW Take a look at https://github.com/Microsoft/cpprestsdk/pull/135 and https://github.com/Microsoft/cpprestsdk/issues/314 (none of those are implemented in official REST SDK)