public static function init($login, $password) { $_SESSION['user_password'] = $password; // save the password as passcode for the encryption if (OC_User::isLoggedIn()) { // does key exist? if (!file_exists(OC_Config::getValue("datadirectory") . '/' . $login . '/encryption.key')) { OC_Crypt::createkey($_SESSION['user_password']); } } }
public static function init($login, $password) { $view = new OC_FilesystemView('/' . $login); OC_FileProxy::$enabled = false; if (!$view->file_exists('/encryption.key')) { // does key exist? OC_Crypt::createkey($login, $password); } $key = $view->file_get_contents('/encryption.key'); OC_FileProxy::$enabled = true; $_SESSION['enckey'] = OC_Crypt::decrypt($key, $password); }