OpenSSL PHP RSA 加密:使用哪个库在客户端解密?
我开发了一个桌面应用程序(.NET 2.0),它需要从运行 php/mysql 的服务器获取一些信息。服务器端的提供者决定使用 openssl_private_encrypt 方法进行加密,并为我提供了一个 publickey.pem 文件。我不擅长 php/mysql,但我知道如果我使用 asp .net,情况不会有任何不同。
我的问题是如何解密 .NET 2.0 应用程序中的私有加密数据。我所有使用 RSACrypoServiceProvider 和公钥的尝试都被证明是不成功的。
我偶然发现了 ManagedOpenSSL 库,但这也不好。
我确信 StackOverflow 的许多人都会做类似的事情,如果知道他们是如何做到的那就太好了。
提前感谢您的所有帮助。
I have developed a desktop application (.NET 2.0) and it needs to get some information from a server running php/mysql. The provider at server end has decided to use encryption using openssl_private_encrypt method and has provided me a publickey.pem file. I am not good at php/mysql but i do know that it would not be any different if i were using asp .net.
My question is how do i decrypt private-enrypted data in a .NET 2.0 application. All my attempts to use the RSACrypoServiceProvider with the publickey have proven unsuccessful.
I stumbled upon ManagedOpenSSL library but that was no good either.
I am certain many at StackOverflow would have done similar stuff and it would be nice o know how they did it.
Appreciate all your help in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
.NET 使用 OpenSSL 不支持的 XML 格式的密钥。我的建议是使用 phpseclib(一种纯 PHP RSA 实现)生成密钥对 - 或者至少将现有密钥对转换为 XML 。
.NET uses XML formatted keys which OpenSSL doesn't support. My recommendation would be to generate the key pair - or at least convert the existing one to XML - with phpseclib, a pure PHP RSA implementation.
这是我用来让它工作的!
responseFromServerEnc 是加密消息,responseFromServer 已正确解密。
Here is what i used to make it work!
And responseFromServerEnc was the encrypted message and responseFromServer was correctly decrypted.