diff --git a/composer/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PSS.php b/composer/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PSS.php index 57f9db1..5257658 100644 --- a/composer/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PSS.php +++ b/composer/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PSS.php @@ -110,7 +110,11 @@ public static function load($key, $password = '') $result['hash'] = \str_replace('id-', '', $params['hashAlgorithm']['algorithm']); $result['MGFHash'] = \str_replace('id-', '', $params['maskGenAlgorithm']['parameters']['algorithm']); if (isset($params['saltLength'])) { - $result['saltLength'] = (int) $params['saltLength']->toString(); + if (is_int($params['saltLength'])) { + $result['saltLength'] = $params['saltLength']; + } else { + $result['saltLength'] = (int) $params['saltLength']->toString(); + } } if (isset($key['meta'])) { $result['meta'] = $key['meta']; diff --git a/composer/phpseclib/phpseclib/phpseclib/File/X509.php b/composer/phpseclib/phpseclib/phpseclib/File/X509.php index 62b2a59..4cbadc2 100644 --- a/composer/phpseclib/phpseclib/phpseclib/File/X509.php +++ b/composer/phpseclib/phpseclib/phpseclib/File/X509.php @@ -2127,7 +2127,7 @@ public function saveSPKAC(array $spkac, $format = self::FORMAT_PEM) /** * Load a Certificate Revocation List * - * @param string $crl + * @param string|array $crl * @param int $mode * @return mixed */ diff --git a/scoper.inc.php b/scoper.inc.php index c1246e4..323931b 100644 --- a/scoper.inc.php +++ b/scoper.inc.php @@ -93,6 +93,33 @@ static function (string $filePath, string $prefix, string $content): string { $s_prefix = str_replace('\\', '\\\\', $prefix); $content = str_replace("'phpseclib3\\\\", "'\\\\" . $s_prefix . '\\\\phpseclib3\\\\', $content); $content = str_replace("'\\\\phpseclib3", "'\\\\" . $s_prefix . '\\\\phpseclib3', $content); + + // Specific patch for Crypt/RSA/Formats/Keys/PSS.php: handle saltLength being an int or an object + if (str_contains($filePath, 'Crypt/RSA/Formats/Keys/PSS.php')) { + $search = '$result[\'saltLength\'] = (int) $params[\'saltLength\']->toString();'; + $replace = <<<'PHP' +if (is_int($params['saltLength'])) { + $result['saltLength'] = $params['saltLength']; + } else { + $result['saltLength'] = (int) $params['saltLength']->toString(); + } +PHP; + if (strpos($content, $search) !== false) { + $content = str_replace($search, $replace, $content); + } else { + $content = preg_replace( + '/\$result\\[\\\'saltLength\\\']\\s*=\\s*\\(int\\)\\s*\\$params\\[\\\'saltLength\\\']\\->toString\\(\\);/m', + $replace, + $content + ); + } + } + + // Specific patch for File/X509.php: update docblock param type for $crl to string|array + if (str_contains($filePath, 'File/X509.php')) { + $content = str_replace('@param string $crl', '@param string|array $crl', $content); + } + return $content; }, // patchers for pdfparser