Array.Clear (hash, 0, hash.Length);
}
- static byte[] Compute_NTLMv2 (Type2Message type2, string username, string password)
+ static byte[] Compute_NTLMv2 (Type2Message type2, string username, string password, string domain)
{
var ntlm_hash = Compute_NTLM_Password (password);
var ubytes = Encoding.Unicode.GetBytes (username.ToUpperInvariant ());
- var tbytes = Encoding.Unicode.GetBytes (type2.TargetName.ToUpperInvariant ());
+ var tbytes = Encoding.Unicode.GetBytes (domain);
var bytes = new byte [ubytes.Length + tbytes.Length];
ubytes.CopyTo (bytes, 0);
}
public static void Compute (Type2Message type2, NtlmAuthLevel level,
- string username, string password,
+ string username, string password, string domain,
out byte[] lm, out byte[] ntlm)
{
lm = null;
break;
case NtlmAuthLevel.NTLMv2_only:
- ntlm = Compute_NTLMv2 (type2, username, password);
+ ntlm = Compute_NTLMv2 (type2, username, password, domain);
break;
default:
public string Domain {
get { return _domain; }
set {
- if (_type2 != null)
- throw new InvalidOperationException (
- "Domain is set automatically from Type2Message.TargetName");
if (value == null)
value = "";
if (value == "")
{
base.Decode (message);
- if (BitConverterLE.ToUInt16 (message, 56) != message.Length) {
- string msg = Locale.GetText ("Invalid Type3 message length.");
- throw new ArgumentException (msg, "message");
- }
-
_password = null;
if (message.Length >= 64)
ntlm = legacy.NT;
}
} else {
- ChallengeResponse2.Compute (_type2, _level, _username, _password, out lm, out ntlm);
+ ChallengeResponse2.Compute (_type2, _level, _username, _password, _domain, out lm, out ntlm);
}
var lmresp_len = lm != null ? lm.Length : 0;