@NotThreadSafe final class NTLMEngineImpl extends java.lang.Object implements NTLMEngine
Modifier and Type | Class and Description |
---|---|
protected static class |
NTLMEngineImpl.CipherGen |
(package private) static class |
NTLMEngineImpl.HMACMD5
Cryptography support - HMACMD5 - algorithmically based on various web
resources by Karl Wright
|
(package private) static class |
NTLMEngineImpl.MD4
Cryptography support - MD4.
|
(package private) static class |
NTLMEngineImpl.NTLMMessage
NTLM message generation, base class
|
(package private) static class |
NTLMEngineImpl.Type1Message
Type 1 message assembly class
|
(package private) static class |
NTLMEngineImpl.Type2Message
Type 2 message class
|
(package private) static class |
NTLMEngineImpl.Type3Message
Type 3 message assembly class
|
Modifier and Type | Field and Description |
---|---|
protected static int |
FLAG_DOMAIN_PRESENT |
protected static int |
FLAG_REQUEST_128BIT_KEY_EXCH |
protected static int |
FLAG_REQUEST_56BIT_ENCRYPTION |
protected static int |
FLAG_REQUEST_ALWAYS_SIGN |
protected static int |
FLAG_REQUEST_EXPLICIT_KEY_EXCH |
protected static int |
FLAG_REQUEST_LAN_MANAGER_KEY |
protected static int |
FLAG_REQUEST_NTLM2_SESSION |
protected static int |
FLAG_REQUEST_NTLMv1 |
protected static int |
FLAG_REQUEST_SEAL |
protected static int |
FLAG_REQUEST_SIGN |
protected static int |
FLAG_REQUEST_TARGET |
protected static int |
FLAG_REQUEST_UNICODE_ENCODING |
protected static int |
FLAG_REQUEST_VERSION |
protected static int |
FLAG_TARGETINFO_PRESENT |
protected static int |
FLAG_WORKSTATION_PRESENT |
Constructor and Description |
---|
NTLMEngineImpl() |
Modifier and Type | Method and Description |
---|---|
(package private) static int |
F(int x,
int y,
int z) |
(package private) static int |
G(int x,
int y,
int z) |
java.lang.String |
generateType1Msg(java.lang.String domain,
java.lang.String workstation)
Generates a Type1 message given the domain and workstation.
|
java.lang.String |
generateType3Msg(java.lang.String username,
java.lang.String password,
java.lang.String domain,
java.lang.String workstation,
java.lang.String challenge)
Generates a Type3 message given the user credentials and the
authentication challenge.
|
(package private) static java.lang.String |
getResponseFor(java.lang.String message,
java.lang.String username,
java.lang.String password,
java.lang.String host,
java.lang.String domain)
Returns the response for the given message.
|
(package private) static java.lang.String |
getType1Message(java.lang.String host,
java.lang.String domain)
Creates the first message (type 1 message) in the NTLM authentication
sequence.
|
(package private) static java.lang.String |
getType3Message(java.lang.String user,
java.lang.String password,
java.lang.String host,
java.lang.String domain,
byte[] nonce,
int type2Flags,
java.lang.String target,
byte[] targetInformation)
Creates the type 3 message using the given server nonce.
|
(package private) static int |
H(int x,
int y,
int z) |
(package private) static byte[] |
hmacMD5(byte[] value,
byte[] key)
Calculates HMAC-MD5
|
(package private) static byte[] |
ntlm2SessionResponse(byte[] ntlmHash,
byte[] challenge,
byte[] clientChallenge)
Calculates the NTLM2 Session Response for the given challenge, using the
specified password and client challenge.
|
(package private) static byte[] |
RC4(byte[] value,
byte[] key)
Calculates RC4
|
(package private) static int |
rotintlft(int val,
int numbits) |
(package private) static void |
writeULong(byte[] buffer,
int value,
int offset) |
protected static final int FLAG_REQUEST_UNICODE_ENCODING
protected static final int FLAG_REQUEST_TARGET
protected static final int FLAG_REQUEST_SIGN
protected static final int FLAG_REQUEST_SEAL
protected static final int FLAG_REQUEST_LAN_MANAGER_KEY
protected static final int FLAG_REQUEST_NTLMv1
protected static final int FLAG_DOMAIN_PRESENT
protected static final int FLAG_WORKSTATION_PRESENT
protected static final int FLAG_REQUEST_ALWAYS_SIGN
protected static final int FLAG_REQUEST_NTLM2_SESSION
protected static final int FLAG_REQUEST_VERSION
protected static final int FLAG_TARGETINFO_PRESENT
protected static final int FLAG_REQUEST_128BIT_KEY_EXCH
protected static final int FLAG_REQUEST_EXPLICIT_KEY_EXCH
protected static final int FLAG_REQUEST_56BIT_ENCRYPTION
static java.lang.String getResponseFor(java.lang.String message, java.lang.String username, java.lang.String password, java.lang.String host, java.lang.String domain) throws NTLMEngineException
message
- the message that was received from the server.username
- the username to authenticate with.password
- the password to authenticate with.host
- The host.domain
- the NT domain to authenticate in.HttpException
- If the messages cannot be retrieved.NTLMEngineException
static java.lang.String getType1Message(java.lang.String host, java.lang.String domain) throws NTLMEngineException
host
- the computer name of the host requesting authentication.domain
- The domain to authenticate with.NTLMEngineException
static java.lang.String getType3Message(java.lang.String user, java.lang.String password, java.lang.String host, java.lang.String domain, byte[] nonce, int type2Flags, java.lang.String target, byte[] targetInformation) throws NTLMEngineException
user
- The user name. This should not include the domain name.password
- The password.host
- The host that is originating the authentication request.domain
- The domain to authenticate within.nonce
- the 8 byte array the server sent.NTLMEngineException
- If fails.static byte[] hmacMD5(byte[] value, byte[] key) throws NTLMEngineException
NTLMEngineException
static byte[] RC4(byte[] value, byte[] key) throws NTLMEngineException
NTLMEngineException
static byte[] ntlm2SessionResponse(byte[] ntlmHash, byte[] challenge, byte[] clientChallenge) throws NTLMEngineException
NTLMEngineException
static void writeULong(byte[] buffer, int value, int offset)
static int F(int x, int y, int z)
static int G(int x, int y, int z)
static int H(int x, int y, int z)
static int rotintlft(int val, int numbits)
public java.lang.String generateType1Msg(java.lang.String domain, java.lang.String workstation) throws NTLMEngineException
NTLMEngine
generateType1Msg
in interface NTLMEngine
domain
- Optional Windows domain name. Can be null
.workstation
- Optional Windows workstation name. Can be
null
.NTLMEngineException
public java.lang.String generateType3Msg(java.lang.String username, java.lang.String password, java.lang.String domain, java.lang.String workstation, java.lang.String challenge) throws NTLMEngineException
NTLMEngine
generateType3Msg
in interface NTLMEngine
username
- Windows user namepassword
- Passworddomain
- Windows domain nameworkstation
- Windows workstation namechallenge
- Type2 challenge.NTLMEngineException