// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2004 Novell (http://www.novell.com)
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// References
-// a. NTLM Authentication Scheme for HTTP, Ronald Tschalär
+// a. NTLM Authentication Scheme for HTTP, Ronald Tschalär
// http://www.innovation.ch/java/ntlm.html
-// b. The NTLM Authentication Protocol, Copyright © 2003 Eric Glass
+// b. The NTLM Authentication Protocol, Copyright © 2003 Eric Glass
// http://davenport.sourceforge.net/ntlm.html
//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
using System;
using System.Globalization;
set {
if (value == null)
throw new ArgumentNullException ("Challenge");
- if (value.Length != 8)
- throw new ArgumentException ("Invalid Challenge Length");
+ if (value.Length != 8) {
+ string msg = Locale.GetText ("Invalid Challenge Length (should be 8 bytes).");
+ throw new ArgumentException (msg, "Challenge");
+ }
_challenge = (byte[]) value.Clone ();
}
}
{
base.Decode (message);
- if (BitConverter.ToUInt16 (message, 56) != message.Length)
- throw new ArgumentException ("Invalid Type3 message length");
+ if (BitConverterLE.ToUInt16 (message, 56) != message.Length) {
+ string msg = Locale.GetText ("Invalid Type3 message length.");
+ throw new ArgumentException (msg, "message");
+ }
_password = null;
- int dom_len = BitConverter.ToUInt16 (message, 28);
+ int dom_len = BitConverterLE.ToUInt16 (message, 28);
int dom_off = 64;
_domain = Encoding.Unicode.GetString (message, dom_off, dom_len);
- int host_len = BitConverter.ToUInt16 (message, 44);
- int host_off = BitConverter.ToUInt16 (message, 48);
+ int host_len = BitConverterLE.ToUInt16 (message, 44);
+ int host_off = BitConverterLE.ToUInt16 (message, 48);
_host = Encoding.Unicode.GetString (message, host_off, host_len);
- int user_len = BitConverter.ToUInt16 (message, 36);
- int user_off = BitConverter.ToUInt16 (message, 40);
+ int user_len = BitConverterLE.ToUInt16 (message, 36);
+ int user_off = BitConverterLE.ToUInt16 (message, 40);
_username = Encoding.Unicode.GetString (message, user_off, user_len);
_lm = new byte [24];
- int lm_off = BitConverter.ToUInt16 (message, 16);
+ int lm_off = BitConverterLE.ToUInt16 (message, 16);
Buffer.BlockCopy (message, lm_off, _lm, 0, 24);
_nt = new byte [24];
- int nt_off = BitConverter.ToUInt16 (message, 24);
+ int nt_off = BitConverterLE.ToUInt16 (message, 24);
Buffer.BlockCopy (message, nt_off, _nt, 0, 24);
if (message.Length >= 64)
- Flags = (NtlmFlags) BitConverter.ToUInt32 (message, 60);
+ Flags = (NtlmFlags) BitConverterLE.ToUInt32 (message, 60);
}
public override byte[] GetBytes ()