summaryrefslogtreecommitdiffstats
path: root/apps/encryption/lib
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2016-01-11 13:02:11 +0100
committerBjörn Schießle <bjoern@schiessle.org>2016-01-11 13:09:06 +0100
commit46f6c289cac2ad20f9b57e1aff2894a38221a917 (patch)
tree4aeddafc7dd8b87d5ec69ec613b9480c940de730 /apps/encryption/lib
parentdf2abda814e8909136a27fdac136dc15e62fe429 (diff)
downloadnextcloud-server-46f6c289cac2ad20f9b57e1aff2894a38221a917.tar.gz
nextcloud-server-46f6c289cac2ad20f9b57e1aff2894a38221a917.zip
only use master key ID if a user is logged in. Otherwise keep the public link share key
Diffstat (limited to 'apps/encryption/lib')
-rw-r--r--apps/encryption/lib/keymanager.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/encryption/lib/keymanager.php b/apps/encryption/lib/keymanager.php
index 8fa42be27fc..ae34286d21c 100644
--- a/apps/encryption/lib/keymanager.php
+++ b/apps/encryption/lib/keymanager.php
@@ -386,16 +386,17 @@ class KeyManager {
public function getFileKey($path, $uid) {
$encryptedFileKey = $this->keyStorage->getFileKey($path, $this->fileKeyId, Encryption::ID);
- if ($this->util->isMasterKeyEnabled()) {
- $uid = $this->getMasterKeyId();
- }
-
if (is_null($uid)) {
$uid = $this->getPublicShareKeyId();
$shareKey = $this->getShareKey($path, $uid);
$privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.privateKey', Encryption::ID);
$privateKey = $this->crypt->decryptPrivateKey($privateKey);
} else {
+
+ if ($this->util->isMasterKeyEnabled()) {
+ $uid = $this->getMasterKeyId();
+ }
+
$shareKey = $this->getShareKey($path, $uid);
$privateKey = $this->session->getPrivateKey();
}