Lazarus

Programming => Networking and Web Programming => Topic started by: torbente on January 22, 2022, 01:45:58 am

Title: SSL files location
Post by: torbente on January 22, 2022, 01:45:58 am
Hi everyone;

I believe this is a pretty simple question, and i was unable to find nothing relative.

Using a TFPHttpClient...

It is mandatory to keep the SLL files on the same folder of our app? Or we can redirect its location, something like...

Code: Pascal  [Select][+][-]
  1. MyTFPHttpClient.SSLFiles.path:= Path; // Different from app path

Or maybe to resource files included in the app binary?

Thanks
Title: Re: SSL files location
Post by: PascalDragon on January 23, 2022, 01:31:58 pm
It is mandatory to keep the SLL files on the same folder of our app? Or we can redirect its location, something like...

What do you mean with “SSL files”? The libraries or the certificates?
Title: Re: SSL files location
Post by: torbente on January 23, 2022, 01:36:12 pm
It is mandatory to keep the SLL files on the same folder of our app? Or we can redirect its location, something like...

What do you mean with “SSL files”? The libraries or the certificates?

Libraryes: ssleay.dll and libeay.dll
Title: Re: SSL files location
Post by: PascalDragon on January 23, 2022, 01:40:30 pm
You can determine their location by calling InitSSLInterface of the unit OpenSSL before using any SSL related functionality (at best as soon as possible in your main program). Please note that this should only really be necessary for Windows as other operating systems provide suitable default libraries.
Title: Re: SSL files location
Post by: Gustavo 'Gus' Carreno on January 23, 2022, 01:58:02 pm
Hey PascalDragon,

You can determine their location by calling InitSSLInterface of the unit OpenSSL before using any SSL related functionality (at best as soon as possible in your main program). Please note that this should only really be necessary for Windows as other operating systems provide suitable default libraries.

The OP's question is if you can SET the location not how to GET the location.

He wants a tidy system and wants the App to be in a folder and the .dlls to be in AppFolder/SSL so it's all neat and organised.

He's asking if it's possible to provide an extra path in conjunction to the paths already in the PATH variable.

If so, then how?

If not, I'll undertake the task to console him of his grief :)

Cheers,
Gus
Title: Re: SSL files location
Post by: PascalDragon on January 23, 2022, 02:06:57 pm
Hey PascalDragon,

You can determine their location by calling InitSSLInterface of the unit OpenSSL before using any SSL related functionality (at best as soon as possible in your main program). Please note that this should only really be necessary for Windows as other operating systems provide suitable default libraries.

The OP's question is if you can SET the location not how to GET the location.

determine was meant as a synonym of regulate or control and not retrieve. The function takes the paths to the two libraries to initialize the function imports. Thus torbente is able to control where the libraries should be placed. The remainder is up to them.
Title: Re: SSL files location
Post by: Gustavo 'Gus' Carreno on January 23, 2022, 02:16:13 pm
Hey PascalDragon,

determine was meant as a synonym of regulate or control and not retrieve. The function takes the paths to the two libraries to initialize the function imports. Thus torbente is able to control where the libraries should be placed. The remainder is up to them.

Ooops, mea culpa, really sorry. I get it now!!

So I'm guessing that one of the params for InitSSLInterface will be the path to the libs.
Does this include the lib name's themselves o just a folder name to look them up?

Cheers,
Gus
Title: Re: SSL files location
Post by: torbente on January 24, 2022, 12:16:05 am
Code: Pascal  [Select][+][-]
  1. determine was meant as a synonym of regulate or control and not retrieve. The function takes the paths to the two libraries to initialize the function imports. Thus torbente is able to control where the libraries should be placed. The remainder is up to them.

Hi @PascalDragon

Any working code example? Or a link to any previous related thread to give me a better idea?

Thanks a lot in advance...
Title: Re: SSL files location
Post by: PascalDragon on January 24, 2022, 01:47:50 pm
Not tested, but should give you an idea:

Code: Pascal  [Select][+][-]
  1. program tssl;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   OpenSSL, SysUtils;
  7.  
  8. var
  9.   p: String;
  10. begin
  11.   p := IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0)) + 'Libs');
  12.   InitSSLInterface(p + 'ssleay32.dll', p + 'libeay32.dll');
  13.   // do something with SSL
  14. end.
TinyPortal © 2005-2018