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

时间:2022-01-23 18:31:11

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

谢谢

1 个解决方案

#1


10  

I think you want

我认为你想要的

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

See more at devco.

多见于devco。

#1


10  

I think you want

我认为你想要的

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

See more at devco.

多见于devco。