diff options
author | Andrey Andreev <narf@devilix.net> | 2014-02-05 22:11:23 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2014-02-05 22:11:23 +0100 |
commit | 8d33a9a4a8ac924678ae5bba6387ca7fce206f4b (patch) | |
tree | 6346b721e1b37bcb5c6274fcade57aa40d9fe7af /tests | |
parent | 8e20216f25624524d7d6e0322e85e6ccb47e3778 (diff) |
CI_Encryption: HMAC to not be derived from the encryption key
Diffstat (limited to 'tests')
-rw-r--r-- | tests/codeigniter/libraries/Encryption_test.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/codeigniter/libraries/Encryption_test.php b/tests/codeigniter/libraries/Encryption_test.php index ca1a4cd60..da9870fc5 100644 --- a/tests/codeigniter/libraries/Encryption_test.php +++ b/tests/codeigniter/libraries/Encryption_test.php @@ -74,18 +74,20 @@ class Encryption_test extends CI_TestCase { // Add some randomness to the selected driver $driver = mt_rand(0,1); $params = array( + 'driver' => $driver_index[$driver], 'cipher' => $test[0], 'mode' => $test[1], 'key' => openssl_random_pseudo_bytes($test[2]) ); - $this->encryption->initialize(array('driver' => $driver_index[$driver])); - $ciphertext = $this->encryption->encrypt($message, $params); + $this->encryption->initialize($params); + $ciphertext = $this->encryption->encrypt($message); $driver = (int) ! $driver; + $params['driver'] = $driver_index[$driver]; - $this->encryption->initialize(array('driver' => $driver_index[$driver])); - $this->assertEquals($message, $this->encryption->decrypt($ciphertext, $params)); + $this->encryption->initialize($params); + $this->assertEquals($message, $this->encryption->decrypt($ciphertext)); } } |