ZeeWanderer / binacpp-windows

windows port of Binance C++ library [WIP]
MIT License
1 stars 1 forks source link

Unable to get local issuer certificate. #2

Open OfekDayan opened 3 years ago

OfekDayan commented 3 years ago

Hi, I'm using this code:

 BinaCPP_websocket::init();
 BinaCPP_websocket::connect_endpoint(ws_depth_onData ,"/ws/!bookTicker"); 
 BinaCPP_websocket::enter_event_loop(); 

That's the error I get: [2021/05/14 22:28:31:3827] N: LWS: 4.1.6-, loglevel 7 [2021/05/14 22:28:31:3838] N: NET CLI SRV H1 H2 WS IPV6-on [2021/05/14 22:28:32:0550] E: SSL error: unable to get local issuer certificate (preverify_ok=0;err=20;depth=1)

Any ideas why?

ZeeWanderer commented 3 years ago

I do not use websoket api part myself, but it seems like your system ca store does not have required public SSL certificates installed. If you manually download cacert.pem and add

info.client_ssl_ca_filepath = "./cacert.pem"; // relative or absolute path to aforementioned file

here https://github.com/ZeeWanderer/binacpp-windows/blob/master/src/binacpp_websocket.cpp#L88 it would fix the error.

As I do not have much experience with websocket API or libwebsockets in general I don't know if this is the correct solution.

ZeeWanderer commented 3 years ago

I pushed a commit, now you can manually provide ca cert filepath by passing it to BinaCPP_websocket::init();