Update: 2026-06-24 22:56:39
This commit is contained in:
@@ -34,6 +34,15 @@ class EncryptionHelper
|
||||
return self::PREFIX_GCM . base64_encode($iv . $tag . $encrypted);
|
||||
}
|
||||
|
||||
// ─── تشفير نص باستخدام AES-256-CBC الحتمي ──
|
||||
public function encryptDataDeterministic(string $plainText): string
|
||||
{
|
||||
$plainText = mb_convert_encoding($plainText, 'UTF-8');
|
||||
$padded = $this->addPadding($plainText);
|
||||
$encrypted = openssl_encrypt($padded, self::ALGO_CBC, $this->key, OPENSSL_RAW_DATA, $this->cbcIv);
|
||||
return base64_encode($encrypted);
|
||||
}
|
||||
|
||||
// ─── فك تشفير نص (يدعم CBC والـ GCM المستقبلي) ───────────
|
||||
public function decryptData(string $cipherText): string|false
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user