About the decompilation of C# dll files to obtain the source code

background

Some time ago, when our company was doing encryption source code operations, we described the way to encrypt C# cs files into dll files. In order to avoid misunderstanding [take this encryption method as an absolutely safe operation], I will write an article about anti A blog that compiles dll files out of source code.

operate

1. First of all, we need to prepare a C# decompilation tool. I use the free software JetBrains dotPeek here. There are many similar ones. You can download them online. In order to avoid the suspicion of advertisements, the tool download link is not given here. Open the tool.
insert image description here
2. Click the [File->Open] button in the menu bar and select the dll file to be decompiled.
insert image description here
After opening, you can see that the dll has been loaded in the decompilation tool.
insert image description here
3. We expand this directory and view the source code
insert image description here
to see that Test.dll The source code of the Program class in the file is reproduced.

in conclusion

Just doing dll encryption on the cs class written by ourselves is far from meeting the security requirements of protecting the source code, because it can be reproduced by peers with decompilation tools, so it needs to be combined with other encryption methods, and the intellectual property attack and defense battle has a long way to go.

Guess you like

Origin blog.csdn.net/qq_36694133/article/details/116519118