Re: Serial Generation and Validation
by TGI (Parson) on Oct 03, 2005 at 17:16 UTC
|
As has been pointed out already, these schemes are essentially security by obscurity--i.e. not so good. In practice, the keep honest people honest, but can be circumvented by anyone who cares to spend the time and effort.
The usual approach is to take some unique information (serial number, licensee name and address, etc.), combine it with secret salt value(s) and hash and chop and mash and mix and boil and burn. When you finish you want to wind up with a nice registration code. You need to make up your own ledgerdemain. A good system will provide numbers that are hard to combine to recover the salt value. The secret salt must be stored in the file, so you'll probably want to hide it in your code somehow--do something like use the 8 bit xor sum of line 256 in your perl script rather than my $salt = 'SECRETSALT-WOOT'; .
Textfiles.org has some essays on cracking serial numbers, they may give you some ideas about how other systems work.
If you read the above sources, you'll see that even if you generate ultra-secure codes that cannot be guessed, someone can always decompile your software and reverse engineer your algorithms. If you want maximum achievable security, you'll have to write code that comes out obscured after it has been deparsed, or decompiled (or write obscured assembler). Of course this code can still be decontstructed by a dedicated cracker.
| [reply] |
Re: Serial Generation and Validation
by QM (Parson) on Oct 03, 2005 at 15:59 UTC
|
...these codes to be generated by and also validate with some sort of obscure algorithm.
As soon as someone gives you an obscure algorithm here, it's no longer obscure.
-QM
--
Quantum Mechanics: The dreams stuff is made of
| [reply] |
Re: Serial Generation and Validation
by Fletch (Bishop) on Oct 03, 2005 at 16:08 UTC
|
| [reply] |
Re: Serial Generation and Validation
by Ultra (Hermit) on Oct 03, 2005 at 17:30 UTC
|
First of all you should ask yourself why you want do this. And obviously answer that too ...
Too often people feel like protecting their work using serials and stuff like that just to realize they provide little or no protection at all. Consider what happens when someone manages to replicate you serial generation process (which will eventually happen as your application is more and more used by people), or more simply one of your clients puts his/her serial on the Net. ;-)
On the other hand you could issue PGP certificates signed with your secret key, and have your application check the certificate fingerprint for authenticity. Of course that doesn't stop anyone from distributing one of your certs ... but if you really want to do this there's nothing to stop you.
Keep in mind that your app is in the user's hands, so anyone with some time and knowledge can trick it into "thinking" any other certificate is the "right" one.
You might find The Case of Quake Cheats illuminating about what that means.
| [reply] |
Re: Serial Generation and Validation
by Moron (Curate) on Oct 04, 2005 at 11:04 UTC
|
Any relevant experience I have has been legally protected from disclosure (should be obvious why). However, I can give a few pointers:-
1) although random generation would be a headache (gets slower as it has to check more and more used codes), pseudo random generation can work because it covers each possibility once for a consecutive set of integers. But you want much larger primes than are used in the trivial linked example.
2) use a secret, obscure but consistent filter to remove the majority of generated codes and enable a validity test e.g. filter out anything that isn't a factor of a certain prime (not a suggestion -- too insecure -- but an indication of what such a filter is). The test should significantly reduce the candidate valid codes, so plenty of size is needed for each code to leave enough left over - 16 bytes is popular for codes which are matched against a validity list but more are needed for unmatched codes which rely on a validity algorithm, depending on the inclusion percentage of the filter you select, so that enough valid codes remain over a significant period of possible usage.
3) Two-way encryption is needed after that, because filtering after encryption is arguably too transparent and one-way encryption after filtering would prevent validity testing. GnuPG contains enough ammunition for this.
| [reply] |
Re: Serial Generation and Validation
by ErichTheRead (Initiate) on Oct 03, 2005 at 22:38 UTC
|
If you can GENERATE something, so can anybody else. Then there is no security.
There are some truely random (apparently) events in the universe. Milliseconds between butterfly wing flaps, number of photons out of a lightbulb per second, rolls of the dice, and such. If you had ENOUGH truly random numbers, then just use an exclusive-or for your encryption. Nothing is more secure, or easier, or EXPENSIVE. You also have to transfer the key beforehand. | [reply] |
Re: Serial Generation and Validation
by contradev (Monk) on Oct 04, 2005 at 20:43 UTC
|
I can't comment on "true" software serial creation/validation, but from a web point of view (where hopefully no one can see your validation code)then this is really quite easy and a fun exercise..
I have often created codes similar to the typical "enter your code to receive your free whatever" in carts and usually it is preferable to use lookup tables, but sometimes where these codes need to be unlimited and unique you have to resort to a bit of trickery - you know you're not going to fool someone with clue and a lot of spare time but you can make it hard for them.
As mentioned above, use a lot of false trails (data which you can ignore) and leave youself with a chunk of data you can apply a bit of basic maths to.
regrds
c
1 and sleep; | [reply] [d/l] |