up. 双向数据加密

This commit is contained in:
u2nyakim 2025-08-29 16:18:02 +08:00
parent 1e8aac7a32
commit dc53249596

View File

@ -76,10 +76,10 @@ class Request extends \think\Request
$key = $keyIv['key']; $key = $keyIv['key'];
$iv = $keyIv['iv']; $iv = $keyIv['iv'];
// 添加 PKCS#7 填充 // // 添加 PKCS#7 填充
$blockSize = 16; // AES 块大小 // $blockSize = 16; // AES 块大小
$padding = $blockSize - (strlen($data) % $blockSize); // $padding = $blockSize - (strlen($data) % $blockSize);
$data .= str_repeat(chr($padding), $padding); // $data .= str_repeat(chr($padding), $padding);
// AES-256-CBC 加密 // AES-256-CBC 加密
$encrypted = openssl_encrypt( $encrypted = openssl_encrypt(