/trunk/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/IEEE.php |
---|
0,0 → 1,66 |
<?php |
/** |
* IEEE P1363 Signature Handler |
* |
* PHP version 5 |
* |
* Handles signatures in the format described in |
* https://standards.ieee.org/ieee/1363/2049/ and |
* https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/sign#ecdsa |
* |
* @author Jim Wigginton <terrafrost@php.net> |
* @copyright 2016 Jim Wigginton |
* @license http://www.opensource.org/licenses/mit-license.html MIT License |
* @link http://phpseclib.sourceforge.net |
*/ |
namespace phpseclib3\Crypt\EC\Formats\Signature; |
use phpseclib3\Math\BigInteger; |
/** |
* ASN1 Signature Handler |
* |
* @author Jim Wigginton <terrafrost@php.net> |
*/ |
abstract class IEEE |
{ |
/** |
* Loads a signature |
* |
* @param string $sig |
* @return array |
*/ |
public static function load($sig) |
{ |
if (!is_string($sig)) { |
return false; |
} |
$len = strlen($sig); |
if ($len & 1) { |
return false; |
} |
$r = new BigInteger(substr($sig, 0, $len >> 1), 256); |
$s = new BigInteger(substr($sig, $len >> 1), 256); |
return compact('r', 's'); |
} |
/** |
* Returns a signature in the appropriate format |
* |
* @param \phpseclib3\Math\BigInteger $r |
* @param \phpseclib3\Math\BigInteger $s |
* @return string |
*/ |
public static function save(BigInteger $r, BigInteger $s) |
{ |
$r = $r->toBytes(); |
$s = $s->toBytes(); |
$len = max(strlen($r), strlen($s)); |
return str_pad($r, $len, "\0", STR_PAD_LEFT) . str_pad($s, $len, "\0", STR_PAD_LEFT); |
} |
} |
/trunk/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php |
---|
29,7 → 29,6 |
use phpseclib3\Exception\BadConfigurationException; |
use phpseclib3\Math\BigInteger\Engines\Engine; |
use UnexpectedValueException; |
/** |
* Pure-PHP arbitrary precision integer arithmetic library. Supports base-2, base-10, base-16, and base-256 |
153,7 → 152,7 |
} |
} |
throw new UnexpectedValueException('No valid BigInteger found. This is only possible when JIT is enabled on Windows and neither the GMP or BCMath extensions are available so either disable JIT or install GMP / BCMath'); |
throw new \UnexpectedValueException('No valid BigInteger found. This is only possible when JIT is enabled on Windows and neither the GMP or BCMath extensions are available so either disable JIT or install GMP / BCMath'); |
} |
} |
/trunk/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php |
---|
263,7 → 263,7 |
$r = $this->value->powMod($temp, static::$modulo[$this->instanceID]); |
while (!$t->equals($one)) { |
for ($i == clone $one; $i->compare($m) < 0; $i = $i->add($one)) { |
for ($i = clone $one; $i->compare($m) < 0; $i = $i->add($one)) { |
if ($t->powMod($two->pow($i), static::$modulo[$this->instanceID])->equals($one)) { |
break; |
} |
/trunk/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php |
---|
1551,7 → 1551,21 |
['hmac-sha1-96', 'hmac-md5-96'] |
)); |
} |
break; |
case substr($this->server_identifier, 0, 24) == 'SSH-2.0-TurboFTP_SERVER_': |
if (!isset($preferred['server_to_client']['crypt'])) { |
$s2c_encryption_algorithms = array_values(array_diff( |
$s2c_encryption_algorithms, |
['aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] |
)); |
} |
if (!isset($preferred['client_to_server']['crypt'])) { |
$c2s_encryption_algorithms = array_values(array_diff( |
$c2s_encryption_algorithms, |
['aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] |
)); |
} |
} |
$client_cookie = Random::string(16); |
2315,7 → 2329,7 |
return $this->login_helper($username, $password); |
} |
$this->disconnect_helper(NET_SSH2_DISCONNECT_CONNECTION_LOST); |
throw new ConnectionClosedException('Connection closed by server'); |
throw $e; |
} |
list($type, $service) = Strings::unpackSSH2('Cs', $response); |