Package jcifs.internal.smb2
Class Smb2SigningDigest
- java.lang.Object
-
- jcifs.internal.smb2.Smb2SigningDigest
-
- All Implemented Interfaces:
SMBSigningDigest
public class Smb2SigningDigest extends Object implements SMBSigningDigest
- Author:
- mbechler
-
-
Constructor Summary
Constructors Constructor Description Smb2SigningDigest(byte[] sessionKey, int dialect, byte[] preauthIntegrityHash)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
sign(byte[] data, int offset, int length, CommonServerMessageBlock request, CommonServerMessageBlock response)
Performs MAC signing of the SMB.boolean
verify(byte[] data, int offset, int length, int extraPad, CommonServerMessageBlock msg)
Performs MAC signature verification.
-
-
-
Constructor Detail
-
Smb2SigningDigest
public Smb2SigningDigest(byte[] sessionKey, int dialect, byte[] preauthIntegrityHash) throws GeneralSecurityException
- Parameters:
sessionKey
-dialect
-preauthIntegrityHash
-- Throws:
GeneralSecurityException
-
-
Method Detail
-
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 interfaceSMBSigningDigest
- 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 messageresponse
- response message- See Also:
SMBSigningDigest.sign(byte[], int, int, jcifs.internal.CommonServerMessageBlock, jcifs.internal.CommonServerMessageBlock)
-
verify
public boolean verify(byte[] data, int offset, int length, int extraPad, CommonServerMessageBlock msg)
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 interfaceSMBSigningDigest
- Parameters:
data
- The data.offset
- The starting offset at which the SMB header begins.extraPad
- extra padding to include in signaturemsg
- The message to verify- Returns:
- whether verification was unsuccessful
- See Also:
SMBSigningDigest.verify(byte[], int, int, int, jcifs.internal.CommonServerMessageBlock)
-
-