summaryrefslogtreecommitdiffstats
path: root/apps/encryption/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/encryption/lib')
-rw-r--r--apps/encryption/lib/AppInfo/Application.php9
-rw-r--r--apps/encryption/lib/Command/DisableMasterKey.php6
-rw-r--r--apps/encryption/lib/Command/EnableMasterKey.php6
-rw-r--r--apps/encryption/lib/Command/RecoverUser.php8
-rw-r--r--apps/encryption/lib/Controller/RecoveryController.php3
-rw-r--r--apps/encryption/lib/Controller/SettingsController.php1
-rw-r--r--apps/encryption/lib/Controller/StatusController.php4
-rw-r--r--apps/encryption/lib/Crypto/Crypt.php11
-rw-r--r--apps/encryption/lib/Crypto/DecryptAll.php3
-rw-r--r--apps/encryption/lib/Crypto/EncryptAll.php18
-rw-r--r--apps/encryption/lib/Crypto/Encryption.php12
-rw-r--r--apps/encryption/lib/Exceptions/MultiKeyDecryptException.php1
-rw-r--r--apps/encryption/lib/Exceptions/MultiKeyEncryptException.php1
-rw-r--r--apps/encryption/lib/Exceptions/PrivateKeyMissingException.php3
-rw-r--r--apps/encryption/lib/Exceptions/PublicKeyMissingException.php3
-rw-r--r--apps/encryption/lib/HookManager.php4
-rw-r--r--apps/encryption/lib/Hooks/UserHooks.php2
-rw-r--r--apps/encryption/lib/KeyManager.php13
-rw-r--r--apps/encryption/lib/Migration/SetMasterKeyStatus.php1
-rw-r--r--apps/encryption/lib/Recovery.php11
-rw-r--r--apps/encryption/lib/Session.php1
-rw-r--r--apps/encryption/lib/Settings/Admin.php1
-rw-r--r--apps/encryption/lib/Util.php2
23 files changed, 28 insertions, 96 deletions
diff --git a/apps/encryption/lib/AppInfo/Application.php b/apps/encryption/lib/AppInfo/Application.php
index fcd7ef569b9..688564887d3 100644
--- a/apps/encryption/lib/AppInfo/Application.php
+++ b/apps/encryption/lib/AppInfo/Application.php
@@ -78,7 +78,6 @@ class Application extends \OCP\AppFramework\App {
*/
public function registerHooks() {
if (!$this->config->getSystemValueBool('maintenance')) {
-
$container = $this->getContainer();
$server = $container->getServer();
// Register our hooks and fire them.
@@ -97,7 +96,6 @@ class Application extends \OCP\AppFramework\App {
]);
$hookManager->fireHooks();
-
} else {
// Logout user if we are in maintenance to force re-login
$this->getContainer()->getServer()->getUserSession()->logout();
@@ -112,8 +110,7 @@ class Application extends \OCP\AppFramework\App {
Encryption::ID,
Encryption::DISPLAY_NAME,
function () use ($container) {
-
- return new Encryption(
+ return new Encryption(
$container->query('Crypt'),
$container->query('KeyManager'),
$container->query('Util'),
@@ -123,8 +120,7 @@ class Application extends \OCP\AppFramework\App {
$container->getServer()->getLogger(),
$container->getServer()->getL10N($container->getAppName())
);
- });
-
+ });
}
public function registerServices() {
@@ -261,6 +257,5 @@ class Application extends \OCP\AppFramework\App {
);
}
);
-
}
}
diff --git a/apps/encryption/lib/Command/DisableMasterKey.php b/apps/encryption/lib/Command/DisableMasterKey.php
index 18bf0b3903d..d59e3b586c8 100644
--- a/apps/encryption/lib/Command/DisableMasterKey.php
+++ b/apps/encryption/lib/Command/DisableMasterKey.php
@@ -50,7 +50,6 @@ class DisableMasterKey extends Command {
public function __construct(Util $util,
IConfig $config,
QuestionHelper $questionHelper) {
-
$this->util = $util;
$this->config = $config;
$this->questionHelper = $questionHelper;
@@ -64,10 +63,9 @@ class DisableMasterKey extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output) {
-
$isMasterKeyEnabled = $this->util->isMasterKeyEnabled();
- if(!$isMasterKeyEnabled) {
+ if (!$isMasterKeyEnabled) {
$output->writeln('Master key already disabled');
} else {
$question = new ConfirmationQuestion(
@@ -83,7 +81,5 @@ class DisableMasterKey extends Command {
$output->writeln('aborted.');
}
}
-
}
-
}
diff --git a/apps/encryption/lib/Command/EnableMasterKey.php b/apps/encryption/lib/Command/EnableMasterKey.php
index d1148c88ccd..6c4645e7212 100644
--- a/apps/encryption/lib/Command/EnableMasterKey.php
+++ b/apps/encryption/lib/Command/EnableMasterKey.php
@@ -49,7 +49,6 @@ class EnableMasterKey extends Command {
public function __construct(Util $util,
IConfig $config,
QuestionHelper $questionHelper) {
-
$this->util = $util;
$this->config = $config;
$this->questionHelper = $questionHelper;
@@ -63,10 +62,9 @@ class EnableMasterKey extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output) {
-
$isAlreadyEnabled = $this->util->isMasterKeyEnabled();
- if($isAlreadyEnabled) {
+ if ($isAlreadyEnabled) {
$output->writeln('Master key already enabled');
} else {
$question = new ConfirmationQuestion(
@@ -79,7 +77,5 @@ class EnableMasterKey extends Command {
$output->writeln('aborted.');
}
}
-
}
-
}
diff --git a/apps/encryption/lib/Command/RecoverUser.php b/apps/encryption/lib/Command/RecoverUser.php
index 9d98b38de47..a4d7b2407d6 100644
--- a/apps/encryption/lib/Command/RecoverUser.php
+++ b/apps/encryption/lib/Command/RecoverUser.php
@@ -54,7 +54,6 @@ class RecoverUser extends Command {
IConfig $config,
IUserManager $userManager,
QuestionHelper $questionHelper) {
-
$this->util = $util;
$this->questionHelper = $questionHelper;
$this->userManager = $userManager;
@@ -74,10 +73,9 @@ class RecoverUser extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output) {
-
$isMasterKeyEnabled = $this->util->isMasterKeyEnabled();
- if($isMasterKeyEnabled) {
+ if ($isMasterKeyEnabled) {
$output->writeln('You use the master key, no individual user recovery needed.');
return;
}
@@ -90,7 +88,7 @@ class RecoverUser extends Command {
}
$recoveryKeyEnabled = $this->util->isRecoveryEnabledForUser($uid);
- if($recoveryKeyEnabled === false) {
+ if ($recoveryKeyEnabled === false) {
$output->writeln('Recovery key is not enabled for: ' . $uid);
return;
}
@@ -108,7 +106,5 @@ class RecoverUser extends Command {
$output->write('Start to recover users files... This can take some time...');
$this->userManager->get($uid)->setPassword($newLoginPassword, $recoveryPassword);
$output->writeln('Done.');
-
}
-
}
diff --git a/apps/encryption/lib/Controller/RecoveryController.php b/apps/encryption/lib/Controller/RecoveryController.php
index 534e00e1b2e..509ff2a0391 100644
--- a/apps/encryption/lib/Controller/RecoveryController.php
+++ b/apps/encryption/lib/Controller/RecoveryController.php
@@ -161,7 +161,6 @@ class RecoveryController extends Controller {
*/
public function userSetRecovery($userEnableRecovery) {
if ($userEnableRecovery === '0' || $userEnableRecovery === '1') {
-
$result = $this->recovery->setRecoveryForUser($userEnableRecovery);
if ($result) {
@@ -180,7 +179,6 @@ class RecoveryController extends Controller {
]
);
}
-
}
return new DataResponse(
[
@@ -189,5 +187,4 @@ class RecoveryController extends Controller {
]
], Http::STATUS_BAD_REQUEST);
}
-
}
diff --git a/apps/encryption/lib/Controller/SettingsController.php b/apps/encryption/lib/Controller/SettingsController.php
index 545f544625b..f918f176767 100644
--- a/apps/encryption/lib/Controller/SettingsController.php
+++ b/apps/encryption/lib/Controller/SettingsController.php
@@ -150,7 +150,6 @@ class SettingsController extends Controller {
Http::STATUS_BAD_REQUEST
);
}
-
}
/**
diff --git a/apps/encryption/lib/Controller/StatusController.php b/apps/encryption/lib/Controller/StatusController.php
index d3925e4482a..40159627b00 100644
--- a/apps/encryption/lib/Controller/StatusController.php
+++ b/apps/encryption/lib/Controller/StatusController.php
@@ -67,10 +67,9 @@ class StatusController extends Controller {
* @return DataResponse
*/
public function getStatus() {
-
$status = 'error';
$message = 'no valid init status';
- switch($this->session->getStatus()) {
+ switch ($this->session->getStatus()) {
case Session::INIT_EXECUTED:
$status = 'interactionNeeded';
$message = (string)$this->l->t(
@@ -102,5 +101,4 @@ class StatusController extends Controller {
]
);
}
-
}
diff --git a/apps/encryption/lib/Crypto/Crypt.php b/apps/encryption/lib/Crypto/Crypt.php
index b8e7ebab85b..24b1f21ecd0 100644
--- a/apps/encryption/lib/Crypto/Crypt.php
+++ b/apps/encryption/lib/Crypto/Crypt.php
@@ -54,7 +54,6 @@ use OCP\IUserSession;
* @package OCA\Encryption\Crypto
*/
class Crypt {
-
const DEFAULT_CIPHER = 'AES-256-CTR';
// default cipher from old Nextcloud versions
const LEGACY_CIPHER = 'AES-128-CFB';
@@ -109,7 +108,6 @@ class Crypt {
* @return array|bool
*/
public function createKeyPair() {
-
$log = $this->logger;
$res = $this->getOpenSSLPKey();
@@ -176,7 +174,6 @@ class Crypt {
* @throws EncryptionFailedException
*/
public function symmetricEncryptFileContent($plainContent, $passPhrase, $version, $position) {
-
if (!$plainContent) {
$this->logger->error('Encryption Library, symmetrical encryption failed no content given',
['app' => 'encryption']);
@@ -207,7 +204,6 @@ class Crypt {
* @throws \InvalidArgumentException
*/
public function generateHeader($keyFormat = 'hash') {
-
if (in_array($keyFormat, $this->supportedKeyFormats, true) === false) {
throw new \InvalidArgumentException('key format "' . $keyFormat . '" is not supported');
}
@@ -267,8 +263,8 @@ class Crypt {
}
// Workaround for OpenSSL 0.9.8. Fallback to an old cipher that should work.
- if(OPENSSL_VERSION_NUMBER < 0x1000101f) {
- if($cipher === 'AES-256-CTR' || $cipher === 'AES-128-CTR') {
+ if (OPENSSL_VERSION_NUMBER < 0x1000101f) {
+ if ($cipher === 'AES-256-CTR' || $cipher === 'AES-128-CTR') {
$cipher = self::LEGACY_CIPHER;
}
}
@@ -284,7 +280,7 @@ class Crypt {
* @throws \InvalidArgumentException
*/
protected function getKeySize($cipher) {
- if(isset($this->supportedCiphersAndKeySize[$cipher])) {
+ if (isset($this->supportedCiphersAndKeySize[$cipher])) {
return $this->supportedCiphersAndKeySize[$cipher];
}
@@ -389,7 +385,6 @@ class Crypt {
* @return false|string
*/
public function decryptPrivateKey($privateKey, $password = '', $uid = '') {
-
$header = $this->parseHeader($privateKey);
if (isset($header['cipher'])) {
diff --git a/apps/encryption/lib/Crypto/DecryptAll.php b/apps/encryption/lib/Crypto/DecryptAll.php
index a488c726523..ed43bc75457 100644
--- a/apps/encryption/lib/Crypto/DecryptAll.php
+++ b/apps/encryption/lib/Crypto/DecryptAll.php
@@ -78,10 +78,9 @@ class DecryptAll {
* @return bool
*/
public function prepare(InputInterface $input, OutputInterface $output, $user) {
-
$question = new Question('Please enter the recovery key password: ');
- if($this->util->isMasterKeyEnabled()) {
+ if ($this->util->isMasterKeyEnabled()) {
$output->writeln('Use master key to decrypt all files');
$user = $this->keyManager->getMasterKeyId();
$password =$this->keyManager->getMasterKeyPassword();
diff --git a/apps/encryption/lib/Crypto/EncryptAll.php b/apps/encryption/lib/Crypto/EncryptAll.php
index d0aaafd0617..8fa2214234e 100644
--- a/apps/encryption/lib/Crypto/EncryptAll.php
+++ b/apps/encryption/lib/Crypto/EncryptAll.php
@@ -131,7 +131,6 @@ class EncryptAll {
* @param OutputInterface $output
*/
public function encryptAll(InputInterface $input, OutputInterface $output) {
-
$this->input = $input;
$this->output = $output;
@@ -184,7 +183,7 @@ class EncryptAll {
$progress->setFormat(" %message% \n [%bar%]");
$progress->start();
- foreach($this->userManager->getBackends() as $backend) {
+ foreach ($this->userManager->getBackends() as $backend) {
$limit = 500;
$offset = 0;
do {
@@ -203,7 +202,7 @@ class EncryptAll {
}
}
$offset += $limit;
- } while(count($users) >= $limit);
+ } while (count($users) >= $limit);
}
$progress->setMessage('Key-pair created for all users');
@@ -231,7 +230,6 @@ class EncryptAll {
}
$progress->setMessage("all files encrypted");
$progress->finish();
-
}
/**
@@ -241,7 +239,7 @@ class EncryptAll {
*/
protected function encryptAllUserFilesWithMasterKey(ProgressBar $progress) {
$userNo = 1;
- foreach($this->userManager->getBackends() as $backend) {
+ foreach ($this->userManager->getBackends() as $backend) {
$limit = 500;
$offset = 0;
do {
@@ -252,7 +250,7 @@ class EncryptAll {
$userNo++;
}
$offset += $limit;
- } while(count($users) >= $limit);
+ } while (count($users) >= $limit);
}
}
@@ -264,12 +262,11 @@ class EncryptAll {
* @param string $userCount
*/
protected function encryptUsersFiles($uid, ProgressBar $progress, $userCount) {
-
$this->setupUserFS($uid);
$directories = [];
$directories[] = '/' . $uid . '/files';
- while($root = array_pop($directories)) {
+ while ($root = array_pop($directories)) {
$content = $this->rootView->getDirectoryContent($root);
foreach ($content as $file) {
$path = $root . '/' . $file['name'];
@@ -279,7 +276,7 @@ class EncryptAll {
} else {
$progress->setMessage("encrypt files for user $userCount: $path");
$progress->advance();
- if($this->encryptFile($path) === false) {
+ if ($this->encryptFile($path) === false) {
$progress->setMessage("encrypt files for user $userCount: $path (already encrypted)");
$progress->advance();
}
@@ -461,7 +458,6 @@ class EncryptAll {
$table->setRows($rows);
$table->render();
}
-
}
/**
@@ -471,7 +467,6 @@ class EncryptAll {
* @return array an array of the html mail body and the plain text mail body
*/
protected function createMailBody($password) {
-
$html = new \OC_Template("encryption", "mail", "");
$html->assign('password', $password);
$htmlMail = $html->fetchPage();
@@ -482,5 +477,4 @@ class EncryptAll {
return [$htmlMail, $plainTextMail];
}
-
}
diff --git a/apps/encryption/lib/Crypto/Encryption.php b/apps/encryption/lib/Crypto/Encryption.php
index f976a0815db..57cf4e2edac 100644
--- a/apps/encryption/lib/Crypto/Encryption.php
+++ b/apps/encryption/lib/Crypto/Encryption.php
@@ -45,7 +45,6 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Encryption implements IEncryptionModule {
-
const ID = 'OC_DEFAULT_MODULE';
const DISPLAY_NAME = 'Default encryption module';
@@ -184,7 +183,7 @@ class Encryption implements IEncryptionModule {
$this->isWriteOperation = false;
$this->writeCache = '';
- if($this->session->isReady() === false) {
+ if ($this->session->isReady() === false) {
// if the master key is enabled we can initialize encryption
// with a empty password and user name
if ($this->util->isMasterKeyEnabled()) {
@@ -221,7 +220,7 @@ class Encryption implements IEncryptionModule {
// if we read a part file we need to increase the version by 1
// because the version number was also increased by writing
// the part file
- if(Scanner::isPartialFile($path)) {
+ if (Scanner::isPartialFile($path)) {
$this->version = $this->version + 1;
}
}
@@ -313,7 +312,6 @@ class Encryption implements IEncryptionModule {
// Clear the write cache, ready for reuse - it has been
// flushed and its old contents processed
$this->writeCache = '';
-
}
$encrypted = '';
@@ -340,7 +338,6 @@ class Encryption implements IEncryptionModule {
// Clear $data ready for next round
$data = '';
-
} else {
// Read the chunk from the start of $data
@@ -352,9 +349,7 @@ class Encryption implements IEncryptionModule {
// $data, leaving only unprocessed data in $data
// var, for handling on the next round
$data = substr($data, $this->unencryptedBlockSizeSigned);
-
}
-
}
return $encrypted;
@@ -389,7 +384,6 @@ class Encryption implements IEncryptionModule {
* @return boolean
*/
public function update($path, $uid, array $accessList) {
-
if (empty($accessList)) {
if (isset(self::$rememberVersion[$path])) {
$this->keyManager->setVersion($path, self::$rememberVersion[$path], new View());
@@ -401,7 +395,6 @@ class Encryption implements IEncryptionModule {
$fileKey = $this->keyManager->getFileKey($path, $uid);
if (!empty($fileKey)) {
-
$publicKeys = [];
if ($this->useMasterPassword === true) {
$publicKeys[$this->keyManager->getMasterKeyId()] = $this->keyManager->getPublicMasterKey();
@@ -422,7 +415,6 @@ class Encryption implements IEncryptionModule {
$this->keyManager->deleteAllFileKeys($path);
$this->keyManager->setAllFileKeys($path, $encryptedFileKey);
-
} else {
$this->logger->debug('no file key found, we assume that the file "{file}" is not encrypted',
['file' => $path, 'app' => 'encryption']);
diff --git a/apps/encryption/lib/Exceptions/MultiKeyDecryptException.php b/apps/encryption/lib/Exceptions/MultiKeyDecryptException.php
index 9bb01249d94..79ec2c3c822 100644
--- a/apps/encryption/lib/Exceptions/MultiKeyDecryptException.php
+++ b/apps/encryption/lib/Exceptions/MultiKeyDecryptException.php
@@ -26,5 +26,4 @@ namespace OCA\Encryption\Exceptions;
use OCP\Encryption\Exceptions\GenericEncryptionException;
class MultiKeyDecryptException extends GenericEncryptionException {
-
}
diff --git a/apps/encryption/lib/Exceptions/MultiKeyEncryptException.php b/apps/encryption/lib/Exceptions/MultiKeyEncryptException.php
index f4a03d259ca..4916a4ceba5 100644
--- a/apps/encryption/lib/Exceptions/MultiKeyEncryptException.php
+++ b/apps/encryption/lib/Exceptions/MultiKeyEncryptException.php
@@ -26,5 +26,4 @@ namespace OCA\Encryption\Exceptions;
use OCP\Encryption\Exceptions\GenericEncryptionException;
class MultiKeyEncryptException extends GenericEncryptionException {
-
}
diff --git a/apps/encryption/lib/Exceptions/PrivateKeyMissingException.php b/apps/encryption/lib/Exceptions/PrivateKeyMissingException.php
index f7014fa2701..4d14b191ddc 100644
--- a/apps/encryption/lib/Exceptions/PrivateKeyMissingException.php
+++ b/apps/encryption/lib/Exceptions/PrivateKeyMissingException.php
@@ -32,10 +32,9 @@ class PrivateKeyMissingException extends GenericEncryptionException {
* @param string $userId
*/
public function __construct($userId) {
- if(empty($userId)) {
+ if (empty($userId)) {
$userId = "<no-user-id-given>";
}
parent::__construct("Private Key missing for user: $userId");
}
-
}
diff --git a/apps/encryption/lib/Exceptions/PublicKeyMissingException.php b/apps/encryption/lib/Exceptions/PublicKeyMissingException.php
index d6f12b3669e..e0667d42a20 100644
--- a/apps/encryption/lib/Exceptions/PublicKeyMissingException.php
+++ b/apps/encryption/lib/Exceptions/PublicKeyMissingException.php
@@ -31,10 +31,9 @@ class PublicKeyMissingException extends GenericEncryptionException {
* @param string $userId
*/
public function __construct($userId) {
- if(empty($userId)) {
+ if (empty($userId)) {
$userId = "<no-user-id-given>";
}
parent::__construct("Public Key missing for user: $userId");
}
-
}
diff --git a/apps/encryption/lib/HookManager.php b/apps/encryption/lib/HookManager.php
index a40f56fa373..324c0d718da 100644
--- a/apps/encryption/lib/HookManager.php
+++ b/apps/encryption/lib/HookManager.php
@@ -26,7 +26,6 @@ namespace OCA\Encryption;
use OCA\Encryption\Hooks\Contracts\IHook;
class HookManager {
-
private $hookInstances = [];
/**
@@ -42,7 +41,6 @@ class HookManager {
}
$this->hookInstances[] = $instance;
}
-
} elseif ($instances instanceof IHook) {
$this->hookInstances[] = $instances;
}
@@ -58,7 +56,5 @@ class HookManager {
*/
$instance->addHooks();
}
-
}
-
}
diff --git a/apps/encryption/lib/Hooks/UserHooks.php b/apps/encryption/lib/Hooks/UserHooks.php
index 16655dfe689..399e2865d03 100644
--- a/apps/encryption/lib/Hooks/UserHooks.php
+++ b/apps/encryption/lib/Hooks/UserHooks.php
@@ -109,7 +109,6 @@ class UserHooks implements IHook {
Session $session,
Crypt $crypt,
Recovery $recovery) {
-
$this->keyManager = $keyManager;
$this->userManager = $userManager;
$this->logger = $logger;
@@ -258,7 +257,6 @@ class UserHooks implements IHook {
// current logged in user changes his own password
if ($user && $params['uid'] === $user->getUID()) {
-
$privateKey = $this->session->getPrivateKey();
// Encrypt private key with new user pwd as passphrase
diff --git a/apps/encryption/lib/KeyManager.php b/apps/encryption/lib/KeyManager.php
index 8b286e00942..a62a4ca27f8 100644
--- a/apps/encryption/lib/KeyManager.php
+++ b/apps/encryption/lib/KeyManager.php
@@ -120,7 +120,6 @@ class KeyManager {
ILogger $log,
Util $util
) {
-
$this->util = $util;
$this->session = $session;
$this->keyStorage = $keyStorage;
@@ -179,7 +178,6 @@ class KeyManager {
* check if a key pair for the master key exists, if not we create one
*/
public function validateMasterKey() {
-
if ($this->util->isMasterKeyEnabled() === false) {
return;
}
@@ -358,11 +356,10 @@ class KeyManager {
* @return boolean
*/
public function init($uid, $passPhrase) {
-
$this->session->setStatus(Session::INIT_EXECUTED);
try {
- if($this->util->isMasterKeyEnabled()) {
+ if ($this->util->isMasterKeyEnabled()) {
$uid = $this->getMasterKeyId();
$passPhrase = $this->getMasterKeyPassword();
$privateKey = $this->getSystemPrivateKey($uid);
@@ -462,7 +459,7 @@ class KeyManager {
*/
public function getVersion($path, View $view) {
$fileInfo = $view->getFileInfo($path);
- if($fileInfo === false) {
+ if ($fileInfo === false) {
return 0;
}
return $fileInfo->getEncryptedVersion();
@@ -478,7 +475,7 @@ class KeyManager {
public function setVersion($path, $version, View $view) {
$fileInfo= $view->getFileInfo($path);
- if($fileInfo !== false) {
+ if ($fileInfo !== false) {
$cache = $fileInfo->getStorage()->getCache();
$cache->update($fileInfo->getId(), ['encrypted' => $version, 'encryptedVersion' => $version]);
}
@@ -642,7 +639,6 @@ class KeyManager {
}
return $keys;
-
}
/**
@@ -685,7 +681,6 @@ class KeyManager {
if ($this->recoveryKeyExists() &&
$this->util->isRecoveryEnabledForUser($uid)) {
-
$publicKeys[$this->getRecoveryKeyId()] = $this->getRecoveryKey();
}
@@ -700,7 +695,7 @@ class KeyManager {
*/
public function getMasterKeyPassword() {
$password = $this->config->getSystemValue('secret');
- if (empty($password)){
+ if (empty($password)) {
throw new \Exception('Can not get secret from Nextcloud instance');
}
diff --git a/apps/encryption/lib/Migration/SetMasterKeyStatus.php b/apps/encryption/lib/Migration/SetMasterKeyStatus.php
index ade393cede1..322b991ae97 100644
--- a/apps/encryption/lib/Migration/SetMasterKeyStatus.php
+++ b/apps/encryption/lib/Migration/SetMasterKeyStatus.php
@@ -73,5 +73,4 @@ class SetMasterKeyStatus implements IRepairStep {
$appVersion = $this->config->getAppValue('encryption', 'installed_version', '0.0.0');
return version_compare($appVersion, '2.0.0', '<');
}
-
}
diff --git a/apps/encryption/lib/Recovery.php b/apps/encryption/lib/Recovery.php
index 657d41b61dd..7d7132999ea 100644
--- a/apps/encryption/lib/Recovery.php
+++ b/apps/encryption/lib/Recovery.php
@@ -95,7 +95,7 @@ class Recovery {
if (!$keyManager->recoveryKeyExists()) {
$keyPair = $this->crypt->createKeyPair();
- if(!is_array($keyPair)) {
+ if (!is_array($keyPair)) {
return false;
}
@@ -120,7 +120,7 @@ class Recovery {
public function changeRecoveryKeyPassword($newPassword, $oldPassword) {
$recoveryKey = $this->keyManager->getSystemPrivateKey($this->keyManager->getRecoveryKeyId());
$decryptedRecoveryKey = $this->crypt->decryptPrivateKey($recoveryKey, $oldPassword);
- if($decryptedRecoveryKey === false) {
+ if ($decryptedRecoveryKey === false) {
return false;
}
$encryptedRecoveryKey = $this->crypt->encryptPrivateKey($decryptedRecoveryKey, $newPassword);
@@ -180,7 +180,6 @@ class Recovery {
* @return bool
*/
public function setRecoveryForUser($value) {
-
try {
$this->config->setUserValue($this->user->getUID(),
'encryption',
@@ -253,7 +252,7 @@ class Recovery {
$encryptedKey = $this->keyManager->getSystemPrivateKey($this->keyManager->getRecoveryKeyId());
$privateKey = $this->crypt->decryptPrivateKey($encryptedKey, $recoveryPassword);
- if($privateKey !== false) {
+ if ($privateKey !== false) {
$this->recoverAllFiles('/' . $user . '/files/', $privateKey, $user);
}
}
@@ -277,7 +276,6 @@ class Recovery {
$this->recoverFile($filePath, $privateKey, $uid);
}
}
-
}
/**
@@ -309,8 +307,5 @@ class Recovery {
$encryptedKeyfiles = $this->crypt->multiKeyEncrypt($fileKey, $publicKeys);
$this->keyManager->setAllFileKeys($path, $encryptedKeyfiles);
}
-
}
-
-
}
diff --git a/apps/encryption/lib/Session.php b/apps/encryption/lib/Session.php
index 58357b2efe1..4398f9c4e0a 100644
--- a/apps/encryption/lib/Session.php
+++ b/apps/encryption/lib/Session.php
@@ -184,5 +184,4 @@ class Session {
$this->session->remove('decryptAllKey');
$this->session->remove('decryptAllUid');
}
-
}
diff --git a/apps/encryption/lib/Settings/Admin.php b/apps/encryption/lib/Settings/Admin.php
index 91ce234ef58..d3b64bee4ee 100644
--- a/apps/encryption/lib/Settings/Admin.php
+++ b/apps/encryption/lib/Settings/Admin.php
@@ -125,5 +125,4 @@ class Admin implements ISettings {
public function getPriority() {
return 11;
}
-
}
diff --git a/apps/encryption/lib/Util.php b/apps/encryption/lib/Util.php
index 681f025417b..2b11b8151c0 100644
--- a/apps/encryption/lib/Util.php
+++ b/apps/encryption/lib/Util.php
@@ -182,7 +182,6 @@ class Util {
throw new \BadMethodCallException('Unknown user: ' .
'method expects path to a user folder relative to the data folder');
}
-
}
return $owner;
@@ -197,5 +196,4 @@ class Util {
public function getStorage($path) {
return $this->files->getMount($path)->getStorage();
}
-
}