]> source.dussan.org Git - nextcloud-server.git/commitdiff
Removing left overs from old encryption app
authorThomas Müller <thomas.mueller@tmit.eu>
Tue, 31 Mar 2015 09:50:53 +0000 (11:50 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Tue, 7 Apr 2015 11:30:29 +0000 (13:30 +0200)
13 files changed:
apps/files/index.php
apps/files/js/files.js
apps/files/templates/index.php
lib/private/connector/sabre/file.php
lib/private/util.php
lib/public/util.php
settings/ajax/decryptall.php [deleted file]
settings/ajax/deletekeys.php [deleted file]
settings/ajax/restorekeys.php [deleted file]
settings/js/personal.js
settings/personal.php
settings/routes.php
settings/templates/personal.php

index 3f93285902935ec0dd5a50cf5ab8adc43b4c0c76..23830da695db5726d97b7d5b6f01bc874a30026b 100644 (file)
@@ -142,7 +142,6 @@ OCP\Util::addscript('files', 'keyboardshortcuts');
 $tmpl = new OCP\Template('files', 'index', 'user');
 $tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']);
 $tmpl->assign('isPublic', false);
-$tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles());
 $tmpl->assign("mailNotificationEnabled", $config->getAppValue('core', 'shareapi_allow_mail_notification', 'no'));
 $tmpl->assign("mailPublicNotificationEnabled", $config->getAppValue('core', 'shareapi_allow_public_notification', 'no'));
 $tmpl->assign("allowShareWithLink", $config->getAppValue('core', 'shareapi_allow_links', 'yes'));
index e63c3cad52eef7cd47b2c98919d8c068c142f2e4..9d2d563984e8f5b3a0c29d9ee0ddef1d4a38017d 100644 (file)
                                return;
                        }
 
-                       var encryptedFiles = $('#encryptedFiles').val();
                        var initStatus = $('#encryptionInitStatus').val();
                        if (initStatus === '0') { // enc not initialized, but should be
                                OC.Notification.show(t('files', 'Encryption App is enabled but your keys are not initialized, please log-out and log-in again'));
                        }
                        if (initStatus === '1') { // encryption tried to init but failed
                                OC.Notification.show(t('files', 'Invalid private key for Encryption App. Please update your private key password in your personal settings to recover access to your encrypted files.'));
-                               return;
-                       }
-                       if (encryptedFiles === '1') {
-                               OC.Notification.show(t('files', 'Encryption was disabled but your files are still encrypted. Please go to your personal settings to decrypt your files.'));
-                               return;
                        }
                },
 
index 222a996aae3002c1c38c26d9087647edbb278277..84f3033ba9effdb420139848f24b68de97fa14e0 100644 (file)
@@ -12,7 +12,6 @@
 <input type="hidden" name="filesApp" id="filesApp" value="1" />
 <input type="hidden" name="usedSpacePercent" id="usedSpacePercent" value="<?php p($_['usedSpacePercent']); ?>" />
 <?php if (!$_['isPublic']) :?>
-<input type="hidden" name="encryptedFiles" id="encryptedFiles" value="<?php $_['encryptedFiles'] ? p('1') : p('0'); ?>" />
 <input type="hidden" name="encryptedInitStatus" id="encryptionInitStatus" value="<?php p($_['encryptionInitStatus']) ?>" />
 <input type="hidden" name="mailNotificationEnabled" id="mailNotificationEnabled" value="<?php p($_['mailNotificationEnabled']) ?>" />
 <input type="hidden" name="mailPublicNotificationEnabled" id="mailPublicNotificationEnabled" value="<?php p($_['mailPublicNotificationEnabled']) ?>" />
index 58579f42dfc6d706249e6a8b7232dc11b2d9e62b..a436973ba913b5bae16216cf4e60658780c52e0f 100644 (file)
@@ -76,11 +76,6 @@ class File extends \OC\Connector\Sabre\Node implements \Sabre\DAV\IFile {
                        throw new \Sabre\DAV\Exception\ServiceUnavailable("File is not updatable: ".$e->getMessage());
                }
 
-               // throw an exception if encryption was disabled but the files are still encrypted
-               if (\OC_Util::encryptedFiles()) {
-                       throw new \Sabre\DAV\Exception\ServiceUnavailable("Encryption is disabled");
-               }
-
                // verify path of the target
                $this->verifyPath();
 
@@ -187,18 +182,13 @@ class File extends \OC\Connector\Sabre\Node implements \Sabre\DAV\IFile {
        public function get() {
 
                //throw exception if encryption is disabled but files are still encrypted
-               if (\OC_Util::encryptedFiles()) {
-                       throw new \Sabre\DAV\Exception\ServiceUnavailable("Encryption is disabled");
-               } else {
-                       try {
-                               return $this->fileView->fopen(ltrim($this->path, '/'), 'rb');
-                       } catch (\OCP\Encryption\Exception\EncryptionException $e) {
-                               throw new \Sabre\DAV\Exception\Forbidden($e->getMessage());
-                       } catch (\OCP\Files\StorageNotAvailableException $e) {
-                               throw new \Sabre\DAV\Exception\ServiceUnavailable("Failed to open file: ".$e->getMessage());
-                       }
+               try {
+                       return $this->fileView->fopen(ltrim($this->path, '/'), 'rb');
+               } catch (\OCP\Encryption\Exception\EncryptionException $e) {
+                       throw new \Sabre\DAV\Exception\Forbidden($e->getMessage());
+               } catch (\OCP\Files\StorageNotAvailableException $e) {
+                       throw new \Sabre\DAV\Exception\ServiceUnavailable("Failed to open file: ".$e->getMessage());
                }
-
        }
 
        /**
index e6dd307faea8bbbd2e9e1cbe2479c59fbd68fcd1..3fd0f844684752b68e0889332af3a6d76149fafa 100644 (file)
@@ -812,51 +812,6 @@ class OC_Util {
                return $errors;
        }
 
-
-       /**
-        * check if there are still some encrypted files stored
-        *
-        * @return boolean
-        */
-       public static function encryptedFiles() {
-               //check if encryption was enabled in the past
-               $encryptedFiles = false;
-               if (OC_App::isEnabled('files_encryption') === false) {
-                       $view = new OC\Files\View('/' . OCP\User::getUser());
-                       $keysPath = '/files_encryption/keys';
-                       if ($view->is_dir($keysPath)) {
-                               $dircontent = $view->getDirectoryContent($keysPath);
-                               if (!empty($dircontent)) {
-                                       $encryptedFiles = true;
-                               }
-                       }
-               }
-
-               return $encryptedFiles;
-       }
-
-       /**
-        * check if a backup from the encryption keys exists
-        *
-        * @return boolean
-        */
-       public static function backupKeysExists() {
-               //check if encryption was enabled in the past
-               $backupExists = false;
-               if (OC_App::isEnabled('files_encryption') === false) {
-                       $view = new OC\Files\View('/' . OCP\User::getUser());
-                       $backupPath = '/files_encryption/backup.decryptAll';
-                       if ($view->is_dir($backupPath)) {
-                               $dircontent = $view->getDirectoryContent($backupPath);
-                               if (!empty($dircontent)) {
-                                       $backupExists = true;
-                               }
-                       }
-               }
-
-               return $backupExists;
-       }
-
        /**
         * Check for correct file permissions of data directory
         *
index b50ce54839b05350c997decfea07c2456054c460..37cb1b5448537f181643b21039151fa2cd64c0b4 100644 (file)
@@ -219,9 +219,11 @@ class Util {
        /**
         * check if some encrypted files are stored
         * @return bool
+        *
+        * @deprecated No longer required
         */
        public static function encryptedFiles() {
-               return \OC_Util::encryptedFiles();
+               return false;
        }
 
        /**
diff --git a/settings/ajax/decryptall.php b/settings/ajax/decryptall.php
deleted file mode 100644 (file)
index 5925cee..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-/**
- * @author Björn Schießle <schiessle@owncloud.com>
- * @author Joas Schilling <nickvergessen@owncloud.com>
- * @author Lukas Reschke <lukas@owncloud.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <icewind@owncloud.com>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- * @author Volkan Gezer <volkangezer@gmail.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- */
-OCP\JSON::checkLoggedIn();
-OCP\JSON::callCheck();
-
-//encryption app needs to be loaded
-OC_App::loadApp('files_encryption');
-
-// init encryption app
-$params = array('uid' => \OCP\User::getUser(),
-                               'password' => (string)$_POST['password']);
-
-$view = new OC\Files\View('/');
-$util = new \OCA\Files_Encryption\Util($view, \OCP\User::getUser());
-$l = \OC::$server->getL10N('settings');
-
-$result = $util->initEncryption($params);
-
-if ($result !== false) {
-
-       try {
-               $successful = $util->decryptAll();
-       } catch (\Exception $ex) {
-               \OCP\Util::writeLog('encryption library', "Decryption finished unexpected: " . $ex->getMessage(), \OCP\Util::ERROR);
-               $successful = false;
-       }
-
-       $util->closeEncryptionSession();
-
-       if ($successful === true) {
-               \OCP\JSON::success(array('data' => array('message' => $l->t('Files decrypted successfully'))));
-       } else {
-               \OCP\JSON::error(array('data' => array('message' => $l->t('Couldn\'t decrypt your files, please check your owncloud.log or ask your administrator'))));
-       }
-} else {
-       \OCP\JSON::error(array('data' => array('message' => $l->t('Couldn\'t decrypt your files, check your password and try again'))));
-}
-
diff --git a/settings/ajax/deletekeys.php b/settings/ajax/deletekeys.php
deleted file mode 100644 (file)
index 2192eb8..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * @author Björn Schießle <schiessle@owncloud.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <icewind@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- */
-OCP\JSON::checkLoggedIn();
-OCP\JSON::callCheck();
-
-$l = \OC::$server->getL10N('settings');
-
-$util = new \OCA\Files_Encryption\Util(new \OC\Files\View(), \OC_User::getUser());
-$result = $util->deleteBackup('decryptAll');
-
-if ($result) {
-       \OCP\JSON::success(array('data' => array('message' => $l->t('Encryption keys deleted permanently'))));
-} else {
-       \OCP\JSON::error(array('data' => array('message' => $l->t('Couldn\'t permanently delete your encryption keys, please check your owncloud.log or ask your administrator'))));
-}
diff --git a/settings/ajax/restorekeys.php b/settings/ajax/restorekeys.php
deleted file mode 100644 (file)
index 52c02b3..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * @author Björn Schießle <schiessle@owncloud.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <icewind@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- */
-OCP\JSON::checkLoggedIn();
-OCP\JSON::callCheck();
-
-$l = \OC::$server->getL10N('settings');
-
-$util = new \OCA\Files_Encryption\Util(new \OC\Files\View(), \OC_User::getUser());
-$result = $util->restoreBackup('decryptAll');
-
-if ($result) {
-       \OCP\JSON::success(array('data' => array('message' => $l->t('Backups restored successfully'))));
-} else {
-       \OCP\JSON::error(array('data' => array('message' => $l->t('Couldn\'t restore your encryption keys, please check your owncloud.log or ask your administrator'))));
-}
index 30d7f5e93889e8243884938965da7529d70bd501..a847a1ee3a3af9c9ad2cc4be738abd2f452592c0 100644 (file)
@@ -230,40 +230,6 @@ $(document).ready(function () {
                return false;
        });
 
-       $('button:button[name="submitDecryptAll"]').click(function () {
-               var privateKeyPassword = $('#decryptAll input:password[id="privateKeyPassword"]').val();
-               $('#decryptAll button:button[name="submitDecryptAll"]').prop("disabled", true);
-               $('#decryptAll input:password[name="privateKeyPassword"]').prop("disabled", true);
-               OC.Encryption.decryptAll(privateKeyPassword);
-       });
-
-
-       $('button:button[name="submitRestoreKeys"]').click(function () {
-               $('#restoreBackupKeys button:button[name="submitDeleteKeys"]').prop("disabled", true);
-               $('#restoreBackupKeys button:button[name="submitRestoreKeys"]').prop("disabled", true);
-               OC.Encryption.restoreKeys();
-       });
-
-       $('button:button[name="submitDeleteKeys"]').click(function () {
-               $('#restoreBackupKeys button:button[name="submitDeleteKeys"]').prop("disabled", true);
-               $('#restoreBackupKeys button:button[name="submitRestoreKeys"]').prop("disabled", true);
-               OC.Encryption.deleteKeys();
-       });
-
-       $('#decryptAll input:password[name="privateKeyPassword"]').keyup(function (event) {
-               var privateKeyPassword = $('#decryptAll input:password[id="privateKeyPassword"]').val();
-               if (privateKeyPassword !== '') {
-                       $('#decryptAll button:button[name="submitDecryptAll"]').prop("disabled", false);
-                       if (event.which === 13) {
-                               $('#decryptAll button:button[name="submitDecryptAll"]').prop("disabled", true);
-                               $('#decryptAll input:password[name="privateKeyPassword"]').prop("disabled", true);
-                               OC.Encryption.decryptAll(privateKeyPassword);
-                       }
-               } else {
-                       $('#decryptAll button:button[name="submitDecryptAll"]').prop("disabled", true);
-               }
-       });
-
        var uploadparms = {
                done: function (e, data) {
                        avatarResponseHandler(data.result);
@@ -380,47 +346,6 @@ $(document).ready(function () {
 });
 
 OC.Encryption = {
-       decryptAll: function (password) {
-               var message = t('settings', 'Decrypting files... Please wait, this can take some time.');
-               OC.Encryption.msg.start('#decryptAll .msg', message);
-               $.post('ajax/decryptall.php', {password: password}, function (data) {
-                       if (data.status === "error") {
-                               OC.Encryption.msg.finished('#decryptAll .msg', data);
-                               $('#decryptAll input:password[name="privateKeyPassword"]').prop("disabled", false);
-                       } else {
-                               OC.Encryption.msg.finished('#decryptAll .msg', data);
-                       }
-                       $('#restoreBackupKeys').removeClass('hidden');
-               });
-       },
-
-       deleteKeys: function () {
-               var message = t('settings', 'Delete encryption keys permanently.');
-               OC.Encryption.msg.start('#restoreBackupKeys .msg', message);
-               $.post('ajax/deletekeys.php', null, function (data) {
-                       if (data.status === "error") {
-                               OC.Encryption.msg.finished('#restoreBackupKeys .msg', data);
-                               $('#restoreBackupKeys button:button[name="submitDeleteKeys"]').prop("disabled", false);
-                               $('#restoreBackupKeys button:button[name="submitRestoreKeys"]').prop("disabled", false);
-                       } else {
-                               OC.Encryption.msg.finished('#restoreBackupKeys .msg', data);
-                       }
-               });
-       },
-
-       restoreKeys: function () {
-               var message = t('settings', 'Restore encryption keys.');
-               OC.Encryption.msg.start('#restoreBackupKeys .msg', message);
-               $.post('ajax/restorekeys.php', {}, function (data) {
-                       if (data.status === "error") {
-                               OC.Encryption.msg.finished('#restoreBackupKeys .msg', data);
-                               $('#restoreBackupKeys button:button[name="submitDeleteKeys"]').prop("disabled", false);
-                               $('#restoreBackupKeys button:button[name="submitRestoreKeys"]').prop("disabled", false);
-                       } else {
-                               OC.Encryption.msg.finished('#restoreBackupKeys .msg', data);
-                       }
-               });
-       }
 };
 
 OC.Encryption.msg = {
index e4d278d4f28155d0e803393f6cb0caf52ade8724..12b320ac001597574c312fc463efca5a518fa6b5 100644 (file)
@@ -59,11 +59,6 @@ $email=$config->getUserValue(OC_User::getUser(), 'settings', 'email', '');
 $userLang=$config->getUserValue( OC_User::getUser(), 'core', 'lang', OC_L10N::findLanguage() );
 $languageCodes=OC_L10N::findAvailableLanguages();
 
-//check if encryption was enabled in the past
-$filesStillEncrypted = OC_Util::encryptedFiles();
-$backupKeysExists = OC_Util::backupKeysExists();
-$enableDecryptAll = $filesStillEncrypted || $backupKeysExists;
-
 // array of common languages
 $commonlangcodes = array(
        'en', 'es', 'fr', 'de', 'de_DE', 'ja', 'ar', 'ru', 'nl', 'it', 'pt_BR', 'pt_PT', 'da', 'fi_FI', 'nb_NO', 'sv', 'tr', 'zh_CN', 'ko'
@@ -120,9 +115,6 @@ $tmpl->assign('activelanguage', $userLang);
 $tmpl->assign('passwordChangeSupported', OC_User::canUserChangePassword(OC_User::getUser()));
 $tmpl->assign('displayNameChangeSupported', OC_User::canUserChangeDisplayName(OC_User::getUser()));
 $tmpl->assign('displayName', OC_User::getDisplayName());
-$tmpl->assign('enableDecryptAll' , $enableDecryptAll);
-$tmpl->assign('backupKeysExists' , $backupKeysExists);
-$tmpl->assign('filesStillEncrypted' , $filesStillEncrypted);
 $tmpl->assign('enableAvatars', $config->getSystemValue('enable_avatars', true));
 $tmpl->assign('avatarChangeSupported', OC_User::canUserChangeAvatar(OC_User::getUser()));
 $tmpl->assign('certs', $certificateManager->listCertificates());
@@ -163,9 +155,6 @@ $formsAndMore = array_merge($formsAndMore, $formsMap);
 
 // add bottom hardcoded forms from the template
 $formsAndMore[]= array( 'anchor' => 'ssl-root-certificates', 'section-name' => $l->t('SSL root certificates') );
-if($enableDecryptAll) {
-       $formsAndMore[]= array( 'anchor' => 'encryption', 'section-name' => $l->t('Encryption') );
-}
 
 $tmpl->assign('forms', $formsAndMore);
 $tmpl->printPage();
index 5a069e5a1c69f1f25b7845de76b56669e6b8ac83..af9ac1d8eeaae856181ff00022bae5b9ffa13f62 100644 (file)
@@ -89,12 +89,6 @@ $this->create('settings_personal_changepassword', '/settings/personal/changepass
        ->action('OC\Settings\ChangePassword\Controller', 'changePersonalPassword');
 $this->create('settings_ajax_setlanguage', '/settings/ajax/setlanguage.php')
        ->actionInclude('settings/ajax/setlanguage.php');
-$this->create('settings_ajax_decryptall', '/settings/ajax/decryptall.php')
-       ->actionInclude('settings/ajax/decryptall.php');
-$this->create('settings_ajax_restorekeys', '/settings/ajax/restorekeys.php')
-       ->actionInclude('settings/ajax/restorekeys.php');
-$this->create('settings_ajax_deletekeys', '/settings/ajax/deletekeys.php')
-       ->actionInclude('settings/ajax/deletekeys.php');
 $this->create('settings_cert_post', '/settings/ajax/addRootCertificate')
        ->actionInclude('settings/ajax/addRootCertificate.php');
 $this->create('settings_cert_remove', '/settings/ajax/removeRootCertificate')
index 2a0b4bb0dc434e5c2629b4b4512a5eb279808a21..dfdc61918050f02482db17eb5527f3400da55543 100644 (file)
@@ -242,58 +242,6 @@ if($_['passwordChangeSupported']) {
        </form>
 </div>
 
-<?php if($_['enableDecryptAll']): ?>
-<div id="encryption" class="section">
-
-       <h2>
-               <?php p( $l->t( 'Encryption' ) ); ?>
-       </h2>
-
-       <?php if($_['filesStillEncrypted']): ?>
-
-       <div id="decryptAll">
-       <?php p($l->t( "The encryption app is no longer enabled, please decrypt all your files" )); ?>
-       <p>
-               <input
-                       type="password"
-                       name="privateKeyPassword"
-                       id="privateKeyPassword" />
-               <label for="privateKeyPassword"><?php p($l->t( "Log-in password" )); ?></label>
-               <br />
-               <button
-                       type="button"
-                       disabled
-                       name="submitDecryptAll"><?php p($l->t( "Decrypt all Files" )); ?>
-               </button>
-               <span class="msg"></span>
-       </p>
-       <br />
-       </div>
-       <?php endif; ?>
-
-       <div id="restoreBackupKeys" <?php $_['backupKeysExists'] ? '' : print_unescaped("class='hidden'") ?>>
-
-       <?php p($l->t( "Your encryption keys are moved to a backup location. If something went wrong you can restore the keys. Only delete them permanently if you are sure that all files are decrypted correctly." )); ?>
-       <p>
-               <button
-                       type="button"
-                       name="submitRestoreKeys"><?php p($l->t( "Restore Encryption Keys" )); ?>
-               </button>
-               <button
-                       type="button"
-                       name="submitDeleteKeys"><?php p($l->t( "Delete Encryption Keys" )); ?>
-               </button>
-               <span class="msg"></span>
-
-       </p>
-       <br />
-
-       </div>
-
-
-</div>
-       <?php endif; ?>
-
 <div class="section">
        <h2><?php p($l->t('Version'));?></h2>
        <strong><?php p($theme->getTitle()); ?></strong> <?php p(OC_Util::getHumanVersion()) ?><br />