|
NAMEPAR::Filter::Crypto - Encrypt Perl files in PAR archivesSYNOPSIS# Create a PAR archive containing an encrypted Perl script: $ pp -f Crypto -M Filter::Crypto::Decrypt -o hello hello.pl # The same, but with included modules encrypted as well: $ pp -f Crypto -F Crypto -M Filter::Crypto::Decrypt -o hello hello.pl # Encrypt Perl source code in $code: use PAR::Filter::Crypto; PAR::Filter::Crypto->apply(\$code); DESCRIPTIONThis module is a PAR::Filter sub-class for producing PAR archives containing encrypted Perl files. The PAR::Filter class itself is part of the PAR distribution, and is clearly a prerequisite for using this sub-class.The usual means of producing a PAR archive is using the pp script, which also comes with the PAR distribution. That script's -f and -F command-line options can be used to specify a "filter" through which to pass the Perl files being put into the PAR archive. Specifying this sub-class as the filter (i.e. "-f Crypto" for scripts and/or "-F Crypto" for modules) means that the Perl files will be encrypted using the Filter::Crypto::CryptFile module. The resulting encrypted files are what will be placed in the PAR archive. Note that the encrypted script requires the Filter::Crypto::Decrypt module in order to decrypt itself when it is run. The original Perl script will not have specified any such dependency, so pp will not automatically include that module in the PAR archive for you. Therefore, you must use the -M option to force that module to be included. Also note that if you use the -F option to encrypt modules as well then the filtering will automatically skip the Filter::Crypto::Decrypt module itself for obvious reasons. A typical pp invocation is thus something like: $ pp -f Crypto -F Crypto -M Filter::Crypto::Decrypt -o hello hello.pl (Version 0.75 of the Module::ScanDeps module, used by pp to scan for dependencies that need including in the PAR archive, is known to have problems finding shared library files for modules specified by pp's -M option (as illustrated above). If you find that the shared library file for Filter::Crypto::Decrypt is missing from your PAR archive then you need to upgrade Module::ScanDeps to version 0.76 or higher.) Of course, you must not include the Filter::Crypto::CryptFile module as well, otherwise people to whom you distribute your PAR archive will have the means to easily decrypt the encrypted Perl script within it! Also, note that the script is encrypted by reading its entire contents into memory, encrypting it in memory, and then writing it out to disk. This should be safe for most purposes given that Perl scripts are typically not very large, but other methods should be considered instead if this is likely to cause out-of-memory errors due to the size of the scripts, e.g. if the scripts have very large "__DATA__" sections. Methods
DIAGNOSTICSWarnings and Error MessagesThis module may produce the following diagnostic messages. They are classified as follows (a la perldiag):(W) A warning (optional). (F) A fatal error (trappable). (I) An internal error that you should never see (trappable).
EXPORTSNone.KNOWN BUGSNone.SEE ALSOPAR::Filter;Filter::Crypto. ACKNOWLEDGEMENTSThe "apply()" method is based on that in the PAR::Filter::Bytecode module in the PAR::Packer distribution (version 1.017), written by Audrey Tang.AUTHORSteve Hay <shay@cpan.org <mailto:shay@cpan.org>>.COPYRIGHTCopyright (C) 2004-2008, 2012, 2014 Steve Hay. All rights reserved.LICENCEThis module is free software; you can redistribute it and/or modify it under the same terms as Perl itself, i.e. under the terms of either the GNU General Public License or the Artistic License, as specified in the LICENCE file.VERSIONVersion 2.09DATE08 Dec 2020HISTORYSee the Changes file.
Visit the GSP FreeBSD Man Page Interface. |