Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executing Application inside an archive file without extraction

I want to compress and encrypt my whole application, maybe with Zip, 7z, Bz2, Tar, or any compression method, and using AES-128/256 as encryption algorithm for security purposes. Then create a launcher application which will handle the execution of the application and decryption of the archive.

I already have an idea on how to achieve it but with references/libraries only:

  • The application will handle the decryption of the file using #ZipLib, the password might be stored inside a SecureString

  • Create a new AppDomain and execute the executable from the archive without extracting it (just loading the bytecodes)

  • The secondary AppDomain must implement the event AssemblyResolve and whenever it needs to load an assembly; it will try to decrypt that file from within the archive.

But how about the files needed by the application such as images, embedded database(ex. SQLite), XMLs, and other external files? Is there any other way to do it?

like image 533
eSPiYa Avatar asked Oct 25 '22 10:10

eSPiYa


1 Answers

Files can all be loaded during runtime and do not require loading during design time. You can bring up a resources manager and pull in pictures from your encrypted areas. This can be achieved. It will require some time however. It sounds to me like what you are doing is good in concept but falls a little short. The only way to run a program is by it being extracted in some manner or another. If your goal is to protect your information, your launcher will expose your data. By using .NET in itself is exposing what you are doing (.NET Reflector, etc.). If your goal is to make it difficult, then a launcher will suffice.

Just remember, everything can be broken.

like image 178
Jimmie Clark Avatar answered Oct 31 '22 00:10

Jimmie Clark