summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/tests
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-11-14 17:30:38 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2014-11-26 10:57:47 +0100
commita90606fb14adc0aa149a87528d4f1ce61d0250e9 (patch)
tree314b9edadf1e00211a65578c6f913eb23ab8b44d /apps/files_encryption/tests
parent266f1a2afa890a7e2750a51fa3d6da98240751fe (diff)
downloadnextcloud-server-a90606fb14adc0aa149a87528d4f1ce61d0250e9.tar.gz
nextcloud-server-a90606fb14adc0aa149a87528d4f1ce61d0250e9.zip
change private/public key names for consistency reasons
Diffstat (limited to 'apps/files_encryption/tests')
-rw-r--r--apps/files_encryption/tests/hooks.php4
-rw-r--r--apps/files_encryption/tests/keymanager.php13
-rwxr-xr-xapps/files_encryption/tests/share.php8
-rwxr-xr-xapps/files_encryption/tests/util.php12
4 files changed, 21 insertions, 16 deletions
diff --git a/apps/files_encryption/tests/hooks.php b/apps/files_encryption/tests/hooks.php
index 944d8a38870..fc40d4cd61f 100644
--- a/apps/files_encryption/tests/hooks.php
+++ b/apps/files_encryption/tests/hooks.php
@@ -439,8 +439,8 @@ class Test_Encryption_Hooks extends \OCA\Files_Encryption\Tests\TestCase {
// set user password for the first time
\OCA\Encryption\Hooks::postCreateUser(array('uid' => 'newUser', 'password' => 'newUserPassword'));
- $this->assertTrue($view->file_exists('public-keys/newUser.public.key'));
- $this->assertTrue($view->file_exists('newUser/files_encryption/newUser.private.key'));
+ $this->assertTrue($view->file_exists('public-keys/newUser.publicKey'));
+ $this->assertTrue($view->file_exists('newUser/files_encryption/newUser.privateKey'));
// check if we are able to decrypt the private key
$encryptedKey = \OCA\Encryption\Keymanager::getPrivateKey($view, 'newUser');
diff --git a/apps/files_encryption/tests/keymanager.php b/apps/files_encryption/tests/keymanager.php
index d4a3f85ed48..f86f7d894ce 100644
--- a/apps/files_encryption/tests/keymanager.php
+++ b/apps/files_encryption/tests/keymanager.php
@@ -175,7 +175,7 @@ class Test_Encryption_Keymanager extends \OCA\Files_Encryption\Tests\TestCase {
Encryption\Keymanager::setPrivateKey($key, 'dummyUser');
- $this->assertTrue($this->view->file_exists('/dummyUser/files_encryption/dummyUser.private.key'));
+ $this->assertTrue($this->view->file_exists('/dummyUser/files_encryption/dummyUser.privateKey'));
//clean up
$this->view->deleteAll('/dummyUser');
@@ -187,14 +187,19 @@ class Test_Encryption_Keymanager extends \OCA\Files_Encryption\Tests\TestCase {
function testSetPrivateSystemKey() {
$key = "dummy key";
- $keyName = "myDummyKey.private.key";
+ $keyName = "myDummyKey";
+ $encHeader = Encryption\Crypt::generateHeader();
Encryption\Keymanager::setPrivateSystemKey($key, $keyName);
- $this->assertTrue($this->view->file_exists('/owncloud_private_key/' . $keyName));
+ $this->assertTrue($this->view->file_exists('/owncloud_private_key/' . $keyName . '.privateKey'));
+
+ $result = Encryption\Keymanager::getPrivateSystemKey($keyName);
+
+ $this->assertSame($encHeader . $key, $result);
// clean up
- $this->view->unlink('/owncloud_private_key/' . $keyName);
+ $this->view->unlink('/owncloud_private_key/' . $keyName.'.privateKey');
}
diff --git a/apps/files_encryption/tests/share.php b/apps/files_encryption/tests/share.php
index 48aaec5c196..d7afc9e2da7 100755
--- a/apps/files_encryption/tests/share.php
+++ b/apps/files_encryption/tests/share.php
@@ -915,8 +915,8 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase {
$this->assertGreaterThan(0, $fileInfo['unencrypted_size']);
// break users public key
- $this->view->rename('/public-keys/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3 . '.public.key',
- '/public-keys/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3 . '.public.key_backup');
+ $this->view->rename('/public-keys/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3 . '.publicKey',
+ '/public-keys/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3 . '.publicKey_backup');
// re-enable the file proxy
\OC_FileProxy::$enabled = $proxyStatus;
@@ -943,8 +943,8 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase {
// break user1 public key
$this->view->rename(
- '/public-keys/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3 . '.public.key_backup',
- '/public-keys/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3 . '.public.key');
+ '/public-keys/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3 . '.publicKey_backup',
+ '/public-keys/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3 . '.publicKey');
// remove share file
$this->view->unlink('/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1 . '/files_encryption/keys/'
diff --git a/apps/files_encryption/tests/util.php b/apps/files_encryption/tests/util.php
index fc6145a8cb5..96e8fcd81fe 100755
--- a/apps/files_encryption/tests/util.php
+++ b/apps/files_encryption/tests/util.php
@@ -89,9 +89,9 @@ class Test_Encryption_Util extends \OCA\Files_Encryption\Tests\TestCase {
$this->encryptionDir = '/' . $this->userId . '/' . 'files_encryption';
$this->keysPath = $this->encryptionDir . '/' . 'keys';
$this->publicKeyPath =
- $this->publicKeyDir . '/' . $this->userId . '.public.key'; // e.g. data/public-keys/admin.public.key
+ $this->publicKeyDir . '/' . $this->userId . '.publicKey'; // e.g. data/public-keys/admin.publicKey
$this->privateKeyPath =
- $this->encryptionDir . '/' . $this->userId . '.private.key'; // e.g. data/admin/admin.private.key
+ $this->encryptionDir . '/' . $this->userId . '.privateKey'; // e.g. data/admin/admin.privateKey
$this->view = new \OC\Files\View('/');
@@ -402,8 +402,8 @@ class Test_Encryption_Util extends \OCA\Files_Encryption\Tests\TestCase {
$this->assertTrue($this->view->is_dir($backupPath . '/keys'));
$this->assertTrue($this->view->file_exists($backupPath . '/keys/' . $filename . '/fileKey'));
$this->assertTrue($this->view->file_exists($backupPath . '/keys/' . $filename . '/' . $user . '.shareKey'));
- $this->assertTrue($this->view->file_exists($backupPath . '/' . $user . '.private.key'));
- $this->assertTrue($this->view->file_exists($backupPath . '/' . $user . '.public.key'));
+ $this->assertTrue($this->view->file_exists($backupPath . '/' . $user . '.privateKey'));
+ $this->assertTrue($this->view->file_exists($backupPath . '/' . $user . '.publicKey'));
// cleanup
$this->view->unlink($this->userId . '/files/' . $filename);
@@ -435,8 +435,8 @@ class Test_Encryption_Util extends \OCA\Files_Encryption\Tests\TestCase {
$this->assertTrue($this->view->is_dir($backupPath . '/keys/foo'));
$this->assertTrue($this->view->file_exists($backupPath . '/keys/foo/fileKey'));
$this->assertTrue($this->view->file_exists($backupPath . '/keys/foo/user1.shareKey'));
- $this->assertTrue($this->view->file_exists($backupPath . '/' . self::TEST_ENCRYPTION_UTIL_USER1 . '.private.key'));
- $this->assertTrue($this->view->file_exists($backupPath . '/' . self::TEST_ENCRYPTION_UTIL_USER1 . '.public.key'));
+ $this->assertTrue($this->view->file_exists($backupPath . '/' . self::TEST_ENCRYPTION_UTIL_USER1 . '.privateKey'));
+ $this->assertTrue($this->view->file_exists($backupPath . '/' . self::TEST_ENCRYPTION_UTIL_USER1 . '.publicKey'));
//cleanup
$this->view->deleteAll($backupPath);