views:

757

answers:

2

i developed a very simple vb.net application and i need a way for every user to verify that they have paid for it. i would like the simplest method possible. it will be an off-line registration. I am actually looking for a way that I can program this easily myself, and am not interested in third part solutions.

+2  A: 

You could store an encrypted string in the user's registry (e.g. his Full name). Decrypt that string at application start to check if the license is valid.

How secure do you want it to be? If you're looking for rock-solid piracy protection (if it even exists) you'll have to combine it with some sort of online registration/activation system. Or use a 3rd party solution as opted by Mitch Wheat.

Zyphrax
cool how do i modify registry and read from registry? i want this to be as simple as possible and dont care much about piracy protection
I__
alex, if you don't know how to use the registry, I think it's a little too early to be selling software.
grawity
so can you help?
I__
Check this page for more information: http://www.codeproject.com/KB/vb/registry_with_vb.aspx Or search MSDN for more information.
Zyphrax
+3  A: 

Just ask for the name, and calculate a hash (such as SHA1 or MD5) for that name (maybe lowercase and strip whitespace first), prefixed with some secret text that is hardcoded in your program. If you want different keys for different versions, then also prefix the version number before calculating the hash. That hash will be your registration key (or, if you think it is too long: take the first characters of the hash).

Have the user enter both the name and the registration key, and store those in the program's configuration. Then recalculate the hash in exactly the same way whenever you need to validate it, and compare it to the stored key.

Arjan
im sorry but where would i store the program configuration? you mean in the registry?
I__
Yes, or in some file in your program's folder. Actually, as you're saying it's an offline registration, you could email a .reg file that will be included into the registry when the users double clicks it (not too sure if that still works in Vista). Or you can instruct the user to save some file in some location, though for many users it may be hard to save something in the protected Program Files folder?
Arjan