I have a client whom has a document full of javascript that they would like to encrypt. My idea is that I can create an php upload form for the unencrypted document and then it processes and gives the client back the encrypted document. Would it be possible to salt the code so that it will still work but not be able to be undone?
Share
No.
Essentially if your code is working it is being interpreted by the browser (and can be seen… at least partially).
You’re best bet is to obfuscate your code.
On a side note, you could try what Jake said and simply redirect all *.js request to a php page (using .htaccess) which:
1. fopen’s the file,
2. Reads it into a string,
3. encodes the string,
4. and then returns that.
Although that requires the client to have the key with which you encrypted the string. And once someone decrypts that js (to run it), they can steal it…