【发布时间】:2013-04-20 00:20:47
【问题描述】:
我正在使用 C#(.Net) 开发一个服务器项目。我有一个 Tcp 连接(使用 SSL)。我可以在 Tcp 中保护通信。我需要创建 Udp 系统来快速发送数据。现在如何保护 Udp? udp 是无连接的数据报协议。我觉得有办法,那就是:
> Client connects via Tcp, Server sends a random (16 byte lenght) key to Client via Tcp.
> If client wants to send data via Udp, it replaces the data like this (key[16 byte lengt] + data)
> Server checks incoming data's first 16 byte and if it's true, generates an other random password and sends it client back via Tcp.
> Clients understands new key via incoming Tcp data, and uses the new key.
即Udp过程全部成功后,服务器为客户端创建另一个随机密钥并将其发送给客户端。客户端使用密钥进行 Udp 身份验证。
是的,这是一种真正的方式,但在 Udp 处理之后我不会发送新数据。因为有性能问题。 udp 必须很快,但如果您在每次成功的 udp 进程后发送数据,这可能会导致服务器端滞后。我想通过一次操作来实现 Udp 安全。 (只有udp发送,没有tcp回调)
如果没有办法,我将使用该系统。有人知道吗?
(注意:我知道,非对称密码学是最好的方法(使用 SSL),但我无法创建我的超级安全密码学(如 128 位)功能。)
编辑:有没有办法将 SSL 与 Udp 一起使用?
【问题讨论】:
-
您可以使用 DTLS 保护 UDP。但我不知道.NET 的 DTLS 实现。您描述的保护 UDP 的方式是完全不安全的,因为它既不提供完整性也不提供机密性。
-
@dtb 如果没有第 3 方软件,在 .Net 中就无法做到这一点,对吧? Err,我可以使用我的系统(成功 udp 数据后向客户端发送 Udp 密钥),这是一个好方法吗?
-
是的,您需要用于 DTLS 的第 3 方软件。不,你的系统不是一个好方法。
标签: c# performance security sockets udp