mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-28 12:10:59 +00:00
SSH2: build supported cipher list off of files that are present
This commit is contained in:
parent
2edc9fc0a9
commit
adf8afd4eb
@ -942,7 +942,9 @@ class Net_SSH2 {
|
||||
'ssh-dss' // REQUIRED sign Raw DSS Key
|
||||
);
|
||||
|
||||
static $encryption_algorithms = array(
|
||||
static $encryption_algorithms = false;
|
||||
if ($encryption_algorithms === false) {
|
||||
$encryption_algorithms = array(
|
||||
// from <http://tools.ietf.org/html/rfc4345#section-4>:
|
||||
'arcfour256',
|
||||
'arcfour128',
|
||||
@ -978,6 +980,33 @@ class Net_SSH2 {
|
||||
'none' // OPTIONAL no encryption; NOT RECOMMENDED
|
||||
);
|
||||
|
||||
if (!file_exists('Crypt/AES.php')) {
|
||||
$encryption_algorithms = array_diff(
|
||||
$encryption_algorithms,
|
||||
array('aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-cbc', 'aes192-cbc', 'aes256-cbc')
|
||||
);
|
||||
}
|
||||
if (!file_exists('Crypt/Twofish.php')) {
|
||||
$encryption_algorithms = array_diff(
|
||||
$encryption_algorithms,
|
||||
array('twofish128-ctr', 'twofish192-ctr', 'twofish256-ctr', 'twofish128-cbc', 'twofish192-cbc', 'twofish256-cbc', 'twofish-cbc')
|
||||
);
|
||||
}
|
||||
if (!file_exists('Crypt/Blowfish.php')) {
|
||||
$encryption_algorithms = array_diff(
|
||||
$encryption_algorithms,
|
||||
array('blowfish-ctr', 'blowfish-cbc')
|
||||
);
|
||||
}
|
||||
if (!file_exists('Crypt/TripleDES.php')) {
|
||||
$encryption_algorithms = array_diff(
|
||||
$encryption_algorithms,
|
||||
array('3des-ctr', '3des-cbc')
|
||||
);
|
||||
}
|
||||
$encryption_algorithms = array_values($encryption_algorithms);
|
||||
}
|
||||
|
||||
static $mac_algorithms = array(
|
||||
'hmac-sha1-96', // RECOMMENDED first 96 bits of HMAC-SHA1 (digest length = 12, key length = 20)
|
||||
'hmac-sha1', // REQUIRED HMAC-SHA1 (digest length = key length = 20)
|
||||
|
Loading…
Reference in New Issue
Block a user