problem with my code

Viktor Dukhovni openssl-users at dukhovni.org
Thu Jun 18 17:50:26 UTC 2020


On Thu, Jun 18, 2020 at 12:00:33PM +0200, Attila Csosz wrote:

>  err = connect(sd, (struct sockaddr*) &sa, sizeof(sa));
> 
>  // Create SSL context
>  meth = SSLv23_server_method();

Have you tried SSLv23_client_method()?  Your application is a TLS
client, not a TLS server...

>  if (!meth) throw Exception("SSL: method");
>  ctx = SSL_CTX_new(meth);
>  if (!meth) throw Exception("SSL: context");
>  ssl = SSL_new(ctx);
>  if (!ssl) throw Exception("SSL: ssl");
>  SSL_set_fd(ssl, sd);
> 
>  // Connect
>  err = SSL_connect(ssl);
>  if (err == -1) throw Exception("SSL: SSL_connect");

-- 
    Viktor.


More information about the openssl-users mailing list