summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2017-07-20 14:07:57 +0200
committerGitHub <noreply@github.com>2017-07-20 14:07:57 +0200
commitc0e9b374f16b139dc298c8c953f36b519b80793e (patch)
treeb17e6d6b444b6910366f2b19e7acf70400f3c82f /apps
parent4826fd701dda218792b5072977b24da7d42a94fa (diff)
parent473824fa061af2d28f75f194c4a6588ba5ce3701 (diff)
downloadnextcloud-server-c0e9b374f16b139dc298c8c953f36b519b80793e.tar.gz
nextcloud-server-c0e9b374f16b139dc298c8c953f36b519b80793e.zip
Merge pull request #5629 from nextcloud/add-recovery-key-on-public-upload
Add recovery key on public upload
Diffstat (limited to 'apps')
-rw-r--r--apps/encryption/lib/Crypto/Encryption.php23
1 files changed, 21 insertions, 2 deletions
diff --git a/apps/encryption/lib/Crypto/Encryption.php b/apps/encryption/lib/Crypto/Encryption.php
index 6869177ac31..1f8c8a8012e 100644
--- a/apps/encryption/lib/Crypto/Encryption.php
+++ b/apps/encryption/lib/Crypto/Encryption.php
@@ -60,6 +60,9 @@ class Encryption implements IEncryptionModule {
/** @var string */
private $user;
+ /** @var array */
+ private $owner;
+
/** @var string */
private $fileKey;
@@ -136,6 +139,7 @@ class Encryption implements IEncryptionModule {
$this->decryptAll = $decryptAll;
$this->logger = $logger;
$this->l = $il10n;
+ $this->owner = [];
$this->useMasterPassword = $util->isMasterKeyEnabled();
}
@@ -280,13 +284,15 @@ class Encryption implements IEncryptionModule {
}
}
- $publicKeys = $this->keyManager->addSystemKeys($this->accessList, $publicKeys, $this->user);
+ $publicKeys = $this->keyManager->addSystemKeys($this->accessList, $publicKeys, $this->getOwner($path));
$encryptedKeyfiles = $this->crypt->multiKeyEncrypt($this->fileKey, $publicKeys);
$this->keyManager->setAllFileKeys($this->path, $encryptedKeyfiles);
}
return $result;
}
+
+
/**
* encrypt data
*
@@ -407,7 +413,7 @@ class Encryption implements IEncryptionModule {
}
}
- $publicKeys = $this->keyManager->addSystemKeys($accessList, $publicKeys, $uid);
+ $publicKeys = $this->keyManager->addSystemKeys($accessList, $publicKeys, $this->getOwner($path));
$encryptedFileKey = $this->crypt->multiKeyEncrypt($fileKey, $publicKeys);
@@ -557,6 +563,19 @@ class Encryption implements IEncryptionModule {
}
/**
+ * get owner of a file
+ *
+ * @param string $path
+ * @return string
+ */
+ protected function getOwner($path) {
+ if (!isset($this->owner[$path])) {
+ $this->owner[$path] = $this->util->getOwner($path);
+ }
+ return $this->owner[$path];
+ }
+
+ /**
* Check if the module is ready to be used by that specific user.
* In case a module is not ready - because e.g. key pairs have not been generated
* upon login this method can return false before any operation starts and might