SignalR-Client-Cpp on Petalinux Throwing "Error in SSL handshake" Exception

198 Views Asked by At

I have a Xilinx ZCU106 with a Petalinux build I created that includes an application using SignalR-Client-Cpp. Despite trying a number of things, I'm continually getting an "Error in SSL handshake" exception after calling start() on my signalr::hub_connection.

This application runs fine on other Linux systems like Ubuntu. I think the problem is it's having trouble finding the ca-certificates.crt file which is usually in /usr/local/ssl on more normal Linux distro's like Ubuntu. In the Petalinux build it's located here: /etc/ssl/certs/ca-certificates.crt.

The best I can tell, I need to do something like this to configure the signalr::hub_connection to use the certificate file:

web::http::client::http_client_config httpConfig;
httpConfig.set_ssl_context_callback([](boost::asio::ssl::context& ctx) {
    ctx.load_verify_file("/etc/ssl/certs/ca-certificates.crt"); });

web::websockets::client::websocket_client_config wsConfig;
wsConfig.set_ssl_context_callback([](boost::asio::ssl::context& ctx) {
    ctx.load_verify_file("/etc/ssl/certs/ca-certificates.crt"); });

signalr::signalr_client_config signalrConfig;
signalrConfig.set_http_client_config(httpConfig);
signalrConfig.set_websocket_client_config(wsConfig);

auto hubConn = signalr::hub_connection_builder::create(signalrURI).build();

hubConn.set_client_config(signalrConfig);

std::promise<void> task;
hubConn.start([&task](std::exception_ptr exception) { 
    // Code that checks the exception, etc

Yet, even when doing this, the exception that is passed into start() is populated, stating "Error in SSL handshake".

I've tried some other things like using web::credentials and setting those on the signalr_client_config before giving it to the hub_connection but I get the same results.

I'm out of ideas as to how to get this to work and I'm hoping someone else might have some ideas?

1

There are 1 best solutions below

0
Jerome Happy On

This work for me:

web::http::client::http_client_config httpConfig;
httpConfig.set_validate_certificates(false);
signalr::signalr_client_config signalrConfig;
signalrConfig.set_http_client_config(httpConfig);

web::websockets::client::websocket_client_config wsConfig;
wsConfig.set_validate_certificates(false);
signalrConfig.set_websocket_client_config(wsConfig);
connection.set_client_config(signalrConfig);