public static byte[] CalculateSignature(byte[] signingKey, SMB2Dialect dialect, byte[] buffer, int offset, int paddedLength) { if (dialect != SMB2Dialect.SMB202 && dialect != SMB2Dialect.SMB210) { return(AesCmac.CalculateAesCmac(signingKey, buffer, offset, paddedLength)); } using HMACSHA256 sha256 = new HMACSHA256(signingKey); return(sha256.ComputeHash(buffer, offset, paddedLength)); }
public static byte[] CalculateSignature(byte[] signingKey, SMB2Dialect dialect, byte[] buffer, int offset, int paddedLength) { if (dialect == SMB2Dialect.SMB202 || dialect == SMB2Dialect.SMB210) { return(new HMACSHA256(signingKey).ComputeHash(buffer, offset, paddedLength)); } else { return(AesCmac.CalculateAesCmac(signingKey, buffer, offset, paddedLength)); } }