summaryrefslogtreecommitdiffstats
path: root/apps/encryption/lib/crypto/encryption.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/encryption/lib/crypto/encryption.php')
-rw-r--r--apps/encryption/lib/crypto/encryption.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/apps/encryption/lib/crypto/encryption.php b/apps/encryption/lib/crypto/encryption.php
index 66cb1dc434b..516d7b1304a 100644
--- a/apps/encryption/lib/crypto/encryption.php
+++ b/apps/encryption/lib/crypto/encryption.php
@@ -117,11 +117,16 @@ class Encryption implements IEncryptionModule {
$this->writeCache = '';
}
$publicKeys = array();
- foreach ($this->accessList['users'] as $user) {
- $publicKeys[] = $this->keymanager->getPublicKey($user);
+ foreach ($this->accessList['users'] as $uid) {
+ $publicKeys[$uid] = $this->keymanager->getPublicKey($uid);
}
- $result = $this->crypt->multiKeyEncrypt($this->fileKey, $publicKeys);
+ $encryptedKeyfiles = $this->crypt->multiKeyEncrypt($this->fileKey, $publicKeys);
+
+ $this->keymanager->setFileKey($path, $encryptedKeyfiles['data']);
+ foreach ($encryptedKeyfiles['keys'] as $uid => $keyFile) {
+ $this->keymanager->setShareKey($path, $uid, $keyFile);
+ }
}
return $result;
}