Hello Ricardo,

Ricardo Garcia Reis schrieb:
Hello All,

I can not connect to a HTTPS server of WebServices. (https://hnfe.sefaz.es.gov.br/Nfe/wsdl/nfeStatusServico.wsdl)

The error occurs when the function SSL_read() is calling, returning 0 and SSL_get_error () equals SSL_ERROR_ZERO_RETURN.

The problem is not the certificates, because when installing in firefox/IE to view the WSDL in the browser, its ok.

<snip>
    if(AI->ai_family == DEFAULT_FAMILY) {
        sock = socket(AI->ai_family, AI->ai_socktype, AI->ai_protocol);
<snip>
        ssl = SSL_new(ctx);
        chkSSL(SSL_clear(ssl),ssl,sslErr);

        sslBio = BIO_new_socket(sock,BIO_NOCLOSE);
after this                        ====
        SSL_set_bio(ssl, sslBio, sslBio);
and this

(I do
BIO* io = BIO_new(BIO_f_buffer());
BIO_push(io, ssl_bio);
)


    //------------END INITIALIZE HANDSHAKE--------------------------

    SSL_set_connect_state(ssl);

    int retCon = 0;
    retCon = chkSSL(SSL_connect(ssl), ssl, sslErr);
and this              ===============

<snip>
    // ops, test program....
    strncpy(scommand,
"GET /Nfe/wsdl/nfeStatusServico.wsdl HTTP/1.1\r\nHost: hnfe.sefaz.es.gov.br\r\nConnection: Keep-Alive\r\nAccept: */*\r\n",
        sizeof(szCertificate));
    scommand[511] = '\0';

    int iResult = send( sock, scommand, (int)strlen(scommand), 0 );
you can't do this (plaintext over a ssl-secured socket)!

I didn't check everything else, but this stuck out.

I do
r = BIO_write(io, scommand, strlen(scommand));

hth,
Wolfgang

<snip>
thanks in advanced!!

Ricardo



______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to