function initKeys()
{
if(
- file_exists("{$d}/pub.key") ||
- file_exists("{$d}/pri.key")
+ file_exists("{$this->dir}/pub.key") ||
+ file_exists("{$this->dir}/pri.key")
){
return;
}
return;
}
- //$ff->pman['storedir']/key generic for all projects?
-
- $this->setStoreDir($dir);
+ $d = HTML_FlexyFramework::get()->Pman['storedir'].'/key';
+ if(!file_exists($d)) {
+ $oldumask = umask(0);
+ mkdir($d, 0775, true);
+ umask($oldumask);
+ }
+ $this->dir = $d;
$this->initKeys();
function encrypt($v)
{
- $pub_key = file_get_contents("{$this->storedir}/pub.key");
+ $pub_key = file_get_contents("{$this->dir}/pub.key");
if(!$pub_key) {
return;
}
openssl_public_encrypt($v, $cipher, $pub_key);
return $cipher;
}
-
- function setStoreDir($dir)
- {
- if(!file_exists($dir)) {
- $oldumask = umask(0);
- mkdir($dir, 0775, true);
- umask($oldumask);
- }
- $this->storedir = $dir;
- }
}