mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
Added replacement for mcrypt removal in PHP 7.2, added stronger encryption options
SVN:trunk[5996]
This commit is contained in:
@@ -2737,7 +2737,7 @@ class AttributeEncryptedString extends AttributeString
|
||||
const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW;
|
||||
|
||||
static $sKey = null; // Encryption key used for all encrypted fields
|
||||
|
||||
static $sLibrary = null; // Encryption library used for all encrypted fields
|
||||
public function __construct($sCode, $aParams)
|
||||
{
|
||||
parent::__construct($sCode, $aParams);
|
||||
@@ -2745,6 +2745,10 @@ class AttributeEncryptedString extends AttributeString
|
||||
{
|
||||
self::$sKey = MetaModel::GetConfig()->GetEncryptionKey();
|
||||
}
|
||||
if(self::$sLibrary == null)
|
||||
{
|
||||
self::$sLibrary = MetaModel::GetConfig()->GetEncryptionLibrary();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* When the attribute definitions are stored in APC cache:
|
||||
@@ -2760,6 +2764,10 @@ class AttributeEncryptedString extends AttributeString
|
||||
{
|
||||
self::$sKey = MetaModel::GetConfig()->GetEncryptionKey();
|
||||
}
|
||||
if(self::$sLibrary == null)
|
||||
{
|
||||
self::$sLibrary = MetaModel::GetConfig()->GetEncryptionLibrary();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2788,7 +2796,7 @@ class AttributeEncryptedString extends AttributeString
|
||||
*/
|
||||
public function FromSQLToValue($aCols, $sPrefix = '')
|
||||
{
|
||||
$oSimpleCrypt = new SimpleCrypt();
|
||||
$oSimpleCrypt = new SimpleCrypt(self::$sLibrary);
|
||||
$sValue = $oSimpleCrypt->Decrypt(self::$sKey, $aCols[$sPrefix]);
|
||||
return $sValue;
|
||||
}
|
||||
@@ -2798,7 +2806,7 @@ class AttributeEncryptedString extends AttributeString
|
||||
*/
|
||||
public function GetSQLValues($value)
|
||||
{
|
||||
$oSimpleCrypt = new SimpleCrypt();
|
||||
$oSimpleCrypt = new SimpleCrypt(self::$sLibrary);
|
||||
$encryptedValue = $oSimpleCrypt->Encrypt(self::$sKey, $value);
|
||||
|
||||
$aValues = array();
|
||||
|
||||
Reference in New Issue
Block a user