|
|
@ -46,21 +46,18 @@ class Framework_Rcube extends PHPUnit\Framework\TestCase |
|
|
|
function test_encrypt_and_decrypt() |
|
|
|
{ |
|
|
|
$rcube = rcube::get_instance(); |
|
|
|
$result = $rcube->decrypt($rcube->encrypt('test')); |
|
|
|
|
|
|
|
$result = $rcube->decrypt($rcube->encrypt('test')); |
|
|
|
$this->assertSame('test', $result); |
|
|
|
|
|
|
|
// The following tests fail quite often, therefore we disable them
|
|
|
|
$this->markTestSkipped(); |
|
|
|
|
|
|
|
// Test AEAD cipher method
|
|
|
|
$defaultCipherMethod = $rcube->config->get('cipher_method'); |
|
|
|
$rcube->config->set('cipher_method', 'aes-256-gcm'); |
|
|
|
|
|
|
|
$result = $rcube->decrypt($rcube->encrypt('test')); |
|
|
|
|
|
|
|
$this->assertSame('test', $result); |
|
|
|
|
|
|
|
// Back to the default
|
|
|
|
$rcube->config->set('cipher_method', 'DES-EDE3-CBC'); |
|
|
|
try { |
|
|
|
$result = $rcube->decrypt($rcube->encrypt('test')); |
|
|
|
$this->assertSame('test', $result); |
|
|
|
} finally { |
|
|
|
$rcube->config->set('cipher_method', $defaultCipherMethod); |
|
|
|
} |
|
|
|
} |
|
|
|
} |