Files
laravel-gost-template/app/Services/Crypto/LaravelAesCipher.php
2026-06-24 17:20:43 +09:00

32 lines
871 B
PHP

<?php
namespace App\Services\Crypto;
use Illuminate\Contracts\Encryption\Encrypter;
/**
* Драйвер шифрования на встроенном шифраторе Laravel (AES-256-GCM).
*
* Применяется по умолчанию. Для государственных ИС, требующих
* сертифицированные СКЗИ, замените на {@see GostCipher}.
*/
class LaravelAesCipher implements PdnCipher
{
public function __construct(private readonly Encrypter $encrypter) {}
public function encrypt(string $plaintext): string
{
return $this->encrypter->encryptString($plaintext);
}
public function decrypt(string $ciphertext): string
{
return $this->encrypter->decryptString($ciphertext);
}
public function algorithm(): string
{
return 'AES-256-GCM';
}
}