A PAR file is a Zip file. The executable created by pp is a self-extracting Zip file with an auto-run feature.

In theory (I haven't tested this), you could create a PAR with pp, unzip it to a temporary location, then re-zip it with a password. Make sure the new Zip file has the extension .par

Then do: pp -o myprog myscript.par

If that works the way I think it does, pp will do something like cat extractor myscript.par >myprog

(On MS Windows, it would be something like copy /b extractor.exe+myscript.par myprog.exe)

Assuming that works AND the extractor supports encrypted Zip files, running myprog will ask for the password needed to decrypt myscript.par then extract and run normally.

If that doesn't work, you can use 7zip to create encrypted, self extracting archives. I don't recall the details, but there are options to specify the extractor to use (you want the "installer extractor") and the command you want the extractor to run. You will need to unzip your PAR file before creating the self-extracting archive, otherwise it will be the PAR file that gets extracted and not the files inside it.

(Note: The "installer extractor" doesn't actually install anything. It expects the command you tell it to run to do the actual installing. In your case, the command will be to run your program. After your program exits, the extractor will delete the files it created during the extraction phase.)


In reply to Re: Encrypting source code :( by RonW
in thread Encrypting source code :( by bliako

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.