fixed key-manager tests
This commit is contained in:
parent
80f9c5bb6d
commit
e0e89602a2
|
@ -88,20 +88,27 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
$privateKey = Encryption\Crypt::symmetricDecryptFileContent( $key, $this->pass);
|
$privateKey = Encryption\Crypt::symmetricDecryptFileContent( $key, $this->pass);
|
||||||
|
|
||||||
// Will this length vary? Perhaps we should use a range instead
|
$res = openssl_pkey_get_private($privateKey);
|
||||||
$this->assertGreaterThan( 27, strlen( $privateKey ) );
|
|
||||||
|
|
||||||
$this->assertEquals( '-----BEGIN PRIVATE KEY-----', substr( $privateKey, 0, 27 ) );
|
$this->assertTrue(is_resource($res));
|
||||||
|
|
||||||
|
$sslInfo = openssl_pkey_get_details($res);
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('key', $sslInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testGetPublicKey() {
|
function testGetPublicKey() {
|
||||||
|
|
||||||
$key = Encryption\Keymanager::getPublicKey( $this->view, $this->userId );
|
$publiceKey = Encryption\Keymanager::getPublicKey( $this->view, $this->userId );
|
||||||
|
|
||||||
$this->assertGreaterThan( 26, strlen( $key ) );
|
$res = openssl_pkey_get_public($publiceKey);
|
||||||
|
|
||||||
$this->assertEquals( '-----BEGIN PUBLIC KEY-----', substr( $key, 0, 26 ) );
|
$this->assertTrue(is_resource($res));
|
||||||
|
|
||||||
|
$sslInfo = openssl_pkey_get_details($res);
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('key', $sslInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testSetFileKey() {
|
function testSetFileKey() {
|
||||||
|
|
Loading…
Reference in New Issue