THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/12/2012 at 15:55, xxxxxxxx wrote:
My 5 cents...
Originally posted by xxxxxxxx
I have to admit, this was one of the hardest things to get my head round when I first serialised a plugin. It seems so sinmple, but it isn't.
Well, the whole SNHook thing is a bit weird at first, that's true. But you can also completely ignore it and use e.g. a license file.
Originally posted by xxxxxxxx
Anyway, the first thing you need is some way to generate a serial number. For this, you need the purchaser's C4D serial, the first 11 digits that is.
Well, you *could* use anything else, too. The licensee's name, his network adapter's MAC address, whatever. But yeah, the C4D serial is usually the best choise, and the easiest one for both, you and the customer.
Originally posted by xxxxxxxx
How you generate a serial from that is up to you, but you can do anything you like as long as you can reverse the process and get the original C4D serial back out. You could manipulate it with a magic number known only to you, encrypt with an encryption algorithm, basically do whatever you want. Just make sure that you can reverse the process.
That's one possibility. Use an encryption that can be reversed, too.
The easiest one would be a simple XOR. Then the encryption function is also the decryption function. But then, basically anybody with a scientific pocket calculator could create their own license key :)
Or you use something like AES or Blowfish, which enables you to only compile the decryption function into your plugin binary and keep the encryption to yourself. That would make it a bit harder for somebody to create a key generator for your plugin. Anyway, most of the times, the crackers just skip the license query instead of creating a keygen.
The other possibility is, to use a digestion algorithm that can't be reversed, such as e.g. MD5. In that case, You would not decrypt the customer's license key, but encrypt their C4D serial and compare the encryption result with the license key.
Originally posted by xxxxxxxx
You will probably need another program (I usually build a small windows app in C#).
I used to do that, too (still use it for my two SPREAD plugins), but I found that it's easier to write it either in JavaScript or PHP, and keep it in a secured area on a server on the web, so I can create and deliver licenses from anywhere in the world, as long as I have my phone with me.
Originally posted by xxxxxxxx
All you do then is compare the serial number of the copy of C4D the plugin is running in (you get that by using GeGetSerialInfo()) with the serial you extract from the licence key the user has entered. If they match, it's a legit copy. If they don't it's not and you either tell the user with a dialog or print a console message, or whatever.
I would also advice you to only use the last 5 digits of the serial. That way, you don't have to send out a new license again, if the customer first purchased with his temporary C4D serial and later gets his final one, or if he upgrades his version e.g. from Vis to Studio.
Originally posted by xxxxxxxx
If it can't be loaded then the user hasn't entered the serial yet, so you prompt him to do that (or let a demo period expire if you like).
I never use a demo period. Too easy to cheat. I simply skip the complete license check if the plugin runs in the C4D Demo (or in a NET server / client).
People then have to use the C4D Demo to try out your plugin, but they have as much time to play with it as they want. Pretty fair, IMO.
Originally posted by xxxxxxxx
That's basically it. The hard part is finding some way to encode the C4D serial, but you are own your own with that - no-one will reveal how they do it because that's not information you want a hacker to have.
Just use any common encryption (AES, DES, Blowfish; you can find Open Source C++ source for any of them) or digestion function (MD5, SHA, Whirlpool). IF you'Re afraid somebody's going to try a brute force attack, see that you use a slow algorithm. But really, in practice they're going at it with a disassembler and simply skip the check. If you're not an exceptionally smart programmer with lots of time and experience, they will always find a way.
Originally posted by xxxxxxxx
Just don't spend too much time on it because they WILL break your protection system no matter what you do.
EXACTLY. Keep it simple. They will crack it anyway, and whoever wants to use it for free, will know where to find the cracked version.