Package jcifs.internal.smb1
Class SMB1SigningDigest
- java.lang.Object
-
- jcifs.internal.smb1.SMB1SigningDigest
-
- All Implemented Interfaces:
SMBSigningDigest
public class SMB1SigningDigest extends Object implements SMBSigningDigest
-
-
Constructor Summary
Constructors Constructor Description SMB1SigningDigest(byte[] macSigningKey)This constructor used to instance a SigningDigest object for signing/verifying SMB using kerberos session key.SMB1SigningDigest(byte[] macSigningKey, boolean bypass)SMB1SigningDigest(byte[] macSigningKey, boolean bypass, int initialSequence)SMB1SigningDigest(byte[] macSigningKey, int initialSequence)Construct a digest with a non-zero starting sequence numberSMB1SigningDigest(SmbTransportInternal transport, NtlmPasswordAuthenticator auth)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]digest()voidsign(byte[] data, int offset, int length, CommonServerMessageBlock request, CommonServerMessageBlock response)Performs MAC signing of the SMB.StringtoString()voidupdate(byte[] input, int offset, int len)Update digest with databooleanverify(byte[] data, int offset, int l, int extraPad, CommonServerMessageBlock m)Performs MAC signature verification.static voidwriteUTime(Configuration cfg, long t, byte[] dst, int dstIndex)
-
-
-
Constructor Detail
-
SMB1SigningDigest
public SMB1SigningDigest(byte[] macSigningKey, boolean bypass)- Parameters:
macSigningKey-bypass-
-
SMB1SigningDigest
public SMB1SigningDigest(byte[] macSigningKey, boolean bypass, int initialSequence)- Parameters:
macSigningKey-bypass-initialSequence-
-
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-initialSequence-
-
SMB1SigningDigest
public SMB1SigningDigest(SmbTransportInternal transport, NtlmPasswordAuthenticator auth) throws SmbException
- Parameters:
transport-auth-- Throws:
SmbException
-
-
Method Detail
-
update
public void update(byte[] input, int offset, int len)Update digest with data- Parameters:
input-offset-len-
-
digest
public byte[] 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:
signin 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 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:
verifyin interfaceSMBSigningDigest- Parameters:
data- The data.offset- The starting offset at which the SMB header begins.extraPad- extra padding to include in signaturem- The message to verify- Returns:
- whether verification was unsuccessful
- See Also:
SMBSigningDigest.verify(byte[], int, int, int, jcifs.internal.CommonServerMessageBlock)
-
writeUTime
public static void writeUTime(Configuration cfg, long t, byte[] dst, int dstIndex)
- Parameters:
cfg-t-dst-dstIndex-
-
-