aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/hooks/hooks.php
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-11-14 17:30:38 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2014-11-26 10:57:47 +0100
commita90606fb14adc0aa149a87528d4f1ce61d0250e9 (patch)
tree314b9edadf1e00211a65578c6f913eb23ab8b44d /apps/files_encryption/hooks/hooks.php
parent266f1a2afa890a7e2750a51fa3d6da98240751fe (diff)
downloadnextcloud-server-a90606fb14adc0aa149a87528d4f1ce61d0250e9.tar.gz
nextcloud-server-a90606fb14adc0aa149a87528d4f1ce61d0250e9.zip
change private/public key names for consistency reasons
Diffstat (limited to 'apps/files_encryption/hooks/hooks.php')
-rw-r--r--apps/files_encryption/hooks/hooks.php19
1 files changed, 4 insertions, 15 deletions
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;
}
}