views:

105

answers:

4

Is it possible to convert a dll library back to source code?

Not that I want to do this, but I need to outsource some non-critical parts of a software that I am writing, but I wouldn't want the other guys to copy everything that I have so far.

The code in the respective dll is not the whole code. I have managed to include only the necessary code in the library, but I still wouldn't like the other guys to copy my code.

Should I be worried?

+3  A: 

Possible? Yes.

Easy? It depends.

If you have written your dll in .NET, decompilation is a snap, using tools like Reflector, unless you have obfuscated your code.

Even if this is not .NET code, it is still possible, though much more difficult. And you can make things more difficult if you do obfuscate your code with one of the existing tools.

In general, if you give your code (compiled or not) to someone, they will be able to decompile it from the assembly/bytecode, even if it is obfuscated.

This is not always easy, and normally too much effort. It really depends on how paranoid you are and how valuable your code is to the third party.

There is no protection from a truly determined attacker. It can take them years, but if they are truly determined, they will figure it out.

Oded
Usually better to rewrite from scratch if it's gonna take years.. heck, I get too frustrated just *porting* an open-source library from one language to another.
Mark
+5  A: 

The process of recovering source code from compiled code is called decompilation and it can be achieved with better or worse results depending on the language that the program was written in.

To protect yourself against decompiling you can use an obfuscator which works by modifying the binary to make it harder to decompile. An example of a technique used by an obfuscator is to replace names of members that are visible in the binary with meaningless names (e.g. a001, a002, ...) so that the decompiled code makes less sense. Some even use keywords for these names (e.g. for, while, ...) so that a naive decompiler will produce code that won't even compile. They may also use other techniques such as encrypting strings so that they are not readable when viewing the binary.

Obfuscation is not a perfect defense. A sufficiently talented and determined adversary may be able to recover something reasonably similar to your original source code even if you use obfuscation.

Mark Byers
+2  A: 

.NET assemblies are (in general) remarkably easy to decompile and obtain reasonably intelligible source code. A .NET obfuscator can be run as a post-build step to make decompiling the assembly much less useful to thieves who are trying to steal your intellectual property. There are many .NET obfuscators out there of all shape and sizes. I use CliSecure .NET Obfuscator, Andrew Arnott, a Microsoft MVP just published today a review about it, you may find it here.

Gery Elema
+1  A: 

Try to think that your code can be rewritten by anyone, because the idea will be out in the open once you start to take contractors on your project.

What you have and he doesn't: idea how to make business of it. And if you are afraid that he does, propose NDA to him and you won't have any doubts there.

So my proposal for you is not to worry about tech here.

Daniel Mošmondor