Reputation: 237
Why can we decompile .NET assemblies easily?
What's the main reason we can decompile .NET EXE files easily?
There are much software that I can use to obfuscate my application code, but why does it need to obfuscate for protection? Couldn't Microsoft make it difficult to know basically? May the main reason be that .NET code should turn into IL code? Is this true?
Upvotes: 4
Views: 974
Reputation: 33637
IL code (which is what .NET assemblies contains) is a higher level (virtual) machine language (and much more simpler - stack based only, no registers, etc. as you have in a CPU) than the CPU assembly (x86, ARM, etc.) which is much more low level and not easy (as there are various registers, etc.).
So when the C# compiler compiles to IL code, it is much easier to construct (guess) the original C# code.
Upvotes: 2
Reputation: 62246
Why didn't Microsoft do it? Because you can not protect your code against a determined hacker. Like the biggest software provider, they don't make built-in something like this, but they let you have a market of tools where you can choose the most apropriate tool for you based on your needs and pocket size.
Upvotes: 1
Reputation: 250922
When you open up a .NET DLL with DotPeek or Reflector you are converting IL back into code in the language of your choice. It is important to visualise this as it won't give you back exactly the same code that was written, just code that would produce the same IL.
Upvotes: 0