使用如下命令:
openssl enc -aes-128-cbc -in test.cpp -out test11.cpp -iv f123 -K 1223 #aes-128-cbc为填充模式 -iv指定盐 -K指定秘钥
出现“hex string is too short, padding with zero bytes to length”这样错误
解决:使用命令:
openssl enc -aes-128-cbc -in test.cpp -out test11.cpp -iv f12aaaaaa888888888888888888888aa -K f12aaaaaa888888888888888888888aa #将盐和秘钥设置32字节的16进制字符串
如果采用256cbc,那么盐设置32字节,秘钥设置为64字节。

博客内容讲述了在使用openssl进行AES-128-CBC加密时遇到的'hexstring too short, padding with zero bytes to length'错误。解决方案是确保使用32字节的16进制字符串设置盐和秘钥,对于AES-256-CBC模式,盐和秘钥分别需要32和64字节。正确设置后,加密过程能正常进行。
2万+

被折叠的 条评论
为什么被折叠?



