mrtazz / restclient-cpp

C++ client for making HTTP/REST requests
http://code.mrtazz.com/restclient-cpp/
MIT License
1.57k stars 377 forks source link

How to set custom certificate in client? #179

Closed danyhm closed 2 years ago

danyhm commented 2 years ago

Hello,

I have a working c# .net core Rest Api with a custom selfsigned certificate and now i want to use that certificate in my c++ app searching in the helps lead me nowhere. do you have any working example of how to accomplish this?

129 seems to have the same problem. if this is a limitation of curl then it's impossible to achieve this in windows i guess?

danyhm commented 2 years ago

I finally got it to work. the certification path limitation in windows is actually not a problem. the problem is that if you're not using a Certificate issued by valid authorities that are not in the bundled CA roots of curl then curl won't accept it. so you need to set a custom CA root cert which in my case is used for a self-signed certificate. the catch is that you have to make the CA cert and the server cert with correct parameters so curl will accept them https://www.section.io/engineering-education/how-to-get-ssl-https-for-localhost/ https://gist.github.com/cecilemuller/9492b848eb8fe46d462abeb26656c4f8 i used this online tool to make a single CA cert without using another for server https://certificatetools.com/