Closed lwd-adam closed 4 years ago
/classes/encrypt.class.php
<?
/*************************************************************************|
|--------------- Encryption class ----------------------------------------|
|*************************************************************************|
This class handles encryption and decryption, that's all folks.
|*************************************************************************/
if (!extension_loaded('openssl')) {
die('Openssl Extension not loaded.');
}
class CRYPT {
public function encrypt($Str, $Key = ENCKEY) {
$IVSize = openssl_cipher_iv_length(AES-256-CBC);
$IV = openssl_random_pseudo_bytes($IVSize);
$CryptStr = openssl_encrypt($Str, AES-256-CBC, $Key, OPENSSL_RAW_DATA, $IV);
return base64_encode($IV.$CryptStr);
}
public function decrypt($CryptStr, $Key = ENCKEY) {
if ($CryptStr != '') {
$data = base64_decode($CryptStr);
$IVSize = openssl_ciper_iv_length(AES-256-CBC);
$iv = substr($data, 0, $IVSize);
return openssl_decrypt(substr($data, $IVSize), AES-256-CBC, $key, OPENSSL_RAW_DATA, $iv);
} else {
return '';
}
}
} // class ENCRYPT()
?>
Howdy all. Thought this would be the best tracker to try first! Looks great. Seems like I may be late to the party though.
I've completed the tutorial on 20.04, except for installing Mcrypt - PHP 7.2 deprecated it. So, I see "Mcrypt Extension not loaded." when I visit my new Gazelle site.
Has anyone continued working with this in PHP 7.2+? I would like to know how you compensated for Mcrypt, if you don't mind. Novice area for me. Thanks for anything / everything so far.