From b2beedbf9a82bd87df57f31ab8f6634b0a5db9ea Mon Sep 17 00:00:00 2001 From: Jack Worman Date: Sun, 3 Jul 2022 07:54:11 -0500 Subject: [PATCH] 3rd round of comments --- build/psalm_baseline.xml | 110 +++++++++++++++++++++++---------- phpseclib/File/X509.php | 4 -- phpseclib/System/SSH/Agent.php | 2 +- 3 files changed, 79 insertions(+), 37 deletions(-) diff --git a/build/psalm_baseline.xml b/build/psalm_baseline.xml index 27caa7b2..47a11ff7 100644 --- a/build/psalm_baseline.xml +++ b/build/psalm_baseline.xml @@ -3326,6 +3326,10 @@ $key[$type . 'Algorithm']['parameters']->element + + $decoded[0] + $decoded[0] + $decoded[0] $decoded[0] @@ -3335,9 +3339,6 @@ $key[$type . 'Algorithm'] $key[$type] - - !is_array($decoded) - PKCS8 @@ -3906,6 +3907,12 @@ $decoded + + $decoded[0] + + + $decoded[0] + null @@ -6144,18 +6151,22 @@ $temp['k2'] $temp['k3'] - + $m $params['parameters'] + $params[0] + $temp[0] - + $params['basis'] $params['m'] $params['parameters'] $params['parameters'] + $params[0] $temp['k1'] $temp['k2'] $temp['k3'] + $temp[0] $params @@ -8293,11 +8304,15 @@ toString - + + $decoded[0] + $decoded[0] $params['hashAlgorithm']['algorithm'] $params['maskGenAlgorithm']['parameters']['algorithm'] - + + $decoded[0] + $decoded[0] $params['hashAlgorithm'] $params['maskGenAlgorithm'] @@ -8655,8 +8670,7 @@ PublicKey PublicKey - - !is_array($decoded) + $em === false $em === false $em === false @@ -10211,6 +10225,9 @@ $source $source + + array|bool + $child $child @@ -10299,7 +10316,7 @@ $loc self::$location - + $child['cast'] $child['cast'] $child['class'] @@ -10355,7 +10372,6 @@ $temp[$last]['content'] $temp[$last]['type'] $temp['constant'] - $temp['constant'] $temp['type'] $temp['type'] $temp['type'] @@ -10574,7 +10590,8 @@ $value bindec($byte) - + + $decoded['content'] $length $temp[$i] $temp[$i] @@ -10613,7 +10630,7 @@ $matches[1] $matches[2] - + $child['default'] $child['type'] $child['type'] @@ -10664,6 +10681,7 @@ $temp['length'] $temp['length'] $temp['type'] + $temp['type'] $candidate @@ -10729,10 +10747,7 @@ !isset($this->currentCert) $cert === false - - false - false - false + false false false @@ -10746,10 +10761,7 @@ $j - - string - string - string + string string string @@ -11279,7 +11291,7 @@ $i int|false - + $line $line $publicKey @@ -11288,6 +11300,9 @@ $rclist $rclist $results + $this->saveCSR($this->currentCert) + $this->saveSPKAC($this->currentCert) + $this->saveX509($this->currentCert) base64_decode(preg_replace('#-.+-|[\r\n]#', '', $cert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey'])) base64_decode(preg_replace('#-.+-|[\r\n]#', '', $csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey'])) base64_decode(preg_replace('#-.+-|[\r\n]#', '', $spkac['publicKeyAndChallenge']['spki']['subjectPublicKey'])) @@ -11347,16 +11362,18 @@ $csr - + $cert $crl $csr + $decoded[0]['content'][0]['start'] $path $spkac $temp $v $value $values[$j] + $values[$j] preg_replace('#-.+-|[\r\n]#', '', $cert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey']) preg_replace('#-.+-|[\r\n]#', '', $csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey']) preg_replace('#-.+-|[\r\n]#', '', $spkac['publicKeyAndChallenge']['spki']['subjectPublicKey']) @@ -11366,7 +11383,9 @@ preg_replace('#^id-dsa-with-#', '', strtolower($signatureAlgorithm)) preg_replace_callback('#[^\x20-\x7E]#', $callback, $value->element) - + + $decoded[0] + $decoded[0]['content'] $spkac['publicKeyAndChallenge'] $spkac['publicKeyAndChallenge'] @@ -15877,6 +15896,9 @@ $address + + request_forwarding + $agent_reply_bytes $key @@ -15924,9 +15946,6 @@ $request_channel - - bool - $comment @@ -17668,7 +17687,16 @@ base64_decode('MD6gJQYKKwYBBAGCNxQCA6AXDBVvZmZpY2VAY2VydGRpZ2l0YWwucm+BFW9mZmljZUBjZXJ0ZGlnaXRhbC5ybw==') - + + $a[0] + $decoded[0] + $decoded[0] + $decoded[0] + $decoded[0]['content'] + $decoded[0]['content'] + $decoded[0]['content'][1]['content'][0]['content'] + + $a[0] $decoded[0] $decoded[0] @@ -17677,8 +17705,9 @@ $decoded[0] $decoded[0] $decoded[0] - $decoded[0] - $decoded[0] + + + $a[0] $decoded[0] $decoded[0] $decoded[0] @@ -17732,8 +17761,9 @@ $x509->getPublicKey()->getPadding() $x509->getPublicKey()->getPadding() - + $csr + $x509->saveCSR($x509->signCSR(), X509::FORMAT_DER) CSRTest @@ -17770,6 +17800,9 @@ $spkac $spkac + + $x509->saveSPKAC($spkac) + SPKACTest SPKACTest @@ -17810,6 +17843,10 @@ $result $subjectKey + + $cert + $certificate + $customExtensionDecodedData['list'] $customExtensionDecodedData['name'] @@ -17954,8 +17991,17 @@ withHash withHash - + $a + $cert + $newcert->saveX509($newcert->sign($ca, $oldcert)) + $r + $result + $result + $result + $result + $x509->saveX509($cert) + $x509->saveX509($decoded) X509Test diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index c3b5f755..b9346a7c 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -2426,8 +2426,6 @@ class X509 * $issuer's private key needs to be loaded. * $subject can be either an existing X.509 cert (if you want to resign it), * a CSR or something with the DN and public key explicitly set. - * - * @return mixed */ public function sign(X509 $issuer, X509 $subject) { @@ -2730,8 +2728,6 @@ class X509 * Sign a CRL * * $issuer's private key needs to be loaded. - * - * @return mixed */ public function signCRL(X509 $issuer, X509 $crl) { diff --git a/phpseclib/System/SSH/Agent.php b/phpseclib/System/SSH/Agent.php index c3508290..a65eecf9 100644 --- a/phpseclib/System/SSH/Agent.php +++ b/phpseclib/System/SSH/Agent.php @@ -230,7 +230,7 @@ class Agent * open to give the SSH Agent an opportunity * to take further action. i.e. request agent forwarding */ - public function registerChannelOpen(SSH2 $ssh) + public function registerChannelOpen(SSH2 $ssh): void { if ($this->forward_status == self::FORWARD_REQUEST) { $this->request_forwarding($ssh);