From a90606fb14adc0aa149a87528d4f1ce61d0250e9 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 14 Nov 2014 17:30:38 +0100 Subject: change private/public key names for consistency reasons --- apps/files_encryption/hooks/hooks.php | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'apps/files_encryption/hooks/hooks.php') diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index 1413a0580a1..e9d0235d167 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -152,18 +152,7 @@ class Hooks { public static function postDeleteUser($params) { if (\OCP\App::isEnabled('files_encryption')) { - $view = new \OC\Files\View('/'); - - // cleanup public key - $publicKey = '/public-keys/' . $params['uid'] . '.public.key'; - - // Disable encryption proxy to prevent recursive calls - $proxyStatus = \OC_FileProxy::$enabled; - \OC_FileProxy::$enabled = false; - - $view->unlink($publicKey); - - \OC_FileProxy::$enabled = $proxyStatus; + Keymanager::deletePublicKey(new \OC\Files\View(), $params['uid']); } } @@ -244,7 +233,7 @@ class Hooks { \OC_FileProxy::$enabled = false; // Save public key - $view->file_put_contents('/public-keys/' . $user . '.public.key', $keypair['publicKey']); + Keymanager::setPublicKey($keypair['publicKey'], $user); // Encrypt private key with new password $encryptedKey = \OCA\Encryption\Crypt::symmetricEncryptFileContent($keypair['privateKey'], $newUserPassword, Helper::getCipher()); @@ -292,7 +281,7 @@ class Hooks { $l = new \OC_L10N('files_encryption'); $users = array(); - $view = new \OC\Files\View('/public-keys/'); + $view = new \OC\Files\View('/'); switch ($params['shareType']) { case \OCP\Share::SHARE_TYPE_USER: @@ -305,7 +294,7 @@ class Hooks { $notConfigured = array(); foreach ($users as $user) { - if (!$view->file_exists($user . '.public.key')) { + if (!Keymanager::publicKeyExists($view, $user)) { $notConfigured[] = $user; } } -- cgit v1.2.3