简体   繁体   English

Flash和C#加密

[英]Flash & C# encryption

I am creating a TCP connect with Flash to a C# daemon. 我正在创建一个使用Flash连接到C#守护程序的TCP连接。

Now I have come to the part of encryption... I know that Flash is decompilable and so not safe to store private keys on. 现在我进入了加密部分……我知道Flash是可反编译的,因此不安全地存储私钥。

I need 2 way encryption because of the messages that have to be send back to the Flash client. 由于必须将消息发送回Flash客户端,因此我需要2种方式进行加密。

I have been thinking and googling, but cannot find a proper solution yet. 我一直在思考和谷歌搜索,但找不到合适的解决方案。

Anybody got an idea?? 有人知道吗?

You'd usually use a hybrid encryption. 您通常会使用混合加密。

  1. Client opens a session on the server, acquiring public key for an asymmetric encryption. 客户端在服务器上打开一个会话,获取用于非对称加密的公共密钥。
  2. Client generates a key for a symmetric encryption, and sends this key to the server, encrypted with the public key previously acquired. 客户端生成用于对称加密的密钥,然后将此密钥发送到服务器,并使用先前获取的公共密钥进行加密。
  3. The rest of the communication is encrypted using a symmetric encryption with they key now known to both client and server. 其余的通信使用对称加密进行加密,客户端和服务器现在都知道它们的密钥。

greetz 格尔茨
back2dos back2dos

back2dos' solution will work (and be the easiest) if your connection is SSL/TLS. 如果您的连接是SSL / TLS,则back2dos的解决方案将起作用(并且最简单)。

If you are forced to use regular sockets (eg, the server does not have an SSL certificate), then you'll need to do the same by hand. 如果您被迫使用常规套接字(例如,服务器没有SSL证书),那么您将需要手动执行此操作。 In this case, you'll need to use a Diffie-Hellman key exchange, which enables the creation of a shared secret that is not actually sent over the wire. 在这种情况下,您将需要使用Diffie-Hellman密钥交换,该密钥交换可以创建实际上不是通过网络发送的共享密钥。

Again, if possible, use back2dos' solution. 同样,如果可能,请使用back2dos的解决方案。 It's a lot easier. 这更容易。

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

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