Module jcifs

Class SMB1SigningDigest

java.lang.Object
org.codelibs.jcifs.smb.internal.smb1.SMB1SigningDigest
All Implemented Interfaces:
SMBSigningDigest

public class SMB1SigningDigest extends Object implements SMBSigningDigest

This class is intended for internal use.

  • Constructor Details

    • SMB1SigningDigest

      public SMB1SigningDigest(byte[] macSigningKey, boolean bypass)
      Constructs a signing digest with bypass option
      Parameters:
      macSigningKey - The MAC signing key used for generating signatures
      bypass - Whether to bypass signature verification
    • SMB1SigningDigest

      public SMB1SigningDigest(byte[] macSigningKey, boolean bypass, int initialSequence)
      Constructs a signing digest with bypass option and initial sequence number
      Parameters:
      macSigningKey - The MAC signing key used for generating signatures
      bypass - Whether to bypass signature verification
      initialSequence - The initial sequence number for signing
    • SMB1SigningDigest

      public SMB1SigningDigest(byte[] macSigningKey)
      This constructor used to instance a SigningDigest object for signing/verifying SMB using kerberos session key. The MAC Key = concat(Session Key, Digest of Challenge); Because of Kerberos Authentication don't have challenge, The MAC Key = Session Key
      Parameters:
      macSigningKey - The MAC key used to sign or verify SMB.
    • SMB1SigningDigest

      public SMB1SigningDigest(byte[] macSigningKey, int initialSequence)
      Construct a digest with a non-zero starting sequence number
      Parameters:
      macSigningKey - The MAC signing key used for generating signatures
      initialSequence - The initial sequence number for signing
    • SMB1SigningDigest

      public SMB1SigningDigest(SmbTransportInternal transport, NtlmPasswordAuthenticator auth) throws SmbException
      Constructs a signing digest from transport and authentication information
      Parameters:
      transport - The SMB transport containing server encryption key
      auth - The NTLM password authenticator containing user credentials
      Throws:
      SmbException - If there is an error setting up the signing digest
  • Method Details

    • update

      public void update(byte[] input, int offset, int len)
      Update digest with data
      Parameters:
      input - The input data to update the digest with
      offset - The starting offset in the input data
      len - The length of data to process
    • digest

      public byte[] digest()
      Finalize and return the calculated message digest
      Returns:
      calculated digest
    • sign

      public void sign(byte[] data, int offset, int length, CommonServerMessageBlock request, CommonServerMessageBlock response)
      Performs MAC signing of the SMB. This is done as follows. The signature field of the SMB is overwritten with the sequence number; The MD5 digest of the MAC signing key + the entire SMB is taken; The first 8 bytes of this are placed in the signature field.
      Specified by:
      sign in interface SMBSigningDigest
      Parameters:
      data - The data.
      offset - The starting offset at which the SMB header begins.
      length - The length of the SMB data starting at offset.
      request - request message
      response - response message
      See Also:
    • verify

      public boolean verify(byte[] data, int offset, int l, int extraPad, CommonServerMessageBlock m)
      Performs MAC signature verification. This calculates the signature of the SMB and compares it to the signature field on the SMB itself.
      Specified by:
      verify in interface SMBSigningDigest
      Parameters:
      data - The data.
      offset - The starting offset at which the SMB header begins.
      l - The length of the data to verify
      extraPad - extra padding to include in signature
      m - The message to verify
      Returns:
      whether verification was unsuccessful
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • writeUTime

      public static void writeUTime(Configuration cfg, long t, byte[] dst, int dstIndex)
      Copies the given text data into the destination array
      Parameters:
      cfg - The configuration to use for text encoding
      t - The text data to copy
      dst - The destination byte array
      dstIndex - The starting index in the destination array