net.sourceforge.jtds.jdbc
Class NtlmAuth

java.lang.Object
  |
  +--net.sourceforge.jtds.jdbc.NtlmAuth

public class NtlmAuth
extends java.lang.Object

This class calculates the two "responses" to the nonce supplied by the server as a part of NTLM authentication.

Version:
$Id: NtlmAuth.java,v 1.4 2004/08/24 17:45:02 bheineman Exp $
Author:
Matt Brinkley

Constructor Summary
NtlmAuth()
           
 
Method Summary
static byte[] answerLmChallenge(java.lang.String pwd, byte[] nonce)
           
static byte[] answerNtChallenge(java.lang.String password, byte[] nonce)
           
private static byte[] convertPassword(java.lang.String password)
          Used by answerNtlmChallenge.
private static byte[] encryptNonce(byte[] key, byte[] nonce)
           
private static byte[] makeDESkey(byte[] buf, int off)
          Turns a 7-byte DES key into an 8-byte one by adding parity bits.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

NtlmAuth

public NtlmAuth()
Method Detail

answerNtChallenge

public static final byte[] answerNtChallenge(java.lang.String password,
                                             byte[] nonce)
                                      throws java.io.UnsupportedEncodingException

answerLmChallenge

public static final byte[] answerLmChallenge(java.lang.String pwd,
                                             byte[] nonce)
                                      throws java.io.UnsupportedEncodingException

encryptNonce

private static byte[] encryptNonce(byte[] key,
                                   byte[] nonce)

convertPassword

private static final byte[] convertPassword(java.lang.String password)
                                     throws java.io.UnsupportedEncodingException
Used by answerNtlmChallenge. We need the password converted to caps, narrowed and padded/truncated to 14 chars...

makeDESkey

private static final byte[] makeDESkey(byte[] buf,
                                       int off)
Turns a 7-byte DES key into an 8-byte one by adding parity bits. All implementations of DES seem to want an 8-byte key.


Generated on November 8 2005