Merge branch '2.0' into 3.0

This commit is contained in:
William Desportes 2020-09-09 10:01:39 +02:00
commit 480af6b980
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
33 changed files with 68 additions and 79 deletions

View File

@ -77,7 +77,7 @@ abstract class Strings
* uint64 is not supported.
*
* @param string $format
* @param $data
* @param string $data
* @return mixed
*/
public static function unpackSSH2($format, &$data)
@ -138,7 +138,7 @@ abstract class Strings
/**
* Create SSH2-style string
*
* @param $elements[]
* @param string[] ...$elements
* @access public
* @return mixed
*/

View File

@ -239,7 +239,7 @@ abstract class AsymmetricKey
* Load Plugins
*
* @access private
* @param $format
* @param string $format
*/
private static function loadPlugins($format)
{
@ -325,7 +325,6 @@ abstract class AsymmetricKey
* Tests engine validity
*
* @access public
* @param int $val
*/
public static function useBestEngine()
{

View File

@ -65,7 +65,7 @@ abstract class OpenSSH
*
* @access public
* @param string $key
* @param string $type
* @param string $password
* @return array
*/
public static function load($key, $password = '')

View File

@ -42,7 +42,7 @@ abstract class PKCS
* Is the key a base-64 encoded PEM, DER or should it be auto-detected?
*
* @access private
* @param int
* @var int
*/
protected static $format = self::MODE_ANY;

View File

@ -882,7 +882,7 @@ abstract class SymmetricKey
* @see Crypt/Hash.php
* @param string $password
* @param string $method
* @param $func_args[]
* @param string[] ...$func_args
* @throws \LengthException if pbkdf1 is being used and the derived key length exceeds the hash length
* @return bool
* @access public

View File

@ -388,7 +388,6 @@ abstract class DH extends AsymmetricKey
*
* @see self::getPublicKey()
* @access public
* @param string $type optional
* @return mixed
*/
public function getParameters()

View File

@ -185,7 +185,7 @@ abstract class DSA extends AsymmetricKey
*
* Returns the private key, from which the publickey can be extracted
*
* @param $args[]
* @param int[] ...$args
* @access public
* @return DSA\PrivateKey
*/
@ -304,7 +304,6 @@ abstract class DSA extends AsymmetricKey
*
* @see self::getPublicKey()
* @access public
* @param string $type optional
* @return mixed
*/
public function getParameters()
@ -323,7 +322,7 @@ abstract class DSA extends AsymmetricKey
* Valid values are: ASN1, SSH2, Raw
*
* @access public
* @param string $padding
* @param string $format
*/
public function withSignatureFormat($format)
{

View File

@ -57,7 +57,6 @@ class PrivateKey extends DSA implements Common\PrivateKey
*
* @see self::getPrivateKey()
* @access public
* @param string $type optional
* @return mixed
*/
public function getPublicKey()

View File

@ -35,7 +35,6 @@ class PublicKey extends DSA implements Common\PublicKey
* @access public
* @param string $message
* @param string $signature
* @param string $format optional
* @return mixed
*/
public function verify($message, $signature)

View File

@ -373,7 +373,7 @@ abstract class EC extends AsymmetricKey
* Valid values are: ASN1, SSH2, Raw
*
* @access public
* @param string $padding
* @param string $format
*/
public function withSignatureFormat($format)
{

View File

@ -252,7 +252,8 @@ class KoblitzPrime extends Prime
* Calculates the parameters needed from the Euclidean algorithm as discussed at
* http://diamond.boisestate.edu/~liljanab/MATH308/GuideToECC.pdf#page=148
*
* @param BigInteger $n
* @param BigInteger $u
* @param BigInteger $v
* @return BigInteger[]
*/
protected static function extendedGCD(BigInteger $u, BigInteger $v)

View File

@ -102,7 +102,7 @@ class Ed25519 extends TwistedEdwards
*
* Used by EC\Keys\Common.php
*
* @param BigInteger $x
* @param BigInteger $y
* @param boolean $sign
* @return object[]
*/
@ -189,7 +189,7 @@ class Ed25519 extends TwistedEdwards
/**
* Encode a point as a string
*
* @param string $str
* @param array $point
* @return string
*/
public function encodePoint($point)

View File

@ -54,7 +54,7 @@ class Ed448 extends TwistedEdwards
*
* Used by EC\Keys\Common.php
*
* @param BigInteger $x
* @param BigInteger $y
* @param boolean $sign
* @return object[]
*/
@ -127,7 +127,7 @@ class Ed448 extends TwistedEdwards
/**
* Encode a point as a string
*
* @param string $str
* @param array $point
* @return string
*/
public function encodePoint($point)

View File

@ -78,7 +78,7 @@ abstract class MontgomeryPrivate
* Convert an EC public key to the appropriate format
*
* @access public
* @param \phpseclib3\Crypt\EC\Curves\MontgomeryCurve $curve
* @param \phpseclib3\Crypt\EC\BaseCurves\Montgomery $curve
* @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey
* @return string
*/
@ -92,7 +92,7 @@ abstract class MontgomeryPrivate
*
* @access public
* @param \phpseclib3\Math\Common\FiniteField\Integer $privateKey
* @param \phpseclib3\Crypt\EC\Curves\Montgomery $curve
* @param \phpseclib3\Crypt\EC\BaseCurves\Montgomery $curve
* @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey
* @param string $password optional
* @return string

View File

@ -68,7 +68,7 @@ abstract class MontgomeryPublic
* Convert an EC public key to the appropriate format
*
* @access public
* @param \phpseclib3\Crypt\EC\Curves\Montgomery $curve
* @param \phpseclib3\Crypt\EC\BaseCurves\Montgomery $curve
* @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey
* @return string
*/

View File

@ -175,7 +175,7 @@ abstract class PKCS8 extends Progenitor
* @access public
* @param \phpseclib3\Crypt\EC\BaseCurves\Base $curve
* @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey
* @param array $optiona optional
* @param array $options optional
* @return string
*/
public static function savePublicKey(BaseCurve $curve, array $publicKey, array $options = [])

View File

@ -35,7 +35,7 @@ abstract class ASN1
* Loads a signature
*
* @access public
* @param array $key
* @param string $sig
* @return array
*/
public static function load($sig)

View File

@ -734,7 +734,7 @@ abstract class RSA extends AsymmetricKey
* Example: $key->withPadding(RSA::ENCRYPTION_PKCS1 | RSA::SIGNATURE_PKCS1);
*
* @access public
* @param string $label
* @param int $padding
*/
public function withPadding($padding)
{

View File

@ -461,7 +461,6 @@ class PrivateKey extends RSA implements Common\PrivateKey
* @see self::encrypt()
* @access public
* @param string $ciphertext
* @param int $padding optional
* @return bool|string
*/
public function decrypt($ciphertext)
@ -481,7 +480,6 @@ class PrivateKey extends RSA implements Common\PrivateKey
* Returns the public key
*
* @access public
* @param string $type optional
* @return mixed
*/
public function getPublicKey()
@ -526,7 +524,7 @@ class PrivateKey extends RSA implements Common\PrivateKey
throw new UnsupportedFormatException('The PSS format can only be used when the signature method has been explicitly set to PSS');
}
}
if (empty($this->primes)) {
return $type::savePublicKey($this->modulus, $this->exponent, $options);
}

View File

@ -475,7 +475,7 @@ class Salsa20 extends StreamCipher
* @see self::decrypt()
* @see self::encrypt()
* @access private
* @param string $text
* @param string $ciphertext
* @return string
*/
protected function poly1305($ciphertext)

View File

@ -1198,7 +1198,7 @@ abstract class ASN1
* Called by _encode_der()
*
* @access public
* @param string $content
* @param string $source
* @return string
*/
public static function encodeOID($source)

View File

@ -559,7 +559,7 @@ class X509
* Map extension values from octet string to extension-specific internal
* format.
*
* @param &array $root
* @param array $root (by reference)
* @param string $path
* @access private
*/
@ -608,7 +608,7 @@ class X509
* Map extension values from extension-specific internal format to
* octet string.
*
* @param &array Ref $root
* @param array $root (by reference)
* @param string $path
* @access private
*/
@ -672,7 +672,7 @@ class X509
* Map attribute values from ANY type to attribute-specific internal
* format.
*
* @param &array Ref $root
* @param array $root (by reference)
* @param string $path
* @access private
*/
@ -712,7 +712,7 @@ class X509
* Map attribute values from attribute-specific internal format to
* ANY type.
*
* @param &array $root Ref
* @param array $root (by reference)
* @param string $path
* @access private
*/
@ -754,7 +754,7 @@ class X509
* Map DN values from ANY type to DN-specific internal
* format.
*
* @param &array $root
* @param array $root (by reference)
* @param string $path
* @access private
*/
@ -783,7 +783,7 @@ class X509
* Map DN values from DN-specific internal format to
* ANY type.
*
* @param &array $root
* @param array $root (by reference)
* @param string $path
* @access private
*/
@ -2051,7 +2051,7 @@ class X509
*
* Key needs to be a \phpseclib3\Crypt\RSA object
*
* @param object $key
* @param PublicKey $key
* @access public
* @return bool
*/
@ -2065,7 +2065,7 @@ class X509
*
* Key needs to be a \phpseclib3\Crypt\RSA object
*
* @param object $key
* @param PrivateKey $key
* @access public
*/
public function setPrivateKey(PrivateKey $key)
@ -2513,7 +2513,6 @@ class X509
*
* @param \phpseclib3\File\X509 $issuer
* @param \phpseclib3\File\X509 $subject
* @param string $signatureAlgorithm optional
* @access public
* @return mixed
*/
@ -2708,7 +2707,6 @@ class X509
* Sign a CSR
*
* @access public
* @param string $signatureAlgorithm
* @return mixed
*/
public function signCSR()
@ -2764,7 +2762,6 @@ class X509
* Sign a SPKAC
*
* @access public
* @param string $signatureAlgorithm
* @return mixed
*/
public function signSPKAC()
@ -2829,7 +2826,6 @@ class X509
*
* @param \phpseclib3\File\X509 $issuer
* @param \phpseclib3\File\X509 $crl
* @param string $signatureAlgorithm optional
* @access public
* @return mixed
*/
@ -2960,7 +2956,7 @@ class X509
/**
* Identify signature algorithm from key settings
*
* @param object $key
* @param PrivateKey $key
* @access private
* @throws \phpseclib3\Exception\UnsupportedAlgorithmException if the algorithm is unsupported
* @return string
@ -3061,7 +3057,7 @@ class X509
* Set Serial Number
*
* @param string $serial
* @param $base integer Optional
* @param int $base optional
* @access public
*/
public function setSerialNumber($serial, $base = -256)
@ -3711,7 +3707,7 @@ class X509
/**
* Set the domain name's which the cert is to be valid for
*
* @param $domains[]
* @param mixed[] ...$domains
* @access public
* @return array
*/
@ -3726,7 +3722,7 @@ class X509
* Set the IP Addresses's which the cert is to be valid for
*
* @access public
* @param $ipAddresses[] optional
* @param mixed[] ...$ipAddresses
*/
public function setIPAddress(...$ipAddresses)
{

View File

@ -153,7 +153,7 @@ class BigInteger implements \Serializable
* 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 $x integer|BigInteger\Engines\Engine Base-10 number or base-$base number if $base set.
* @param int|BigInteger\Engines\Engine $x Base-10 number or base-$base number if $base set.
* @param int $base
* @return BigInteger
*/
@ -463,7 +463,7 @@ class BigInteger implements \Serializable
* Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y).
*
* @param BigInteger $y
* @return int < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal.
* @return int in case < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal.
* @access public
* @see self::equals()
* @internal Could return $this->subtract($x), but that's not as fast as what we do do.
@ -730,7 +730,7 @@ class BigInteger implements \Serializable
/**
* Return the minimum BigInteger between an arbitrary number of BigIntegers.
*
* @param BigInteger[] $nums
* @param BigInteger ...$nums
* @return BigInteger
*/
public static function min(BigInteger ...$nums)
@ -743,7 +743,7 @@ class BigInteger implements \Serializable
/**
* Return the maximum BigInteger between an arbitrary number of BigIntegers.
*
* @param BigInteger[] $nums
* @param BigInteger ...$nums
* @return BigInteger
*/
public static function max(BigInteger ...$nums)

View File

@ -438,7 +438,7 @@ class BCMath extends Engine
* Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y).
*
* @param BCMath $y
* @return int < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal.
* @return int in case < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal.
* @see self::equals()
* @internal Could return $this->subtract($x), but that's not as fast as what we do do.
*/
@ -639,7 +639,7 @@ class BCMath extends Engine
/**
* Return the minimum BigInteger between an arbitrary number of BigIntegers.
*
* @param BCMath[] $nums
* @param BCMath ...$nums
* @return BCMath
*/
public static function min(BCMath ...$nums)
@ -650,7 +650,7 @@ class BCMath extends Engine
/**
* Return the maximum BigInteger between an arbitrary number of BigIntegers.
*
* @param BCMath[] $nums
* @param BCMath ...$nums
* @return BCMath
*/
public static function max(BCMath ...$nums)

View File

@ -434,8 +434,8 @@ abstract class Engine implements \Serializable
*
* Shifts binary strings $shift bits, essentially multiplying by 2**$shift.
*
* @param $x String
* @param $shift Integer
* @param string $x
* @param int $shift
* @return string
*/
protected static function base256_lshift(&$x, $shift)

View File

@ -289,7 +289,7 @@ class GMP extends Engine
* Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y).
*
* @param GMP $y
* @return int < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal.
* @return int in case < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal.
* @access public
* @see self::equals()
* @internal Could return $this->subtract($x), but that's not as fast as what we do do.
@ -640,7 +640,7 @@ class GMP extends Engine
/**
* Return the minimum BigInteger between an arbitrary number of BigIntegers.
*
* @param GMP[] $nums
* @param GMP ...$nums
* @return GMP
*/
public static function min(GMP ...$nums)
@ -651,7 +651,7 @@ class GMP extends Engine
/**
* Return the maximum BigInteger between an arbitrary number of BigIntegers.
*
* @param GMP[] $nums
* @param GMP ...$nums
* @return GMP
*/
public static function max(GMP ...$nums)

View File

@ -291,7 +291,7 @@ class PHP32 extends PHP
* Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y).
*
* @param PHP32 $y
* @return int < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal.
* @return int in case < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal.
* @access public
* @see self::equals()
* @internal Could return $this->subtract($x), but that's not as fast as what we do do.
@ -386,7 +386,7 @@ class PHP32 extends PHP
/**
* Return the minimum BigInteger between an arbitrary number of BigIntegers.
*
* @param PHP32[] $nums
* @param PHP32 ...$nums
* @return PHP32
*/
public static function min(PHP32 ...$nums)
@ -397,7 +397,7 @@ class PHP32 extends PHP
/**
* Return the maximum BigInteger between an arbitrary number of BigIntegers.
*
* @param PHP32[] $nums
* @param PHP32 ...$nums
* @return PHP32
*/
public static function max(PHP32 ...$nums)

View File

@ -295,7 +295,7 @@ class PHP64 extends PHP
* Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y).
*
* @param PHP64 $y
* @return int < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal.
* @return int in case < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal.
* @access public
* @see self::equals()
* @internal Could return $this->subtract($x), but that's not as fast as what we do do.
@ -390,7 +390,7 @@ class PHP64 extends PHP
/**
* Return the minimum BigInteger between an arbitrary number of BigIntegers.
*
* @param PHP64[] $nums
* @param PHP64 ...$nums
* @return PHP64
*/
public static function min(PHP64 ...$nums)
@ -401,7 +401,7 @@ class PHP64 extends PHP
/**
* Return the maximum BigInteger between an arbitrary number of BigIntegers.
*
* @param PHP64[] $nums
* @param PHP64 ...$nums
* @return PHP64
*/
public static function max(PHP64 ...$nums)

View File

@ -420,7 +420,7 @@ class SFTP extends SSH2
* Login
*
* @param string $username
* @param $args[] string password
* @param string[] ...$args
* @throws \UnexpectedValueException on receipt of unexpected packets
* @return bool
* @access public
@ -1054,7 +1054,7 @@ class SFTP extends SSH2
* $sftp->setListOrder();
* Don't do any sort of sorting
*
* @param $args[]
* @param string[] ...$args
* @access public
*/
public function setListOrder(...$args)
@ -1733,7 +1733,7 @@ class SFTP extends SSH2
* Helper function for directory creation
*
* @param string $dir
* @param string $attr
* @param int $mode
* @return bool
* @access private
*/
@ -2853,6 +2853,7 @@ class SFTP extends SSH2
*
* @param int $type
* @param string $data
* @param int $request_id
* @see self::_get_sftp_packet()
* @see self::send_channel_packet()
* @return bool

View File

@ -767,8 +767,8 @@ class Stream
* If NET_SFTP_STREAM_LOGGING is defined all calls will be output on the screen and then (regardless of whether or not
* NET_SFTP_STREAM_LOGGING is enabled) the parameters will be passed through to the appropriate method.
*
* @param string
* @param array
* @param string $name
* @param array $arguments
* @return mixed
* @access public
*/

View File

@ -2038,7 +2038,7 @@ class SSH2
* The $password parameter can be a plaintext password, a \phpseclib3\Crypt\RSA object or an array
*
* @param string $username
* @param $args[] param mixed $password
* @param string[] ...$args
* @return bool
* @see self::_login()
* @access public
@ -2064,7 +2064,7 @@ class SSH2
* Login Helper
*
* @param string $username
* @param $args[] param mixed $password
* @param string[] ...$args
* @return bool
* @see self::_login_helper()
* @access private
@ -2275,7 +2275,7 @@ class SSH2
/**
* Handle the keyboard-interactive requests / responses.
*
* @param $responses[]
* @param mixed[] ...$responses
* @return bool
* @throws \RuntimeException on connection error
* @access private
@ -3161,7 +3161,7 @@ class SSH2
* See '6. Binary Packet Protocol' of rfc4253 for more info.
*
* @see self::_send_binary_packet()
* @param bool $filter_channel_packets
* @param bool $skip_channel_filter
* @return string
* @access private
*/
@ -3379,7 +3379,7 @@ class SSH2
*
* @see self::_get_binary_packet()
* @param string $payload
* @param bool $filter_channel_packets
* @param bool $skip_channel_filter
* @return string
* @access private
*/
@ -4135,7 +4135,7 @@ class SSH2
* named constants from it, using the value as the name of the constant and the index as the value of the constant.
* If any of the constants that would be defined already exists, none of the constants will be defined.
*
* @param $args[]
* @param mixed[] ...$args
* @access protected
*/
protected function define_array(...$args)

View File

@ -242,7 +242,7 @@ class Identity implements PrivateKey
* Valid values are: ASN1, SSH2, Raw
*
* @access public
* @param string $padding
* @param string $format
*/
public function withSignatureFormat($format)
{
@ -279,7 +279,6 @@ class Identity implements PrivateKey
* See "2.6.2 Protocol 2 private key signature request"
*
* @param string $message
* @param int $padding optional
* @return string
* @throws \RuntimeException on connection errors
* @throws \phpseclib3\Exception\UnsupportedAlgorithmException if the algorithm is unsupported

View File

@ -27,8 +27,7 @@ trait ReadBytes
/**
* Read data
*
* @param string $data
* @return string Data from SSH Agent
* @param int $length
* @throws \RuntimeException on connection errors
* @access public
*/