views:

365

answers:

2

Hi world,

I'm going to integrate a license key generator in my web site, in the way that It can automatically generate license keys when occurs a paypal notification (IPN)... but my question is: what is the best way to protect the php file (that contains the method used to generate the key) and the private (a .pem file)?

Thanks in advance!

A: 

I was not 100% clear what you were asking, but here goes...

You can generate your own a unique key and pass it over to paypal when the order is placed, such that paypal IPN will return the key to you. You can use this to verify that the IPN message is a legitimate one.

rikh
I'm sorry! I've reformulated my question!
This is a very good idea! Thanks!
+1  A: 

It sounds like to what to protect the source of the php file itself. It sounds like you want some obfuscation and precompiling. There are a number of tools out there that will compile your php files into binary. Not machine code, but a byte code of sorts. There are others that will just obfuscate the source code.

These are both just "security by obscurity" though. If you are not distributing the source of the program, users should not be looking at these files anywho.

Perhaps your question was how to keep users from downloading the php/pem file? You would do that the same way you protect all your config files with passwords and what not in them. Either by telling the web server to NOT allow them to be served, or by placing them in a directory outside of where the web server hosts.

shimpossible
Thank you! Yes, I didn't know if paypal server can receive the post back of the ipn notification even if a protect the directory that contains the php files used to receive the notification and to generate the license!So, you think that if I place in that directory an .htaccess withorder allow,denydeny from allI've made a good level of protection?
if you do not allow access to the file, then no one can access it, including paypal. What do you want to 'protect' the file from? People reading the source/downloading the file? People faking a paypal notification?
shimpossible