How do I create Ntlm Type 1 and Type 3 messages in .Net(如何在 .Net 中创建 Ntlm Type 1 和 Type 3 消息)
问题描述
我需要为 NTLM 握手创建类型 1 消息和类型 3 消息.是否有任何.Net API ?
I need to create Type 1 message and Type 3 message for NTLM handshaking. Is there any .Net API for this?
本质上,应用程序是基于 WPF 的,但使用 Socket 来从服务器传输数据.使用套接字是一项技术要求,但问题是当用户需要使用代理服务器连接到服务器时.此外,如果代理授权基于 Ntlm,客户端应用程序需要创建 Type 1 和 Type 3 消息才能与代理服务器握手.
Essentially, the application is WPF based, but Socket is used in order to stream data from the server. Use of socket is a technical requirement, but the problem is when user needs to connect to the server using a proxy server. Further, if the proxy authorization is based on Ntlm, the client application needs to create Type 1 and Type 3 messages in order to handshake with the proxy server.
我的问题是:.NET 库中是否已经有任何 API 可用以创建这些不同类型的 NTLM 消息?任何帮助或替代方案将不胜感激.提前致谢.
My question is: Is there any API already available in .NET libraries that can be consumed in order to create these different types of NTLM messages? Any help or alternatives will be greatly appreciated. Thanks in advance.
推荐答案
如果你受限于套接字,你将不得不手动实现整个 NTLM 身份验证协议.Microsoft 有一个 安全支持提供程序接口 (SSPI) 在 secur32.dll 中实现各种安全协议,您可能可以通过 PInvoke 从那里重用一些 API 函数(也有某种 .net 包装器可用 这里).
If you are restricted to sockets, you will have to manually implement entire NTLM authentication protocol. Microsoft has a Security Support Provider Interface (SSPI) in secur32.dll to implement various security protocols, you can probably reuse some of API functions from there, through PInvoke (also there is some sort of .net wrapper is available here).
这里是NTLM auth protocol的描述,API示例在NTLMSSP 和 SSPI 部分.基本上,整个身份验证方案都是围绕调用 AcquireCredentialsHandle/InitializeSecurityContext 与不同参数.这将为您提供原始字节格式的 type1/type3 ntlm 消息,您必须通过套接字发送/接收这些消息.
Here is the description of NTLM auth protocol, with API samples in NTLMSSP and SSPI section. Basically, entire authentication scheme is evolving around calling AcquireCredentialsHandle / InitializeSecurityContext with different parameters. This would provide you with type1/type3 ntlm messages in raw byte format, which you would have to send/receive through sockets.
这篇关于如何在 .Net 中创建 Ntlm Type 1 和 Type 3 消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 .Net 中创建 Ntlm Type 1 和 Type 3 消息
基础教程推荐
- 将 XML 转换为通用列表 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30