From 79dead6a5e7a993008987a2fecf7c7caf030e52e Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sat, 4 Mar 2023 23:48:43 -0600 Subject: [PATCH] CS adjustments --- phpseclib/Crypt/Common/Formats/Keys/PKCS8.php | 4 +++- phpseclib/Crypt/DH/Formats/Keys/PKCS8.php | 1 - phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php | 1 - phpseclib/Crypt/EC/Formats/Keys/PKCS8.php | 1 - phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php | 1 - phpseclib/Net/SSH2.php | 2 -- tests/Unit/Crypt/EC/KeyTest.php | 2 +- 7 files changed, 4 insertions(+), 8 deletions(-) diff --git a/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php b/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php index f05eee9d..ea6c6c6c 100644 --- a/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php +++ b/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php @@ -629,8 +629,10 @@ abstract class PKCS8 extends PKCS /** * Perform some preliminary parsing of the key + * + * @param string|array $key */ - private static function preParse(string &$key): array + private static function preParse(&$key): array { self::initialize_static_variables(); diff --git a/phpseclib/Crypt/DH/Formats/Keys/PKCS8.php b/phpseclib/Crypt/DH/Formats/Keys/PKCS8.php index ac0d31cc..d8cc31d3 100644 --- a/phpseclib/Crypt/DH/Formats/Keys/PKCS8.php +++ b/phpseclib/Crypt/DH/Formats/Keys/PKCS8.php @@ -23,7 +23,6 @@ namespace phpseclib3\Crypt\DH\Formats\Keys; use phpseclib3\Crypt\Common\Formats\Keys\PKCS8 as Progenitor; use phpseclib3\Exception\RuntimeException; -use phpseclib3\Exception\UnexpectedValueException; use phpseclib3\File\ASN1; use phpseclib3\File\ASN1\Maps; use phpseclib3\Math\BigInteger; diff --git a/phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php b/phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php index 7045ca19..c5a0e037 100644 --- a/phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php +++ b/phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php @@ -27,7 +27,6 @@ namespace phpseclib3\Crypt\DSA\Formats\Keys; use phpseclib3\Crypt\Common\Formats\Keys\PKCS8 as Progenitor; use phpseclib3\Exception\RuntimeException; -use phpseclib3\Exception\UnexpectedValueException; use phpseclib3\File\ASN1; use phpseclib3\File\ASN1\Maps; use phpseclib3\Math\BigInteger; diff --git a/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php b/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php index 421c98c8..e6322ed9 100644 --- a/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php +++ b/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php @@ -32,7 +32,6 @@ use phpseclib3\Crypt\EC\BaseCurves\TwistedEdwards as TwistedEdwardsCurve; use phpseclib3\Crypt\EC\Curves\Ed25519; use phpseclib3\Crypt\EC\Curves\Ed448; use phpseclib3\Exception\RuntimeException; -use phpseclib3\Exception\UnexpectedValueException; use phpseclib3\Exception\UnsupportedCurveException; use phpseclib3\File\ASN1; use phpseclib3\File\ASN1\Maps; diff --git a/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php b/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php index d8d1b8d1..78a776a9 100644 --- a/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php +++ b/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php @@ -28,7 +28,6 @@ declare(strict_types=1); namespace phpseclib3\Crypt\RSA\Formats\Keys; use phpseclib3\Crypt\Common\Formats\Keys\PKCS8 as Progenitor; -use phpseclib3\Exception\UnexpectedValueException; use phpseclib3\File\ASN1; use phpseclib3\Math\BigInteger; diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 7d68a949..2b58f5a2 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -2376,8 +2376,6 @@ class SSH2 /** * Return the currently configured timeout - * - * @return int */ public function getTimeout(): int { diff --git a/tests/Unit/Crypt/EC/KeyTest.php b/tests/Unit/Crypt/EC/KeyTest.php index 53ed68ec..8028b3d6 100644 --- a/tests/Unit/Crypt/EC/KeyTest.php +++ b/tests/Unit/Crypt/EC/KeyTest.php @@ -674,7 +674,7 @@ MIIEDwIBADATBgcqhkjOPQIBBggqhkjOPQMBBwSCA/MwggPvAgEBBIID6P////// $this->assertTrue($key->verify($plaintext, $sig)); } - public function testNakedPKCS8PubKey() + public function testNakedPKCS8PubKey(): void { $key = 'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAErPJyxEu2/oKCrJaaTVTrq39DKJ2XcN6W+k8UvGf+Y/lDWNbFitQocabsDUvSN0edHH3UKP5QPTz4cOlyIPMrXQ=='; $key = PublicKeyLoader::load($key);