Search code examples
perlencryptionperl-modulecrypt

Encrypted perl scripts by Filter::Crypto (crypt_file) usage on other machines


I'm trying to use Filter::Crypto module, but I'm little bit struggling with it. I would like to encrypt a script

crypt_file script.pl > encrypted_script.pl

and then use that encrypted script on another machine.

When I use

pp -f Crypto -M Filter::Crypto::Decrypt -o encrypted_script encrypted_script.pl

created binary works fine - it contains key for decryption. But I want to use just the encrypted_script.pl file. I would like to provide fully functional encrypted perl script, which nobody would be able to decrypt (easily). Is it even possible?


Solution

  • You're talking about digital rights management, although you may not know it.

    Encrypting something so it's really hard to read is relatively easy. Doing so at the same time as allowing someone to read it, but only when you say so is really difficult. (as in, basically impossible without control over the target infrastructure, at which point it's largely academic anyway)

    That goes double when you're trying to use an interpreted language like perl, because obfuscation tricks have to be de-obfuscated before you can run them.

    The module explains some of this, and has some mechanisms to make it slightly harder, but at a pretty fundamental level - it's impossible to do exhaustively.