|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.jtds.jdbc.NtlmAuth
This class calculates the two "responses" to the nonce supplied by the server as a part of NTLM authentication. Much gratitude to the authors of this page, esp. for NTLMv2 info: http://davenport.sourceforge.net/ntlm.html
Constructor Summary | |
NtlmAuth()
|
Method Summary | |
static byte[] |
answerLmChallenge(java.lang.String pwd,
byte[] nonce)
|
static byte[] |
answerLmv2Challenge(java.lang.String domain,
java.lang.String user,
java.lang.String password,
byte[] nonce,
byte[] clientNonce)
|
static byte[] |
answerNtChallenge(java.lang.String password,
byte[] nonce)
|
static byte[] |
answerNtlmv2Challenge(java.lang.String domain,
java.lang.String user,
java.lang.String password,
byte[] nonce,
byte[] targetInfo,
byte[] clientNonce)
|
static byte[] |
answerNtlmv2Challenge(java.lang.String domain,
java.lang.String user,
java.lang.String password,
byte[] nonce,
byte[] targetInfo,
byte[] clientNonce,
byte[] timestamp)
|
static byte[] |
answerNtlmv2Challenge(java.lang.String domain,
java.lang.String user,
java.lang.String password,
byte[] nonce,
byte[] targetInfo,
byte[] clientNonce,
long now)
|
private static byte[] |
convertPassword(java.lang.String password)
Used by answerNtlmChallenge. |
private static byte[] |
createBlob(byte[] targetInformation,
byte[] clientChallenge,
byte[] timestamp)
Creates the NTLMv2 blob from the given target information block and client challenge. |
static byte[] |
createTimestamp(long time)
Creates a timestamp in the format used in NTLMv2 responses. |
private static byte[] |
encryptNonce(byte[] key,
byte[] nonce)
|
private static byte[] |
hmacMD5(byte[] data,
byte[] key)
Calculates the HMAC-MD5 hash of the given data using the specified hashing key. |
private static byte[] |
lmv2Response(byte[] hash,
byte[] clientData,
byte[] challenge)
Creates the LMv2 Response from the given hash, client data, and Type 2 challenge. |
private static byte[] |
makeDESkey(byte[] buf,
int off)
Turns a 7-byte DES key into an 8-byte one by adding parity bits. |
private static byte[] |
md5(byte[] data)
|
private static byte[] |
ntHash(java.lang.String password)
Creates the md4 hash of the unicode password. |
private static byte[] |
ntv2Hash(java.lang.String domain,
java.lang.String user,
java.lang.String password)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NtlmAuth()
Method Detail |
public static byte[] answerNtChallenge(java.lang.String password, byte[] nonce) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public static byte[] answerLmChallenge(java.lang.String pwd, byte[] nonce) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public static byte[] answerNtlmv2Challenge(java.lang.String domain, java.lang.String user, java.lang.String password, byte[] nonce, byte[] targetInfo, byte[] clientNonce) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public static byte[] answerNtlmv2Challenge(java.lang.String domain, java.lang.String user, java.lang.String password, byte[] nonce, byte[] targetInfo, byte[] clientNonce, byte[] timestamp) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public static byte[] answerNtlmv2Challenge(java.lang.String domain, java.lang.String user, java.lang.String password, byte[] nonce, byte[] targetInfo, byte[] clientNonce, long now) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public static byte[] answerLmv2Challenge(java.lang.String domain, java.lang.String user, java.lang.String password, byte[] nonce, byte[] clientNonce) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
private static byte[] ntv2Hash(java.lang.String domain, java.lang.String user, java.lang.String password) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
private static byte[] lmv2Response(byte[] hash, byte[] clientData, byte[] challenge)
hash
- The NTLMv2 Hash.clientData
- The client data (blob or client challenge).challenge
- The server challenge from the Type 2 message.
private static byte[] hmacMD5(byte[] data, byte[] key)
data
- The data for which the hash will be calculated.key
- The hashing key.
private static byte[] md5(byte[] data)
public static byte[] createTimestamp(long time)
time
- current time, as returned from System.currentTimeMillis
private static byte[] createBlob(byte[] targetInformation, byte[] clientChallenge, byte[] timestamp)
targetInformation
- The target information block from the Type 2
message.clientChallenge
- The random 8-byte client challenge.
private static byte[] encryptNonce(byte[] key, byte[] nonce)
private static byte[] ntHash(java.lang.String password) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
private static byte[] convertPassword(java.lang.String password) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
private static byte[] makeDESkey(byte[] buf, int off)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |