copy protection

Andrew Kuchling akuchlin at mems-exchange.org
Tue Oct 17 15:25:55 EDT 2000


"Max M. Stalnaker" <stalnaker at acm.org> writes:
> If I were doing this, I would produce a binary python with these features,
> which I believe is allowed by the license.  Aside from the unique
> application number, it would optionally encrypt the pyc with a special
> language key that is kept secret.  In the present product, there is a

Zope did something similar, back in the days before the code was
released.  Products could be shipped as encrypted .pyc files; see
lib/python/App/Extensions.py in the Zope code, where it does:

    elif p[-4:]=='.pyp':
        prod_id=split(module, '.')[0]
        data=zlib.decompress(
            rotor.newrotor(prod_id +' shshsh').decrypt(open(p,'rb').read())
            )
        execsrc=compile(data, module, 'exec')
        m={}
        exec execsrc in m

That code probably isn't directly applicable to your situation.
Instead, you would probably write an import hook using imphooks.py
that automatically decrypts .pyp files with some key, the key being
derived down in C code so it's a bit more difficult to reverse
engineer it, and uses something a bit stronger than the rotor module.

--amk




More information about the Python-list mailing list