Sunday 15 March 2015

php - fopen() path for private and public keys -



php - fopen() path for private and public keys -

my question in relation finding public , private key sets within file structure. quite incompetent concept, please bear me.

currently, open private , public key pairs, utilize next expression:

fopen(dirname(__file__) . '/rsa_private_key.pem', 'r');

dirname(__file__) directs /vagrant/opencart/upload/catalog/controller/payment, script gets executed resides. so, private/public key pair resides in same folder script opens it.

i doing file restructuring, , have created new folder under path : /vagrant/opencart/upload/keys, both private , public keys reside.

however, not quite sure how point fopen() it. since developing on local machine, could, say, utilize absolute path, on different servers, cannot utilize absolute path forever.

my question is, how point fopen() path: /vagrant/opencart/upload/keys?

the first thing should move private key outside of web server's document root. nature of term "private key" tells you not want able access these keys! putting them under web server's docroot exposes them unnecessarily - if set rules in place protect them (e.g., htaccess file), there's no reason set them in location - definition - intended accessible default.

depending on distribution you're going deploy on, there standard location deploying such; if not, encourage define own policy, such putting them under /etc/opencart/keys.

once know/define policy, have absolute path can use, solving original problem.

php fopen

No comments:

Post a Comment