Add recovery key on public upload
In order to decide if a recovery key needs to be added we always need to check the files owner settings and not the settings of the currently logged in user. Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
parent
cd6afb6957
commit
f7a2b96507
|
@ -60,6 +60,9 @@ class Encryption implements IEncryptionModule {
|
||||||
/** @var string */
|
/** @var string */
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
private $owner;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
private $fileKey;
|
private $fileKey;
|
||||||
|
|
||||||
|
@ -174,6 +177,7 @@ class Encryption implements IEncryptionModule {
|
||||||
$this->path = $this->getPathToRealFile($path);
|
$this->path = $this->getPathToRealFile($path);
|
||||||
$this->accessList = $accessList;
|
$this->accessList = $accessList;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
$this->owner = $this->util->getOwner($path);
|
||||||
$this->isWriteOperation = false;
|
$this->isWriteOperation = false;
|
||||||
$this->writeCache = '';
|
$this->writeCache = '';
|
||||||
|
|
||||||
|
@ -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->owner);
|
||||||
$encryptedKeyfiles = $this->crypt->multiKeyEncrypt($this->fileKey, $publicKeys);
|
$encryptedKeyfiles = $this->crypt->multiKeyEncrypt($this->fileKey, $publicKeys);
|
||||||
$this->keyManager->setAllFileKeys($this->path, $encryptedKeyfiles);
|
$this->keyManager->setAllFileKeys($this->path, $encryptedKeyfiles);
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* encrypt data
|
* encrypt data
|
||||||
*
|
*
|
||||||
|
@ -407,7 +413,7 @@ class Encryption implements IEncryptionModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$publicKeys = $this->keyManager->addSystemKeys($accessList, $publicKeys, $uid);
|
$publicKeys = $this->keyManager->addSystemKeys($accessList, $publicKeys, $this->owner);
|
||||||
|
|
||||||
$encryptedFileKey = $this->crypt->multiKeyEncrypt($fileKey, $publicKeys);
|
$encryptedFileKey = $this->crypt->multiKeyEncrypt($fileKey, $publicKeys);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue