mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-04 10:38:12 +01:00
Merge branch '2.0' into 3.0
This commit is contained in:
commit
92a67a03aa
@ -924,7 +924,7 @@ class SSH2
|
|||||||
* @var int
|
* @var int
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private $crypto_engine = false;
|
private static $crypto_engine = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A System_SSH_Agent for use in the SSH2 Agent Forwarding scenario
|
* A System_SSH_Agent for use in the SSH2 Agent Forwarding scenario
|
||||||
@ -1114,9 +1114,9 @@ class SSH2
|
|||||||
* @param int $engine
|
* @param int $engine
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function setCryptoEngine($engine)
|
public static function setCryptoEngine($engine)
|
||||||
{
|
{
|
||||||
$this->crypto_engine = $engine;
|
self::$crypto_engine = $engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1710,8 +1710,8 @@ class SSH2
|
|||||||
|
|
||||||
$this->encrypt = self::encryption_algorithm_to_crypt_instance($encrypt);
|
$this->encrypt = self::encryption_algorithm_to_crypt_instance($encrypt);
|
||||||
if ($this->encrypt) {
|
if ($this->encrypt) {
|
||||||
if ($this->crypto_engine) {
|
if (self::$crypto_engine) {
|
||||||
$this->encrypt->setPreferredEngine($this->crypto_engine);
|
$this->encrypt->setPreferredEngine(self::$crypto_engine);
|
||||||
}
|
}
|
||||||
if ($this->encrypt->getBlockLengthInBytes()) {
|
if ($this->encrypt->getBlockLengthInBytes()) {
|
||||||
$this->encrypt_block_size = $this->encrypt->getBlockLengthInBytes();
|
$this->encrypt_block_size = $this->encrypt->getBlockLengthInBytes();
|
||||||
@ -1754,8 +1754,8 @@ class SSH2
|
|||||||
|
|
||||||
$this->decrypt = self::encryption_algorithm_to_crypt_instance($decrypt);
|
$this->decrypt = self::encryption_algorithm_to_crypt_instance($decrypt);
|
||||||
if ($this->decrypt) {
|
if ($this->decrypt) {
|
||||||
if ($this->crypto_engine) {
|
if (self::$crypto_engine) {
|
||||||
$this->decrypt->setPreferredEngine($this->crypto_engine);
|
$this->decrypt->setPreferredEngine(self::$crypto_engine);
|
||||||
}
|
}
|
||||||
if ($this->decrypt->getBlockLengthInBytes()) {
|
if ($this->decrypt->getBlockLengthInBytes()) {
|
||||||
$this->decrypt_block_size = $this->decrypt->getBlockLengthInBytes();
|
$this->decrypt_block_size = $this->decrypt->getBlockLengthInBytes();
|
||||||
@ -4430,16 +4430,21 @@ class SSH2
|
|||||||
//'none' // OPTIONAL no encryption; NOT RECOMMENDED
|
//'none' // OPTIONAL no encryption; NOT RECOMMENDED
|
||||||
];
|
];
|
||||||
|
|
||||||
$engines = [
|
if (self::$crypto_engine) {
|
||||||
'libsodium',
|
$engines = [self::$crypto_engine];
|
||||||
'OpenSSL (GCM)',
|
} else {
|
||||||
'OpenSSL',
|
$engines = [
|
||||||
'mcrypt',
|
'libsodium',
|
||||||
'Eval',
|
'OpenSSL (GCM)',
|
||||||
'PHP'
|
'OpenSSL',
|
||||||
];
|
'mcrypt',
|
||||||
|
'Eval',
|
||||||
|
'PHP'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
$ciphers = [];
|
$ciphers = [];
|
||||||
|
|
||||||
foreach ($engines as $engine) {
|
foreach ($engines as $engine) {
|
||||||
foreach ($algos as $algo) {
|
foreach ($algos as $algo) {
|
||||||
$obj = self::encryption_algorithm_to_crypt_instance($algo);
|
$obj = self::encryption_algorithm_to_crypt_instance($algo);
|
||||||
|
Loading…
Reference in New Issue
Block a user