java.lang.Object
org.codelibs.jcifs.smb.impl.NtlmUtil
Internal use only
- Author:
- mbechler
This class is intended for internal use.
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]getLMv2Response(byte[] responseKeyLM, byte[] serverChallenge, byte[] clientChallenge) Creates the LMv2 response for the supplied keys and challenges.static byte[]getLMv2Response(String domain, String user, byte[] passwordHash, byte[] challenge, byte[] clientChallenge) Creates the LMv2 response for the supplied information.static byte[]getLMv2Response(String domain, String user, String password, byte[] challenge, byte[] clientChallenge) Creates the LMv2 response for the supplied information.static byte[]Generates the NT password hash for the given password.static byte[]getNTLM2Response(byte[] passwordHash, byte[] serverChallenge, byte[] clientChallenge) Creates the NTLM2 session response for the supplied information.static byte[]getNTLMResponse(byte[] passwordHash, byte[] challenge) Generate the Unicode MD4 hash for the password associated with these credentials.static byte[]getNTLMResponse(String password, byte[] challenge) Generate the Unicode MD4 hash for the password associated with these credentials.static byte[]getNTLMv2Response(byte[] responseKeyNT, byte[] serverChallenge, byte[] clientChallenge, long nanos1601, byte[] avPairs) Creates the NTLMv2 response for the supplied information.static byte[]getPreNTLMResponse(CIFSContext tc, String password, byte[] challenge) Generate the ANSI DES hash for the password associated with these credentials.static byte[]Generates the NTOWFv1 hash for the given password.static byte[]Generates the NTOWFv2 hash for the given domain, username, and password hash.static byte[]Generates the NTOWFv2 hash for the given domain, username, and password.
-
Method Details
-
getNTLMv2Response
public static byte[] getNTLMv2Response(byte[] responseKeyNT, byte[] serverChallenge, byte[] clientChallenge, long nanos1601, byte[] avPairs) Creates the NTLMv2 response for the supplied information.- Parameters:
responseKeyNT- the NT response keyserverChallenge- the server challenge bytesclientChallenge- the client challenge bytesnanos1601- the timestamp in nanoseconds since 1601avPairs- the AV pairs from the Type 2 message- Returns:
- the calculated response
-
getLMv2Response
public static byte[] getLMv2Response(byte[] responseKeyLM, byte[] serverChallenge, byte[] clientChallenge) Creates the LMv2 response for the supplied keys and challenges.- Parameters:
responseKeyLM- the LM response keyserverChallenge- the server challenge bytesclientChallenge- the client challenge bytes- Returns:
- the calculated response
-
nTOWFv2
Generates the NTOWFv2 hash for the given domain, username, and password.- Parameters:
domain- the authentication domainusername- the usernamepassword- the password- Returns:
- the calculated mac
-
nTOWFv2
Generates the NTOWFv2 hash for the given domain, username, and password hash.- Parameters:
domain- the authentication domainusername- the usernamepasswordHash- NT password hash- Returns:
- the calculated mac
-
getNTHash
Generates the NT password hash for the given password.- Parameters:
password- the password to hash- Returns:
- nt password hash
-
nTOWFv1
Generates the NTOWFv1 hash for the given password.- Parameters:
password- the password to hash- Returns:
- the calculated hash
-
getNTLM2Response
public static byte[] getNTLM2Response(byte[] passwordHash, byte[] serverChallenge, byte[] clientChallenge) throws GeneralSecurityException Creates the NTLM2 session response for the supplied information.- Parameters:
passwordHash- the password hash to useserverChallenge- the server challenge bytesclientChallenge- the client challenge bytes- Returns:
- the calculated response
- Throws:
GeneralSecurityException- if a cryptographic error occurs
-
getLMv2Response
public static byte[] getLMv2Response(String domain, String user, String password, byte[] challenge, byte[] clientChallenge) throws GeneralSecurityException Creates the LMv2 response for the supplied information.- Parameters:
domain- The domain in which the username exists.user- The username.password- The user's password.challenge- The server challenge.clientChallenge- The client challenge (nonce).- Returns:
- the calculated response
- Throws:
GeneralSecurityException- if a cryptographic error occurs
-
getLMv2Response
public static byte[] getLMv2Response(String domain, String user, byte[] passwordHash, byte[] challenge, byte[] clientChallenge) throws GeneralSecurityException Creates the LMv2 response for the supplied information.- Parameters:
domain- The domain in which the username exists.user- The username.passwordHash- The user's NT hash.challenge- The server challenge.clientChallenge- The client challenge (nonce).- Returns:
- the calculated response
- Throws:
GeneralSecurityException- if a cryptographic error occurs
-
getNTLMResponse
public static byte[] getNTLMResponse(String password, byte[] challenge) throws GeneralSecurityException Generate the Unicode MD4 hash for the password associated with these credentials.- Parameters:
password- the password to hashchallenge- the server challenge bytes- Returns:
- the calculated response
- Throws:
GeneralSecurityException- if a cryptographic error occurs
-
getNTLMResponse
public static byte[] getNTLMResponse(byte[] passwordHash, byte[] challenge) throws GeneralSecurityException Generate the Unicode MD4 hash for the password associated with these credentials.- Parameters:
passwordHash- NT Hashchallenge- the server challenge bytes- Returns:
- the calculated response
- Throws:
GeneralSecurityException- if a cryptographic error occurs
-
getPreNTLMResponse
public static byte[] getPreNTLMResponse(CIFSContext tc, String password, byte[] challenge) throws GeneralSecurityException Generate the ANSI DES hash for the password associated with these credentials.- Parameters:
tc- the CIFS context to use for configurationpassword- the password to hashchallenge- the server challenge bytes- Returns:
- the calculated response
- Throws:
GeneralSecurityException- if a cryptographic error occurs
-