如何在.Net中创建Ntlm类型1和类型3消息 [英] How do I create Ntlm Type 1 and Type 3 messages in .Net

查看:100
本文介绍了如何在.Net中创建Ntlm类型1和类型3消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为NTLM握手创建Type 1消息和Type 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,可以使用这些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身份验证协议的说明,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类型1和类型3消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆