views:

212

answers:

3

Can I use mono's AOT (Ahead of Time compilation) feature to natively "pre-compile" all or part of some of my own .NET DLLs (and or EXEs) to make them harder to reverse engineer? I'm using Windows (7 / x64 but I have an x86 XP machine as well) and .NET 3.5 (VS 2008) and I'm curious if mono/AOT can be/has been used for this purpose? (Tying them to x86 is acceptable at this point.)

See also this question where I tried this and had no luck.

+1  A: 

Short answer, no.

AOT'ing an assembly will only generate a shared library so the next time you use that assembly, Mono will not have to JIT-compile the methods that you use, but instead it will load them from the .so. Your assembly needs to be there because the metadata in it is still needed.

Gonzalo
So the real IP protection problem is the metadata and the only way to address that is manual or semi-automated obfuscation?
Jared Updike
Yes. Mono AOT is like MS ngen. It won't protect your IP.
Gonzalo
+1  A: 

AFAIK, mono's AOT doesn't remove the metadata which means a hacker has lots of information to try to understand the logic in your code. Also it isn't available for all processors and platforms (specifically I think it isn't available on Windows). It is easier to try some commercial obfuscators that do just that, while taking away most of the metadata.

Monoman
+3  A: 

The IL code in assemblies can be removed once the code has been precompiled (this is what we do for monotouch, for example, to reduce app download size). There are a few restrictions, but it works. Whether you should go to such lengths to screw your costumers with obfuscation is another matter, though.

lupus
Will (does) AOT work in Windows?
Jared Updike