org.xwt
Class HTTP.Proxy.NTLM

java.lang.Object
  extended byorg.xwt.HTTP.Proxy.NTLM
Enclosing class:
HTTP.Proxy

public static class HTTP.Proxy.NTLM
extends java.lang.Object

An implementation of Microsoft's proprietary NTLM authentication protocol. This code was derived from Eric Glass's work, and is copyright as follows: Copyright (c) 2003 Eric Glass (eglass1 at comcast.net). Permission to use, copy, modify, and distribute this document for any purpose and without any fee is hereby granted, provided that the above copyright notice and this list of conditions appear in all copies. The most current version of this document may be obtained from http://davenport.sourceforge.net/ntlm.html .


Field Summary
static byte[] type1
           
 
Constructor Summary
HTTP.Proxy.NTLM()
           
 
Method Summary
static byte[] getLMResponse(java.lang.String password, byte[] challenge)
          Calculates the LM Response for the given challenge, using the specified password.
static byte[] getLMv2Response(java.lang.String target, java.lang.String user, java.lang.String password, byte[] challenge, byte[] clientChallenge)
          Calculates the LMv2 Response for the given challenge, using the specified authentication target, username, password, and client challenge.
static byte[] getNTLM2SessionResponse(java.lang.String password, byte[] challenge, byte[] clientChallenge)
          Calculates the NTLM2 Session Response for the given challenge, using the specified password and client challenge.
static byte[] getNTLMResponse(java.lang.String password, byte[] challenge)
          Calculates the NTLM Response for the given challenge, using the specified password.
static byte[] getNTLMv2Response(java.lang.String target, java.lang.String user, java.lang.String password, byte[] targetInformation, byte[] challenge, byte[] clientChallenge)
          Calculates the NTLMv2 Response for the given challenge, using the specified authentication target, username, password, target information block, and client challenge.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type1

public static final byte[] type1
Constructor Detail

HTTP.Proxy.NTLM

public HTTP.Proxy.NTLM()
Method Detail

getNTLMResponse

public static byte[] getNTLMResponse(java.lang.String password,
                                     byte[] challenge)
                              throws java.lang.Exception
Calculates the NTLM Response for the given challenge, using the specified password.

Parameters:
password - The user's password.
challenge - The Type 2 challenge from the server.
Returns:
The NTLM Response.
Throws:
java.lang.Exception

getLMResponse

public static byte[] getLMResponse(java.lang.String password,
                                   byte[] challenge)
                            throws java.lang.Exception
Calculates the LM Response for the given challenge, using the specified password.

Parameters:
password - The user's password.
challenge - The Type 2 challenge from the server.
Returns:
The LM Response.
Throws:
java.lang.Exception

getNTLMv2Response

public static byte[] getNTLMv2Response(java.lang.String target,
                                       java.lang.String user,
                                       java.lang.String password,
                                       byte[] targetInformation,
                                       byte[] challenge,
                                       byte[] clientChallenge)
                                throws java.lang.Exception
Calculates the NTLMv2 Response for the given challenge, using the specified authentication target, username, password, target information block, and client challenge.

Parameters:
target - The authentication target (i.e., domain).
user - The username.
password - The user's password.
targetInformation - The target information block from the Type 2 message.
challenge - The Type 2 challenge from the server.
clientChallenge - The random 8-byte client challenge.
Returns:
The NTLMv2 Response.
Throws:
java.lang.Exception

getLMv2Response

public static byte[] getLMv2Response(java.lang.String target,
                                     java.lang.String user,
                                     java.lang.String password,
                                     byte[] challenge,
                                     byte[] clientChallenge)
                              throws java.lang.Exception
Calculates the LMv2 Response for the given challenge, using the specified authentication target, username, password, and client challenge.

Parameters:
target - The authentication target (i.e., domain).
user - The username.
password - The user's password.
challenge - The Type 2 challenge from the server.
clientChallenge - The random 8-byte client challenge.
Returns:
The LMv2 Response.
Throws:
java.lang.Exception

getNTLM2SessionResponse

public static byte[] getNTLM2SessionResponse(java.lang.String password,
                                             byte[] challenge,
                                             byte[] clientChallenge)
                                      throws java.lang.Exception
Calculates the NTLM2 Session Response for the given challenge, using the specified password and client challenge.

Parameters:
password - The user's password.
challenge - The Type 2 challenge from the server.
clientChallenge - The random 8-byte client challenge.
Returns:
The NTLM2 Session Response. This is placed in the NTLM response field of the Type 3 message; the LM response field contains the client challenge, null-padded to 24 bytes.
Throws:
java.lang.Exception