diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-12-03 16:52:44 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-12-09 09:47:26 +0100 |
commit | efac8ced90879f34919eb55055423523b146d33e (patch) | |
tree | ee2778caa0a8ddf5c181a590625d98081e0c7d63 /apps/files_encryption/ajax | |
parent | 78a307995c510c0184d915fcab26baa3be815342 (diff) | |
download | nextcloud-server-efac8ced90879f34919eb55055423523b146d33e.tar.gz nextcloud-server-efac8ced90879f34919eb55055423523b146d33e.zip |
Update OCA\Encryption to OCA\Files_Encryption in the encryption app itself
Diffstat (limited to 'apps/files_encryption/ajax')
-rw-r--r-- | apps/files_encryption/ajax/adminrecovery.php | 7 | ||||
-rw-r--r-- | apps/files_encryption/ajax/changeRecoveryPassword.php | 14 | ||||
-rw-r--r-- | apps/files_encryption/ajax/getMigrationStatus.php | 3 | ||||
-rw-r--r-- | apps/files_encryption/ajax/updatePrivateKeyPassword.php | 16 | ||||
-rw-r--r-- | apps/files_encryption/ajax/userrecovery.php | 4 |
5 files changed, 20 insertions, 24 deletions
diff --git a/apps/files_encryption/ajax/adminrecovery.php b/apps/files_encryption/ajax/adminrecovery.php index 684fd51ae13..503c15b53a9 100644 --- a/apps/files_encryption/ajax/adminrecovery.php +++ b/apps/files_encryption/ajax/adminrecovery.php @@ -7,7 +7,8 @@ * * Script to handle admin settings for encrypted key recovery */ -use OCA\Encryption; + +use OCA\Files_Encryption\Helper; \OCP\JSON::checkAdminUser(); \OCP\JSON::checkAppEnabled('files_encryption'); @@ -42,7 +43,7 @@ $recoveryKeyId = \OC::$server->getAppConfig()->getValue('files_encryption', 'rec if (isset($_POST['adminEnableRecovery']) && $_POST['adminEnableRecovery'] === '1') { - $return = \OCA\Encryption\Helper::adminEnableRecovery($recoveryKeyId, $_POST['recoveryPassword']); + $return = Helper::adminEnableRecovery($recoveryKeyId, $_POST['recoveryPassword']); // Return success or failure if ($return) { @@ -56,7 +57,7 @@ if (isset($_POST['adminEnableRecovery']) && $_POST['adminEnableRecovery'] === '1 isset($_POST['adminEnableRecovery']) && '0' === $_POST['adminEnableRecovery'] ) { - $return = \OCA\Encryption\Helper::adminDisableRecovery($_POST['recoveryPassword']); + $return = Helper::adminDisableRecovery($_POST['recoveryPassword']); if ($return) { $successMessage = $l->t('Recovery key successfully disabled'); diff --git a/apps/files_encryption/ajax/changeRecoveryPassword.php b/apps/files_encryption/ajax/changeRecoveryPassword.php index 01b76a969b6..3d31b12af7c 100644 --- a/apps/files_encryption/ajax/changeRecoveryPassword.php +++ b/apps/files_encryption/ajax/changeRecoveryPassword.php @@ -9,8 +9,6 @@ * */ -use OCA\Encryption; - \OCP\JSON::checkAdminUser(); \OCP\JSON::checkAppEnabled('files_encryption'); \OCP\JSON::callCheck(); @@ -49,21 +47,21 @@ if ($_POST['newPassword'] !== $_POST['confirmPassword']) { } $view = new \OC\Files\View('/'); -$util = new \OCA\Encryption\Util(new \OC\Files\View('/'), \OCP\User::getUser()); +$util = new \OCA\Files_Encryption\Util(new \OC\Files\View('/'), \OCP\User::getUser()); $proxyStatus = \OC_FileProxy::$enabled; \OC_FileProxy::$enabled = false; $keyId = $util->getRecoveryKeyId(); -$encryptedRecoveryKey = Encryption\Keymanager::getPrivateSystemKey($keyId); -$decryptedRecoveryKey = $encryptedRecoveryKey ? \OCA\Encryption\Crypt::decryptPrivateKey($encryptedRecoveryKey, $oldPassword) : false; +$encryptedRecoveryKey = \OCA\Files_Encryption\Keymanager::getPrivateSystemKey($keyId); +$decryptedRecoveryKey = $encryptedRecoveryKey ? \OCA\Files_Encryption\Crypt::decryptPrivateKey($encryptedRecoveryKey, $oldPassword) : false; if ($decryptedRecoveryKey) { - $cipher = \OCA\Encryption\Helper::getCipher(); - $encryptedKey = \OCA\Encryption\Crypt::symmetricEncryptFileContent($decryptedRecoveryKey, $newPassword, $cipher); + $cipher = \OCA\Files_Encryption\Helper::getCipher(); + $encryptedKey = \OCA\Files_Encryption\Crypt::symmetricEncryptFileContent($decryptedRecoveryKey, $newPassword, $cipher); if ($encryptedKey) { - \OCA\Encryption\Keymanager::setPrivateSystemKey($encryptedKey, $keyId); + \OCA\Files_Encryption\Keymanager::setPrivateSystemKey($encryptedKey, $keyId); $return = true; } } diff --git a/apps/files_encryption/ajax/getMigrationStatus.php b/apps/files_encryption/ajax/getMigrationStatus.php index adceb949044..bb260199b19 100644 --- a/apps/files_encryption/ajax/getMigrationStatus.php +++ b/apps/files_encryption/ajax/getMigrationStatus.php @@ -6,7 +6,8 @@ * * check migration status */ -use OCA\Encryption\Util; + +use OCA\Files_Encryption\Util; \OCP\JSON::checkAppEnabled('files_encryption'); diff --git a/apps/files_encryption/ajax/updatePrivateKeyPassword.php b/apps/files_encryption/ajax/updatePrivateKeyPassword.php index 97da3811a0f..7161b0cff92 100644 --- a/apps/files_encryption/ajax/updatePrivateKeyPassword.php +++ b/apps/files_encryption/ajax/updatePrivateKeyPassword.php @@ -9,8 +9,6 @@ * */ -use OCA\Encryption; - \OCP\JSON::checkLoggedIn(); \OCP\JSON::checkAppEnabled('files_encryption'); \OCP\JSON::callCheck(); @@ -24,7 +22,7 @@ $oldPassword = $_POST['oldPassword']; $newPassword = $_POST['newPassword']; $view = new \OC\Files\View('/'); -$session = new \OCA\Encryption\Session($view); +$session = new \OCA\Files_Encryption\Session($view); $user = \OCP\User::getUser(); $loginName = \OC::$server->getUserSession()->getLoginName(); @@ -36,14 +34,14 @@ if ($passwordCorrect !== false) { $proxyStatus = \OC_FileProxy::$enabled; \OC_FileProxy::$enabled = false; -$encryptedKey = Encryption\Keymanager::getPrivateKey($view, $user); -$decryptedKey = $encryptedKey ? \OCA\Encryption\Crypt::decryptPrivateKey($encryptedKey, $oldPassword) : false; +$encryptedKey = \OCA\Files_Encryption\Keymanager::getPrivateKey($view, $user); +$decryptedKey = $encryptedKey ? \OCA\Files_Encryption\Crypt::decryptPrivateKey($encryptedKey, $oldPassword) : false; if ($decryptedKey) { - $cipher = \OCA\Encryption\Helper::getCipher(); - $encryptedKey = \OCA\Encryption\Crypt::symmetricEncryptFileContent($decryptedKey, $newPassword, $cipher); + $cipher = \OCA\Files_Encryption\Helper::getCipher(); + $encryptedKey = \OCA\Files_Encryption\Crypt::symmetricEncryptFileContent($decryptedKey, $newPassword, $cipher); if ($encryptedKey) { - \OCA\Encryption\Keymanager::setPrivateKey($encryptedKey, $user); + \OCA\Files_Encryption\Keymanager::setPrivateKey($encryptedKey, $user); $session->setPrivateKey($decryptedKey); $return = true; } @@ -61,7 +59,7 @@ if ($decryptedKey) { // success or failure if ($return) { - $session->setInitialized(\OCA\Encryption\Session::INIT_SUCCESSFUL); + $session->setInitialized(\OCA\Files_Encryption\Session::INIT_SUCCESSFUL); \OCP\JSON::success(array('data' => array('message' => $l->t('Private key password successfully updated.')))); } else { \OCP\JSON::error(array('data' => array('message' => $errorMessage))); diff --git a/apps/files_encryption/ajax/userrecovery.php b/apps/files_encryption/ajax/userrecovery.php index a5b89fa7233..e49fee83a36 100644 --- a/apps/files_encryption/ajax/userrecovery.php +++ b/apps/files_encryption/ajax/userrecovery.php @@ -7,8 +7,6 @@ * Script to handle admin settings for encrypted key recovery */ -use OCA\Encryption; - \OCP\JSON::checkLoggedIn(); \OCP\JSON::checkAppEnabled('files_encryption'); \OCP\JSON::callCheck(); @@ -22,7 +20,7 @@ if ( $userId = \OCP\USER::getUser(); $view = new \OC\Files\View('/'); - $util = new \OCA\Encryption\Util($view, $userId); + $util = new \OCA\Files_Encryption\Util($view, $userId); // Save recovery preference to DB $return = $util->setRecoveryForUser($_POST['userEnableRecovery']); |