Registration Code

Ken Seehart pythonic at seehart.com
Mon Apr 3 15:42:27 EDT 2006


Math wrote:
> Hello,
> 
> I wonder if I can ask this particular question here...
> I'm writing this piece of Python Software and I'm almost done...:-)
> But now I want the end-user to register this software with a 
> registration code or perhaps something like an evaluation demo version 
> which expires after some period of time...
> Is this the right place to ask or does anybody know where to look for 
> more on the subject?
> 
> Thanks
> 

One thing I tried some time ago:

I encypted the bytecode of a few important functions with a key based on 
information required from the user.  Without the key, these functions 
can't be decrypted.  This is somewhat more secure than just testing the 
key with an "if" statement since the latter could easily be bypassed by 
a hacker.

To encrypt the function, I saved the bytecode of the target function to 
a file.  Then, in the version to be shipped, I substituted the encrypted 
version of bytecode for the original bytecode.  The rest of the program 
(including the part that asks for the authentication information) works 
fine.  If the authentication passes, the encrypted function(s) are 
decrypted.  Normally the encrypted functions are never executed of 
course (if authentication fails, the user is notified).  If a hacker 
bypasses the authentication test, the program will crash when the 
program attempts to executed the encypted bytecode.

How to determine the key depends on your application.  You may choose to 
include hardware serial numbers, for example.

- Ken




More information about the Python-list mailing list