如何加密在 Flash 和 Java 中运行的客户端和服务器之间的数据?
我们有一个多客户端系统,其中客户端是用 Flash 编写的,服务器是用 Java 编写的。目前,Flash 中的通信是通过使用 flash.net.Socket
完成的,协议是用 JSON 编写的。服务器使用自定义端口来接收连接,然后继续与每个客户端通信。正如预期的那样,数据在两个前端以原始字节的形式发送和接收,然后根据需要进行解码。
我们希望对客户端和服务器之间的通信进行加密。我对公钥/私钥加密有一些基本的了解,但我不知道交换密钥的最佳方法是什么,也不知道有哪些库(在两种语言上)可以执行此操作。
解决这个问题的最佳策略是什么?我应该从哪里开始寻找库/方法来实现这种加密?
We have a multiclient system where the client is written in Flash and the server is written in Java. Currently, communication is done in Flash by usage of flash.net.Socket
and the protocol is written in JSON. The server uses a custom port to receive connections and then proceed to talk with each client. As expected, data is sent and received on both fronts as raw bytes, which are then decoded as needed.
We would like to encrypt the communication between clients and server. I have some basic understanding about public/private key encryption, but I do not know what is the best way to exchange keys or what libraries are available (on both languages) to do this.
What would be the best strategy to attack this problem and where should I start looking for libraries/methods to implement this encryption?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无需重新发明轮子。使用 ssl/tls。我们已经在几个商业项目中使用了 as3 ssl 实现。确保为 as3 组件创建根证书存储,并至少使用服务器证书的根 ca 填充它。在服务器上,使用java内置的ssl服务器套接字。
或者,如果可能的话,您可以取消自定义服务器,并使用 https,就像在 HTML/JavaScript 中使用 Ajax 一样。
No need to reinvent the wheel. Use ssl/tls. There's an as3 ssl implementation that we've used in several commercial projects. Make sure you create a root cert store for the as3 component and populate it with at least the root ca for your server cert. On the server, use java's built in ssl server socket.
Alternatively, you could do away with the custom server, if this is at all possible, and use https, kind of like you would with Ajax in HTML/JavaScript.