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

房东的猫 提交于 2019-12-22 17:28:07

问题


Possible Duplicate:
.Net Obfuscation
Alternative for Obfuscation in the .NET world

Just a few minutes ago, I read that there are a number of tools, many free, that allow you to convert a C# .exe back to a VB solution. This means that my proprietary code can be viewed, edited, and recompiled/redistributed. Is there a way to prevent this?


回答1:


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.




回答2:


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




回答3:


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




回答4:


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.




回答5:


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.



来源:https://stackoverflow.com/questions/7314704/how-can-i-protect-my-c-sharp-code-from-being-decompiled

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