How to protect DLL files in. NET (anti-cracking, anti-compilation)

Source: Internet
Author: User
Tags reflector

. NET is a language that is built on a virtual machine that generates the intermediate language of the MSIL directly, and then the. NET compiler JIT interprets the image as native code and delivers CPU execution. The intermediate language is easy to decompile, so study how to effectively protect DLL files. My approximate method is: Strong signature + obfuscation + encryption. Strong-Signed strong-named assemblies ensure that your assemblies are unique without tampering, spoofing, and so on, even if assemblies of the same name are different. Note: Unsigned main programs can reference signed or unsigned assemblies; the signed main program cannot refer to unsigned assemblies. (The above article has the corresponding solution) confusion is the compilation generated MSIL intermediate code obfuscation, the simplest confusion is the name confusion, will be named Space name, class name, method name, field name and so on all replaced with special symbols or other symbols, the purpose is to let people see halo, but does not change the program execution logic. I use the dotfuscator here to confuse. Dotfuscator Obfuscation method: 1. Create a new project; 2. Select the DLL, EXE file to be confused; 3. Select the library attribute in the attribute (it is important, because I would like to confuse the DLL file, if not selected, the confusion will not be properly called!) ) as shown in: 4. Select the Bulid tab and click the Bulid button to confuse. We can also choose other tags to encrypt strings, add watermarks and other operations, I am here to encrypt work with another method, so there is no choice to operate. OK, after the confusion is complete, we can use Reflector.exe to decompile the garbled DLL file, you can compare the source to see the effect. Encryption next we continue to encrypt the obfuscated DLL file and further protect the DLL file. The encryption tool I am using is maxtocode. After opening the software, switch to Chinese, you can see very simple, after adding the DLL file, directly click to perform encryption. Other options such as: Encryption string, strong name, etc. are very simple, we have a try to know, and maxtocode help to do very friendly, a look will be used. The encrypted DLL file is one times larger than before, and after Reflector.exe, it is found that DLL files are encrypted more thoroughly because the contents of the main function are hidden. Through the above three steps, so that your DLL file can be exempt from the general people's crack, of course, it is impossible to absolutely prevent being cracked.

Transferred from:

How to protect DLL files in. NET (anti-cracking, anti-compilation)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.