Advertising (This ad goes away for registered users. You can Login or Register)

Protecting C# code...

Discuss security issues on computers here.
Content that is judged "dangerous" might be removed without prior notice
Nickolas
Posts: 174
Joined: Sat Jan 22, 2011 3:14 pm
Location: In a black hole...

Protecting C# code...

Post 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.
Advertising
Image
Image
Image
Image
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: Protecting C# code...

Post 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.
Advertising
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
Nickolas
Posts: 174
Joined: Sat Jan 22, 2011 3:14 pm
Location: In a black hole...

Re: Protecting C# code...

Post 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.
Image
Image
Image
Image
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: Protecting C# code...

Post by m0skit0 »

Yeah, implementing your own language is way easier and faster than encrypting... :lol: 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.
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
Nickolas
Posts: 174
Joined: Sat Jan 22, 2011 3:14 pm
Location: In a black hole...

Re: Protecting C# code...

Post 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? :lol:
Image
Image
Image
Image
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: Protecting C# code...

Post by m0skit0 »

Again, to protect your DLLs and data files from being modified :mrgreen:
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
Nickolas
Posts: 174
Joined: Sat Jan 22, 2011 3:14 pm
Location: In a black hole...

Re: Protecting C# code...

Post 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?
Image
Image
Image
Image
sss0
Posts: 53
Joined: Sat Mar 24, 2012 2:02 am

Re: Protecting C# code...

Post 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.
Nickolas
Posts: 174
Joined: Sat Jan 22, 2011 3:14 pm
Location: In a black hole...

Re: Protecting C# code...

Post 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. :cry: 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).
Image
Image
Image
Image
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: Protecting C# code...

Post 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.
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
Locked

Return to “Security”