Skip to content
Snippets Groups Projects
Commit 227b1229 authored by Florin Peter's avatar Florin Peter
Browse files

fixed again key-manager tests

parent 68125266
No related branches found
No related tags found
No related merge requests found
...@@ -163,29 +163,23 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase { ...@@ -163,29 +163,23 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
function testGetUserKeys() { function testGetUserKeys() {
$keys = Encryption\Keymanager::getUserKeys( $this->view, $this->userId ); $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 ) ); $this->assertArrayHasKey('key', $sslInfoPublic);
} $privateKey = Encryption\Crypt::symmetricDecryptFileContent( $keys['privateKey'], $this->pass);
function testGetPublicKeys() { $resPrivate = openssl_pkey_get_private($privateKey);
# TODO: write me $this->assertTrue(is_resource($resPrivate));
} $sslInfoPrivate = openssl_pkey_get_details($resPrivate);
function testGetFileKey() { $this->assertArrayHasKey('key', $sslInfoPrivate);
// Encryption\Keymanager::getFileKey( $this->view, $this->userId, $this->filePath );
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment