summaryrefslogtreecommitdiffstats
path: root/apps/encryption/lib/recovery.php
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2015-03-31 17:13:36 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-04-07 13:30:29 +0200
commit1358d07d3516ffb6ecedc451bd1a0ad60d3cb673 (patch)
tree9e25e4c5c98a31c4edf0a9a4139cd93a90ac6e2d /apps/encryption/lib/recovery.php
parente4895bda01f9c94fc33e094ae9466e1cf5502916 (diff)
downloadnextcloud-server-1358d07d3516ffb6ecedc451bd1a0ad60d3cb673.tar.gz
nextcloud-server-1358d07d3516ffb6ecedc451bd1a0ad60d3cb673.zip
let user enable recovery key
Diffstat (limited to 'apps/encryption/lib/recovery.php')
-rw-r--r--apps/encryption/lib/recovery.php17
1 files changed, 10 insertions, 7 deletions
diff --git a/apps/encryption/lib/recovery.php b/apps/encryption/lib/recovery.php
index 701c0934c95..b3da82a3cc5 100644
--- a/apps/encryption/lib/recovery.php
+++ b/apps/encryption/lib/recovery.php
@@ -90,7 +90,7 @@ class Recovery {
IStorage $keyStorage,
IFile $file,
View $view) {
- $this->user = $user && $user->isLoggedIn() ? $user->getUser() : false;
+ $this->user = ($user && $user->isLoggedIn()) ? $user->getUser() : false;
$this->crypt = $crypt;
$this->random = $random;
$this->keyManager = $keyManager;
@@ -180,7 +180,7 @@ class Recovery {
$value);
if ($value === '1') {
- $this->addRecoveryKeys('/' . $this->user . '/files/');
+ $this->addRecoveryKeys('/' . $this->user->getUID() . '/files/');
} else {
$this->removeRecoveryKeys();
}
@@ -198,20 +198,22 @@ class Recovery {
$dirContent = $this->view->getDirectoryContent($path);
foreach ($dirContent as $item) {
// get relative path from files_encryption/keyfiles/
- $filePath = $item['path'];
+ $filePath = $item->getPath();
if ($item['type'] === 'dir') {
$this->addRecoveryKeys($filePath . '/');
} else {
- $fileKey = $this->keyManager->getFileKey($filePath, $this->user);
+ $fileKey = $this->keyManager->getFileKey($filePath, $this->user->getUID());
if (!empty($fileKey)) {
- $accessList = $this->file->getAccessList($path);
+ $accessList = $this->file->getAccessList($filePath);
$publicKeys = array();
foreach ($accessList['users'] as $uid) {
- $publicKeys[$uid] = $this->keymanager->getPublicKey($uid);
+ $publicKeys[$uid] = $this->keyManager->getPublicKey($uid);
}
+ $publicKeys = $this->keyManager->addSystemKeys($accessList, $publicKeys);
+
$encryptedKeyfiles = $this->crypt->multiKeyEncrypt($fileKey, $publicKeys);
- $this->keymanager->setAllFileKeys($path, $encryptedKeyfiles);
+ $this->keyManager->setAllFileKeys($filePath, $encryptedKeyfiles);
}
}
}
@@ -221,6 +223,7 @@ class Recovery {
* remove recovery key to all encrypted files
*/
private function removeRecoveryKeys($path = '/') {
+ return true;
$dirContent = $this->view->getDirectoryContent($this->keyfilesPath . $path);
foreach ($dirContent as $item) {
// get relative path from files_encryption/keyfiles