Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/go/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Golang OpenSSL坏iv大小_Go_Openssl - Fatal编程技术网

Golang OpenSSL坏iv大小

Golang OpenSSL坏iv大小,go,openssl,Go,Openssl,我正在尝试创建以下内容: cipher, err := openssl.GetCipherByName("aes-128-ecb") decryptionTool, err := openssl.NewDecryptionCipherCtx(cipher, nil, byteKey, iv) byteKey和iv都有16字节长 当我构建代码时,会出现以下错误: panic: bad IV size (16 bytes instead of 0) 我阅读了文档,检查了源代码,但是我仍然找不到一

我正在尝试创建以下内容:

cipher, err := openssl.GetCipherByName("aes-128-ecb")
decryptionTool, err := openssl.NewDecryptionCipherCtx(cipher, nil, byteKey, iv)
byteKey和iv都有16字节长

当我构建代码时,会出现以下错误:

panic: bad IV size (16 bytes instead of 0)
我阅读了文档,检查了源代码,但是我仍然找不到一种方法来添加IV而不出错。我正在使用spacemonkeygo的OpenSSL

有人知道怎么了吗? 提前谢谢你

编辑:我添加了上面的密码类型,以及关于biteKey和iv的更多细节


编辑2:欧洲央行没有IV!我完全忘记了。我想这就解决了。

我第一次使用ECB,我想把它改成CBC。我忘了将其更改为aes cbc,因此在尝试添加IV时出错。

这取决于参数
chiper
byteKey
IV
的内容。如果没有详细信息,很难找到错误。我猜您的密码定义为零长度IV。您使用的密码是什么?我使用的是aes-128-ecb。我把它添加到了帖子里