Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Access to secure url returning ssl error
#1
I am using XE8.
My openssl dlls are in 1.0.2.13 version.
 
I have the next site with the documentation  to get some currency exchange values:
https://api.promasters.net.br/cotacao/#documentacao

I am trying the next code, but I get an error:

   
Code:
'Error connecting with SSL.'#$D#$A'error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure' 

    
if I put the next line into browser "http://api.promasters.net.br/cotacao/v1/valores" it returns the correct values.

How could I fix it?

My code:

        
Code:
const ss='http://api.promasters.net.br/cotacao/v1/valores';
        var
          s: string;
          lHTTP: TIdHTTP;
          HandlerSock:TIdSSLIOHandlerSocketOpenSSL;
        begin
          lHTTP := TIdHTTP.Create(nil);
          lHTTP.Request.UserAgent := 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0';
          try
            HandlerSock:=TIdSSLIOHandlerSocketOpenSSL.Create(lHTTP);
            HandlerSock.SSLOptions.Method := sslvSSLv23;
            HandlerSock.SSLOptions.SSLVersions := [sslvTLSv1_2, sslvTLSv1_1, sslvTLSv1];
            lHTTP.IOHandler := HandlerSock;
            lHTTP.HandleRedirects := True;
            s := lHTTP.Get(ss);
            ShowMessage(s);
          finally
            lHTTP.Free;
          end;
        end;
Reply
#2
(06-16-2018, 01:52 PM)cprmlao@hotmail.com Wrote: I am using XE8.
My openssl dlls are in 1.0.2.13 version.

The current version of OpenSSL 1.0.2 is 1.0.2.15 (1.0.2o).

(06-16-2018, 01:52 PM)cprmlao@hotmail.com Wrote: I am trying the next code, but I get an error:

Code:
'Error connecting with SSL.'#$D#$A'error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure' 

Using the latest SVN snapshot of Indy 10 (rev 5462) with the latest OpenSSL DLLs from Fulgan, the code you showed works fine for me, using both "http:" and "https:" urls.

Reply
#3
Thank you Remy. With XE8, I download the latest indy snapshot. I make settings of the search path of my project to the new Indy Folder(Protocols,System and Core). I put the latest OpenSSL DLLs into my project folder and I recompiled. All works well. With Berlin, I just put the latest OpenSSL DLLs into my project folder and recompiled. It worked as well.
Concerning to SSL, you can tell me which indy units are affected from XE8 to Berlin/Tokio. If I know that, i will copy only that units to my project folder. I want to avoid reinstall indy.
Reply
#4
(06-18-2018, 07:42 PM)cprmlao@hotmail.com Wrote: Concerning to SSL, you can tell me which indy units are affected from XE8 to Berlin/Tokio. If I know that, i will copy only that units to my project folder. I want to avoid reinstall indy.

You would have to pull both branches from SVN (specific Delphi releases of Indy are tagged) and run a diff between them. But IIRC (I might be wrong) there were some interface changes made to the OpenSSL units between the times that XE8 and Tokyo were released, so trying to use the newer units with Embarcadero's copy of Indy (which is a bit outdated as they haven't updated Indy from SVN for awhile) will likely not work. You can add individual units from a package into a project only when NO interface changes have been made in those units, only implementation changes.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)