note 88629 deleted from function.openssl-pkey-get-public by danbrown
| From: | danbrown@php.net | Date: | Sun, 01 Feb 2009 20:10:06 +0000 |
| Subject: | note 88629 deleted from function.openssl-pkey-get-public by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-150074@lists.php.net to get a copy of this message | ||
Note Submitter: jrgray SPLAT gmail DOT com
----
nice! thanks so much, this was exactly what I was looking for, saved me much aggravation.
the only tweaks I would make are to keep the keys outside of the documentroot path (e.g., on centos
5 I use /usr/local/etc/apache/), and to store the passphrase in another file (in case your php
script gets exposed).
$dir = '/usr/local/etc/apache/';
$passphrase = file_get_contents($dir."passphrase");
$passphrase=chop($passphrase);
$key_private = openssl_get_privatekey(file_get_contents($dir.'private.pem'), $passphrase);
$key_public = openssl_get_publickey(file_get_contents($dir.'public.pem'));
...