Encrypt a big file using openssl smime

I have generated a local certificate in my system and I am trying to encrypt a file through smime. But when I run the command it give me error Unable to load certificate Expecting trusted certificate Error 1024 . This is my script that I am trying to run

openssl  smime  -encrypt -aes256  -in  ABC.xml  -binary  -outform DEM  -out  DEF.xml  test.pem

Test.pem is my public key. Can anyone tell me that how can I bypass this section and generate a file. Thanks in advance.


You don't indicate how you created your test.pem , but here's the sequence of commands you might be able to use:

Create a new key and a certificate request (you will be prompted for additional information to complete the request):

openssl req -newkey rsa:2048 -keyout privkey.pem -out req.pem

Self-sign the certificate request to create a certificate

openssl x509 -req -in req.pem -signkey privkey.pem -out cert.pem

(You can delete req.pem at this point if you wish)

Encrypt the file using the newly generated certificate:

openssl smime -encrypt -aes256 -in ABC.xml -binary -outform DER -out DEF.xml cert.pem

The file can then be decrypted using:

openssl smime -decrypt -in DEF.xml -inform DER -inkey privkey.pem -out GHI.xml

在openssl中为大文件执行加密,首先使用sha算法对该文件进行散列,然后尝试加密数据,因为smime支持将有限的数据作为输入

链接地址: http://www.djcxy.com/p/63488.html

上一篇: 使用openssl进行SMIME加密,使用java bouncy castle解密失败

下一篇: 使用openssl smime加密一个大文件