views:

329

answers:

4

I have developed a small application and now i want to protect it.

I want to run it only on my own computer and i have developed it for myself.

How can i do that?

+4  A: 

A. Don't publish it.
B. Hard-code your computer name in the code, and make the first thing the program does to be verifying that System.Environment.MachineName matches it.

Jay
if i re install fresh copy of window, i don't think that machinename remains same......
Web Worm
@testkhan: You can make the machine name whatever you like.
Adam Robinson
...which also means anybody else could set a machine name to match what is required to run your code, assuming that (1) they really want to run your code, and (2) they know that a specific machine name is required.
Jay
+1  A: 

It really depends on who is the "enemy".

If you wish to protect it from your greedy, non-cracker, friends, then you can simply have the application run only if a certain password is found in the registry (using a cryptographically secure hash function), or use the MachineName as Jay suggested.

But if you're thinking of protecting it from serious "enemies", do notice: It has been mathematically proven that as long as the hardware is insecure, any software running on it is inherently insecure. That means that every piece of software is crackable, any protection mechanism is bypassable (even secured-hardware devices such as Alladin's Finjan USB product key, since the rest of the hardware is insecure). Since most (if not all) of today's hardware is insecure, you simply cannot get 100% security in a software.

In between, there are lots of security solutions for licensing and copy-protection. It all comes down to who is the enemy and what is the threat.

M.A. Hanin
+1  A: 

No matter how hard you try, if someone really want to run it on another computer, they will.

All need to do is reverse engineer your protection to

  1. remove it
  2. play with it
Fredou
A: 

Another option might be to have your program ask the USER a question that has a derived answer. Here's a brain dead example....

Your Program: "What time is it now?"

You Enter: (TheYear + 10 - theDay + 11) Mod 13

In this way its actually ONLY YOU that can run the program instead of it being MACHINE dependent.

tobrien