.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.47)
.\"
.\" 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
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    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
.\"
.\" Required to disable full justification in groff 1.23.0.
.if n .ds AD l
.\" ========================================================================
.\"
.IX Title "decrypt 3"
.TH decrypt 3 2026-01-17 "perl v5.42.0" "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\*(Aqt being used.
.Sp
There is code in the BOOT: 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\*(Aqt taken any steps to spot when the compiler is in
use and you have an encrypted Perl script called "myscript.pl", 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 BOOT: 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 FAQ for
further details.
.SH AUTHOR
.IX Header "AUTHOR"
Paul Marquess
.SH DATE
.IX Header "DATE"
19th December 1995
