summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/lib/stream.php
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-10-11 14:20:46 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2013-10-11 14:20:46 +0200
commit39d710e737da31111f62b44abf30b0be95246c99 (patch)
treeb2eefe4f0800be7dc1caab4b8be1c74dae452457 /apps/files_encryption/lib/stream.php
parent4336d42ab095c304d0a46bb30c2d0203e606597e (diff)
downloadnextcloud-server-39d710e737da31111f62b44abf30b0be95246c99.tar.gz
nextcloud-server-39d710e737da31111f62b44abf30b0be95246c99.zip
block file access if share keys are missing
Diffstat (limited to 'apps/files_encryption/lib/stream.php')
-rw-r--r--apps/files_encryption/lib/stream.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index b25ba7bb677..5ce5caf80ce 100644
--- a/apps/files_encryption/lib/stream.php
+++ b/apps/files_encryption/lib/stream.php
@@ -254,16 +254,20 @@ class Stream {
// If a keyfile already exists
if ($this->encKeyfile) {
+ $shareKey = Keymanager::getShareKey($this->rootView, $this->userId, $this->relPath);
+
// if there is no valid private key return false
if ($this->privateKey === false) {
-
// if private key is not valid redirect user to a error page
- \OCA\Encryption\Helper::redirectToErrorPage();
-
+ \OCA\Encryption\Helper::redirectToErrorPage($this->session);
return false;
}
- $shareKey = Keymanager::getShareKey($this->rootView, $this->userId, $this->relPath);
+ if ($shareKey === false) {
+ // if no share key is available redirect user to a error page
+ \OCA\Encryption\Helper::redirectToErrorPage($this->session, \OCA\Encryption\Crypt::ENCRYPTION_NO_SHARE_KEY_FOUND);
+ return false;
+ }
$this->plainKey = Crypt::multiKeyDecrypt($this->encKeyfile, $shareKey, $this->privateKey);