我正在尝试用AES加密来加密有效负载,如下所示,用于SSG。但我一直
解析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初始化向量在哪里使用,以及如何使用?
谢谢
发布于 2021-12-29 05:25:20
基于openssl_encrypt库文档,第五个参数中心$iv用于初始化向量值。所以,我认为你必须替换你正在做的事情,它随机地生成一个随机初始化向量到所提供的固定值。
https://stackoverflow.com/questions/70409255
复制相似问题