Class NtlmFunctions


  • public class NtlmFunctions
    extends java.lang.Object
    NTLM Helper functions
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.nio.charset.Charset UNICODE  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private NtlmFunctions()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static Cipher getDESCipher​(SecurityProvider securityProvider, byte[] key)  
      static byte[] hmac_md5​(SecurityProvider securityProvider, byte[] key, byte[]... message)
      [MS-NLMP].pdf 6 Appendix A: Cryptographic Operations Reference (HMAC_MD5(K, M)).
      (package private) static byte[] md4​(SecurityProvider securityProvider, byte[] m)
      [MS-NLMP].pdf 6 Appendix A: Cryptographic Operations Reference (MD4(M)).
      static byte[] md5​(SecurityProvider securityProvider, byte[]... message)  
      static java.lang.String oem​(byte[] bytes)  
      static byte[] oem​(java.lang.String s)  
      static byte[] rc4k​(SecurityProvider securityProvider, byte[] k, byte[] d)
      [MS-NLMP].pdf 6 Appendix A: Cryptographic Operations Reference (RC4K(K, D)).
      private static byte[] setupKey​(byte[] key56)  
      static java.lang.String unicode​(byte[] bytes)  
      static byte[] unicode​(java.lang.String string)
      [MS-NLMP].pdf 6 Appendix A: Cryptographic Operations Reference (UNICODE(string)).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • UNICODE

        public static final java.nio.charset.Charset UNICODE
    • Constructor Detail

      • NtlmFunctions

        private NtlmFunctions()
    • Method Detail

      • unicode

        public static byte[] unicode​(java.lang.String string)
        [MS-NLMP].pdf 6 Appendix A: Cryptographic Operations Reference (UNICODE(string)).
        Parameters:
        string - The string to get the bytes of.
        Returns:
        The 2-byte little endian byte order encoding of the Unicode UTF-16 representation of the string.
      • unicode

        public static java.lang.String unicode​(byte[] bytes)
      • oem

        public static byte[] oem​(java.lang.String s)
      • oem

        public static java.lang.String oem​(byte[] bytes)
      • md4

        static byte[] md4​(SecurityProvider securityProvider,
                          byte[] m)
        [MS-NLMP].pdf 6 Appendix A: Cryptographic Operations Reference (MD4(M)).
        Parameters:
        m - The string to calculcate the MD4 hash of.
        Returns:
        The 2-byte little endian byte order encoding of the Unicode UTF-16 representation of the string.
      • hmac_md5

        public static byte[] hmac_md5​(SecurityProvider securityProvider,
                                      byte[] key,
                                      byte[]... message)
        [MS-NLMP].pdf 6 Appendix A: Cryptographic Operations Reference (HMAC_MD5(K, M)).
        Parameters:
        key - The bytes of key K
        message - The bytes of message M
        Returns:
        The 16-byte HMAC-keyed MD5 message digest of the byte string M using the key K
      • md5

        public static byte[] md5​(SecurityProvider securityProvider,
                                 byte[]... message)
      • rc4k

        public static byte[] rc4k​(SecurityProvider securityProvider,
                                  byte[] k,
                                  byte[] d)
                           throws NtlmException
        [MS-NLMP].pdf 6 Appendix A: Cryptographic Operations Reference (RC4K(K, D)).
        Parameters:
        k - The key to initialize the RC4 cipher with.
        d - The data to encrypt.
        Returns:
        The encrypted data.
        Throws:
        NtlmException
      • setupKey

        private static byte[] setupKey​(byte[] key56)