mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-08 14:51:00 +00:00
CS adjustments
This commit is contained in:
parent
0db8742630
commit
4cdcb74b8c
@ -386,7 +386,7 @@ class Blowfish extends BlockCipher
|
||||
/* key-expanding p[] and S-Box building sb[] */
|
||||
$this->bctx = [
|
||||
'p' => [],
|
||||
'sb' => self::$sbox
|
||||
'sb' => self::$sbox,
|
||||
];
|
||||
|
||||
// unpack binary string in unsigned chars
|
||||
@ -543,7 +543,7 @@ class Blowfish extends BlockCipher
|
||||
[$p[16], $p[17]] = self::encryptBlockHelperFast($p[14], $p[15], $sbox, $p);
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
list($sbox[0], $sbox[1]) = self::encryptBlockHelperFast($p[16], $p[17], $sbox, $p);
|
||||
[$sbox[0], $sbox[1]] = self::encryptBlockHelperFast($p[16], $p[17], $sbox, $p);
|
||||
for ($i = 2; $i < 1024; $i += 2) {
|
||||
[$sbox[$i], $sbox[$i + 1]] = self::encryptBlockHelperFast($sbox[$i - 2], $sbox[$i - 1], $sbox, $p);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ abstract class AsymmetricKey
|
||||
* Load the key
|
||||
*
|
||||
* @param string|array $key
|
||||
* @return \phpseclib3\Crypt\Common\PublicKey|\phpseclib3\Crypt\Common\PrivateKey
|
||||
* @return PublicKey|PrivateKey
|
||||
*/
|
||||
public static function load($key, ?string $password = null): AsymmetricKey
|
||||
{
|
||||
|
@ -669,7 +669,7 @@ abstract class PKCS8 extends PKCS
|
||||
|
||||
$decoded = self::preParse($key);
|
||||
|
||||
$r = ASN1::asn1map($decoded[0], ASN1\Maps\EncryptedPrivateKeyInfo::MAP);
|
||||
$r = ASN1::asn1map($decoded[0], Maps\EncryptedPrivateKeyInfo::MAP);
|
||||
if (!is_array($r)) {
|
||||
throw new RuntimeException('Unable to parse using EncryptedPrivateKeyInfo map');
|
||||
}
|
||||
@ -679,7 +679,7 @@ abstract class PKCS8 extends PKCS
|
||||
if (!$decoded) {
|
||||
throw new RuntimeException('Unable to decode BER');
|
||||
}
|
||||
$r['encryptionAlgorithm']['parameters'] = ASN1::asn1map($decoded[0], ASN1\Maps\PBES2params::MAP);
|
||||
$r['encryptionAlgorithm']['parameters'] = ASN1::asn1map($decoded[0], Maps\PBES2params::MAP);
|
||||
|
||||
$kdf = &$r['encryptionAlgorithm']['parameters']['keyDerivationFunc'];
|
||||
switch ($kdf['algorithm']) {
|
||||
|
@ -42,8 +42,6 @@ final class PrivateKey extends DH
|
||||
|
||||
/**
|
||||
* Returns the public key
|
||||
*
|
||||
* @return DH\PublicKey
|
||||
*/
|
||||
public function getPublicKey(): PublicKey
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ abstract class Base
|
||||
/**
|
||||
* Returns the length, in bytes, of the modulo
|
||||
*
|
||||
* @return integer
|
||||
* @return Integer
|
||||
*/
|
||||
public function getLengthInBytes(): int
|
||||
{
|
||||
@ -74,7 +74,7 @@ abstract class Base
|
||||
/**
|
||||
* Returns the length, in bits, of the modulo
|
||||
*
|
||||
* @return integer
|
||||
* @return Integer
|
||||
*/
|
||||
public function getLength(): int
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ class BigInteger implements \JsonSerializable
|
||||
* If the second parameter - $base - is negative, then it will be assumed that the number's are encoded using
|
||||
* two's compliment. The sole exception to this is -10, which is treated the same as 10 is.
|
||||
*
|
||||
* @param string|int|BigInteger\Engines\Engine $x Base-10 number or base-$base number if $base set.
|
||||
* @param string|int|Engine $x Base-10 number or base-$base number if $base set.
|
||||
*/
|
||||
public function __construct($x = 0, int $base = 10)
|
||||
{
|
||||
@ -172,7 +172,7 @@ class BigInteger implements \JsonSerializable
|
||||
|
||||
if ($x instanceof self::$mainEngine) {
|
||||
$this->value = clone $x;
|
||||
} elseif ($x instanceof BigInteger\Engines\Engine) {
|
||||
} elseif ($x instanceof Engine) {
|
||||
$this->value = new static("$x");
|
||||
$this->value->setPrecision($x->getPrecision());
|
||||
} else {
|
||||
|
@ -46,7 +46,6 @@ use phpseclib3\Net\SFTP\OpenFlag;
|
||||
use phpseclib3\Net\SFTP\OpenFlag5;
|
||||
use phpseclib3\Net\SFTP\PacketType as SFTPPacketType;
|
||||
use phpseclib3\Net\SFTP\StatusCode;
|
||||
use phpseclib3\Net\SSH2\DisconnectReason;
|
||||
use phpseclib3\Net\SSH2\MessageType as SSH2MessageType;
|
||||
|
||||
/**
|
||||
|
@ -3024,9 +3024,6 @@ class SSH2
|
||||
* 2: phpseclib takes an active approach to see if the connection is still active by sending an SSH_MSG_CHANNEL_OPEN
|
||||
* packet and imediately trying to close that channel. some routers, in particular, however, will only let you
|
||||
* open one channel, so this approach could yield false positives
|
||||
*
|
||||
* @param int $level
|
||||
* @return bool
|
||||
*/
|
||||
public function isConnected(int $level = 0): bool
|
||||
{
|
||||
|
@ -1426,14 +1426,14 @@ vtpiPBM=
|
||||
/**
|
||||
* @group github1994
|
||||
*/
|
||||
public function testCloseNumbers()
|
||||
public function testCloseNumbers(): void
|
||||
{
|
||||
$rsa = PublicKeyLoader::load([
|
||||
// Modulus
|
||||
'n' => new BigInteger('5BDD6AFB1E1AFB50D1B2989F70B549B8D44AE3712B444F2C5D862C46C99526E998B79BF0B4F1461524E39D263F3130B9E08F3B17C2070785EFB0EDEC1E75C6C2B8185FA9596886D5DAF8B68E92FCF5F1B33E7CD772845555B086D2A2466B6398A04DFE1C727BB020g1ED2BF3F03D2826F89616D0846C18B1D87064616FAD394462', 16),
|
||||
|
||||
// Exponent
|
||||
'e' => new BigInteger('6FE4F5D0AFCC16E8A5CC68955D4EF28255A546D06F34DD103540B9A7D202AEC96353072DB65D9C360E9030F413971142EE6A28974767CCF3ABFA4E7ADDAEAD81D3F8AE5FF1B8241CA9EF51C10941FFFA74482A636CBD909D29CF7A0346653D3C286EA1F392F4968AEF1489EC4B4BCEA4F248F3931B1C9BE2808DBD33B049731A', 16)
|
||||
'e' => new BigInteger('6FE4F5D0AFCC16E8A5CC68955D4EF28255A546D06F34DD103540B9A7D202AEC96353072DB65D9C360E9030F413971142EE6A28974767CCF3ABFA4E7ADDAEAD81D3F8AE5FF1B8241CA9EF51C10941FFFA74482A636CBD909D29CF7A0346653D3C286EA1F392F4968AEF1489EC4B4BCEA4F248F3931B1C9BE2808DBD33B049731A', 16),
|
||||
])
|
||||
->withPadding(RSA::SIGNATURE_PKCS1)
|
||||
->withHash('md5')
|
||||
|
@ -453,7 +453,7 @@ class ASN1Test extends PhpseclibTestCase
|
||||
$this->assertNull($decoded);
|
||||
}
|
||||
|
||||
public function testLongOID()
|
||||
public function testLongOID(): void
|
||||
{
|
||||
$cert = file_get_contents(dirname(__FILE__) . '/ASN1/mal-cert-02.der');
|
||||
|
||||
|
@ -1395,7 +1395,7 @@ JYhGgW6KsKViE0hzQB8dSAcNcfwQPSKzOd02crXdJ7uYvZZK9prN83Oe1iDaizeA
|
||||
$this->assertFalse($x509->validateURL('https://aa'));
|
||||
}
|
||||
|
||||
public function testLargeInteger()
|
||||
public function testLargeInteger(): void
|
||||
{
|
||||
// cert has an elliptic curve public key with a specified curve (vs a named curve) with
|
||||
// an excessively large integer value
|
||||
|
Loading…
Reference in New Issue
Block a user