public class Type3Message extends NtlmMessage
NTLMSSP_NEGOTIATE_128, NTLMSSP_NEGOTIATE_56, NTLMSSP_NEGOTIATE_ALWAYS_SIGN, NTLMSSP_NEGOTIATE_ANONYMOUS, NTLMSSP_NEGOTIATE_DATAGRAM_STYLE, NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY, NTLMSSP_NEGOTIATE_KEY_EXCH, NTLMSSP_NEGOTIATE_LM_KEY, NTLMSSP_NEGOTIATE_LOCAL_CALL, NTLMSSP_NEGOTIATE_NETWARE, NTLMSSP_NEGOTIATE_NTLM, NTLMSSP_NEGOTIATE_OEM, NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED, NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED, NTLMSSP_NEGOTIATE_SEAL, NTLMSSP_NEGOTIATE_SIGN, NTLMSSP_NEGOTIATE_TARGET_INFO, NTLMSSP_NEGOTIATE_UNICODE, NTLMSSP_NEGOTIATE_VERSION, NTLMSSP_REQUEST_ACCEPT_RESPONSE, NTLMSSP_REQUEST_INIT_RESPONSE, NTLMSSP_REQUEST_NON_NT_SESSION_KEY, NTLMSSP_REQUEST_TARGET, NTLMSSP_TARGET_TYPE_DOMAIN, NTLMSSP_TARGET_TYPE_SERVER, NTLMSSP_TARGET_TYPE_SHARE| Constructor and Description |
|---|
Type3Message(byte[] material)
Creates a Type-3 message using the given raw Type-3 material.
|
Type3Message(CIFSContext tc)
Creates a Type-3 message using default values from the current
environment.
|
Type3Message(CIFSContext tc,
Type2Message type2,
String targetName,
byte[] passwordHash,
String domain,
String user,
String workstation,
int flags)
Creates a Type-3 message in response to the given Type-2 message.
|
Type3Message(CIFSContext tc,
Type2Message type2,
String targetName,
byte[] passwordHash,
String password,
String domain,
String user,
String workstation,
int flags,
boolean nonAnonymous)
Creates a Type-3 message in response to the given Type-2 message.
|
Type3Message(CIFSContext tc,
Type2Message type2,
String targetName,
String password,
String domain,
String user,
String workstation,
int flags)
Creates a Type-3 message in response to the given Type-2 message.
|
Type3Message(CIFSContext tc,
Type2Message type2,
String targetName,
String password,
String domain,
String user,
String workstation,
int flags,
boolean nonAnonymous)
Creates a Type-3 message in response to the given Type-2 message.
|
Type3Message(int flags,
byte[] lmResponse,
byte[] ntResponse,
String domain,
String user,
String workstation)
Creates a Type-3 message with the specified parameters.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
getDefaultFlags(CIFSContext tc)
Returns the default flags for a generic Type-3 message in the
current environment.
|
static int |
getDefaultFlags(CIFSContext tc,
Type2Message type2)
Returns the default flags for a Type-3 message created in response
to the given Type-2 message in the current environment.
|
String |
getDomain()
Returns the domain in which the user has an account.
|
byte[] |
getEncryptedSessionKey()
Returns the session key.
|
byte[] |
getLMResponse()
Returns the LanManager/LMv2 response.
|
static byte[] |
getLMResponse(CIFSContext tc,
Type2Message type2,
String password)
Constructs the LanManager response to the given Type-2 message using
the supplied password.
|
static byte[] |
getLMv2Response(CIFSContext tc,
Type2Message type2,
String domain,
String user,
byte[] passwordHash,
byte[] clientChallenge) |
static byte[] |
getLMv2Response(CIFSContext tc,
Type2Message type2,
String domain,
String user,
String password,
byte[] clientChallenge) |
byte[] |
getMasterKey()
The real session key if the regular session key is actually
the encrypted version used for key exchange.
|
byte[] |
getMic() |
static byte[] |
getNTLMv2Response(CIFSContext tc,
Type2Message type2,
byte[] responseKeyNT,
byte[] clientChallenge,
byte[] clientChallengeInfo,
long ts) |
byte[] |
getNTResponse()
Returns the NT/NTLMv2 response.
|
static byte[] |
getNTResponse(CIFSContext tc,
Type2Message type2,
byte[] passwordHash)
Constructs the NT response to the given Type-2 message using
the supplied password.
|
static byte[] |
getNTResponse(CIFSContext tc,
Type2Message type2,
String password)
Constructs the NT response to the given Type-2 message using
the supplied password.
|
String |
getUser()
Returns the username for the authenticating user.
|
String |
getWorkstation()
Returns the workstation from which authentication is being performed.
|
boolean |
isMICRequired() |
void |
setDomain(String domain)
Sets the domain for this message.
|
void |
setEncryptedSessionKey(byte[] sessionKey)
Sets the session key.
|
void |
setLMResponse(byte[] lmResponse)
Sets the LanManager/LMv2 response for this message.
|
void |
setMic(byte[] mic) |
void |
setNTResponse(byte[] ntResponse)
Sets the NT/NTLMv2 response for this message.
|
void |
setupMIC(byte[] type1,
byte[] type2)
Sets the MIC
|
void |
setUser(String user)
Sets the user for this message.
|
void |
setWorkstation(String workstation)
Sets the workstation for this message.
|
byte[] |
toByteArray()
Returns the raw byte representation of this message.
|
String |
toString() |
getFlag, getFlags, setFlag, setFlagspublic Type3Message(CIFSContext tc)
tc - context to usepublic Type3Message(CIFSContext tc, Type2Message type2, String targetName, String password, String domain, String user, String workstation, int flags) throws GeneralSecurityException, CIFSException
tc - context to usetype2 - The Type-2 message which this represents a response to.targetName - SPN of the target system, optionalpassword - The password to use when constructing the response.domain - The domain in which the user has an account.user - The username for the authenticating user.workstation - The workstation from which authentication is
taking place.flags - GeneralSecurityExceptionCIFSExceptionpublic Type3Message(CIFSContext tc, Type2Message type2, String targetName, String password, String domain, String user, String workstation, int flags, boolean nonAnonymous) throws GeneralSecurityException, CIFSException
tc - context to usetype2 - The Type-2 message which this represents a response to.targetName - SPN of the target system, optionalpassword - The password to use when constructing the response.domain - The domain in which the user has an account.user - The username for the authenticating user.workstation - The workstation from which authentication is
taking place.flags - nonAnonymous - actually perform authentication with empty passwordGeneralSecurityExceptionCIFSExceptionpublic Type3Message(CIFSContext tc, Type2Message type2, String targetName, byte[] passwordHash, String domain, String user, String workstation, int flags) throws CIFSException, GeneralSecurityException
tc - context to usetype2 - The Type-2 message which this represents a response to.targetName - SPN of the target system, optionalpasswordHash - The NT password hash to use when constructing the response.domain - The domain in which the user has an account.user - The username for the authenticating user.workstation - The workstation from which authentication is
taking place.flags - GeneralSecurityExceptionCIFSExceptionpublic Type3Message(CIFSContext tc, Type2Message type2, String targetName, byte[] passwordHash, String password, String domain, String user, String workstation, int flags, boolean nonAnonymous) throws GeneralSecurityException, CIFSException
tc - context to usetype2 - The Type-2 message which this represents a response to.targetName - SPN of the target system, optionalpasswordHash - The NT password hash, takes precedence over password (which is no longer required unless legacy LM
authentication is needed)password - The password to use when constructing the response.domain - The domain in which the user has an account.user - The username for the authenticating user.workstation - The workstation from which authentication is
taking place.flags - nonAnonymous - actually perform authentication with empty passwordGeneralSecurityExceptionCIFSExceptionpublic Type3Message(int flags,
byte[] lmResponse,
byte[] ntResponse,
String domain,
String user,
String workstation)
flags - The flags to apply to this message.lmResponse - The LanManager/LMv2 response.ntResponse - The NT/NTLMv2 response.domain - The domain in which the user has an account.user - The username for the authenticating user.workstation - The workstation from which authentication is
taking place.public Type3Message(byte[] material)
throws IOException
material - The raw Type-3 material used to construct this message.IOException - If an error occurs while parsing the material.public void setupMIC(byte[] type1,
byte[] type2)
throws GeneralSecurityException,
IOException
type1 - type2 - GeneralSecurityExceptionIOExceptionpublic static int getDefaultFlags(CIFSContext tc)
tc - context to useint containing the default flags.public static int getDefaultFlags(CIFSContext tc, Type2Message type2)
tc - context to usetype2 - The Type-2 message.int containing the default flags.public byte[] getLMResponse()
byte[] containing the LanManager response.public void setLMResponse(byte[] lmResponse)
lmResponse - The LanManager response.public byte[] getNTResponse()
byte[] containing the NT/NTLMv2 response.public void setNTResponse(byte[] ntResponse)
ntResponse - The NT/NTLMv2 response.public String getDomain()
String containing the domain for the user.public void setDomain(String domain)
domain - The domain.public String getUser()
String containing the user for this message.public void setUser(String user)
user - The user.public String getWorkstation()
String containing the workstation.public void setWorkstation(String workstation)
workstation - The workstation.public byte[] getMasterKey()
byte[] containing the session key.public byte[] getEncryptedSessionKey()
getMasterKey() instead.byte[] containing the encrypted session key.public void setEncryptedSessionKey(byte[] sessionKey)
sessionKey - The session key.public byte[] getMic()
byte[] containing the message integrity code.public void setMic(byte[] mic)
mic - NTLM mic to set (16 bytes)public boolean isMICRequired()
public byte[] toByteArray()
throws IOException
NtlmMessagetoByteArray in class NtlmMessagebyte[] containing the raw message material.IOExceptionpublic static byte[] getLMResponse(CIFSContext tc, Type2Message type2, String password) throws GeneralSecurityException
tc - context to usetype2 - The Type-2 message.password - The password.byte[] containing the LanManager response.GeneralSecurityExceptionpublic static byte[] getLMv2Response(CIFSContext tc, Type2Message type2, String domain, String user, String password, byte[] clientChallenge) throws GeneralSecurityException
tc - type2 - domain - user - password - clientChallenge - GeneralSecurityExceptionpublic static byte[] getLMv2Response(CIFSContext tc, Type2Message type2, String domain, String user, byte[] passwordHash, byte[] clientChallenge) throws GeneralSecurityException
tc - type2 - domain - user - passwordHash - NT password hashclientChallenge - GeneralSecurityExceptionpublic static byte[] getNTLMv2Response(CIFSContext tc, Type2Message type2, byte[] responseKeyNT, byte[] clientChallenge, byte[] clientChallengeInfo, long ts)
tc - context to usetype2 - The Type-2 message.responseKeyNT - clientChallenge - clientChallengeInfo - ts - timestamp (nanos since 1601)byte[] containing the NTLMv2 response.public static byte[] getNTResponse(CIFSContext tc, Type2Message type2, String password) throws GeneralSecurityException
tc - context to usetype2 - The Type-2 message.password - The password.byte[] containing the NT response.GeneralSecurityExceptionpublic static byte[] getNTResponse(CIFSContext tc, Type2Message type2, byte[] passwordHash) throws GeneralSecurityException
tc - context to usetype2 - The Type-2 message.passwordHash - The NT password hash.byte[] containing the NT response.GeneralSecurityExceptionCopyright © 2023. All rights reserved.