Author Topic: Is it possible to communitate to HTTPS server without OpenSSL, via synapse?  (Read 1487 times)

egsuh

  • Hero Member
  • *****
  • Posts: 1826
Hi,
My webserver accepted only http in the past. Now I changed it to respond to https.
So far so good. Connecting to it via webbrowser works fine.

I have Lazarus-built program, that accesses to webserver, via Ararat Synapse. I had no problem in accessing the webserver by http://www.alphaq.biz.

After changing my server to accept https, the old program did not work. So, I added ssl_openssl in the uses clause that access the web server, changed the URL to https://www.alphaq.biz.

And it works fine.

What I'm curious is, I think I have installed OpenSSL, downloaded from a site, and installed to my PC. But I cannot find the related files. I cannot find OpenSSL directory, like under Program Files, or other places.

So my question is, is it sufficient to add ssl_openssl unit to the uses clause within Lazarus unit, or is my PC have installations of OpenSSL somewhere on my PC? The issue is whetherh I have to distribute OpenSSL libraries together with my client program

LemonParty

  • Hero Member
  • *****
  • Posts: 619
Yes, you have to distribute
Quote
libcrypto-3-x64.dll
libssl-3-x64.dll
with your program. There is a chance that somewhere in system already installed those libraries but I would not rely on this.
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

LemonParty

  • Hero Member
  • *****
  • Posts: 619
If you looking for this files. Here is the place where I downloaded them:
https://forum.lazarus.freepascal.org/index.php/topic,74503.msg587798.html#msg587798
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

egsuh

  • Hero Member
  • *****
  • Posts: 1826
@LemonParty

Thank you for your kind comment. My Lazarus version is 4.8 with FPC3.2.2. So, I think I have to use OpenSSL 1.1.
Funny thing is, I'm testing on another PC. Here my new program works fine, and old one that uses http connection does not. I can find libssl-3-64.dll, etc. at my Windows/System32 folder. Also I can find c:\Program files\OpenSSL folder. So, it seems that on this PC OpenSSL v3.0 has been installed.

But, my program used ssl_openssl, not ssl_openssl3. Why does this work? I'm curious.

LemonParty

  • Hero Member
  • *****
  • Posts: 619
Don't know if it actual for your case, but this is what I found in unit openssl:
Code: Pascal  [Select][+][-]
  1. const
  2. // SSL and Crypto DLL arrays must have the same length and contain
  3. // matched pairs of DLL filenames. Place newer versions at the beginning.
  4. {$IF DEFINED(WIN64)}
  5.   SSL_DLL_Names:    array[1..4] of AnsiString = ('libssl-3-x64',    'libssl-1_1-x64',    'ssleay32', 'libssl32');
  6.   Crypto_DLL_Names: array[1..4] of AnsiString = ('libcrypto-3-x64', 'libcrypto-1_1-x64', 'libeay32', 'libeay32');
So that mean that it supports multiple versions of SSL library. Maybe you have a similar thing in your libraries.
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

Warfley

  • Hero Member
  • *****
  • Posts: 2084
Windows since many years now (starting somewhen with Windows 10) ships OpenSSL via it's system library and updates. On Linux the user usually has it installed via the package manager.
You do not need to distribute your own version of OpenSSL in most cases, in fact you should not distribute your own version, as the OS updates will keep it up to date much more reliable than you probably will.

dbannon

  • Hero Member
  • *****
  • Posts: 3882
    • tomboy-ng, a rewrite of the classic Tomboy
Windows since many years now (starting somewhen with Windows 10) ships OpenSSL via it's system library and updates. On Linux the user usually has it installed via the package manager.
You do not need to distribute your own version of OpenSSL in most cases, in fact you should not distribute your own version, as the OS updates will keep it up to date much more reliable than you probably will.

Warfley, are you sure of that ?  I have googled around and no where do I see a mention of a pre-installed openssl on windows. Endless people pushing their version of openssl (worryingly) and some AI answers saying, very clearly :

OpenSSL is not preinstalled on Windows 11; users need to download and install it separately from the Win32/Win64 OpenSSL Installation Project or other sources.

Yes, I know, AI, but several agreed.

(Life would be so easy if it was pre-installed, so hoping I am wrong!)

Davo
Lazarus 4, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

PierceNg

  • Sr. Member
  • ****
  • Posts: 443
    • SamadhiWeb
On my Win 11 Home laptop, MS OneDrive ships libssl-3-x64.dll and libcrypto-3-x64.dll, updated yesterday. The files are in C:\Users\<me>\AppData\Local\Microsoft\OneDrive\26.134.0713.0007\.

Other than that,

- VS 2022 CE ships a version of mingw64, which has those two DLLs, updated Jul 2026 as part of security update.
- LibreOffice ships the DLLs, dated 2025, presumably untouched since I installed or last updated.

Update: Grepping strings output of libcrypto.dll for version info yields:

- OneDrive copy: OpenSSL 3.4.4 27 Jan 2026
- VS 2022 CE copy: OpenSSL 3.5.6 7 Apr 2026

According to OpenSSL site, v3.5.7 is current LTS version.
« Last Edit: August 11, 2026, 11:13:04 am by PierceNg »

LemonParty

  • Hero Member
  • *****
  • Posts: 619
I have just tested on my project. I removed libssl-3-x64.dll, libcrypto-3-x64.dll from folder with my project and things stop work.
I have latest Windows 11, last update two weeks ago.
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

dbannon

  • Hero Member
  • *****
  • Posts: 3882
    • tomboy-ng, a rewrite of the classic Tomboy
I have just tested on my project. I removed libssl-3-x64.dll, libcrypto-3-x64.dll from folder with my project and things stop work.
I have latest Windows 11, last update two weeks ago.

@PieceNG may have answered that. You have to have agreed to all your working directories being moved to OneDrive, looking at my wife's laptop, seems just about every thing is on OneDrive, documents, music etc. She insists she was not asked.

But in return for totally destroying your privacy, you get access to well maintained openssl (and probably lots of other software I imagine).  But (probably) those files are not on your path, so, need to be copied over or installed. Beats me, I have a windows install on my laptop but I would have to be the worst Windows user on this forum !

Davo
Lazarus 4, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

egsuh

  • Hero Member
  • *****
  • Posts: 1826
So, OneDrive might have installed the dll files.
I think I had better not distribute OpenSSL myself. Instead, if users say something does not work. "please install OpenSSL" first.

Xor-el

  • Sr. Member
  • ****
  • Posts: 421
So, OneDrive might have installed the dll files.
I think I had better not distribute OpenSSL myself. Instead, if users say something does not work. "please install OpenSSL" first.

have you seen https://forum.lazarus.freepascal.org/index.php/topic,74777.msg588672/topicseen.html#new

Thaddy

  • Hero Member
  • *****
  • Posts: 19626
  • Glad to be alive.
I have added two simple examples to that post.
Yes, it is possible and I would even say it is highly recommended.

Note that the generated binary looks very large but that is a false observation: with OpenSSL you have shared libraries that also need to count to the binary size of a distribution.
And you have no versioning and bitness problems: the cause of a great many questions on this forum.
« Last Edit: August 15, 2026, 05:51:56 pm by Thaddy »
Any "programmer" that knows only one programming language is not a programmer

Xor-el

  • Sr. Member
  • ****
  • Posts: 421
I have added two simple examples to that post.
Yes, it is possible and I would even say it is highly recommended.

Note that the generated binary looks very large but that is a false observation: with OpenSSL you have shared libraries that also need to count to the binary size of a distribution.
And you have no versioning and bitness problems: the cause of a great many questions on this forum.

Thanks for the examples Thaddy, very much appreciated.

Warfley

  • Hero Member
  • *****
  • Posts: 2084
Warfley, are you sure of that ?  I have googled around and no where do I see a mention of a pre-installed openssl on windows. Endless people pushing their version of openssl (worryingly) and some AI answers saying, very clearly :

Oh yes you are right, I have mistaken that, OpenSSL is distributed with some software like mingw or openssh.

 

TinyPortal © 2005-2018