From 5a915391486ac96c7ef2f2f8ea9b0d80b3ade6c3 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Mon, 29 Dec 2014 22:10:26 -0600 Subject: [PATCH] SSH2: rm unsupported algorithms if OpenSSL is being used --- phpseclib/Net/SSH2.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index a02c57d6..53b110d8 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -1091,7 +1091,9 @@ class Net_SSH2 $identifier = 'SSH-2.0-phpseclib_0.3'; $ext = array(); - if (extension_loaded('mcrypt')) { + if (extension_loaded('openssl')) { + $ext[] = 'openssl'; + } elseif (extension_loaded('mcrypt')) { $ext[] = 'mcrypt'; } @@ -1164,6 +1166,14 @@ class Net_SSH2 //'none' // OPTIONAL no encryption; NOT RECOMMENDED ); + if (extension_loaded('openssl')) { + // OpenSSL does not support arcfour256 + $encryption_algorithms = array_diff( + $encryption_algorithms, + array('arcfour256') + ); + } + if (phpseclib_resolve_include_path('Crypt/RC4.php') === false) { $encryption_algorithms = array_diff( $encryption_algorithms,