OpenSSL“错误读取输入文件";和“不良魔术数" [英] OpenSSL "error reading input file" and "bad magic number"

查看:1050
本文介绍了OpenSSL“错误读取输入文件";和“不良魔术数"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试加密一个简单的字符串"Hello world".使用OpenSSL命令行工具.我已经尝试过同时使用base64和binary进行加密.但是我遇到了一些无用的错误.

I'm trying to encrypt a simple string "Hello world." with the OpenSSL command line tool. I've tried both encrypting using both base64 and binary. But I'm getting some unhelpful errors.

$ "Hello world." > plain.txt
$ openssl enc -aes-128-ecb -e -base64 -in plain.txt > enc.txt
enter aes-128-ecb encryption password:
Verifying - enter aes-128-ecb encryption password:
$ cat enc.txt
U2FsdGVkX18ZoAY34fL2aMO0Bu5AJnewemhfiBmSL1IJujqOtpJm7V0C+Tt83egJ
$ openssl enc -aes-128-ecb -d -base64 -in enc.txt > out.txt
enter aes-128-ecb decryption password:
error reading input file

然后我尝试使用二进制文件

Then I try binary

$ "Hello world." > plain.txt
$ openssl enc -aes-128-ecb -e -in plain.txt > enc.bin
enter aes-128-ecb encryption password:
Verifying - enter aes-128-ecb encryption password:
$ openssl enc -aes-128-ecb -d -in enc.bin > out.txt 
enter aes-128-ecb decryption password:
bad magic number

推荐答案

标记,我看不到您的命令有任何问题.它们在我的系统上都运行良好.所以问题一定在其他地方.

Mark, I don't see anything wrong with your commands. They all worked fine on my system. So the problem must be somewhere else.

我建议尝试安装不同版本的OpenSSL或其他系统.

I'd recommend trying a different installation/version of OpenSSL, or a different system.

这篇关于OpenSSL“错误读取输入文件";和“不良魔术数"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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