Compartir a través de


3.1.5.1 Receiving Any Message

 Processing of any message is handled as specified in [MS-CIFS] section 3.1.5.1 with the following additions:

The MD5 algorithm, as specified in [RFC1321], MUST be used to generate a hash of the SMB message (from the start of the SMB header), and SHOULD be used as follows.

 IF ( Connection.SigningChallengeResponse != NULL ) THEN
    CALL MD5Init( md5context )
    CALL MD5Update( md5context, Connection.SigningSessionKey )
    CALL MD5Update( md5context, 
                    Connection.SigningChallengeResponse ) 
    CALL MD5Update( md5context, SMB message )
    CALL MD5Final( digest, md5context )
 ELSE
    CALL MD5Init( md5context )
    CALL MD5Update( md5context, Connection.SigningSessionKey )
    CALL MD5Update( md5context, SMB message )
    CALL MD5Final( digest, md5context )
 END IF
 SET the signature TO the first 8 bytes of the digest
  

The resulting 8-byte signature is compared with the original value of the SMB_Header.SecuritySignature field. If the signature received with the message does not match the signature that is calculated, then the message MUST be discarded and no further processing on it is done. The receiver MAY also terminate the connection by disconnecting the underlying transport connection and cleaning up any state associated with the connection.