++ed by:
Alessandro Ranellucci

NAME

Module::Crypt - Encrypt your Perl code and compile it into XS

SYNOPSIS

 use Module::Crypt;
 
 # for a single file:
 CryptModule(
    file         => 'Bar.pm',
    install_base => '/path/to/my/lib',
    password     => 'Password',
 );
 
 # for multiple files:
 CryptModule(
    files        => ['Foo.pm', 'Bar.pm'],
    install_base => '/path/to/my/lib',
    allow_debug  => 1,
 );
 
 # for a directory:
 CryptModule(
    files        => '/path/to/source/dir',
    install_base => '/path/to/my/lib',
    addl_code    => q{croak "Whoa!" if $SomethingIsWrong},
 );

ABSTRACT

Module::Crypt encrypts your pure-Perl modules and then compiles them into a XS module. It lets you distribute binary versions without disclosing code, although please note that we should better call this an obfuscation, as Perl is still internally working with your original code. While this isn't 100% safe, it makes code retrival much harder than any other known Perl obfuscation method.

Besides code encryption, there are some additional measures for code protection, such as avoiding debugger usage. However it does not mean that your code is impossible to be seen and tackled with; the whole purpose of this module is to make would-be cracker's life *a little bit* harder. You can think of Module::Crypt as an analog to car alarm: its purpose is not in making a car unstealable but rather in keeping car thief occupied long enough that he or she drops the idea and walks away.

Having said that, please keep in mind that nothing will keep a determined person from cracking any defense. We can only hope that with Module::Crypt it will take a seasoned Perl wizard to do this, not ordinary Joe Wannabe Cracker.

PUBLIC FUNCTIONS

CryptModule

This function does the actual encryption and compilation. It is supposed to be called from a Makefile-like script that you'll create inside your development directory. The 4 lines you see in each of the examples above are sufficient to build (and rebuild) the modules.

file

This contains the path of your source module. It can be a relative filename too, if you're launching your CryptModule() from the same directory.

files

If you want to encrypt and compile multiple modules, you can pass an arrayref to the files parameter with the paths/filenames listed. If you pass a string instead of of an arrayref, it will be interpreted as a directory path so that Module::Crypt will scan it and automatically add any .pm file to the modules list.

install_base

(Optional) This parameter contains the destination of the compiled modules. If not specified, it defaults to a directory named "output" inside the current working directory.

password

(Optional) This parameter allows you to specify a password to be used when encoding module code with ARC4 algorithm.

allow_debug

(Optional) Set this option to true value to allow the module startup code to run under debugger. By default it will shut down in XS bootstrap phase if debugger flag is detected.

Note that this feature does not mean that your Perl code is absolutely safe from being seen.

addl_code

(Optional) Pass any arbitrary Perl code (as string) in this parameter to be eval'ed *before* the main code is unencrypted. Additional code may contain sanity checks, environment control measures or whatever you may come up with.

Any die's/croak's in that code are translated above -- i.e. use 'Your::Module' will die with eval error if additional code fails. This means that you should be pretty sure that additional code actually works and there are no compiler errors in it.

BUGS

None known yet.

AVAILABILITY

Latest versions can be downloaded from CPAN. You are very welcome to write mail to the author (aar@cpan.org) with your contributions, comments, suggestions, bug reports or complaints.

AUTHOR

Alessandro Ranellucci <aar@cpan.org> Code refactoring and feature additions by Alexander Tokarev <tokarev@cpan.org>

COPYRIGHT AND LICENSE

Copyright (c) Alessandro Ranellucci. Module::Crypt is free software, you may redistribute it and/or modify it under the same terms as Perl itself.

DISCLAIMER

This is highly experimental code. Use it AT YOUR OWN RISK. This software is provided by the copyright holders and contributors ``as is'' and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the regents or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.




Hosting generously
sponsored by Bytemark