diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2015-04-13 15:56:36 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2015-04-30 12:04:02 +0200 |
commit | 4ef9df8750553518143a7b1d088ab755db482cf1 (patch) | |
tree | 7f0a4885b29be371126ad81913bb01445c79a45a /apps/encryption/lib | |
parent | d308ec4f0ea54e8cb0c99228a480da8cb7cf30a8 (diff) | |
download | nextcloud-server-4ef9df8750553518143a7b1d088ab755db482cf1.tar.gz nextcloud-server-4ef9df8750553518143a7b1d088ab755db482cf1.zip |
skip user if we don't have a public key
Diffstat (limited to 'apps/encryption/lib')
-rw-r--r-- | apps/encryption/lib/crypto/encryption.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/apps/encryption/lib/crypto/encryption.php b/apps/encryption/lib/crypto/encryption.php index 4e181b0712a..0fb6f257f31 100644 --- a/apps/encryption/lib/crypto/encryption.php +++ b/apps/encryption/lib/crypto/encryption.php @@ -25,6 +25,7 @@ namespace OCA\Encryption\Crypto; +use OCA\Encryption\Exceptions\PublicKeyMissingException; use OCA\Encryption\Util; use OCP\Encryption\IEncryptionModule; use OCA\Encryption\KeyManager; @@ -67,6 +68,7 @@ class Encryption implements IEncryptionModule { /** @var Util */ private $util; + /** @var ILogger */ private $logger; @@ -161,6 +163,9 @@ class Encryption implements IEncryptionModule { * @param string $path to the file * @return string remained data which should be written to the file in case * of a write operation + * @throws PublicKeyMissingException + * @throws \Exception + * @throws \OCA\Encryption\Exceptions\MultiKeyEncryptException */ public function end($path) { $result = ''; @@ -171,7 +176,16 @@ class Encryption implements IEncryptionModule { } $publicKeys = array(); foreach ($this->accessList['users'] as $uid) { - $publicKeys[$uid] = $this->keyManager->getPublicKey($uid); + try { + $publicKeys[$uid] = $this->keyManager->getPublicKey($uid); + } catch (PublicKeyMissingException $e) { + $this->logger->warning('no public key found for user \'' . $uid . + '\', user will not be able to read the file', array('app' => 'encryption')); + // if the public key of the owner is missing we should fail + if ($uid === $this->user) { + throw $e; + } + } } $publicKeys = $this->keyManager->addSystemKeys($this->accessList, $publicKeys); |