encrypt an Matlab application standalone ?

11 views (last 30 days)
Benoit MAGUET
Benoit MAGUET on 22 Jul 2020
Answered: David Leffingwell on 12 Jun 2023
Hi,
We are aiming at sharing an application to partners without allowing them to get access to the source code
Therefor, Is it possible to protect (encrypt) an executable file from Matlab (.exe) ?
In particular, can we trust in p-code or standalone executable ?
Or do we need more advanced coding tools or crypting workflow ?
Thanks

Answers (3)

Steven Lord
Steven Lord on 22 Jul 2020
From the documentation for MATLAB Compiler: "All MATLAB files in the deployable archive are encrypted using the Advanced Encryption Standard (AES) cryptosystem."
  2 Comments
Benoit MAGUET
Benoit MAGUET on 23 Jul 2020
Hi Steven,
Thank you for your quick response.
I would like to have confirmation that a Standalone App is indeed a deployable archive.
And also how one coul encrypt or hide the hierachy of the archive.
Because once transformed into Standalone app, we can extract the archive, the files seem well encrypted but we can even the entire hierarchy of the app.
David Leffingwell
David Leffingwell on 12 Jun 2023
Edited: David Leffingwell on 12 Jun 2023
In R2021b or later you can use the -s option of the MATLAB Compiler to obfuscate the file and folder structure in the Standalone application. Also, in R2022b or later, you can use the -j option of the MATLAB Compiler to automatically P-Code all your M files with a newer version of P-Code.
See here for more details.

Sign in to comment.


Walter Roberson
Walter Roberson on 23 Jul 2020
In particular, can we trust in p-code or standalone executable ?
You should definitely not trust in p-code. It obscures, but there are debugging techniques that can examine parts of it. It is expected that someone might have largely decoded it by now.
Last year, someone made the claim that they had the AES key needed to decrypt .exe files. I do not know if the claim was accurate, but I would not rule out the possibility that someone dug through the executable enough to figure it out.
The role of good encryption and obfuscation is to make it more expensive to decode the files than the value gained. You should never ever count on software encryption to make it impossible for code to be examined.
The military works with hardened hardware with sealed chips designed to make it near impossible to get at the components (and bus lines) without breaking the device beyond use. Even then, for the class of devices that needs that kind of protection, they use carefully designed software and hardware to avoid "back channels" (e.g., giving away whether an operation succeded or not by monitoring timing differences.)

David Leffingwell
David Leffingwell on 12 Jun 2023
The MATLAB Compiler can be used to create an encrypted Standalone application.
In R2021b or later you can use the -s option of the MATLAB Compiler to obfuscate the file and folder structure in the Standalone application. Also, in R2022b or later, you can use the -j option of the MATLAB Compiler to automatically P-Code all your M files with a newer version of P-Code.
See here for more details.

Categories

Find more on Programming in Help Center and File Exchange

Tags

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!