Search code examples
c#.netvisual-c++reverse-engineeringdecompiling

Protecting source code of a DLL


I have a library written in C#. I want to distribute it as a DLL. But it seems that .NET allows for comfortable decompilation of it, so the algorithms can be easily stolen.

I can rewrite it in C++, but I'm new to .NET. So, the main problem would be to write an interface to C#. The library is not too big and uses threads, network and some math

Is there a way to build a DLL that can by disassembled only? Or I better need to just write everything in C++ and provide an interface to C#? Is it much harder to decompile C++ than C#?


Solution

  • If you are really worried about the intellectual property of your algorithm, then you have some options.

    1) Patent the algorithm. I can hear the howls, but that is how you protect intellectual property in a legal manner.

    2) Do not give the DLL with the algorithm to the users. Host the algorithm in the cloud and only allow customers to access it that way.

    Some of the rest i don't understand. You say you can write C++, but don't know how to write an interface to C#? Use COM. C# can use COM libraries. Or, export your function in C++ and write a .NET interop library that calls the C++ DLL using PInvoke.