Linux 使用 RSA 和 DES3 密钥加密和解密一串文本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8589814/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 03:45:56  来源:igfitidea点击:

Encrypt and decrypt a string of text with RSA and DES3 key

linuxpublic-key-encryption

提问by JMK

I am using the Linux command line, I have created a Private Key using the following command:

我正在使用 Linux 命令行,我使用以下命令创建了一个私钥:

openssl genrsa -des3 -out private.pem 2048

I have extracted the public key from the private key like so:

我已经从私钥中提取了公钥,如下所示:

openssl rsa -in private.pem -out public.pem -outform PEM -pubout

I want to use the public key to encrypt a string of text, lets say "foo bar", and then decrypt this string again.

我想使用公钥加密一串文本,比如说“foo bar”,然后再次解密这个字符串。

How do I go about this?

我该怎么做?

Thanks

谢谢

采纳答案by Roger Lindsj?

I think you want

我想你想要

openssl rsautl -encrypt -inkey public.pem -pubin -in unencrypted_file.txt -out encrypted_file.ssl

See more at devco.

devco 上查看更多信息