rpc.security.ntlm
Class Responses

java.lang.Object
  extended by rpc.security.ntlm.Responses

public class Responses
extends java.lang.Object

Calculates the various Type 3 responses.


Constructor Summary
Responses()
           
 
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[] clientNonce)
          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[] clientNonce)
          Calculates the NTLM2 Session Response for the given challenge, using the specified password and client nonce.
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[] clientNonce)
          Calculates the NTLMv2 Response for the given challenge, using the specified authentication target, username, password, target information block, and client nonce.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Responses

public Responses()
Method Detail

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

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

getNTLMv2Response

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

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.
clientNonce - The random 8-byte client nonce.
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[] clientNonce)
                              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.
clientNonce - The random 8-byte client nonce.
Returns:
The LMv2 Response.
Throws:
java.lang.Exception

getNTLM2SessionResponse

public static byte[] getNTLM2SessionResponse(java.lang.String password,
                                             byte[] challenge,
                                             byte[] clientNonce)
                                      throws java.io.UnsupportedEncodingException,
                                             java.security.NoSuchAlgorithmException,
                                             java.security.InvalidKeyException,
                                             javax.crypto.NoSuchPaddingException,
                                             java.lang.IllegalStateException,
                                             javax.crypto.IllegalBlockSizeException,
                                             javax.crypto.BadPaddingException
Calculates the NTLM2 Session Response for the given challenge, using the specified password and client nonce.

Parameters:
password - The user's password.
challenge - The Type 2 challenge from the server.
clientNonce - The random 8-byte client nonce.
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 nonce, null-padded to 24 bytes.
Throws:
java.io.UnsupportedEncodingException
java.security.NoSuchAlgorithmException
javax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeException
java.lang.IllegalStateException
javax.crypto.NoSuchPaddingException
java.security.InvalidKeyException