function initKeys()
{
- $d = HTML_FlexyFramework::get()->Pman['storedir'].'/key';
+ $dir = $this->keyDir();
if(
- file_exists("{$d}/pub.key") ||
- file_exists("{$d}/pri.key")
+ file_exists("{$dir}/pub.key") ||
+ file_exists("{$dir}/pri.key")
){
return;
}
$pub_key = openssl_pkey_get_details($ssl);
$pub_key = $pub_key["key"];
- file_put_contents("{$d}/pub.key",$pub_key);
- file_put_contents("{$d}/pri.key",$pri_key);
+ file_put_contents("{$dir}/pub.key",$pub_key);
+ file_put_contents("{$dir}/pri.key",$pri_key);
}
function getSetting($m,$n)
return;
}
+ function keyDir()
+ {
+ $d = HTML_FlexyFramework::get()->Pman['storedir'].'/key';
+ if(!file_exists($d)) {
+ $oldumask = umask(0);
+ mkdir($d, 0775, true);
+ umask($oldumask);
+ }
+ return $d;
+ }
+
+
function initSetting($a)
{
if(empty($a)) {
if($c) {
return;
}
-
- $d = HTML_FlexyFramework::get()->Pman['storedir'].'/key';
-
- if(!file_exists($d)) {
- $oldumask = umask(0);
- mkdir($d, 0775, true);
- umask($oldumask);
- }
- $this->storedir = $d;
+
$this->initKeys();
function encrypt($v)
{
- $pub_key = file_get_contents("{$this->storedir}/pub.key");
+ $pub_key = file_get_contents("{$this->keyDir()}/pub.key");
if(!$pub_key) {
return;
}