HTTPS Sslv3 Indy Delphi 7 error

Asked

Viewed 1,895 times

0

I am trying to make connection via HTTPS using Sslv3(required to consume a specific service), but when I try to perform the post, I get the following error:

Erro no SSL

At first, I think it’s a problem in the configuration of the components. I did some research, but I couldn’t solve my problem. Follow the component configuration code and send:

var
   _idhttp : TIdHttp;
   _idSSL : TIdSSLIOHandlerSocket;
   _retorno : String;
begin

   _idSSL := TIdSSLIOHandlerSocket.Create(nil);
   with _idSSL do
   begin
      SSLOptions.Method := sslvSSLv3;
      SSLOptions.Mode := sslmClient;
      SSLOptions.VerifyMode := [];
      SSLOptions.VerifyDepth := 0;
   end;

   _idhttp := TIdHTTP.Create(nil);
  with _idhttp do
  begin
     IOHandler := _idSSL;
     AllowCookies := true;
     ProxyParams.BasicAuthentication := true;
     ProxyParams.ProxyPort := 0;
     request.ContentLength := -1;
     request.ContentRangeEnd := 0;
     request.ContentRangeStart := 0;
     Request.Accept := 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
     request.BasicAuthentication := false;
     request.UserAgent := 'Mozilla/3.0 (compatible; Indy Library)';
     HTTPOptions := [hoForceEncodeParams];
     HandleRedirects := true;
  end;

  retorno := _idhttp.Post(URL,xmlIn);

end;

Thanks in advance for any help. Hugs!

1 answer

0


After much research, I managed to solve my problem! First of all, I upgraded the version of Indy(Delphi 7) to the latest version.

And I also had to update and put in the application folder the DLL’s of SSL, which I downloaded in the following link(yes, it has captcha): http://indy.fulgan.com/SSL/

The configuration of the components was as follows:

var
   retorno : String;//variável que recebe o retorno da requisição
   param : TStringStream;//é onde eu coloco as informações que vão ser enviadas via POST



try
  _idSSL := TIdSSLIOHandlerSocketOpenSSL.Create(nil); //SSL
  _idhttp := TIdHTTP.Create(nil);
  with _idhttp do
  begin
     IOHandler := _idSSL;
     ReadTimeout := 0;
     AllowCookies := true;
     ProxyParams.BasicAuthentication := true;
     ProxyParams.ProxyPort := 0;
     request.ContentLength := -1;
     request.ContentRangeEnd := 0;
     request.ContentRangeStart := 0;
     Request.Accept := 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
     request.ContentType := 'text/xml';
     request.CharSet := 'utf-8';
     request.UserAgent := 'Mozilla/3.0 (compatible; Indy Library)';
  end;
  param := TStringStream.Create(xmlIn.Text);//xmlIn é um objeto da classe TStringList que contém os valores a serem enviados
  retorno := _idhttp.Post(URL,param);
  result := retorno;
except
  on e: exception do
  begin
     raise Exception.Create('Erro ao enviar requisição: ' + #13 + e.Message);
     result := '';
  end;
end;

Any questions, leave a comment. I’ll be happy to help.

I hope I helped. Hugs!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.