SSL certificate ?
Hello Is it possible to use SSL certificate ? Do you have some snippets code? my socketio server needs authenticated client and reject others
Thanks !
I exactly have the same question. Did you find and answer to this? I asked chatgtp :
The Socket.IO C++ client library uses the OpenSSL library for secure communication over TLS/SSL. The TLS support is implemented in the socket.io-client-cpp/src/internal/ssl.cpp source file. This file contains the implementation of the ssl::initialize() function, which initializes the OpenSSL library, and the ssl::connect_ssl() function, which establishes a TLS connection to the Socket.IO server.
But I did not find any ssl.cpp file unfortunately.
Nope The only thing i find (by code analysis) is : When you check the header of sio_client_impl.cpp ; you see a comment :
// If using Asio's SSL support, you will also need to add this #include.
// Source: http://think-async.com/Asio/asio-1.10.6/doc/asio/using.html
// #include <asio/ssl/impl/src.hpp>
And in cpp :
#if SIO_TLS
client_impl::context_ptr client_impl::on_tls_init(connection_hdl conn)
{
context_ptr ctx = context_ptr(new asio::ssl::context(asio::ssl::context::tls));
asio::error_code ec;
ctx->set_options(asio::ssl::context::default_workarounds |
asio::ssl::context::no_tlsv1 |
asio::ssl::context::no_tlsv1_1 |
asio::ssl::context::single_dh_use,ec);
if(ec)
{
cerr<<"Init tls failed,reason:"<< ec.message()<<endl;
}
return ctx;
}
#endif
So I think that you have to modify context_ptr object (and/or its instanciation) ...