Page 1 of 2
Protecting C# code...
Posted: Wed Jun 13, 2012 11:29 am
by Nickolas
Here's the deal. I have been working on a "plugin" for a game engine called Unity3D. Unity executes any C# code located in a (let's say certain) code file in a (again I am too bored to explain, so certain) path. The MAIN file has to be a .cs to be executed (plain code) but I can use libraries and functions in them by calling them from the main file. I want to protect the rest files. What would you recommend? Creating DLLs with my code? Please note that the protection is against the "average coder" so there might be a possibility of RE if I use DLLs.
Re: Protecting C# code...
Posted: Wed Jun 20, 2012 11:02 am
by m0skit0
Well I've recently cracked a .Net app and it was a kid's game. Moving stuff to external libraries doesn't really change much, as you're just splitting the code into various files. Libraries are not much a security feature but a code reusability feature.
Did you check
Dotfuscator? It comes bundled with VS IIRC. Also you can maybe check some kind of encryption and/or check-sum checking on the files.
Re: Protecting C# code...
Posted: Wed Jun 20, 2012 12:19 pm
by Nickolas
Encrypting the code files is impossible, as the engine reads them directly...

I have an idea, though. I could design my own language in which I'll implement the code and just have a main C# file which loads the other files.
Re: Protecting C# code...
Posted: Wed Jun 20, 2012 3:09 pm
by m0skit0
Yeah, implementing your own language is way easier and faster than encrypting...

Dude, you can just make the engine decrypting using a public key, while code/data are encrypted using a private key. This way nobody can modify your code/data even if they can decrypt it.
Of course they can just RE your code and jump over decryption to make it execute plain stuff.
Re: Protecting C# code...
Posted: Wed Jun 20, 2012 7:57 pm
by Nickolas
Again, the decryption method will have to be in the main file which is plain C# so that it can be run! So why bother?

Re: Protecting C# code...
Posted: Thu Jun 21, 2012 9:03 am
by m0skit0
Again, to protect your DLLs and data files from being modified

Re: Protecting C# code...
Posted: Fri Jun 22, 2012 6:21 am
by Nickolas
No no no. It isn't protection against modding! They bought the source, they can do whatever with it. I just don't want them to pack it and email it to friends, relatives and the whole world. So I want to keep secret a portion of the code which will not actually affect the modification capabilities of my program, but will prevent them from sending it to other people. Any ideas?
Re: Protecting C# code...
Posted: Fri Jun 22, 2012 6:35 am
by sss0
Have you ever considered joining the "Free software movement" instead?
I really suggest you study the programming environment displayed nowadays, if you already haven't. I see of almost no reason to not embrace this cause against proprietary software. Even if your development has the intuit of profitability as the ending goal, such thing can still be achieved with libre software.
Re: Protecting C# code...
Posted: Fri Jun 22, 2012 6:56 am
by Nickolas
sss0 wrote:Have you ever considered joining the "Free software movement" instead?
I really suggest you study the programming environment displayed nowadays, if you already haven't. I see of almost no reason to not embrace this cause against proprietary software. Even if your development has the intuit of profitability as the ending goal, such thing can still be achieved with libre software.
It's not as easy as that.

It is not normal software. Imagine it like an extension, a plugin. They put the rules not me, if I give it out for free then it is considered as open-source (since I am selling the actual
source).
Re: Protecting C# code...
Posted: Fri Jun 22, 2012 7:54 am
by m0skit0
Well, really the only way is to license the code for a given hardware and not allow it to run on other hardwares. This requires internet connection. You can find other ways too, but keep in mind that everything can be cracked.