diff --git a/phpseclib/Crypt/Common/Keys/PKCS1.php b/phpseclib/Crypt/Common/Keys/PKCS1.php index 7a16f8bd..9b964aad 100644 --- a/phpseclib/Crypt/Common/Keys/PKCS1.php +++ b/phpseclib/Crypt/Common/Keys/PKCS1.php @@ -182,7 +182,7 @@ abstract class PKCS1 extends PKCS * @param array $options optional * @return string */ - protected static function wrapPrivateKey($key, $type, $password, $options = []) + protected static function wrapPrivateKey($key, $type, $password, array $options = []) { if (empty($password) || !is_string($password)) { return "-----BEGIN $type PRIVATE KEY-----\r\n" . diff --git a/phpseclib/Crypt/Common/Keys/PKCS8.php b/phpseclib/Crypt/Common/Keys/PKCS8.php index 8b3921a7..5c968027 100644 --- a/phpseclib/Crypt/Common/Keys/PKCS8.php +++ b/phpseclib/Crypt/Common/Keys/PKCS8.php @@ -529,7 +529,7 @@ abstract class PKCS8 extends PKCS * @param array $options optional * @return string */ - protected static function wrapPrivateKey($key, $attr, $params, $password, $oid = null, $publicKey = '', $options = []) + protected static function wrapPrivateKey($key, $attr, $params, $password, $oid = null, $publicKey = '', array $options = []) { self::initialize_static_variables(); diff --git a/phpseclib/Crypt/Common/Keys/PuTTY.php b/phpseclib/Crypt/Common/Keys/PuTTY.php index 11159bba..87b6f067 100644 --- a/phpseclib/Crypt/Common/Keys/PuTTY.php +++ b/phpseclib/Crypt/Common/Keys/PuTTY.php @@ -175,7 +175,7 @@ abstract class PuTTY * @param array $options optional * @return string */ - protected static function wrapPrivateKey($public, $private, $type, $password, $options = []) + protected static function wrapPrivateKey($public, $private, $type, $password, array $options = []) { $key = "PuTTY-User-Key-File-2: " . $type . "\r\nEncryption: "; $encryption = (!empty($password) || is_string($password)) ? 'aes256-cbc' : 'none'; diff --git a/phpseclib/Crypt/Common/PrivateKey.php b/phpseclib/Crypt/Common/PrivateKey.php index c726f3ea..4de3c0e7 100644 --- a/phpseclib/Crypt/Common/PrivateKey.php +++ b/phpseclib/Crypt/Common/PrivateKey.php @@ -25,6 +25,6 @@ interface PrivateKey public function sign($message); //public function decrypt($ciphertext); public function getPublicKey(); - public function toString($type); + public function toString($type, array $options = []); public function withPassword($string); } diff --git a/phpseclib/Crypt/Common/PublicKey.php b/phpseclib/Crypt/Common/PublicKey.php index c1102f71..1bc3fc3f 100644 --- a/phpseclib/Crypt/Common/PublicKey.php +++ b/phpseclib/Crypt/Common/PublicKey.php @@ -24,6 +24,6 @@ interface PublicKey { public function verify($message, $signature); //public function encrypt($plaintext); - public function toString($type); + public function toString($type, array $options = []); public function getFingerprint($algorithm); } diff --git a/phpseclib/Crypt/DSA/Keys/OpenSSH.php b/phpseclib/Crypt/DSA/Keys/OpenSSH.php index 65a9c417..16b2c453 100644 --- a/phpseclib/Crypt/DSA/Keys/OpenSSH.php +++ b/phpseclib/Crypt/DSA/Keys/OpenSSH.php @@ -65,7 +65,7 @@ abstract class OpenSSH extends Progenitor * @param array $options optional * @return string */ - public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, $options = []) + public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, array $options = []) { if ($q->getLength() != 160) { throw new \InvalidArgumentException('SSH only supports keys with an N (length of Group Order q) of 160'); diff --git a/phpseclib/Crypt/DSA/Keys/PKCS1.php b/phpseclib/Crypt/DSA/Keys/PKCS1.php index 54e08208..2b028156 100644 --- a/phpseclib/Crypt/DSA/Keys/PKCS1.php +++ b/phpseclib/Crypt/DSA/Keys/PKCS1.php @@ -116,7 +116,7 @@ abstract class PKCS1 extends Progenitor * @param array $options optional * @return string */ - public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = '', $options = []) + public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = '', array $options = []) { $key = [ 'version' => 0, diff --git a/phpseclib/Crypt/DSA/Keys/PKCS8.php b/phpseclib/Crypt/DSA/Keys/PKCS8.php index 661b723c..d4cc8f11 100644 --- a/phpseclib/Crypt/DSA/Keys/PKCS8.php +++ b/phpseclib/Crypt/DSA/Keys/PKCS8.php @@ -130,7 +130,7 @@ abstract class PKCS8 extends Progenitor * @param array $options optional * @return string */ - public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = '', $options = []) + public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = '', array $options = []) { $params = [ 'p' => $p, @@ -154,7 +154,7 @@ abstract class PKCS8 extends Progenitor * @param array $options optional * @return string */ - public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, $options = []) + public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, array $options = []) { $params = [ 'p' => $p, diff --git a/phpseclib/Crypt/DSA/Keys/PuTTY.php b/phpseclib/Crypt/DSA/Keys/PuTTY.php index 03031fb6..04865474 100644 --- a/phpseclib/Crypt/DSA/Keys/PuTTY.php +++ b/phpseclib/Crypt/DSA/Keys/PuTTY.php @@ -94,7 +94,7 @@ abstract class PuTTY extends Progenitor * @param array $options optional * @return string */ - public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = false, $options = []) + public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = false, array $options = []) { if ($q->getLength() != 160) { throw new \InvalidArgumentException('SSH only supports keys with an N (length of Group Order q) of 160'); diff --git a/phpseclib/Crypt/DSA/Parameters.php b/phpseclib/Crypt/DSA/Parameters.php index b97c1dfe..961473ab 100644 --- a/phpseclib/Crypt/DSA/Parameters.php +++ b/phpseclib/Crypt/DSA/Parameters.php @@ -31,7 +31,7 @@ class Parameters extends DSA * @param array $options optional * @return string */ - public function toString($type = 'PKCS1', $options = []) + public function toString($type = 'PKCS1', array $options = []) { $type = self::validatePlugin('Keys', 'PKCS1', 'saveParameters'); diff --git a/phpseclib/Crypt/DSA/PrivateKey.php b/phpseclib/Crypt/DSA/PrivateKey.php index 32e9fbda..927fe0d7 100644 --- a/phpseclib/Crypt/DSA/PrivateKey.php +++ b/phpseclib/Crypt/DSA/PrivateKey.php @@ -147,7 +147,7 @@ class PrivateKey extends DSA implements Common\PrivateKey * @param array $options optional * @return string */ - public function toString($type, $options = []) + public function toString($type, array $options = []) { $type = self::validatePlugin('Keys', $type, 'savePrivateKey'); diff --git a/phpseclib/Crypt/DSA/PublicKey.php b/phpseclib/Crypt/DSA/PublicKey.php index 72ff5025..37c7c649 100644 --- a/phpseclib/Crypt/DSA/PublicKey.php +++ b/phpseclib/Crypt/DSA/PublicKey.php @@ -83,7 +83,7 @@ class PublicKey extends DSA implements Common\PublicKey * @param array $options optional * @return string */ - public function toString($type, $options = []) + public function toString($type, array $options = []) { $type = self::validatePlugin('Keys', $type, 'savePublicKey'); diff --git a/phpseclib/Crypt/ECDSA/Keys/OpenSSH.php b/phpseclib/Crypt/ECDSA/Keys/OpenSSH.php index c4b07341..8d8f9c1f 100644 --- a/phpseclib/Crypt/ECDSA/Keys/OpenSSH.php +++ b/phpseclib/Crypt/ECDSA/Keys/OpenSSH.php @@ -189,7 +189,7 @@ abstract class OpenSSH extends Progenitor * @param array $options optional * @return string */ - public static function savePublicKey(BaseCurve $curve, array $publicKey, $options = []) + public static function savePublicKey(BaseCurve $curve, array $publicKey, array $options = []) { $comment = isset($options['comment']) ? $options['comment'] : self::$comment; diff --git a/phpseclib/Crypt/ECDSA/Keys/PKCS1.php b/phpseclib/Crypt/ECDSA/Keys/PKCS1.php index c9007b88..7ef60770 100644 --- a/phpseclib/Crypt/ECDSA/Keys/PKCS1.php +++ b/phpseclib/Crypt/ECDSA/Keys/PKCS1.php @@ -118,7 +118,7 @@ abstract class PKCS1 extends Progenitor * @param array $options optional * @return string */ - public static function savePrivateKey(Integer $privateKey, BaseCurve $curve, array $publicKey, $password = '', $options = []) + public static function savePrivateKey(Integer $privateKey, BaseCurve $curve, array $publicKey, $password = '', array $options = []) { self::initialize_static_variables(); diff --git a/phpseclib/Crypt/ECDSA/Keys/PKCS8.php b/phpseclib/Crypt/ECDSA/Keys/PKCS8.php index 78b056f5..69ee94db 100644 --- a/phpseclib/Crypt/ECDSA/Keys/PKCS8.php +++ b/phpseclib/Crypt/ECDSA/Keys/PKCS8.php @@ -201,7 +201,7 @@ abstract class PKCS8 extends Progenitor * @param array $options optional * @return string */ - public static function savePrivateKey(Integer $privateKey, BaseCurve $curve, array $publicKey, $password = '', $options = []) + public static function savePrivateKey(Integer $privateKey, BaseCurve $curve, array $publicKey, $password = '', array $options = []) { self::initialize_static_variables(); diff --git a/phpseclib/Crypt/ECDSA/Keys/PuTTY.php b/phpseclib/Crypt/ECDSA/Keys/PuTTY.php index eedcc8db..c70a1ce1 100644 --- a/phpseclib/Crypt/ECDSA/Keys/PuTTY.php +++ b/phpseclib/Crypt/ECDSA/Keys/PuTTY.php @@ -99,7 +99,7 @@ abstract class PuTTY extends Progenitor * @param array $options optional * @return string */ - public static function savePrivateKey(Integer $privateKey, BaseCurve $curve, array $publicKey, $password = false, $options = []) + public static function savePrivateKey(Integer $privateKey, BaseCurve $curve, array $publicKey, $password = false, array $options = []) { self::initialize_static_variables(); diff --git a/phpseclib/Crypt/ECDSA/Parameters.php b/phpseclib/Crypt/ECDSA/Parameters.php index 03d30261..4d2002e4 100644 --- a/phpseclib/Crypt/ECDSA/Parameters.php +++ b/phpseclib/Crypt/ECDSA/Parameters.php @@ -31,7 +31,7 @@ class Parameters extends ECDSA * @param array $options optional * @return string */ - public function toString($type = 'PKCS1', $options = []) + public function toString($type = 'PKCS1', array $options = []) { $type = self::validatePlugin('Keys', 'PKCS1', 'saveParameters'); diff --git a/phpseclib/Crypt/ECDSA/PrivateKey.php b/phpseclib/Crypt/ECDSA/PrivateKey.php index 82fdf015..e726cc36 100644 --- a/phpseclib/Crypt/ECDSA/PrivateKey.php +++ b/phpseclib/Crypt/ECDSA/PrivateKey.php @@ -185,7 +185,7 @@ class PrivateKey extends ECDSA implements Common\PrivateKey * @param array $options optional * @return string */ - public function toString($type, $options = []) + public function toString($type, array $options = []) { $type = self::validatePlugin('Keys', $type, 'savePrivateKey'); diff --git a/phpseclib/Crypt/ECDSA/PublicKey.php b/phpseclib/Crypt/ECDSA/PublicKey.php index 459c468f..7ae2e183 100644 --- a/phpseclib/Crypt/ECDSA/PublicKey.php +++ b/phpseclib/Crypt/ECDSA/PublicKey.php @@ -162,7 +162,7 @@ class PublicKey extends ECDSA implements Common\PublicKey * @param array $options optional * @return string */ - public function toString($type, $options = []) + public function toString($type, array $options = []) { $type = self::validatePlugin('Keys', $type, 'savePublicKey'); diff --git a/phpseclib/Crypt/RSA/Keys/MSBLOB.php b/phpseclib/Crypt/RSA/Keys/MSBLOB.php index ef4d7ccc..268c2440 100644 --- a/phpseclib/Crypt/RSA/Keys/MSBLOB.php +++ b/phpseclib/Crypt/RSA/Keys/MSBLOB.php @@ -185,7 +185,7 @@ abstract class MSBLOB * @param string $password optional * @return string */ - public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, $primes, $exponents, $coefficients, $password = '') + public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '') { if (count($primes) != 2) { throw new \InvalidArgumentException('MSBLOB does not support multi-prime RSA keys'); diff --git a/phpseclib/Crypt/RSA/Keys/OpenSSH.php b/phpseclib/Crypt/RSA/Keys/OpenSSH.php index 5df9696e..6d93e5bb 100644 --- a/phpseclib/Crypt/RSA/Keys/OpenSSH.php +++ b/phpseclib/Crypt/RSA/Keys/OpenSSH.php @@ -66,7 +66,7 @@ abstract class OpenSSH extends Progenitor * @param array $options optional * @return string */ - public static function savePublicKey(BigInteger $n, BigInteger $e, $options = []) + public static function savePublicKey(BigInteger $n, BigInteger $e, array $options = []) { $RSAPublicKey = Strings::packSSH2('sii', 'ssh-rsa', $e, $n); diff --git a/phpseclib/Crypt/RSA/Keys/PKCS1.php b/phpseclib/Crypt/RSA/Keys/PKCS1.php index e5152cc1..959bb7dd 100644 --- a/phpseclib/Crypt/RSA/Keys/PKCS1.php +++ b/phpseclib/Crypt/RSA/Keys/PKCS1.php @@ -104,7 +104,7 @@ abstract class PKCS1 extends Progenitor * @param array $options optional * @return string */ - public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, $primes, $exponents, $coefficients, $password = '', $options = []) + public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []) { $num_primes = count($primes); $key = [ diff --git a/phpseclib/Crypt/RSA/Keys/PKCS8.php b/phpseclib/Crypt/RSA/Keys/PKCS8.php index 1178e93d..5dcbb110 100644 --- a/phpseclib/Crypt/RSA/Keys/PKCS8.php +++ b/phpseclib/Crypt/RSA/Keys/PKCS8.php @@ -107,7 +107,7 @@ abstract class PKCS8 extends Progenitor * @param array $options optional * @return string */ - public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, $primes, $exponents, $coefficients, $password = '', $options = []) + public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []) { $key = PKCS1::savePrivateKey($n, $e, $d, $primes, $exponents, $coefficients); $key = ASN1::extractBER($key); @@ -123,7 +123,7 @@ abstract class PKCS8 extends Progenitor * @param array $options optional * @return string */ - public static function savePublicKey(BigInteger $n, BigInteger $e, $options = []) + public static function savePublicKey(BigInteger $n, BigInteger $e, array $options = []) { $key = PKCS1::savePublicKey($n, $e); $key = ASN1::extractBER($key); diff --git a/phpseclib/Crypt/RSA/Keys/PSS.php b/phpseclib/Crypt/RSA/Keys/PSS.php index 2b759984..8795a67d 100644 --- a/phpseclib/Crypt/RSA/Keys/PSS.php +++ b/phpseclib/Crypt/RSA/Keys/PSS.php @@ -166,7 +166,7 @@ abstract class PSS extends Progenitor * @param array $options optional * @return string */ - public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, $primes, $exponents, $coefficients, $password = '', $options = []) + public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []) { self::initialize_static_variables(); @@ -185,7 +185,7 @@ abstract class PSS extends Progenitor * @param array $options optional * @return string */ - public static function savePublicKey(BigInteger $n, BigInteger $e, $options = []) + public static function savePublicKey(BigInteger $n, BigInteger $e, array $options = []) { $key = PKCS1::savePublicKey($n, $e); $key = ASN1::extractBER($key); @@ -200,7 +200,7 @@ abstract class PSS extends Progenitor * @param array $options * @return string */ - private static function savePSSParams($options) + private static function savePSSParams(array $options) { /* The trailerField field is an integer. It provides diff --git a/phpseclib/Crypt/RSA/Keys/PuTTY.php b/phpseclib/Crypt/RSA/Keys/PuTTY.php index 0fa54704..aaef1f98 100644 --- a/phpseclib/Crypt/RSA/Keys/PuTTY.php +++ b/phpseclib/Crypt/RSA/Keys/PuTTY.php @@ -103,7 +103,7 @@ abstract class PuTTY extends Progenitor * @param array $options optional * @return string */ - public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, $primes, $exponents, $coefficients, $password = '', $options = []) + public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []) { if (count($primes) != 2) { throw new \InvalidArgumentException('PuTTY does not support multi-prime RSA keys'); diff --git a/phpseclib/Crypt/RSA/Keys/XML.php b/phpseclib/Crypt/RSA/Keys/XML.php index 966112bc..06950cc9 100644 --- a/phpseclib/Crypt/RSA/Keys/XML.php +++ b/phpseclib/Crypt/RSA/Keys/XML.php @@ -131,7 +131,7 @@ abstract class XML * @param string $password optional * @return string */ - public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, $primes, $exponents, $coefficients, $password = '') + public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '') { if (count($primes) != 2) { throw new \InvalidArgumentException('XML does not support multi-prime RSA keys'); diff --git a/phpseclib/Crypt/RSA/PrivateKey.php b/phpseclib/Crypt/RSA/PrivateKey.php index 5788f5b5..8810dbdd 100644 --- a/phpseclib/Crypt/RSA/PrivateKey.php +++ b/phpseclib/Crypt/RSA/PrivateKey.php @@ -518,7 +518,7 @@ class PrivateKey extends RSA implements Common\PrivateKey * @param array $options optional * @return string */ - public function toString($type, $options = []) + public function toString($type, array $options = []) { $type = self::validatePlugin( 'Keys', diff --git a/phpseclib/Crypt/RSA/PublicKey.php b/phpseclib/Crypt/RSA/PublicKey.php index 50233633..fe0dff79 100644 --- a/phpseclib/Crypt/RSA/PublicKey.php +++ b/phpseclib/Crypt/RSA/PublicKey.php @@ -469,7 +469,7 @@ class PublicKey extends RSA implements Common\PublicKey * @param array $options optional * @return mixed */ - public function toString($type, $options = []) + public function toString($type, array $options = []) { $type = self::validatePlugin('Keys', $type, 'savePublicKey'); diff --git a/phpseclib/System/SSH/Agent/Identity.php b/phpseclib/System/SSH/Agent/Identity.php index ddba1706..96ddcb56 100644 --- a/phpseclib/System/SSH/Agent/Identity.php +++ b/phpseclib/System/SSH/Agent/Identity.php @@ -320,9 +320,10 @@ class Identity implements PrivateKey * Returns the private key * * @param string $type + * @param array $options optional * @return string */ - public function toString($type) + public function toString($type, array $options = []) { throw new \RuntimeException('ssh-agent does not provide a mechanism to get the private key'); }