aboutsummaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2016-02-29 14:50:56 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2016-02-29 14:54:32 +0100
commit95ea2ccb53e96ce91738c5c4aa4f36c520d76bd9 (patch)
tree0eb58c76519da5056f334985e6d84618b45f226f /apps/encryption/tests
parenta38e8b6436ccfe173b4d368d094753c71bdbd69f (diff)
downloadnextcloud-server-95ea2ccb53e96ce91738c5c4aa4f36c520d76bd9.tar.gz
nextcloud-server-95ea2ccb53e96ce91738c5c4aa4f36c520d76bd9.zip
make decrypt all work with the master key
Diffstat (limited to 'apps/encryption/tests')
-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']
];
}