diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2016-02-29 14:50:56 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2016-02-29 14:54:32 +0100 |
commit | 95ea2ccb53e96ce91738c5c4aa4f36c520d76bd9 (patch) | |
tree | 0eb58c76519da5056f334985e6d84618b45f226f /apps/encryption/tests | |
parent | a38e8b6436ccfe173b4d368d094753c71bdbd69f (diff) | |
download | nextcloud-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.php | 14 |
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'] ]; } |