如何输入密钥和初始化向量,包括具有OpenSSL的特殊字符
我使用此命令解密文件,但它不起作用,因为我的密钥和初始化向量包括特殊字符,
openssl enc -nosalt -aes-256-cbc -d -in input.json -out output.json -base64 -K qwr{@^h`h&_`50/ra7!'dvmh3!uw<&=? -iv 6/#~V).A,lY&=t5b
有人可以向我展示在哪里改进吗?
I use this command to decrypt the file but it does not work because my Key and Initialization Vector including special characters
openssl enc -nosalt -aes-256-cbc -d -in input.json -out output.json -base64 -K qwr{@^h`h&_`50/ra7!'dvmh3!uw<&=? -iv 6/#~V).A,lY&=t5b
Can someone show me where to improve?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
OPENSL
想要这些-k
和-IV
参数以十六进制编码的形式,可能是为了避免命令行解析问题。来自MAN OPENSL
:如何做到这一点,取决于您可以使用哪些工具。例如,如果您将键存储在文件
key.raw
中,则可以使用xxd -g1 -c32 -l32 -l32 -p key.raw
生成它,例如:一次编码一个字符(
-G1
),并在一行中抓住32个字节,避免在末尾意外编码newline字符。您可以将其嵌入
openssl
命令中的-k $(xxd -g1 -c32 -c32 -l32 -p key.raw)
。 IV参数类似。openssl
wants those-K
and-iv
parameters in hex-encoded form, probably to avoid problems with command line parsing. Fromman openssl
:How you do that, depends on what tools are available to you. If for instance you have the key stored in a file
key.raw
then you can usexxd -g1 -c32 -l32 -p key.raw
to generate it, like this:That encodes it one character at a time (
-g1
), and grabs 32 bytes in one line, avoiding accidentally encoding a newline character at the end.You can embed that in the
openssl
command as-K $(xxd -g1 -c32 -l32 -p key.raw)
. Similar for the IV parameter.