java.lang.Object
org.codelibs.jcifs.smb.internal.smb1.SMB1SigningDigest
- All Implemented Interfaces:
SMBSigningDigest
This class is intended for internal use.
-
Constructor Summary
ConstructorsConstructorDescriptionSMB1SigningDigest(byte[] macSigningKey) This constructor used to instance a SigningDigest object for signing/verifying SMB using kerberos session key.SMB1SigningDigest(byte[] macSigningKey, boolean bypass) Constructs a signing digest with bypass optionSMB1SigningDigest(byte[] macSigningKey, boolean bypass, int initialSequence) Constructs a signing digest with bypass option and initial sequence numberSMB1SigningDigest(byte[] macSigningKey, int initialSequence) Construct a digest with a non-zero starting sequence numberSMB1SigningDigest(SmbTransportInternal transport, NtlmPasswordAuthenticator auth) Constructs a signing digest from transport and authentication information -
Method Summary
Modifier and TypeMethodDescriptionbyte[]digest()Finalize and return the calculated message digestvoidsign(byte[] data, int offset, int length, CommonServerMessageBlock request, CommonServerMessageBlock response) Performs MAC signing of the SMB.toString()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) Copies the given text data into the destination array
-
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 signaturesbypass- 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 signaturesbypass- Whether to bypass signature verificationinitialSequence- 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 signaturesinitialSequence- 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 keyauth- 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 withoffset- The starting offset in the input datalen- 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:
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:
-
verify
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.l- The length of the data to verifyextraPad- extra padding to include in signaturem- The message to verify- Returns:
- whether verification was unsuccessful
- See Also:
-
toString
-
writeUTime
Copies the given text data into the destination array- Parameters:
cfg- The configuration to use for text encodingt- The text data to copydst- The destination byte arraydstIndex- The starting index in the destination array
-