How Can I Protect My C# Code From Being Decompiled? [duplicate]

隐身守侯 提交于 2019-12-06 07:28:34
Mark Hall

In short you need to use Obfuscation. To name a few.

  1. Dotfuscator
  2. Obfuscator
  3. Skater (Freeware)
  4. DeployLX CodeVeil
  5. Plus Visual Studio comes with a light version of Dotfuscator.

You can read this MSDN article that has advice on how to obfuscate your code.

You can use an Obfuscator.. Salamander is one such tool for .NET...

Confuser is another free obfuscator for .NET. It is developed in C# and using Mono

You can use mono to compile it to a native binary, just google it up.

You could also code the sensitive functions/components into native C++, wrap it in C++/CLI and use with .NET in addition to obfuscating your .NET assemblies.

Even with obfuscation the JIT compiler will need to see the IL code eventually, you are just making it more difficult to decompile.

Kit

An obfuscator is a good bet, as it increases a person's effort to view, edit, redistribute, etc. the code.

While these don't protect your code physically they could prevent the behavior of decompiling your code: legal mechanisms such as patents, copyrights, and licenses.

Decompiling or reverse engineering is a battle of economic efforts. Is it worth it for you to obfuscate your code (potentially running afoul of reflection "gotchas") vs. is it worth it for someone to reverse engineer (with little context) instead of emulating or rewriting?

A comment on this answer, https://stackoverflow.com/a/1988467/64348, with which several agree, indicates that obfuscation does not prevent getting back to the original (or some close enough version of the original) code. Obfuscation is just a stand-in to a reversible translation with no real key needed except some useful context.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!