Module jcifs

Class PreauthIntegrityNegotiateContext

java.lang.Object
org.codelibs.jcifs.smb.internal.smb2.nego.PreauthIntegrityNegotiateContext
All Implemented Interfaces:
Decodable, Encodable, NegotiateContextRequest, NegotiateContextResponse

public class PreauthIntegrityNegotiateContext extends Object implements NegotiateContextRequest, NegotiateContextResponse
SMB2 Pre-authentication Integrity Negotiate Context. This negotiate context is used in SMB 3.1.1 to establish pre-authentication integrity protection against downgrade attacks.
Author:
mbechler
  • Field Details

    • NEGO_CTX_PREAUTH_TYPE

      public static final int NEGO_CTX_PREAUTH_TYPE
      Context type
      See Also:
    • HASH_ALGO_SHA512

      public static final int HASH_ALGO_SHA512
      SHA-512
      See Also:
  • Constructor Details

    • PreauthIntegrityNegotiateContext

      public PreauthIntegrityNegotiateContext(Configuration config, int[] hashAlgos, byte[] salt)
      Constructs a preauth integrity negotiate context with the specified parameters.
      Parameters:
      config - the SMB configuration
      hashAlgos - the supported hash algorithms
      salt - the salt value for preauth integrity
    • PreauthIntegrityNegotiateContext

      public PreauthIntegrityNegotiateContext()
      Default constructor for deserialization.
  • Method Details

    • getSalt

      public byte[] getSalt()
      Gets the salt value used for preauth integrity.
      Returns:
      the salt
    • getHashAlgos

      public int[] getHashAlgos()
      Gets the supported hash algorithms for preauth integrity.
      Returns:
      the hashAlgos
    • getContextType

      public int getContextType()
      Gets the negotiate context type.
      Specified by:
      getContextType in interface NegotiateContextRequest
      Specified by:
      getContextType in interface NegotiateContextResponse
      Returns:
      the SMB2 negotiate context type
      See Also:
    • encode

      public int encode(byte[] dst, int dstIndex)
      Encodes this object into the specified byte array.
      Specified by:
      encode in interface Encodable
      Parameters:
      dst - the destination byte array to encode into
      dstIndex - the starting index in the destination array
      Returns:
      encoded length
      See Also:
    • decode

      public int decode(byte[] buffer, int bufferIndex, int len) throws SMBProtocolDecodingException
      Decode data from a byte buffer
      Specified by:
      decode in interface Decodable
      Parameters:
      buffer - the byte buffer containing the data to decode
      bufferIndex - the starting index in the buffer
      len - the maximum length of data to decode
      Returns:
      decoded length
      Throws:
      SMBProtocolDecodingException - if decoding fails
      See Also:
    • size

      public int size()
      Returns the size in bytes that this object will occupy when encoded.
      Specified by:
      size in interface Encodable
      Returns:
      the encoded size
      See Also: