2728N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 2728N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2728N/A * This code is free software; you can redistribute it and/or modify it 2728N/A * under the terms of the GNU General Public License version 2 only, as 2728N/A * published by the Free Software Foundation. Oracle designates this 2728N/A * particular file as subject to the "Classpath" exception as provided 2728N/A * by Oracle in the LICENSE file that accompanied this code. 2728N/A * This code is distributed in the hope that it will be useful, but WITHOUT 2728N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 2728N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 2728N/A * version 2 for more details (a copy is included in the LICENSE file that 2728N/A * You should have received a copy of the GNU General Public License version 2728N/A * 2 along with this work; if not, write to the Free Software Foundation, 2728N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2728N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2728N/A * or visit www.oracle.com if you need additional information or have any 2728N/A * The NTLM client. Not multi-thread enabled.<p> 2728N/A * Client client = new Client(null, "host", "dummy", 2728N/A * "REALM", "t0pSeCr3t".toCharArray()); 2728N/A * byte[] type1 = client.type1(); 2728N/A * // Send type1 to server and receive response as type2 2728N/A * byte[] type3 = client.type3(type2, nonce); 2728N/A * Creates an NTLM Client instance. 2728N/A * @param version the NTLM version to use, which can be: 2728N/A * <li>LM: Original NTLM v1, LM only 2728N/A * <li>NTLM: Original NTLM v1, NTLM only 2728N/A * <li>NTLM2: NTLM v1 with Client Challenge 2728N/A * <li>LMv2: NTLM v2, LM only 2728N/A * <li>NTLMv2: NTLM v2, NTLM only 2728N/A * @param hostname hostname of the client, can be null 2728N/A * @param username username to be authenticated, must not be null 2728N/A * @param domain domain of {@code username}, can be null 2728N/A * @param password password for {@code username}, must not be not null. 2728N/A * This method does not make any modification to this parameter, it neither 2728N/A * needs to access the content of this parameter after this method call, 2728N/A * so you are free to modify or nullify this parameter after this call. 4357N/A * @throws NTLMException if {@code username} or {@code password} is null, 4357N/A * or {@code version} is illegal. 2728N/A debug(
"NTLM Client: (h,u,t,version(v)) = (%s,%s,%s,%s(%s))\n",
2728N/A * Generates the Type 1 message 2728N/A * @return the message generated 2728N/A * Generates the Type 3 message 2728N/A * @param type2 the responding Type 2 message from server, must not be null 2728N/A * @param nonce random 8-byte array to be used in message generation, 2728N/A * must not be null except for original NTLM v1 2728N/A * @return the message generated 4357N/A * @throws NTLMException if the incoming message is invalid, or 4357N/A * {@code nonce} is null for NTLM v1. 4357N/A "type2 and nonce cannot be null");
2728N/A System.
arraycopy(
new byte[]{
1,
1,
0,
0,
0,
0,
0,
0},
0,
blob,
0,
8);
2728N/A * Returns the domain value provided by server after the authentication 2728N/A * is complete, or the domain value provided by the client before it. 2728N/A * Disposes any password-derived information.