(c) 2011, S. Hribšek (unless specified otherwise). Zagotavlja Blogger.

.NET reflection - protect your executables

.NET reflection allows yor to get almost all (if not entirely all) informations about any .NET assembly (of course, one that hasn't been compiled to native code) at runtime programmatically through .NETs' metadata model.

One of the most powerful tools that "takes advantage" of that, is .NET Reflector. This powerful, yet extremely easy tool, can take all the .NET reflection has to offer. In reality, it can go like this: you invest, lets say a year into some hard work development. Then, of course, you put it on the internet. Then, someone comes along, not even a hacker, but just someone with 5 minutes on their hands. He or she runs, lets say .NET Reflector... and here we are! I think many would agree this is somewhat illegal. It should be anyway...

This has probably been discussed many times, many places. So there's no need to dig in further. The key is in doing next steps:

  • obfuscate your code (in laimans terms, all naming in your assembly will be changed to "a", "aa", "aaa", "b", "bb" etc.),
  • compile your IL to native code,
  • encrypt your strings and resources,
  • etc.

One of many powerfull tools that provides all that functionality and more, is .NET reactor. It's not free, but is quite powerful and it takes care of everything.