summaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests/lib/crypto/decryptalltest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/encryption/tests/lib/crypto/decryptalltest.php')
-rw-r--r--apps/encryption/tests/lib/crypto/decryptalltest.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/encryption/tests/lib/crypto/decryptalltest.php b/apps/encryption/tests/lib/crypto/decryptalltest.php
index 84819aa73bd..0945692e427 100644
--- a/apps/encryption/tests/lib/crypto/decryptalltest.php
+++ b/apps/encryption/tests/lib/crypto/decryptalltest.php
@@ -87,7 +87,7 @@ class DecryptAllTest extends TestCase {
* @param string $user
* @param string $recoveryKeyId
*/
- public function testGetPrivateKey($user, $recoveryKeyId) {
+ public function testGetPrivateKey($user, $recoveryKeyId, $masterKeyId) {
$password = 'passwd';
$recoveryKey = 'recoveryKey';
$userKey = 'userKey';
@@ -102,6 +102,13 @@ class DecryptAllTest extends TestCase {
$this->keyManager->expects($this->never())->method('getPrivateKey');
$this->crypt->expects($this->once())->method('decryptPrivateKey')
->with($recoveryKey, $password)->willReturn($unencryptedKey);
+ } elseif ($user === $masterKeyId) {
+ $this->keyManager->expects($this->once())->method('getSystemPrivateKey')
+ ->with($masterKeyId)->willReturn($masterKey);
+ $this->keyManager->expects($this->never())->method('getPrivateKey');
+ $this->crypt->expects($this->once())->method('decryptPrivateKey')
+ ->with($masterKey, $password, $masterKeyId)->willReturn($unencryptedKey);
+
} else {
$this->keyManager->expects($this->never())->method('getSystemPrivateKey');
$this->keyManager->expects($this->once())->method('getPrivateKey')
@@ -117,8 +124,9 @@ class DecryptAllTest extends TestCase {
public function dataTestGetPrivateKey() {
return [
- ['user1', 'recoveryKey'],
- ['recoveryKeyId', 'recoveryKeyId']
+ ['user1', 'recoveryKey', 'masterKeyId'],
+ ['recoveryKeyId', 'recoveryKeyId', 'masterKeyId'],
+ ['masterKeyId', 'masterKeyId', 'masterKeyId']
];
}