summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-02-05 13:10:28 +0100
committerAndrey Andreev <narf@devilix.net>2014-02-05 13:10:28 +0100
commitd9a48da095e2b76c65b1b9ebd26b6f06c94cb0e5 (patch)
tree643edcde49de348ab7defa94a25f28db5ccf845f
parente7516b09402580c4fe0bf0ff537f367c1ba0efd2 (diff)
CI_Encryption: Add Blowfish to compatibility list
-rw-r--r--system/libraries/Encryption.php18
-rw-r--r--tests/codeigniter/libraries/Encryption_test.php8
2 files changed, 14 insertions, 12 deletions
diff --git a/system/libraries/Encryption.php b/system/libraries/Encryption.php
index 2228ca3a6..d1aed7399 100644
--- a/system/libraries/Encryption.php
+++ b/system/libraries/Encryption.php
@@ -734,21 +734,25 @@ class CI_Encryption {
'aes-128' => 'rijndael-128',
'aes-192' => 'rijndael-128',
'aes-256' => 'rijndael-128',
- 'des3-ede3' => 'tripledes'
+ 'des3-ede3' => 'tripledes',
+ 'bf' => 'blowfish',
),
'openssl' => array(
'rijndael-128' => 'aes-128',
- 'tripledes' => 'des-ede3'
+ 'tripledes' => 'des-ede3',
+ 'blowfish' => 'bf'
)
);
- // Notes regarding other seemingly matching ciphers between
- // MCrypt and OpenSSL:
+ // Notes:
+ //
+ // - Blowfish is said to be supporting key sizes between
+ // 4 and 56 bytes, but it appears that between MCrypt and
+ // OpenSSL, only those of 16 and more bytes are compatible.
+ //
+ // Other seemingly matching ciphers between MCrypt, OpenSSL:
//
// - DES is compatible, but doesn't need an alias
- // - Blowfish is NOT compatible
- // mcrypt: 'blowfish', 'blowfish-compat'
- // openssl: 'bf'
// - CAST-128/CAST5 is NOT compatible
// mcrypt: 'cast-128'
// openssl: 'cast5'
diff --git a/tests/codeigniter/libraries/Encryption_test.php b/tests/codeigniter/libraries/Encryption_test.php
index 3d091e8d8..b13cb3140 100644
--- a/tests/codeigniter/libraries/Encryption_test.php
+++ b/tests/codeigniter/libraries/Encryption_test.php
@@ -21,10 +21,6 @@ class Encryption_test extends CI_TestCase {
$message = 'This is a message encrypted via MCrypt and decrypted via OpenSSL, or vice-versa.';
- // As it turns out, only ciphers that happened to be a US standard have a
- // somewhat consistent implementation between MCrypt and OpenSSL, so
- // we can only test AES, DES and TripleDES.
- //
// Format is: <MCrypt cipher name>, <OpenSSL cipher name>, <key size>
$portable = array(
array('rijndael-128', 'aes-128', 16),
@@ -33,7 +29,9 @@ class Encryption_test extends CI_TestCase {
array('des', 'des', 7),
array('tripledes', 'des-ede3', 7),
array('tripledes', 'des-ede3', 14),
- array('tripledes', 'des-ede3', 21)
+ array('tripledes', 'des-ede3', 21),
+ array('blowfish', 'bf', 16),
+ array('blowfish', 'bf', 56)
);
$driver_index = array('mcrypt', 'openssl');