Atozed Forums
Access to secure url returning ssl error - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Indy (https://www.atozed.com/forums/forum-8.html)
+--- Forum: Indy General Discussion (https://www.atozed.com/forums/forum-9.html)
+--- Thread: Access to secure url returning ssl error (/thread-425.html)



Access to secure url returning ssl error - cprmlao@hotmail.com - 06-16-2018

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;



RE: Access to secure url returning ssl error - rlebeau - 06-18-2018

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


RE: Access to secure url returning ssl error - cprmlao@hotmail.com - 06-18-2018

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.


RE: Access to secure url returning ssl error - rlebeau - 06-18-2018

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