尝试在OpenSSL中解密文件时出现错误的Magic Number错误 [英] Bad Magic Number error when trying to Decrypt file in OpenSSL

查看:1353
本文介绍了尝试在OpenSSL中解密文件时出现错误的Magic Number错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows的最新版本的OpenSSL,我正在尝试解密使用以下命令使用DES(密码为:pass)加密的消息U2FsdGVkX18ztmw81FTK/c+jAf8xtcZdIpesuV2PLDM=

I'm using Latest version of OpenSSL for Windows, I'm trying to decrypt a message U2FsdGVkX18ztmw81FTK/c+jAf8xtcZdIpesuV2PLDM= encrypted using DES (password is: pass) for which I'm using the following command

des -d -in Encrypted.txt -out normal.txt

输入密码后,我遇到了错误的魔术数字错误:pass

for which I'm getting bad magic number error after entering the password: pass

Encrypted.txt包含加密的消息U2FsdGVkX18ztmw81FTK/c+jAf8xtcZdIpesuV2PLDM= 并且normal.txt为空

Encrypted.txt contains the encrypted message U2FsdGVkX18ztmw81FTK/c+jAf8xtcZdIpesuV2PLDM= and normal.txt is empty

我搜索了堆栈溢出中的所有帖子,没有找到可以解决我的问题的文章,请帮助解决此问题.

I searched all the posts in stack overflow and found no article which could solve my problem, Please help get this issue solved.

推荐答案

des命令的输入不应在base64中.相反,您需要首先解码base64输出,然后将其提供给OpenSSL des命令.例如,当我在Linux上运行以下命令时:

The input to the des command shouldn't be in base64. Instead, you need to first decode the base64 output and then provide it to the OpenSSL des command. For instance, when I run the following on Linux:

echo U2FsdGVkX18ztmw81FTK/c+jAf8xtcZdIpesuV2PLDM= | openssl enc -base64 -d | openssl des -d

我得到正确的输出:

hello world

由于Windows不适用于管道,因此您必须将输出重定向到中间文件,然后运行单独的openssl命令.

Since Windows is not great with pipes, you have to redirect the output to intermediate files and then run individual openssl commands.

这篇关于尝试在OpenSSL中解密文件时出现错误的Magic Number错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆