简体   繁体   English

如何使用openSSL使用公钥加密和解密xml

[英]How to encrypt and decrypt xml using openSSL with public key

Can any one able to tell me how to encrypt and decrypt a xml file using openssl. 任何人都可以告诉我如何使用openssl加密和解密xml文件。 I can able to create privatekey using the Linux command 我可以使用Linux命令创建私钥

openssl genrsa -out private.pem 1024 

And got my private key as private.pem . 并将我的私钥作为private.pem Created public key using 使用创建的公钥

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

got my public key as public.pem 把我的公钥作为public.pem

Now what I want is I want to encrypt the XML file using this public key and again want to decrypt using my private key. 现在我想要的是我想使用这个公钥加密XML文件,并再次想要使用我的私钥解密。

Try: 尝试:

$ openssl rsautl -encrypt -inkey public.pem -pubin -in file.xml -out file.xml.encrypted

Hint: I cheated and looked here: 提示:我骗了,看了看这里:

http://www.devco.net/archives/2006/02/13/public_-_private_key_encryption_using_openssl.php http://www.devco.net/archives/2006/02/13/public_-_private_key_encryption_using_openssl.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM