hiding 1) content of .mat file and 2) .m file names as well as the content
조회 수: 8 (최근 30일)
이전 댓글 표시
Hi there, I need to send a software, containing about 50 files including .m, compiled mex, and .mat, to be used by someone who will test it in matlab. I need to hide: 1) content of .m files, 2) content of .mat files (I load during the run of my .m files), 3) the file names
What is the proper way to do it?
I believe pcode is not quite appropriate, and mcc is not quite right for?
Thank you in advance, Paul Ki
댓글 수: 0
채택된 답변
Jan
2011년 11월 27일
You cannot hide the contents securely, if you want the user to run your program. Even if you encrypt the MAT files, you need a function to decrypt them and then the values are found in clear text in the memory, from where they can be copied by a debugger.
P-coding the M-files is sufficiently secure, if the costs of the software are less than 10$ per line.
You can read the MAT files and convert it to M-code, e.g. by FEX: generate-m-file-code-for-any-matlab-variable . Then you can P-code the results.
Compiled MEX files are a kind of encrypted already. It is not trivial to use a reverse-engineering to get the contents of the files.
I suggest to look how others solve the problem of shipping a program for testing: E.g. MathWorks delivers new releases of Matlab for beta-testing. All testers must confirm a non-disclosure agreement. This is more efficient than encrypting the files.
추가 답변 (2개)
Walter Roberson
2011년 11월 27일
I don't know if you will be able to hide the file names with any provided mechanism.
pcode can obscure .m file contents. There are ways that a sufficiently dedicated person can dig information (but not complete source) out of pcode'd files.
If you use the MATLAB Compiler, then deploytool will create AES encrypted files that are decrypted on-the-fly . However, auxilary files such as .mat files are, as best I recall, unpacked to plain-binary files.
MATLAB does not provide any mechanisms for load() to work in binary streams (such as a pipe that reads and decrypts a file.)
If you are concerned about protecting .mat files, you should consider using fwrite() to save the variables as binary files. You could apply encryption when you do that; your program would then have to read and decrypt the values from the binary files.
댓글 수: 0
David Leffingwell
2023년 6월 12일
If you have access to the MATLAB Compiler, you can it to create a standalone application. Use the -s option to obfuscate the file and folder structure inside the standalone application (which is a self-extracting Zip file). The -s option also encrypts your data (e.g. MAT files) and mex files in addition to your M files. Also you can use the -j option to automatically P-Code all your M files. See here for more details.
댓글 수: 0
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!