|
21 | 21 | define('DOCDIR',sprintf('%s/',realpath(LIBDIR.'../doc/')));
|
22 | 22 | define('HOOKSDIR',sprintf('%s/',realpath(LIBDIR.'../hooks/')));
|
23 | 23 | define('JSDIR','js/');
|
| 24 | +define('SESSION_CIPHER','aes256-gcm'); |
24 | 25 |
|
25 | 26 | /**
|
26 | 27 | * Supplimental functions
|
@@ -768,9 +769,9 @@ function blowfish_encrypt($data,$secret=null) {
|
768 | 769 | if (! trim($secret))
|
769 | 770 | return $data;
|
770 | 771 |
|
771 |
| - if (! empty($data) && function_exists('openssl_encrypt') && in_array('bf-ecb', openssl_get_cipher_methods())) { |
772 |
| - $keylen = openssl_cipher_iv_length('bf-ecb') * 2; |
773 |
| - return openssl_encrypt($data, 'bf-ecb', substr($secret,0,$keylen)); |
| 772 | + if (! empty($data) && function_exists('openssl_encrypt') && in_array(SESSION_CIPHER, openssl_get_cipher_methods())) { |
| 773 | + $keylen = openssl_cipher_iv_length(SESSION_CIPHER) * 2; |
| 774 | + return openssl_encrypt($data, SESSION_CIPHER, substr($secret,0,$keylen)); |
774 | 775 | }
|
775 | 776 |
|
776 | 777 | if (function_exists('mcrypt_module_open') && ! empty($data)) {
|
@@ -829,9 +830,9 @@ function blowfish_decrypt($encdata,$secret=null) {
|
829 | 830 | if (! trim($secret))
|
830 | 831 | return $encdata;
|
831 | 832 |
|
832 |
| - if (! empty($encdata) && function_exists('openssl_encrypt') && in_array('bf-ecb', openssl_get_cipher_methods())) { |
833 |
| - $keylen = openssl_cipher_iv_length('bf-ecb') * 2; |
834 |
| - return trim(openssl_decrypt($encdata, 'bf-ecb', substr($secret,0,$keylen))); |
| 833 | + if (! empty($encdata) && function_exists('openssl_encrypt') && in_array(SESSION_CIPHER, openssl_get_cipher_methods())) { |
| 834 | + $keylen = openssl_cipher_iv_length(SESSION_CIPHER) * 2; |
| 835 | + return trim(openssl_decrypt($encdata, SESSION_CIPHER, substr($secret,0,$keylen))); |
835 | 836 | }
|
836 | 837 |
|
837 | 838 | if (function_exists('mcrypt_module_open') && ! empty($encdata)) {
|
|
0 commit comments