Forum > Networking and Web Programming
OpenSSL initialize error
(1/1)
jhorta:
While I don't get any feedback on the topic https://forum.lazarus.freepascal.org/index.php/topic,69451.0.html, I decided to deploy the API to the cloud (AWS). It turns out that in this case the call is https and according to information on the web, it is necessary to add the opensslsockets package in the uses clause. After doing this, I am getting an error, Could not initialize OpenSSL library. Everything Works fine when i call via Postman. I appreciate any help to get around this problem.
Running on Windows 10, Lazarus 3.4
Error: Could not initialize OpenSSL library
My code:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Procedure Send;Var Client: TFPHttpClient; Response: TStringStream;Begin Client := TFPHttpClient.Create(nil); Client.AddHeader('Content-Type', 'application/json; charset=UTF-8'); Client.RequestBody := TRawByteStringStream.Create('{"jwt": "", ' + '"codAplicacao": "F60EB930-9B1B-11EF-9657-02240D86274B"}'); Response := TStringStream.Create(''); Try Try //Client.Post('http://localhost:4000/local/inicio/hortech', Response); Client.Post('https://mystack.execute-api.us-east-2.amazonaws.com/dev/inicio/hortech', Response); GeraLog('Response: ' + String(Response)); Except on E: Exception do Begin GeraLog('Something wrong: ' + E.Message); End; End; Finally Client.RequestBody.Free; Client.Free; Response.Free; End;End;
TRon:
Try installing the ssl dev package on your distro. strace can be used for details for failure of finding/opening the library.
jhorta:
Thanks for the quick reply. Your mention of 'distro' reinforces to me that I'm on a Windows environment.
As for the suggested installation, I'm quite confused. I've read several threads about the same issue and each one uses a different approach. Some suggest copying one or two dlls to the executable folder. Could you elaborate on this process for a Windows 10 environment?
Thanks again.
TRon:
Sorry, my bad jhorta. I wrongfully assumed *nix environment.
The dll bitness (32 vs 64-bit) has to match the bitness of your executable.
The easiest would be for all (openssl might be accompanied with cryptolibs) the libraries to placed next to your executable.
for a system-wide installation of the openssl-libraries I do not have a clear answer for you as I am not a windows user (anymore). The locations are at first sight illogical e.g. 32-bit dll's inside a 64-bit named folder.
EDIT:
for the system-wide locations on window, see this post from Thaddy (but the whole thread might perhaps be of interest)
Navigation
[0] Message Index