没有 SslStream 的 SSL,因为我想通过 SOCKS5 代理进行连接
背景信息:用 C# 编写的程序
我现在正在开发一个通过 SOCKS5 代理连接的程序(从头开始编码。工作得很好。),但我也想(通过该程序) proxy)通过 SSL 与 DESTINATION 通信。
我做了一些研究,多次用谷歌搜索,并得出结论:SslStream 并不适合我的情况。我需要首先通过代理使用 SSL 进行身份验证,然后在收到密钥后开始发送加密数据包。
问题:
如何在 C# 中使用 TLS 加密我的数据包?由于某种原因我根本无法弄清楚。我被困住了! :(
请求 SSL 证书所需的原始语法是什么?
BACKGROUND INFORMATION: PROGRAM WRITTEN IN C#
I'm working on a program right now that connects through a SOCKS5 proxy (coded from scratch. works well enough.), but I'd also like to (through that proxy) communicate to a DESTINATION through SSL.
I've done some research, googled many a time, and have come to the conclusion that SslStream won't be ideal for my situation. I NEED to first authenticate with the SSL through the proxy, and THEN start sending encrypted packets, once I receive the key.
QUESTIONS:
How can I encrypt my packets with TLS in C#? For some reason I can't at all figure it out. I'm stuck! :(
What is the raw syntax required to even REQUEST said SSL certificate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能想查看开源 Bouncy Castle 加密库 中的 TLS 实现。如果它不能按原样工作,您可以修改它来执行您需要的操作。如果您想深入了解规范本身,您会发现它为 IETF RFC 5246。
不过,您可能已经发现,自己完成连接设置工作的任何部分都会使您无法使用
WebRequest
系列类来处理协议工作的 HTTP 部分。这给你留下了我可以看到的两个选项:你自己也做HTTP(我找到了一个简单的示例 HTTP 客户端 漂浮在网络上),或者更改当前用户代理服务器设置,然后使用
WebRequest
类正常发送请求。You might want to have a look at the TLS implementation in the open source Bouncy Castle cryptography library. If it won't work as-is, you can hack it into doing what you need. If you want to deep-dive the specification itself, you'll find it as IETF RFC 5246.
As you've probably discovered, though, doing any portion of the connection setup work yourself leaves you with no way to use the
WebRequest
family of classes to handle the HTTP portion of the protocol work. That leaves you with two options I can see: do the HTTP yourself as well (I found a trivial example HTTP client floating around the net), or change the current user proxy server settingsthen send the request normally using the
WebRequest
classes.我想向您提供我们的 SecureBlackbox 产品的 SSLBlackbox 包。在众多其他组件中,它有一个基于套接字的简单 SSL 客户端组件,可以通过不同的代理(SOCKS、HTTPS CONNECT)进行连接,并支持 SSL/TLS 直至 TLS 1.2 的所有功能。如果您需要更多控制,您可以使用任何自定义套接字,而不仅仅是内置套接字支持。这使您可以使用组件来保护根本不通过套接字的流量(也可以通过这种方式保护鸽子邮件)。
HTTPS 客户端可用并包含在 SSLBlackbox 中。
I'd like to offer you SSLBlackbox package of our SecureBlackbox product. Among numerous other components it has a simple SSL client component that is socket-based, can connect via different proxies (SOCKS, HTTPS CONNECT) and supports all features of SSL/TLS up to TLS 1.2. If you need more control, you can use any custom socket, and not just built-in socket support. This lets you use the components for securing traffic that goes not via sockets at all (pigeon mail can be secured this way as well).
An HTTPS client is available and included into SSLBlackbox as well.