Module jcifs

Class Type2Message

java.lang.Object
org.codelibs.jcifs.smb.ntlmssp.NtlmMessage
org.codelibs.jcifs.smb.ntlmssp.Type2Message
All Implemented Interfaces:
NtlmFlags

public class Type2Message extends NtlmMessage
Represents an NTLMSSP Type-2 message.
  • Constructor Details

    • Type2Message

      public Type2Message(CIFSContext tc)
      Creates a Type-2 message using default values from the current environment.
      Parameters:
      tc - context to use
    • Type2Message

      public Type2Message(CIFSContext tc, Type1Message type1)
      Creates a Type-2 message in response to the given Type-1 message using default values from the current environment.
      Parameters:
      tc - context to use
      type1 - The Type-1 message which this represents a response to.
    • Type2Message

      public Type2Message(CIFSContext tc, Type1Message type1, byte[] challenge, String target)
      Creates a Type-2 message in response to the given Type-1 message.
      Parameters:
      tc - context to use
      type1 - The Type-1 message which this represents a response to.
      challenge - The challenge from the domain controller/server.
      target - The authentication target.
    • Type2Message

      public Type2Message(CIFSContext tc, int flags, byte[] challenge, String target)
      Creates a Type-2 message with the specified parameters.
      Parameters:
      tc - context to use
      flags - The flags to apply to this message.
      challenge - The challenge from the domain controller/server.
      target - The authentication target.
    • Type2Message

      public Type2Message(byte[] material) throws IOException
      Creates a Type-2 message using the given raw Type-2 material.
      Parameters:
      material - The raw Type-2 material used to construct this message.
      Throws:
      IOException - If an error occurs while parsing the material.
  • Method Details

    • getDefaultFlags

      public static int getDefaultFlags(CIFSContext tc)
      Returns the default flags for a generic Type-2 message in the current environment.
      Parameters:
      tc - context to use
      Returns:
      An int containing the default flags.
    • getDefaultFlags

      public static int getDefaultFlags(CIFSContext tc, Type1Message type1)
      Returns the default flags for a Type-2 message created in response to the given Type-1 message in the current environment.
      Parameters:
      tc - context to use
      type1 - request message
      Returns:
      An int containing the default flags.
    • getChallenge

      public byte[] getChallenge()
      Returns the challenge for this message.
      Returns:
      A byte[] containing the challenge.
    • setChallenge

      public void setChallenge(byte[] challenge)
      Sets the challenge for this message.
      Parameters:
      challenge - The challenge from the domain controller/server.
    • getTarget

      public String getTarget()
      Returns the authentication target.
      Returns:
      A String containing the authentication target.
    • setTarget

      public void setTarget(String target)
      Sets the authentication target.
      Parameters:
      target - The authentication target.
    • getTargetInformation

      public byte[] getTargetInformation()
      Returns the target information block.
      Returns:
      A byte[] containing the target information block. The target information block is used by the client to create an NTLMv2 response.
    • setTargetInformation

      public void setTargetInformation(byte[] targetInformation)
      Sets the target information block. The target information block is used by the client to create an NTLMv2 response.
      Parameters:
      targetInformation - The target information block.
    • getContext

      public byte[] getContext()
      Returns the local security context.
      Returns:
      A byte[] containing the local security context. This is used by the client to negotiate local authentication.
    • setContext

      public void setContext(byte[] context)
      Sets the local security context. This is used by the client to negotiate local authentication.
      Parameters:
      context - The local security context.
    • toByteArray

      public byte[] toByteArray() throws IOException
      Description copied from class: NtlmMessage
      Returns the raw byte representation of this message.
      Specified by:
      toByteArray in class NtlmMessage
      Returns:
      A byte[] containing the raw message material.
      Throws:
      IOException - if an error occurs during message serialization
    • toString

      public String toString()
      Overrides:
      toString in class Object