Recent

Author Topic: [SOLVED] Could not load SSL Library Indy Internet Direct with OpenSSL 1.1  (Read 1509 times)

Codrut1001

  • New Member
  • *
  • Posts: 22
I recently have downloaded Indy Internet Direct for Lazarus on Windows. This version to be exact: https://github.com/IndySockets/Indy/releases/tag/RADStudio-Alexandria

So I tried the same code I used on Windows to get the source code of a website:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button2Click(Sender: TObject);
  2. var
  3.   R: TStringStream;
  4.   SSLIOHandler: TIdSSLIOHandlerSocketOpenSSL;
  5.   HTTP: TIdHTTP;
  6. begin
  7.   HTTP := TIdHttp.Create(nil);
  8.   try
  9.     // IO Handler
  10.     SSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(HTTP);
  11.     HTTP.IOHandler := SSLIOHandler;
  12.  
  13.     SSLIOHandler.SSLOptions.SSLVersions := [sslvTLSv1_2];
  14.  
  15.  
  16.     Memo1.Lines.Text := HTTP.Get('http://www.google.com/');
  17.   finally
  18.     HTTP.Free;
  19.   end;
  20. end;
  21.  

But I get the "Could not load SSL library".

After a while, I found that I had openssl 1.1, and Indy expected Indi 1.0.2 or an older version, as in 1.1 major changes were made.

So than I ran into this post on stack overflow:
https://stackoverflow.com/questions/68415506/delphi-indy10-required-ssl-libraries-under-linux

Which suggested a pull request, for which, I promptly downloaded the code, but It does not appear to have any use for IdHTTP.

So I still can't get the source code of HTTPS websites, or do any POST requests.

Any ideas?
« Last Edit: November 21, 2023, 07:50:56 pm by Codrut1001 »

Codrut1001

  • New Member
  • *
  • Posts: 22
Re: Could not load SSL Library Indy Internet Direct with OpenSSL 1.1
« Reply #1 on: November 21, 2023, 07:50:29 pm »
I was able to fix the problem by just including OpenSSL 1.0.0

I used this code to fix the issue:
Code: [Select]
wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz 
gunzip openssl-1.0.2l.tar.gz
tar xf openssl-1.0.2l.tar
cd openssl-1.0.2l/
./config
make install
./config shared
make clean

Than I placed all the ".so" files in a folder called "lib-ssh"

Finally, changing the library search path with
Code: Pascal  [Select][+][-]
  1. IdOpenSSLSetLibPath( './lib-ssl/' );  
  2.  

donaldklopper

  • Newbie
  • Posts: 6
Re: [SOLVED] Could not load SSL Library Indy Internet Direct with OpenSSL 1.1
« Reply #2 on: November 01, 2024, 10:45:12 pm »
This worked a charm! Thank you!

I had to make some small adjustments... but they were obvious enough. It might help someone else.

Copy the .so files out before you run make clean...

Code: Bash  [Select][+][-]
  1. wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz
  2. gunzip openssl-1.0.2l.tar.gz
  3. tar xf openssl-1.0.2l.tar
  4. cd openssl-1.0.2l/
  5. ./config
  6. make install
  7. ./config shared
  8. ..... copy .so files to your preferred location
  9. make clean
  10.  

Include this in your uses

Code: Pascal  [Select][+][-]
  1.    uses    IdSSLOpenSSLHeaders;
  2.  
to be able to set the path:

Code: Pascal  [Select][+][-]
  1.  
  2.  
  3. procedure TForm1.Button2Click(Sender: TObject);
  4. var
  5.   R: TStringStream;
  6.   SSLIOHandler: TIdSSLIOHandlerSocketOpenSSL;
  7.   HTTP: TIdHTTP;
  8. begin
  9.   IdOpenSSLSetLibPath( '...your_path..' );  
  10.   HTTP := TIdHttp.Create(nil);
  11.   etc etc etc.
  12.  
  13. end;
  14.  
  15.  
  16.  
  17.  

 

TinyPortal © 2005-2018