Package jcifs.smb

Class NtlmUtil


  • public final class NtlmUtil
    extends Object
    Internal use only
    Author:
    mbechler
    • Method Detail

      • getNTLMv2Response

        public static byte[] getNTLMv2Response​(byte[] responseKeyNT,
                                               byte[] serverChallenge,
                                               byte[] clientChallenge,
                                               long nanos1601,
                                               byte[] avPairs)
        Parameters:
        responseKeyNT -
        serverChallenge -
        clientChallenge -
        nanos1601 -
        avPairs -
        Returns:
        the calculated response
      • getLMv2Response

        public static byte[] getLMv2Response​(byte[] responseKeyLM,
                                             byte[] serverChallenge,
                                             byte[] clientChallenge)
        Parameters:
        responseKeyLM -
        serverChallenge -
        clientChallenge -
        Returns:
        the calculated response
      • nTOWFv2

        public static byte[] nTOWFv2​(String domain,
                                     String username,
                                     String password)
        Parameters:
        domain -
        username -
        password -
        Returns:
        the caclulated mac
      • nTOWFv2

        public static byte[] nTOWFv2​(String domain,
                                     String username,
                                     byte[] passwordHash)
        Parameters:
        domain -
        username -
        passwordHash - NT password hash
        Returns:
        the caclulated mac
      • getNTHash

        public static byte[] getNTHash​(String password)
        Parameters:
        password -
        Returns:
        nt password hash
      • nTOWFv1

        public static byte[] nTOWFv1​(String password)
        Parameters:
        password -
        Returns:
        the calculated hash
      • getNTLM2Response

        public static byte[] getNTLM2Response​(byte[] passwordHash,
                                              byte[] serverChallenge,
                                              byte[] clientChallenge)
                                       throws GeneralSecurityException
        Parameters:
        passwordHash -
        serverChallenge -
        clientChallenge -
        Returns:
        the calculated response
        Throws:
        GeneralSecurityException
      • 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
      • 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
      • 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 -
        challenge -
        Returns:
        the calculated response
        Throws:
        GeneralSecurityException
      • 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 Hash
        challenge -
        Returns:
        the calculated response
        Throws:
        GeneralSecurityException
      • 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 -
        password -
        challenge -
        Returns:
        the calculated response
        Throws:
        GeneralSecurityException