summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-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);
}
-
}