aditya1977 has asked for the wisdom of the Perl Monks concerning the following question:

So I'm writing a Perl script and I need to protect the source and also not allow the script to run on any other Linux machine but the one it was intended for. So the idea I came up with was to encode the perl script with perlc. Details here: http://marginalhacks.com/Hacks/perlc/ Also I would generate an xml file which contains license details and some uniquely identifying piece of information regarding the machine. (maybe UUID) The file would be encrypted using gpg and would be decrypted by the script. I would therefore need to include the private key within the script. I was looking at using Crypt:GPG to do this. Firstly is there a way of storing a private key with a script and have Crypt:GPG decrypt a file using it? Secondly is this a crazy idea and is there a better way to obfuscate code and allow it to only run on one machine?
  • Comment on Trying to make a license system / copy protection system

Replies are listed 'Best First'.
Re: Trying to make a license system / copy protection system
by soonix (Chancellor) on Jun 16, 2014 at 17:19 UTC
    Firstly is there a way of storing a private key with a script and have Crypt:GPG decrypt a file using it?

    There is no need to store the private key. You use it to "generate" (encrypt or sign) your "license key". For decrypting/verifying the public key is used, which you can store more or less "open" in your program, because it is, so to say, "public".

    (Of course, not too open, otherwise it would be easy to defeat)

Re: Trying to make a license system / copy protection system
by rurban (Scribe) on Jun 16, 2014 at 14:02 UTC
    I would prefer perlcc. The comment in the linked page about perlcc is absolutely wrong.

      If this is the case should these docs be updated to remove:

      "The code generated in this way is not guaranteed to work. The whole codegen suite (perlcc included) should be considered very experimental. Use for production purposes is strongly discouraged."

      perlcc.PL

        That's a standard disclaimer. I would most definitely try it.