-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unit tests Encryption_test::test_initialize_encrypt_decrypt fails with OpenSSL3 #6171
Comments
PR #6173 fixes the deprecation warnings. With OpenSSL3, some ciphers are not available anymore when the legacy This leads to the failure of See: https://wiki.openssl.org/index.php/OpenSSL_3.0#Providers
Since the test uses
it fails. So a solution would be to use another cipher: "tripledes" instead of "des" --- a/tests/codeigniter/libraries/Encryption_test.php
+++ b/tests/codeigniter/libraries/Encryption_test.php
@@ -208,7 +208,7 @@ class Encryption_test extends CI_TestCase {
$this->assertEquals($message, $this->encryption->decrypt($this->encryption->encrypt($message)));
// Try DES in ECB mode, just for the sake of changing stuff
- $this->encryption->initialize(array('cipher' => 'des', 'mode' => 'ecb', 'key' => substr($key, 0, 8)));
+ $this->encryption->initialize(array('cipher' => 'tripledes', 'mode' => 'ecb', 'key' => substr($key, 0, 8)));
$this->assertEquals($message, $this->encryption->decrypt($this->encryption->encrypt($message)));
}
|
Another solution which would make it work for both openssl 1 & 3 --- a/tests/codeigniter/libraries/Encryption_test.php
+++ b/tests/codeigniter/libraries/Encryption_test.php
@@ -208,7 +208,11 @@
$this->assertEquals($message, $this->encryption->decrypt($this->encryption->encrypt($message)));
// Try DES in ECB mode, just for the sake of changing stuff
- $this->encryption->initialize(array('cipher' => 'des', 'mode' => 'ecb', 'key' => substr($key, 0, 8)));
+ if(OPENSSL_VERSION_NUMBER >= 0x3000000f) {
+ $this->encryption->initialize(array('cipher' => 'tripledes', 'mode' => 'ecb', 'key' => substr($key, 0, 8)));
+ } else {
+ $this->encryption->initialize(array('cipher' => 'des', 'mode' => 'ecb', 'key' => substr($key, 0, 8)));
+ }
$this->assertEquals($message, $this->encryption->decrypt($this->encryption->encrypt($message)));
}
|
Fixed via #6261. We might consider the OpenSSL version/similar solution in the future, but for now, I marked the test as skipped for older PHP versions only. |
running the unit tests of CI3 leads to 1 error and 9 deprecation notices:
Deprecation notices:
Failures
The text was updated successfully, but these errors were encountered: