.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "decrypt 3pm" .TH decrypt 3pm "2019-02-10" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Filter::decrypt \- template for a decrypt source filter .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Filter::decrypt ; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is a sample decrypting source filter. .PP Although this is a fully functional source filter and it does implement a \fIvery\fR simple decrypt algorithm, it is \fInot\fR intended to be used as it is supplied. Consider it to be a template which you can combine with a proper decryption algorithm to develop your own decryption filter. .SH "WARNING" .IX Header "WARNING" It is important to note that a decryption filter can \fInever\fR provide complete security against attack. At some point the parser within Perl needs to be able to scan the original decrypted source. That means that at some stage fragments of the source will exist in a memory buffer. .PP Also, with the introduction of the Perl Compiler backend modules, and the B::Deparse module in particular, using a Source Filter to hide source code is becoming an increasingly futile exercise. .PP The best you can hope to achieve by decrypting your Perl source using a source filter is to make it unavailable to the casual user. .PP Given that proviso, there are a number of things you can do to make life more difficult for the prospective cracker. .IP "1." 5 Strip the Perl binary to remove all symbols. .IP "2." 5 Build the decrypt extension using static linking. If the extension is provided as a dynamic module, there is nothing to stop someone from linking it at run time with a modified Perl binary. .IP "3." 5 Do not build Perl with \f(CW\*(C`\-DDEBUGGING\*(C'\fR. If you do then your source can be retrieved with the \f(CW\*(C`\-DP\*(C'\fR command line option. .Sp The sample filter contains logic to detect the \f(CW\*(C`DEBUGGING\*(C'\fR option. .IP "4." 5 Do not build Perl with C debugging support enabled. .IP "5." 5 Do not implement the decryption filter as a sub-process (like the cpp source filter). It is possible to peek into the pipe that connects to the sub-process. .IP "6." 5 Check that the Perl Compiler isn't being used. .Sp There is code in the \s-1BOOT:\s0 section of decrypt.xs that shows how to detect the presence of the Compiler. Make sure you include it in your module. .Sp Assuming you haven't taken any steps to spot when the compiler is in use and you have an encrypted Perl script called \*(L"myscript.pl\*(R", you can get access the source code inside it using the perl Compiler backend, like this .Sp .Vb 1 \& perl \-MO=Deparse myscript.pl .Ve .Sp Note that even if you have included the \s-1BOOT:\s0 test, it is still possible to use the Deparse module to get the source code for individual subroutines. .IP "7." 5 Do not use the decrypt filter as-is. The algorithm used in this filter has been purposefully left simple. .PP If you feel that the source filtering mechanism is not secure enough you could try using the unexec/undump method. See the Perl \s-1FAQ\s0 for further details. .SH "EXAMPLES" .IX Header "EXAMPLES" See /usr/share/doc/libfilter\-perl/examples/decrypt/ for examples of encryption and decryption scripts using this filter. .SH "AUTHOR" .IX Header "AUTHOR" Paul Marquess .SH "DATE" .IX Header "DATE" 19th December 1995