HMAC Encryption causes crash.

Deploying to Linux? Get penguinated here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
Googie85
Posts: 229
Joined: Tue Aug 05, 2014 10:07 am

HMAC Encryption causes crash.

Post by Googie85 »

Hii Guys!!

Within the LiveCode IDE I can run the following code:

Code: Select all

      put messageAuthenticationCode( \
            tPayload, \
            "KEY", \
            "HMAC-SHA-256") into tCalculatedHMAC
            
When I compile for Linux, my compiled app does not go past the point described above.

Any ideas?

Thanks,

Googie
mrcoollion
Posts: 750
Joined: Thu Sep 11, 2014 1:49 pm

Re: HMAC Encryption causes crash.

Post by mrcoollion »

These days I always initially ask AI for a solution.
As an example in your case I asked the following Google Gemini:
I am using the LiveCode development language and i have the following issue. Please let me know what goes wrong and please do not hallucinate answers.
Within the LiveCode IDE I can run the following code:
Code: Select all
put messageAuthenticationCode( \
tPayload, \
"KEY", \
"HMAC-SHA-256") into tCalculatedHMAC

When I compile for Linux, my compiled app does not go past the point described above.

I got the following answer:
--------------------------------------
This issue typically occurs in LiveCode standalones due to one of two reasons: missing standalone inclusions or missing Linux system dependencies (OpenSSL/libcrypto).

In the IDE, LiveCode loads all security, crypto, and network modules by default. When compiled into a standalone, only modules explicitly included (or successfully detected by the builder) are packaged.

Cause 1: Missing Inclusions in Standalone Builder (Most Common)
The messageAuthenticationCode function depends on the cryptographic engine. If your standalone builder is set to automatic dependency detection, it often fails to detect that crypto functions are required.

How to fix:
In the LiveCode menu, open File → Standalone Application Settings...

Go to the General tab (or Inclusions tab, depending on your LiveCode version).

Switch from "Search for required inclusions when saving the standalone" to "Select inclusions for the standalone application".

Check the box for SSL & Encryption (and/or Crypto, Message Digest, depending on your specific LiveCode version).

Rebuild your Linux standalone.

Cause 2: Missing OpenSSL / libcrypto Libraries on Linux
On Linux, LiveCode delegates cryptographic hashing (like HMAC-SHA-256) and SSL directly to the operating system's OpenSSL dynamic libraries (libcrypto.so / libssl.so).

Version Mismatch: Older LiveCode builds (e.g., LiveCode 9.x) typically look for libcrypto.so.1.1 or libcrypto.so.1.0.0. Newer Linux distributions (such as Ubuntu 22.04+ / Fedora 36+) ship by default with OpenSSL 3.x (libcrypto.so.3).

If the engine cannot find the specific .so version it dynamically links to, the function will fail or throw an unhandled execution error, stopping the script.

How to fix:
Verify OpenSSL 1.1 is installed on the target Linux system:

Bash
# On Debian/Ubuntu-based distributions
sudo apt-get install libssl1.1
# (or libssl-dev / compat-openssl depending on distro)
If running your standalone from the terminal, check what libraries are missing:

Bash
ldd ./YourAppName
Look for any lines outputting not found.

Recommended: Wrap in a try...catch to Inspect the Error
To pinpoint the exact reason why the standalone is halting, wrap the call in a try block and write the error out to a log file or answer dialog:

Code snippet
try
put messageAuthenticationCode( \
tPayload, \
"KEY", \
"HMAC-SHA-256") into tCalculatedHMAC
catch tError
answer "Crypto Error: " & tError
end try
Post Reply