summaryrefslogtreecommitdiffstats
path: root/apps/encryption/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2016-03-02 11:27:29 +0100
committerBjörn Schießle <schiessle@owncloud.com>2016-04-26 11:06:55 +0200
commitd86f8ba5f8718329fb0742be3e18f229c1f56a34 (patch)
treedf632abfaa93c3d075d9f066099ca1706ee24d05 /apps/encryption/lib
parent088ffd05d7a60c5be2dbe8b56b6223a774b0822c (diff)
downloadnextcloud-server-d86f8ba5f8718329fb0742be3e18f229c1f56a34.tar.gz
nextcloud-server-d86f8ba5f8718329fb0742be3e18f229c1f56a34.zip
if we don't have a encrypted file key we can return a empty string right away
Diffstat (limited to 'apps/encryption/lib')
-rw-r--r--apps/encryption/lib/keymanager.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/apps/encryption/lib/keymanager.php b/apps/encryption/lib/keymanager.php
index 5cce760fa59..4f22c3def63 100644
--- a/apps/encryption/lib/keymanager.php
+++ b/apps/encryption/lib/keymanager.php
@@ -394,17 +394,20 @@ class KeyManager {
public function getFileKey($path, $uid) {
$encryptedFileKey = $this->keyStorage->getFileKey($path, $this->fileKeyId, Encryption::ID);
+ if (empty($encryptedFileKey)) {
+ return '';
+ }
+
+ 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();
}