How to encrypt compilation files for standalone?

I have a StandAlone application designed in App Designer, including (.m .mlapp .mat .p .pdf .jpg ...). I want to encrypt all these files execpt the .pdf in the compiled (Matlab Compiler & Matlab Compiler SDK) standalone app. How could i do it easily?

Answers (2)

The MATLAB source files are already encrypted (with you compile with MATLAB compiler, MCC)
Starting in R2021b, you can obscure the names of files and the directory structure, and also encrypt other file types (such as MAT, FIG, MEX, and so on) using the -s option for mcc (MATLAB Compiler). At run time, the encrypted files remain encrypted on the disk but are decrypted in memory to their original form before compiling.

5 Comments

Thank you for the answer. I read the documentation about it, still when i replace -a by -s it doesn't work. Instead, I tried -s on the .exe file and on the main .mlapp and is still not working.
Any hints or suggestions would be much appreciated.
"still when i replace -a by -s "
Why? What in documentation that leads you to replace -a with -s?
They are independent option.
I need to obfuscate the (.mat, .xlsx ...). In the mcc function in matlab, i don't know where to put -s in order to apply this encryption/Obfuscation. I don't mind to obfuscate all my .exe file.
I hope you got me, thank you in advance.
If you are using the command line form of mcc, you can insert -s as the first option
mcc abc.m stuff
becoming
mcc -s abc.m stuff
It does not have to be first; you just cannot insert it into the middle of an option pair
@Rakan 'I need to obfuscate the (.mat, .xlsx ...). In the mcc function in matlab, i don't know where to put -s in order to apply this encryption/Obfuscation. "
Here s the doc that hioe you hhave read and try
-s
Obfuscate folder structures and file names in the deployable archive (.ctf file) from the end user. Optionally encrypt additional file types.
The -s option directs mcc to place user code and data contained in .m, .p, v7.3 .mat, and MEX files into a user package within the CTF. During runtime, MATLAB code and data is decrypted and loaded directly from the user package rather than extracted to the file system. MEX files are temporarily extracted from the user package before being loaded.
To manually include additional file types in the user package, add each file type in a separate extension tag to the file matlabroot/toolbox/compiler/advanced_package_supported_files.xml.
The following is not supported:
  • ver function
  • Out-of-process MATLAB Runtime ( C++ shared library for MATLAB Data Array)
  • Out-of-process MEX file execution (mexhost, feval, matlab.mex.MexHost)

Sign in to comment.

Categories

Products

Release

R2022b

Asked:

on 2 Feb 2023

Commented:

on 4 Feb 2023

Community Treasure Hunt

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

Start Hunting!