1

I have create one application in cakePHP for 1 client.

Now I want to encrypt that code because I don't want client to distribute the code for others.

But which file I should encrypt because cakePHP is open source any file which I will encrypt client can find easily on net.

In short I want to do license of my cakePHP application.

Currently I am encoding only my inherited Controller app class.

Please let me know any one have idea about this.

Toto
  • 89,455
  • 62
  • 89
  • 125
PHP Connect
  • 539
  • 2
  • 7
  • 24
  • 3
    So? The client may be able to get the source to part of the application elsewhere. What's the problem? You can still encrypt the whole thing for simplicity. – deceze Feb 08 '12 at 07:40

4 Answers4

4

If you are really concerned about people stealing your source code, consider using Zend Guard or something similar.

http://www.zend.com/en/products/guard/

Barry Chapman
  • 6,690
  • 3
  • 36
  • 64
  • i think you not understand my question. Encryption software is not the problem. Generally we don't encrypt complete code we encrypt only 1 file. but cakePHP is open source it's easy to get encrypted file code. – PHP Connect Feb 08 '12 at 09:04
  • Why don't you clarify what you are trying to accomplish, and it will yield more valuable answers – Barry Chapman Feb 08 '12 at 09:06
  • 1
    You could do a hybrid of this. Create a core file that renders the application unusable outside of any other URL than the one that your client supplies to you. Encrypt this file using Zend and you are set. This way, if it were given to another person and they tried to use it, unless the URL matched, it wouldn't work – Barry Chapman Feb 08 '12 at 09:31
1

First of all, you are using open source code and, I would like to think you are paid to create your client's app, what is the problem with supplying them the source code they PAID for.

Secondly, I haven't personally heard of any encrypted php code that have not been broken. So if your client really wants to steal the code they PAID for, they can have it fixed.

Before deciding to learn CakePHP and develop my own application, I purchased a copy of PHPCOW and the most aggravating thing with that was that all their source code was ENCRYPTED and I did not know if beforehand. I could not improve on anything because of it. They pushed me to learn CakePHP and because of that, I thank them.

I have spent countless hours developing my application, which have NEWS, PHOTOS, VIDEOS, USERS, ACL, AUTH, etc and when I am done I will be glad to share it with everyone. Because I have used alot of help from the CakePHP community, including advice, plugins, and the core code.

I truly believe that all code developed on top of CakePHP's core needs not be ENCRYPTED.

How about if CakePHP or any other frameworks out there decided to encrypt their code.

AKKAweb
  • 3,795
  • 4
  • 33
  • 64
0

We developed Point of Sale Billing Software on CakePHP and had same question when we wanted to distribute it to clients. Tried with http://www.sourcecop.com/ Sourcecop 3.0 and it's the perfect solution if you want to license your PHP applications. Zend Guard is another such application worth trying.

Shreedhar Bhat
  • 241
  • 2
  • 3
0

I think what you need to do is to allow the user to specify a salt or passphrase. Then use the user-specified passphrase to encrypt and decrypt the contents of a file.

<?
// To save the file
$string = "content you want to encrypt";
$key = "user specified key";
$encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key))));
file_put_contents("secure_file", $encrypted);
?>

and to get the encrypted file, use this:

<?
$key = "user specified key";
$encrypted = file_get_contents("secure_file");
$decrypted = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($encrypted), MCRYPT_MODE_CBC, md5(md5($key))), "\0");
?>

Reference: Best way to use PHP to encrypt and decrypt passwords? for the encryption/decryption code.

Community
  • 1
  • 1
Suman
  • 9,221
  • 5
  • 49
  • 62