【发布时间】:2022-01-21 07:53:28
【问题描述】:
我正在尝试使用 AES 加密来加密有效负载,如下面的 SSG-WSG API。但我不断得到
解析 JSON 请求内容失败
我认为我的加密方式有问题。我在 PHP 中这样做。
<pre>
$cipher = "aes-256-cbc";
$ekey = "encryption key provided to SSG"
//Generate a 256-bit encryption key
$encryption_key = $ekey;
// Generate an initialization vector
$iv_size = openssl_cipher_iv_length($cipher);
$iv = openssl_random_pseudo_bytes($iv_size);
//Data to encrypt
$data = $f; // payload in f
$encrypted_data = openssl_encrypt($data, $cipher, $encryption_key, 0, $iv);
$x = base64_encode($encrypted_data);
</pre>
SSGAPIInitVector初始化向量在哪里使用,如何使用?
谢谢
【问题讨论】:
标签: php api encryption aes