Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL certificate ? #381

Open
zefaridator opened this issue Dec 5, 2022 · 2 comments
Open

SSL certificate ? #381

zefaridator opened this issue Dec 5, 2022 · 2 comments

Comments

@zefaridator
Copy link

Hello
Is it possible to use SSL certificate ? Do you have some snippets code?
my socketio server needs authenticated client and reject others

Thanks !

@peterphonic
Copy link

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.

@zefaridator
Copy link
Author

zefaridator commented Mar 27, 2023

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) ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants