From 4d36e67beea147ee7d30976bebc4fee27daaddfa Mon Sep 17 00:00:00 2001 From: Sidney Souza Date: Fri, 2 Jun 2017 09:46:51 -0300 Subject: [PATCH] Fix Invalid HMAC for D-link DES-3028 When I tried connect to a dlink switch the Net_SSH2 does not choose the correct algorithms for hmac causing an Invalid HMAC error. However, after I commented the line 1280 everything work magnificently --- phpseclib/Net/SSH2.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index d104b813..7a5e88a4 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -1290,8 +1290,9 @@ class Net_SSH2 ); // some SSH servers have buggy implementations of some of the above algorithms - switch ($this->server_identifier) { - case 'SSH-2.0-SSHD': + switch (true) { + case $this->server_identifier == 'SSH-2.0-SSHD': + case substr($this->server_identifier, 0, 13) == 'SSH-2.0-DLINK': $mac_algorithms = array_values(array_diff( $mac_algorithms, array('hmac-sha1-96', 'hmac-md5-96')