bhateja 写道:
hi, i am doing following thing but den i am unable to connect to server using openssl with the same version. i am pasting the CLIENT code for the same.
main()
{

ERR_load_BIO_strings();
    SSL_load_error_strings();
    SSL_library_init();
    OpenSSL_add_all_algorithms();

    /* Set up the SSL context */

    ctx = SSL_CTX_new(SSLv23_client_method());

    /* Load the trust store */

    if(! SSL_CTX_load_verify_locations(ctx, "lcsweb3.crt", NULL))
    {
        fprintf(stderr, "Error loading trust store\n");
        ERR_print_errors_fp(stderr);
        SSL_CTX_free(ctx);
        return 0;
    }

    /* Setup the connection */
    bio = BIO_new_ssl_connect(ctx);

    /* Set the SSL_MODE_AUTO_RETRY flag */

    BIO_set_conn_hostname(bio,"lcsweb3:7275");
    BIO_get_ssl(bio, & ssl);
    SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
/* Create and setup the connection */
    if(BIO_do_connect(bio) <= 0)
    {
        fprintf(stderr, "Error attempting to connect\n");
        ERR_print_errors_fp(stderr);
        BIO_free_all(bio);
        SSL_CTX_free(ctx);
        return 0;
    }
    else
       fprintf(stderr, "successfully connected\n");


here BIO_do_connect(bio) is returning 0 ... i am unable to find where the
problem is .. please help me figuring it out.


Regards,
Gaurav Bhateja



I use SSL_add_all_algorithms() to replace OpenSSL_add_all_algorithms(), otherwise it will run with error
captured by MS2005 debug.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to