在 C# 中实现 SSL 隧道
作为大型应用程序的一部分,我需要在 C# 中实现 SSL 隧道。我想知道是否有更好的方法来做到这一点,而不是自己编写 SSL 协商的每个步骤,这听起来像是重新发明轮子。
您是否知道是否有任何库可以用来最大限度地减少我需要编写的代码,或者是否有任何教程可以展示如何在 .NET 中最有效地实现此或类似的内容?
As a part of a larger application I need to implement an SSL tunnel in C#. I was wondering if there's a better way of doing that instead of writing each step of SSL negotiation myself which sounds like reinventing the wheel.
Do you know if there are any libraries that I could use to minimize the code I need to write or any tutorials which show how this or similar thing can be implemented most efficiently in .NET?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
SSlStream 应该完成大部分工作你。
SSlStream should do most of the work for you.
目前尚不清楚您所说的 SSL 隧道是什么意思。如果我理解正确的话,您需要一些充当本地服务器(其他应用程序连接到的)的客户端软件,然后该软件使用 SSL 连接到您的服务器端软件,服务器端软件又从 SSL 中取出数据隧道,并将它们引向更远的地方。在这种情况下,您将需要客户端和服务器端 SSL/TLS 组件。您可以使用我们的 SecureBlackbox 来完成此任务。 SecureBlackbox 为 SSL/TLS 协议提供全面支持,可完全控制连接和证书管理。
您可能不需要普通的 SSL 通道,而是某种加密代理。在这种情况下,您需要决定您想要什么类型的代理(是 SOCKS 代理还是 HTTP CONNECT 代理)并在客户端实现它。这种代理的好处之一是它可以将真实的连接地址(即客户端想要去的地方)传输到远程服务器,然后由远程服务器执行连接。这是更灵活的方法,但需要一些(我应该说最少的)编码来实现与 SOCKS 或 HTTP CONNECT 请求解析和响应生成相关的内容。
It's not clear what you mean by SSL tunnel. If I understand it right, you need some client-side software which acts as a local server (to which other applications connect), this software then connects using SSL to your server-side software, which in turn takes the data out of the SSL tunnel, and routes them further. In this case you would need client-side and server-side SSL/TLS components. You can use our SecureBlackbox for this task. SecureBlackbox provides comprehensive support for SSL/TLS protocol with complete control over connection and certificate management.
It can be that you need not plain SSL channel, but some kind of encrypting proxy. In this case you need to decide what exactly kind of proxy you want (will it be SOCKS proxy or HTTP CONNECT proxy) and implement it on the client side. one of the benefits of such proxy is that it can transfer the real connection address (i.e. where the client wants to go to) to the remote server, and that remote server will perform connection. This is more flexible approach, but it would require some (minimal, I should say) coding to implement the stuff, related to SOCKS or HTTP CONNECT request parsing and response generation.
.NET 包含 SSL 支持,以
系统为中心.Net.Security.SslStream
类。.NET includes SSL support, centred around the
System.Net.Security.SslStream
class.