summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Peter <github@florin-peter.de>2013-05-18 22:25:47 +0200
committerFlorin Peter <github@florin-peter.de>2013-05-18 22:25:47 +0200
commit227b122947dc92f3d9d3984c1fe00919dc473b8b (patch)
tree21babfc119af2de4a08be28d71e705e22f19a660
parent681252669a237a2383bcdc05892e368785103ad2 (diff)
downloadnextcloud-server-227b122947dc92f3d9d3984c1fe00919dc473b8b.tar.gz
nextcloud-server-227b122947dc92f3d9d3984c1fe00919dc473b8b.zip
fixed again key-manager tests
-rw-r--r--apps/files_encryption/tests/keymanager.php34
1 files changed, 14 insertions, 20 deletions
diff --git a/apps/files_encryption/tests/keymanager.php b/apps/files_encryption/tests/keymanager.php
index 151f6813e0f..48e370d3a53 100644
--- a/apps/files_encryption/tests/keymanager.php
+++ b/apps/files_encryption/tests/keymanager.php
@@ -163,29 +163,23 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
function testGetUserKeys() {
$keys = Encryption\Keymanager::getUserKeys( $this->view, $this->userId );
-
- $this->assertGreaterThan( 26, strlen( $keys['publicKey'] ) );
- $this->assertEquals( '-----BEGIN PUBLIC KEY-----', substr( $keys['publicKey'], 0, 26 ) );
+ $resPublic = openssl_pkey_get_public($keys['publicKey']);
- $privateKey = Encryption\Crypt::symmetricDecryptFileContent( $keys['privateKey'], $this->pass);
+ $this->assertTrue(is_resource($resPublic));
- $this->assertGreaterThan( 27, strlen( $keys['privateKey'] ) );
+ $sslInfoPublic = openssl_pkey_get_details($resPublic);
- $this->assertEquals( '-----BEGIN PRIVATE KEY-----', substr( $privateKey, 0, 27 ) );
-
- }
-
- function testGetPublicKeys() {
-
- # TODO: write me
-
- }
-
- function testGetFileKey() {
-
-// Encryption\Keymanager::getFileKey( $this->view, $this->userId, $this->filePath );
-
+ $this->assertArrayHasKey('key', $sslInfoPublic);
+
+ $privateKey = Encryption\Crypt::symmetricDecryptFileContent( $keys['privateKey'], $this->pass);
+
+ $resPrivate = openssl_pkey_get_private($privateKey);
+
+ $this->assertTrue(is_resource($resPrivate));
+
+ $sslInfoPrivate = openssl_pkey_get_details($resPrivate);
+
+ $this->assertArrayHasKey('key', $sslInfoPrivate);
}
-
}