Update security.php
This commit is contained in:
parent
2cad20a2ff
commit
83116e600d
|
@ -425,44 +425,54 @@ if(!function_exists("get_callable_token")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!function_exists("encapsulate_text")) {
|
if(!function_exists("encapsulate_text")) {
|
||||||
function encapsulate_text($text, $method="aes-128-cbc", $key="", $iv="") {
|
function encapsulate_text($text, $algo="aes-128-cbc", $key="", $iv="") {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$encapsulated_text = "";
|
$encapsulated_text = "";
|
||||||
$encrypted_text = "";
|
$encrypted_text = "";
|
||||||
|
|
||||||
$init_text = base64_encode($text);
|
$init_text = base64_encode($text);
|
||||||
|
|
||||||
|
if($algo == "base64") {
|
||||||
|
$encapsulated_text = $init_text;
|
||||||
|
} else {
|
||||||
$init_key = empty($key) ? $config['masterkey'] : $key;
|
$init_key = empty($key) ? $config['masterkey'] : $key;
|
||||||
$init_iv = empty($iv) ? $config['masteriv'] : $iv;
|
$init_iv = empty($iv) ? $config['masteriv'] : $iv;
|
||||||
|
|
||||||
if(function_exists("openssl_encrypt")) {
|
if(function_exists("openssl_encrypt")) {
|
||||||
$encrypted_text = @openssl_encrypt($init_text , $method, $init_key, true, $init_iv);
|
$encrypted_text = @openssl_encrypt($init_text ,$algo, $init_key, true, $init_iv);
|
||||||
if(!empty($encrypted_text)) {
|
if(!empty($encrypted_text)) {
|
||||||
$encapsulated_text = base64_encode($encrypted_text);
|
$encapsulated_text = base64_encode($encrypted_text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $encapsulated_text;
|
return $encapsulated_text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!function_exists("decapsulate_text")) {
|
if(!function_exists("decapsulate_text")) {
|
||||||
function decapsulate_text($text, $method="aes-128-cbc", $key="", $iv="") {
|
function decapsulate_text($text, $algo="aes-128-cbc", $key="", $iv="") {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$decapsulate_text = "";
|
$decapsulate_text = "";
|
||||||
$decrypted_text = "";
|
$decrypted_text = "";
|
||||||
|
|
||||||
$init_text = base64_decode($text);
|
$init_text = base64_decode($text);
|
||||||
|
|
||||||
|
if($algo = "base64") {
|
||||||
|
$decapsulate_text = $init_text;
|
||||||
|
} else {
|
||||||
$init_key = empty($key) ? $config['masterkey'] : $key;
|
$init_key = empty($key) ? $config['masterkey'] : $key;
|
||||||
$init_iv = empty($iv) ? $config['masteriv'] : $iv;
|
$init_iv = empty($iv) ? $config['masteriv'] : $iv;
|
||||||
|
|
||||||
if(function_exists("openssl_decrypt")) {
|
if(function_exists("openssl_decrypt")) {
|
||||||
$encrypted_text = @openssl_decrypt($init_text , $method, $init_key, true, $init_iv);
|
$encrypted_text = @openssl_decrypt($init_text ,$algo, $init_key, true, $init_iv);
|
||||||
if(!empty($encrypted_text)) {
|
if(!empty($encrypted_text)) {
|
||||||
$decapsulate_text = base64_encode($decrypted_text);
|
$decapsulate_text = base64_encode($decrypted_text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $decapsulate_text;
|
return $decapsulate_text;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user