mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-02-04 21:08:28 +00:00
PSR4 for tests and added fall-through for switches
PSR4 for tests and added fall-through for switches
This commit is contained in:
parent
5f60f96487
commit
574953061a
@ -15,8 +15,5 @@
|
|||||||
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>
|
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>
|
||||||
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
|
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
|
||||||
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
|
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
|
||||||
<exclude name="PSR2.ControlStructures.SwitchDeclaration.TerminatingComment"/>
|
|
||||||
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
|
|
||||||
<exclude name="PSR1.Classes.ClassDeclaration.MultipleClasses"/>
|
|
||||||
</rule>
|
</rule>
|
||||||
</ruleset>
|
</ruleset>
|
||||||
|
@ -71,5 +71,10 @@
|
|||||||
"psr-4": {
|
"psr-4": {
|
||||||
"phpseclib3\\": "phpseclib/"
|
"phpseclib3\\": "phpseclib/"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"phpseclib3\\Tests\\": "tests/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,6 +279,7 @@ abstract class DH extends AsymmetricKey
|
|||||||
return $public->publicKey->powMod($private->privateKey, $private->prime)->toBytes(true);
|
return $public->publicKey->powMod($private->privateKey, $private->prime)->toBytes(true);
|
||||||
case is_string($public):
|
case is_string($public):
|
||||||
$public = new BigInteger($public, -256);
|
$public = new BigInteger($public, -256);
|
||||||
|
// fall-through
|
||||||
case $public instanceof BigInteger:
|
case $public instanceof BigInteger:
|
||||||
return $public->powMod($private->privateKey, $private->prime)->toBytes(true);
|
return $public->powMod($private->privateKey, $private->prime)->toBytes(true);
|
||||||
default:
|
default:
|
||||||
@ -290,6 +291,7 @@ abstract class DH extends AsymmetricKey
|
|||||||
switch (true) {
|
switch (true) {
|
||||||
case $public instanceof EC\PublicKey:
|
case $public instanceof EC\PublicKey:
|
||||||
$public = $public->getEncodedCoordinates();
|
$public = $public->getEncodedCoordinates();
|
||||||
|
// fall-through
|
||||||
case is_string($public):
|
case is_string($public):
|
||||||
$point = $private->multiply($public);
|
$point = $private->multiply($public);
|
||||||
switch ($private->getCurve()) {
|
switch ($private->getCurve()) {
|
||||||
|
@ -340,6 +340,7 @@ class Hash
|
|||||||
break;
|
break;
|
||||||
case 'keccak256':
|
case 'keccak256':
|
||||||
$this->paddingType = self::PADDING_KECCAK;
|
$this->paddingType = self::PADDING_KECCAK;
|
||||||
|
// fall-through
|
||||||
case 'sha256':
|
case 'sha256':
|
||||||
case 'sha512/256':
|
case 'sha512/256':
|
||||||
case 'sha3-256':
|
case 'sha3-256':
|
||||||
|
@ -143,6 +143,7 @@ abstract class MSBLOB
|
|||||||
switch ($magic) {
|
switch ($magic) {
|
||||||
case self::RSA2:
|
case self::RSA2:
|
||||||
$components['isPublicKey'] = false;
|
$components['isPublicKey'] = false;
|
||||||
|
// fall-through
|
||||||
case self::RSA1:
|
case self::RSA1:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -164,6 +164,7 @@ class TripleDES extends DES
|
|||||||
break;
|
break;
|
||||||
case 'cbc3':
|
case 'cbc3':
|
||||||
$mode = 'cbc';
|
$mode = 'cbc';
|
||||||
|
// fall-through
|
||||||
// If not 3CBC, we init as usual
|
// If not 3CBC, we init as usual
|
||||||
default:
|
default:
|
||||||
parent::__construct($mode);
|
parent::__construct($mode);
|
||||||
|
@ -268,6 +268,7 @@ class ANSI
|
|||||||
array_shift($this->history);
|
array_shift($this->history);
|
||||||
array_shift($this->history_attrs);
|
array_shift($this->history_attrs);
|
||||||
}
|
}
|
||||||
|
// fall-through
|
||||||
case "\x1B[K": // Clear screen from cursor right
|
case "\x1B[K": // Clear screen from cursor right
|
||||||
$this->screen[$this->y] = substr($this->screen[$this->y], 0, $this->x);
|
$this->screen[$this->y] = substr($this->screen[$this->y], 0, $this->x);
|
||||||
|
|
||||||
|
@ -787,6 +787,7 @@ abstract class ASN1
|
|||||||
}
|
}
|
||||||
return $values;
|
return $values;
|
||||||
}
|
}
|
||||||
|
// fall-through
|
||||||
case self::TYPE_OCTET_STRING:
|
case self::TYPE_OCTET_STRING:
|
||||||
return $decoded['content'];
|
return $decoded['content'];
|
||||||
case self::TYPE_NULL:
|
case self::TYPE_NULL:
|
||||||
@ -1065,6 +1066,7 @@ abstract class ASN1
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// fall-through
|
||||||
case self::TYPE_OCTET_STRING:
|
case self::TYPE_OCTET_STRING:
|
||||||
/* The initial octet shall encode, as an unsigned binary integer with bit 1 as the least significant bit,
|
/* The initial octet shall encode, as an unsigned binary integer with bit 1 as the least significant bit,
|
||||||
the number of unused bits in the final subsequent octet. The number shall be in the range zero to seven.
|
the number of unused bits in the final subsequent octet. The number shall be in the range zero to seven.
|
||||||
@ -1385,8 +1387,10 @@ abstract class ASN1
|
|||||||
case $insize == 4:
|
case $insize == 4:
|
||||||
$c = ($c << 8) | ord($in[$i++]);
|
$c = ($c << 8) | ord($in[$i++]);
|
||||||
$c = ($c << 8) | ord($in[$i++]);
|
$c = ($c << 8) | ord($in[$i++]);
|
||||||
|
// fall-through
|
||||||
case $insize == 2:
|
case $insize == 2:
|
||||||
$c = ($c << 8) | ord($in[$i++]);
|
$c = ($c << 8) | ord($in[$i++]);
|
||||||
|
// fall-through
|
||||||
case $insize == 1:
|
case $insize == 1:
|
||||||
break;
|
break;
|
||||||
case ($c & 0x80) == 0x00:
|
case ($c & 0x80) == 0x00:
|
||||||
@ -1415,9 +1419,11 @@ abstract class ASN1
|
|||||||
$c >>= 8;
|
$c >>= 8;
|
||||||
$v .= chr($c & 0xFF);
|
$v .= chr($c & 0xFF);
|
||||||
$c >>= 8;
|
$c >>= 8;
|
||||||
|
// fall-through
|
||||||
case $outsize == 2:
|
case $outsize == 2:
|
||||||
$v .= chr($c & 0xFF);
|
$v .= chr($c & 0xFF);
|
||||||
$c >>= 8;
|
$c >>= 8;
|
||||||
|
// fall-through
|
||||||
case $outsize == 1:
|
case $outsize == 1:
|
||||||
$v .= chr($c & 0xFF);
|
$v .= chr($c & 0xFF);
|
||||||
$c >>= 8;
|
$c >>= 8;
|
||||||
@ -1430,18 +1436,23 @@ abstract class ASN1
|
|||||||
case $c >= 0x04000000:
|
case $c >= 0x04000000:
|
||||||
$v .= chr(0x80 | ($c & 0x3F));
|
$v .= chr(0x80 | ($c & 0x3F));
|
||||||
$c = ($c >> 6) | 0x04000000;
|
$c = ($c >> 6) | 0x04000000;
|
||||||
|
// fall-through
|
||||||
case $c >= 0x00200000:
|
case $c >= 0x00200000:
|
||||||
$v .= chr(0x80 | ($c & 0x3F));
|
$v .= chr(0x80 | ($c & 0x3F));
|
||||||
$c = ($c >> 6) | 0x00200000;
|
$c = ($c >> 6) | 0x00200000;
|
||||||
|
// fall-through
|
||||||
case $c >= 0x00010000:
|
case $c >= 0x00010000:
|
||||||
$v .= chr(0x80 | ($c & 0x3F));
|
$v .= chr(0x80 | ($c & 0x3F));
|
||||||
$c = ($c >> 6) | 0x00010000;
|
$c = ($c >> 6) | 0x00010000;
|
||||||
|
// fall-through
|
||||||
case $c >= 0x00000800:
|
case $c >= 0x00000800:
|
||||||
$v .= chr(0x80 | ($c & 0x3F));
|
$v .= chr(0x80 | ($c & 0x3F));
|
||||||
$c = ($c >> 6) | 0x00000800;
|
$c = ($c >> 6) | 0x00000800;
|
||||||
|
// fall-through
|
||||||
case $c >= 0x00000080:
|
case $c >= 0x00000080:
|
||||||
$v .= chr(0x80 | ($c & 0x3F));
|
$v .= chr(0x80 | ($c & 0x3F));
|
||||||
$c = ($c >> 6) | 0x000000C0;
|
$c = ($c >> 6) | 0x000000C0;
|
||||||
|
// fall-through
|
||||||
default:
|
default:
|
||||||
$v .= chr($c);
|
$v .= chr($c);
|
||||||
break;
|
break;
|
||||||
|
@ -3629,6 +3629,7 @@ class X509
|
|||||||
switch ($disposition) {
|
switch ($disposition) {
|
||||||
case self::ATTR_REPLACE:
|
case self::ATTR_REPLACE:
|
||||||
$disposition = self::ATTR_APPEND;
|
$disposition = self::ATTR_APPEND;
|
||||||
|
// fall-through
|
||||||
case self::ATTR_ALL:
|
case self::ATTR_ALL:
|
||||||
$this->removeAttribute($id);
|
$this->removeAttribute($id);
|
||||||
break;
|
break;
|
||||||
|
@ -885,6 +885,7 @@ class SFTP extends SSH2
|
|||||||
switch ($dir) {
|
switch ($dir) {
|
||||||
case '..':
|
case '..':
|
||||||
array_pop($new);
|
array_pop($new);
|
||||||
|
// fall-through
|
||||||
case '.':
|
case '.':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1209,6 +1210,7 @@ class SFTP extends SSH2
|
|||||||
case 'mode':
|
case 'mode':
|
||||||
$a[$sort] &= 07777;
|
$a[$sort] &= 07777;
|
||||||
$b[$sort] &= 07777;
|
$b[$sort] &= 07777;
|
||||||
|
// fall-through
|
||||||
default:
|
default:
|
||||||
if ($a[$sort] === $b[$sort]) {
|
if ($a[$sort] === $b[$sort]) {
|
||||||
break;
|
break;
|
||||||
|
@ -1950,6 +1950,7 @@ class SSH2
|
|||||||
$nonce = $kexHash->hash($keyBytes . $this->exchange_hash . 'A' . $this->session_id);
|
$nonce = $kexHash->hash($keyBytes . $this->exchange_hash . 'A' . $this->session_id);
|
||||||
$this->encryptFixedPart = substr($nonce, 0, 4);
|
$this->encryptFixedPart = substr($nonce, 0, 4);
|
||||||
$this->encryptInvocationCounter = substr($nonce, 4, 8);
|
$this->encryptInvocationCounter = substr($nonce, 4, 8);
|
||||||
|
// fall-through
|
||||||
case 'chacha20-poly1305@openssh.com':
|
case 'chacha20-poly1305@openssh.com':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1995,6 +1996,7 @@ class SSH2
|
|||||||
$nonce = $kexHash->hash($keyBytes . $this->exchange_hash . 'B' . $this->session_id);
|
$nonce = $kexHash->hash($keyBytes . $this->exchange_hash . 'B' . $this->session_id);
|
||||||
$this->decryptFixedPart = substr($nonce, 0, 4);
|
$this->decryptFixedPart = substr($nonce, 0, 4);
|
||||||
$this->decryptInvocationCounter = substr($nonce, 4, 8);
|
$this->decryptInvocationCounter = substr($nonce, 4, 8);
|
||||||
|
// fall-through
|
||||||
case 'chacha20-poly1305@openssh.com':
|
case 'chacha20-poly1305@openssh.com':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -2324,6 +2326,7 @@ class SSH2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// fall-through
|
||||||
case 'password':
|
case 'password':
|
||||||
foreach ($args as $key => $arg) {
|
foreach ($args as $key => $arg) {
|
||||||
$newargs[] = $arg;
|
$newargs[] = $arg;
|
||||||
@ -2431,6 +2434,7 @@ class SSH2
|
|||||||
case NET_SSH2_MSG_USERAUTH_FAILURE:
|
case NET_SSH2_MSG_USERAUTH_FAILURE:
|
||||||
list($auth_methods) = Strings::unpackSSH2('L', $response);
|
list($auth_methods) = Strings::unpackSSH2('L', $response);
|
||||||
$this->auth_methods_to_continue = $auth_methods;
|
$this->auth_methods_to_continue = $auth_methods;
|
||||||
|
// fall-through
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -3584,6 +3588,7 @@ class SSH2
|
|||||||
if (!$this->isAuthenticated()) {
|
if (!$this->isAuthenticated()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// fall-through
|
||||||
case self::NET_SSH2_COMPRESSION_ZLIB:
|
case self::NET_SSH2_COMPRESSION_ZLIB:
|
||||||
if ($this->regenerate_decompression_context) {
|
if ($this->regenerate_decompression_context) {
|
||||||
$this->regenerate_decompression_context = false;
|
$this->regenerate_decompression_context = false;
|
||||||
@ -4138,6 +4143,7 @@ class SSH2
|
|||||||
if ($client_channel == $channel) {
|
if ($client_channel == $channel) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// fall-through
|
||||||
case NET_SSH2_MSG_CHANNEL_EOF:
|
case NET_SSH2_MSG_CHANNEL_EOF:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -4174,6 +4180,7 @@ class SSH2
|
|||||||
if (!$this->isAuthenticated()) {
|
if (!$this->isAuthenticated()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// fall-through
|
||||||
case self::NET_SSH2_COMPRESSION_ZLIB:
|
case self::NET_SSH2_COMPRESSION_ZLIB:
|
||||||
if (!$this->regenerate_compression_context) {
|
if (!$this->regenerate_compression_context) {
|
||||||
$header = '';
|
$header = '';
|
||||||
|
@ -6,9 +6,11 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Functional\Net;
|
||||||
|
|
||||||
use phpseclib3\Net\SFTP;
|
use phpseclib3\Net\SFTP;
|
||||||
|
|
||||||
class Functional_Net_SFTPLargeFileTest extends Functional_Net_SFTPTestCase
|
class SFTPLargeFileTest extends SFTPTestCase
|
||||||
{
|
{
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,11 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Functional\Net;
|
||||||
|
|
||||||
use phpseclib3\Net\SFTP\Stream;
|
use phpseclib3\Net\SFTP\Stream;
|
||||||
|
|
||||||
class Functional_Net_SFTPStreamTest extends Functional_Net_SFTPTestCase
|
class SFTPStreamTest extends SFTPTestCase
|
||||||
{
|
{
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
|
@ -6,12 +6,15 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Functional\Net;
|
||||||
|
|
||||||
use phpseclib3\Net\SFTP;
|
use phpseclib3\Net\SFTP;
|
||||||
|
use phpseclib3\Tests\PhpseclibFunctionalTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides each test method with a new and empty $this->scratchDir.
|
* This class provides each test method with a new and empty $this->scratchDir.
|
||||||
*/
|
*/
|
||||||
abstract class Functional_Net_SFTPTestCase extends PhpseclibFunctionalTestCase
|
abstract class SFTPTestCase extends PhpseclibFunctionalTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var SFTP
|
* @var SFTP
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use phpseclib3\Net\SFTP;
|
namespace phpseclib3\Tests\Functional\Net;
|
||||||
|
|
||||||
class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
|
use phpseclib3\Net\SFTP;
|
||||||
|
use phpseclib3\Tests\PhpseclibFunctionalTestCase;
|
||||||
|
|
||||||
|
class SFTPUserStoryTest extends PhpseclibFunctionalTestCase
|
||||||
{
|
{
|
||||||
protected static $scratchDir;
|
protected static $scratchDir;
|
||||||
protected static $exampleData;
|
protected static $exampleData;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Functional\Net;
|
||||||
|
|
||||||
use phpseclib3\Exception\UnableToConnectException;
|
use phpseclib3\Exception\UnableToConnectException;
|
||||||
use phpseclib3\Net\SFTP;
|
use phpseclib3\Net\SFTP;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Functional\Net;
|
||||||
|
|
||||||
use phpseclib3\Net\SSH2;
|
use phpseclib3\Net\SSH2;
|
||||||
use phpseclib3\System\SSH\Agent;
|
use phpseclib3\System\SSH\Agent;
|
||||||
|
use phpseclib3\Tests\PhpseclibFunctionalTestCase;
|
||||||
|
|
||||||
class Functional_Net_SSH2AgentTest extends PhpseclibFunctionalTestCase
|
class SSH2AgentTest extends PhpseclibFunctionalTestCase
|
||||||
{
|
{
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use phpseclib3\Net\SSH2;
|
namespace phpseclib3\Tests\Functional\Net;
|
||||||
|
|
||||||
class Functional_Net_SSH2Test extends PhpseclibFunctionalTestCase
|
use phpseclib3\Net\SSH2;
|
||||||
|
use phpseclib3\Tests\PhpseclibFunctionalTestCase;
|
||||||
|
|
||||||
|
class SSH2Test extends PhpseclibFunctionalTestCase
|
||||||
{
|
{
|
||||||
public function testConstructor()
|
public function testConstructor()
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests;
|
||||||
|
|
||||||
abstract class PhpseclibFunctionalTestCase extends PhpseclibTestCase
|
abstract class PhpseclibFunctionalTestCase extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,11 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
abstract class PhpseclibTestCase extends PHPUnit\Framework\TestCase
|
namespace phpseclib3\Tests;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
abstract class PhpseclibTestCase extends TestCase
|
||||||
{
|
{
|
||||||
protected $tempFilesToUnlinkOnTearDown = [];
|
protected $tempFilesToUnlinkOnTearDown = [];
|
||||||
|
|
||||||
@ -105,7 +109,7 @@ abstract class PhpseclibTestCase extends PHPUnit\Framework\TestCase
|
|||||||
|
|
||||||
protected static function getVar($obj, $var)
|
protected static function getVar($obj, $var)
|
||||||
{
|
{
|
||||||
$reflection = new ReflectionClass(get_class($obj));
|
$reflection = new \ReflectionClass(get_class($obj));
|
||||||
$prop = $reflection->getProperty($var);
|
$prop = $reflection->getProperty($var);
|
||||||
$prop->setAccessible(true);
|
$prop->setAccessible(true);
|
||||||
return $prop->getValue($obj);
|
return $prop->getValue($obj);
|
||||||
@ -113,7 +117,7 @@ abstract class PhpseclibTestCase extends PHPUnit\Framework\TestCase
|
|||||||
|
|
||||||
public static function callFunc($obj, $func, $params = [])
|
public static function callFunc($obj, $func, $params = [])
|
||||||
{
|
{
|
||||||
$reflection = new ReflectionClass(get_class($obj));
|
$reflection = new \ReflectionClass(get_class($obj));
|
||||||
$method = $reflection->getMethod($func);
|
$method = $reflection->getMethod($func);
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
return $method->invokeArgs($obj, $params);
|
return $method->invokeArgs($obj, $params);
|
||||||
|
@ -6,8 +6,9 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt\AES;
|
||||||
|
|
||||||
class Unit_Crypt_AES_EvalTest extends Unit_Crypt_AES_TestCase
|
class EvalTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
|
@ -6,8 +6,9 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt\AES;
|
||||||
|
|
||||||
class Unit_Crypt_AES_McryptTest extends Unit_Crypt_AES_TestCase
|
class McryptTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
|
@ -6,8 +6,9 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt\AES;
|
||||||
|
|
||||||
class Unit_Crypt_AES_OpenSSLTest extends Unit_Crypt_AES_TestCase
|
class OpenSSLTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
|
@ -6,8 +6,9 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt\AES;
|
||||||
|
|
||||||
class Unit_Crypt_AES_PurePHPTest extends Unit_Crypt_AES_TestCase
|
class PurePHPTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
|
@ -6,12 +6,15 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt\AES;
|
||||||
|
|
||||||
use phpseclib3\Crypt\AES;
|
use phpseclib3\Crypt\AES;
|
||||||
use phpseclib3\Crypt\Rijndael;
|
use phpseclib3\Crypt\Rijndael;
|
||||||
use phpseclib3\Exception\InconsistentSetupException;
|
use phpseclib3\Exception\InconsistentSetupException;
|
||||||
use phpseclib3\Exception\InsufficientSetupException;
|
use phpseclib3\Exception\InsufficientSetupException;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase
|
abstract class TestCase extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
protected $engine;
|
protected $engine;
|
||||||
|
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt;
|
||||||
|
|
||||||
use phpseclib3\Crypt\Blowfish;
|
use phpseclib3\Crypt\Blowfish;
|
||||||
use phpseclib3\Crypt\Random;
|
use phpseclib3\Crypt\Random;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Unit_Crypt_BlowfishTest extends PhpseclibTestCase
|
class BlowfishTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function engineVectors()
|
public function engineVectors()
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use phpseclib3\Crypt\ChaCha20;
|
namespace phpseclib3\Tests\Unit\Crypt;
|
||||||
|
|
||||||
class Unit_Crypt_ChaCha20Test extends PhpseclibTestCase
|
use phpseclib3\Crypt\ChaCha20;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
|
class ChaCha20Test extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
// see https://tools.ietf.org/html/rfc8439#section-2.3.2
|
// see https://tools.ietf.org/html/rfc8439#section-2.3.2
|
||||||
public function test232()
|
public function test232()
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt;
|
||||||
|
|
||||||
use phpseclib3\Crypt\AES;
|
use phpseclib3\Crypt\AES;
|
||||||
use phpseclib3\Crypt\DH;
|
use phpseclib3\Crypt\DH;
|
||||||
use phpseclib3\Crypt\DH\Parameters;
|
use phpseclib3\Crypt\DH\Parameters;
|
||||||
@ -13,8 +15,9 @@ use phpseclib3\Crypt\DH\PrivateKey;
|
|||||||
use phpseclib3\Crypt\DH\PublicKey;
|
use phpseclib3\Crypt\DH\PublicKey;
|
||||||
use phpseclib3\Crypt\EC;
|
use phpseclib3\Crypt\EC;
|
||||||
use phpseclib3\Math\BigInteger;
|
use phpseclib3\Math\BigInteger;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Unit_Crypt_DHTest extends PhpseclibTestCase
|
class DHTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testParametersWithString()
|
public function testParametersWithString()
|
||||||
{
|
{
|
||||||
|
@ -6,15 +6,18 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt\DSA;
|
||||||
|
|
||||||
use phpseclib3\Crypt\DSA;
|
use phpseclib3\Crypt\DSA;
|
||||||
use phpseclib3\Crypt\DSA\Parameters;
|
use phpseclib3\Crypt\DSA\Parameters;
|
||||||
use phpseclib3\Crypt\DSA\PrivateKey;
|
use phpseclib3\Crypt\DSA\PrivateKey;
|
||||||
use phpseclib3\Crypt\DSA\PublicKey;
|
use phpseclib3\Crypt\DSA\PublicKey;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires PHP 7.0
|
* @requires PHP 7.0
|
||||||
*/
|
*/
|
||||||
class Unit_Crypt_DSA_CreateKeyTestDSA extends PhpseclibTestCase
|
class CreateKeyTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testCreateParameters()
|
public function testCreateParameters()
|
||||||
{
|
{
|
||||||
@ -24,8 +27,8 @@ class Unit_Crypt_DSA_CreateKeyTestDSA extends PhpseclibTestCase
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$dsa = DSA::createParameters(100, 100);
|
$dsa = DSA::createParameters(100, 100);
|
||||||
} catch (Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf(Exception::class, $e);
|
$this->assertInstanceOf(\Exception::class, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dsa = DSA::createParameters(512, 160);
|
$dsa = DSA::createParameters(512, 160);
|
||||||
|
@ -6,13 +6,16 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt\DSA;
|
||||||
|
|
||||||
use phpseclib3\Crypt\DSA\Parameters;
|
use phpseclib3\Crypt\DSA\Parameters;
|
||||||
use phpseclib3\Crypt\DSA\PrivateKey;
|
use phpseclib3\Crypt\DSA\PrivateKey;
|
||||||
use phpseclib3\Crypt\DSA\PublicKey;
|
use phpseclib3\Crypt\DSA\PublicKey;
|
||||||
use phpseclib3\Crypt\PublicKeyLoader;
|
use phpseclib3\Crypt\PublicKeyLoader;
|
||||||
use phpseclib3\Exception\NoKeyLoadedException;
|
use phpseclib3\Exception\NoKeyLoadedException;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Unit_Crypt_DSA_LoadDSAKeyTest extends PhpseclibTestCase
|
class LoadDSAKeyTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testBadKey()
|
public function testBadKey()
|
||||||
{
|
{
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt\DSA;
|
||||||
|
|
||||||
use phpseclib3\Crypt\DSA;
|
use phpseclib3\Crypt\DSA;
|
||||||
use phpseclib3\Crypt\PublicKeyLoader;
|
use phpseclib3\Crypt\PublicKeyLoader;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Unit_Crypt_DSA_SignatureTest extends PhpseclibTestCase
|
class SignatureTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testPKCSSignature()
|
public function testPKCSSignature()
|
||||||
{
|
{
|
||||||
|
@ -6,46 +6,15 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use phpseclib3\Common\Functions\Strings;
|
namespace phpseclib3\Tests\Unit\Crypt\EC;
|
||||||
|
|
||||||
use phpseclib3\Crypt\EC;
|
use phpseclib3\Crypt\EC;
|
||||||
use phpseclib3\Crypt\EC\Curves\Ed448;
|
use phpseclib3\Crypt\EC\Curves\Ed448;
|
||||||
use phpseclib3\Crypt\PublicKeyLoader;
|
use phpseclib3\Crypt\PublicKeyLoader;
|
||||||
use phpseclib3\File\ASN1;
|
use phpseclib3\File\ASN1;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Ed448PublicKey
|
class CurveTest extends PhpseclibTestCase
|
||||||
{
|
|
||||||
use phpseclib3\Crypt\EC\Formats\Keys\Common;
|
|
||||||
|
|
||||||
public static function load($key, $password = '')
|
|
||||||
{
|
|
||||||
if (!Strings::is_stringable($key)) {
|
|
||||||
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
|
||||||
}
|
|
||||||
|
|
||||||
$components = ['curve' => new Ed448()];
|
|
||||||
$components['QA'] = self::extractPoint($key, $components['curve']);
|
|
||||||
|
|
||||||
return $components;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Ed448PrivateKey
|
|
||||||
{
|
|
||||||
public static function load($key, $password = '')
|
|
||||||
{
|
|
||||||
if (!Strings::is_stringable($key)) {
|
|
||||||
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
|
||||||
}
|
|
||||||
|
|
||||||
$components = ['curve' => new Ed448()];
|
|
||||||
$components['dA'] = $components['curve']->extractSecret($key);
|
|
||||||
$components['QA'] = $components['curve']->multiplyPoint($components['curve']->getBasePoint(), $components['dA']);
|
|
||||||
|
|
||||||
return $components;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Unit_Crypt_EC_CurveTest extends PhpseclibTestCase
|
|
||||||
{
|
{
|
||||||
public function curves()
|
public function curves()
|
||||||
{
|
{
|
||||||
@ -88,7 +57,7 @@ class Unit_Crypt_EC_CurveTest extends PhpseclibTestCase
|
|||||||
|
|
||||||
public function curvesWithOIDs()
|
public function curvesWithOIDs()
|
||||||
{
|
{
|
||||||
$class = new ReflectionClass('phpseclib3\Crypt\EC\Formats\Keys\PKCS8');
|
$class = new \ReflectionClass('phpseclib3\Crypt\EC\Formats\Keys\PKCS8');
|
||||||
|
|
||||||
$initialize = $class->getMethod('initialize_static_variables');
|
$initialize = $class->getMethod('initialize_static_variables');
|
||||||
$initialize->setAccessible(true);
|
$initialize->setAccessible(true);
|
||||||
@ -231,8 +200,8 @@ class Unit_Crypt_EC_CurveTest extends PhpseclibTestCase
|
|||||||
*/
|
*/
|
||||||
public function testEd448TestVectors()
|
public function testEd448TestVectors()
|
||||||
{
|
{
|
||||||
EC::addFileFormat('Ed448PublicKey');
|
EC::addFileFormat(Ed448PublicKey::class);
|
||||||
EC::addFileFormat('Ed448PrivateKey');
|
EC::addFileFormat(Ed448PrivateKey::class);
|
||||||
|
|
||||||
$private = pack('H*', '6c82a562cb808d10d632be89c8513ebf6c929f34ddfa8c9f63c9960ef6e348a3528c8a3fcc2f044e39a3fc5b94492f8f032e7549a20098f95b');
|
$private = pack('H*', '6c82a562cb808d10d632be89c8513ebf6c929f34ddfa8c9f63c9960ef6e348a3528c8a3fcc2f044e39a3fc5b94492f8f032e7549a20098f95b');
|
||||||
$public = pack('H*', '5fd7449b59b461fd2ce787ec616ad46a1da1342485a70e1f8a0ea75d80e96778edf124769b46c7061bd6783df1e50f6cd1fa1abeafe8256180');
|
$public = pack('H*', '5fd7449b59b461fd2ce787ec616ad46a1da1342485a70e1f8a0ea75d80e96778edf124769b46c7061bd6783df1e50f6cd1fa1abeafe8256180');
|
||||||
|
22
tests/Unit/Crypt/EC/Ed448PrivateKey.php
Normal file
22
tests/Unit/Crypt/EC/Ed448PrivateKey.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt\EC;
|
||||||
|
|
||||||
|
use phpseclib3\Common\Functions\Strings;
|
||||||
|
use phpseclib3\Crypt\EC\Curves\Ed448;
|
||||||
|
|
||||||
|
class Ed448PrivateKey
|
||||||
|
{
|
||||||
|
public static function load($key, $password = '')
|
||||||
|
{
|
||||||
|
if (!Strings::is_stringable($key)) {
|
||||||
|
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
||||||
|
}
|
||||||
|
|
||||||
|
$components = ['curve' => new Ed448()];
|
||||||
|
$components['dA'] = $components['curve']->extractSecret($key);
|
||||||
|
$components['QA'] = $components['curve']->multiplyPoint($components['curve']->getBasePoint(), $components['dA']);
|
||||||
|
|
||||||
|
return $components;
|
||||||
|
}
|
||||||
|
}
|
24
tests/Unit/Crypt/EC/Ed448PublicKey.php
Normal file
24
tests/Unit/Crypt/EC/Ed448PublicKey.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt\EC;
|
||||||
|
|
||||||
|
use phpseclib3\Common\Functions\Strings;
|
||||||
|
use phpseclib3\Crypt\EC\Curves\Ed448;
|
||||||
|
use phpseclib3\Crypt\EC\Formats\Keys\Common;
|
||||||
|
|
||||||
|
class Ed448PublicKey
|
||||||
|
{
|
||||||
|
use Common;
|
||||||
|
|
||||||
|
public static function load($key, $password = '')
|
||||||
|
{
|
||||||
|
if (!Strings::is_stringable($key)) {
|
||||||
|
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
||||||
|
}
|
||||||
|
|
||||||
|
$components = ['curve' => new Ed448()];
|
||||||
|
$components['QA'] = self::extractPoint($key, $components['curve']);
|
||||||
|
|
||||||
|
return $components;
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,8 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt\EC;
|
||||||
|
|
||||||
use phpseclib3\Crypt\EC;
|
use phpseclib3\Crypt\EC;
|
||||||
use phpseclib3\Crypt\EC\Formats\Keys\OpenSSH;
|
use phpseclib3\Crypt\EC\Formats\Keys\OpenSSH;
|
||||||
use phpseclib3\Crypt\EC\Formats\Keys\PKCS1;
|
use phpseclib3\Crypt\EC\Formats\Keys\PKCS1;
|
||||||
@ -14,8 +16,9 @@ use phpseclib3\Crypt\EC\Formats\Keys\PuTTY;
|
|||||||
use phpseclib3\Crypt\EC\Formats\Keys\XML;
|
use phpseclib3\Crypt\EC\Formats\Keys\XML;
|
||||||
use phpseclib3\Crypt\EC\PrivateKey;
|
use phpseclib3\Crypt\EC\PrivateKey;
|
||||||
use phpseclib3\Crypt\PublicKeyLoader;
|
use phpseclib3\Crypt\PublicKeyLoader;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Unit_Crypt_EC_KeyTest extends PhpseclibTestCase
|
class KeyTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testBinaryPKCS1PrivateParameters()
|
public function testBinaryPKCS1PrivateParameters()
|
||||||
{
|
{
|
||||||
@ -458,7 +461,7 @@ pomV7r6gmoMYteGVABfgAAAAD3ZhZ3JhbnRAdmFncmFudAECAwQFBg==
|
|||||||
|
|
||||||
XML::enableRFC4050Syntax();
|
XML::enableRFC4050Syntax();
|
||||||
|
|
||||||
$dom = new DOMDocument();
|
$dom = new \DOMDocument();
|
||||||
$dom->preserveWhiteSpace = false;
|
$dom->preserveWhiteSpace = false;
|
||||||
$dom->loadXML($orig);
|
$dom->loadXML($orig);
|
||||||
$expected = $dom->C14N();
|
$expected = $dom->C14N();
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use phpseclib3\Crypt\AES;
|
namespace phpseclib3\Tests\Unit\Crypt;
|
||||||
|
|
||||||
class Unit_Crypt_GCMTest extends PhpseclibTestCase
|
use phpseclib3\Crypt\AES;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
|
class GCMTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Produces all combinations of test values.
|
* Produces all combinations of test values.
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt;
|
||||||
|
|
||||||
use phpseclib3\Crypt\Hash;
|
use phpseclib3\Crypt\Hash;
|
||||||
use phpseclib3\Exception\UnsupportedAlgorithmException;
|
use phpseclib3\Exception\UnsupportedAlgorithmException;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Unit_Crypt_HashTest extends PhpseclibTestCase
|
class HashTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
protected function assertHashesTo($hash, $message, $expected)
|
protected function assertHashesTo($hash, $message, $expected)
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use phpseclib3\Crypt\RC2;
|
namespace phpseclib3\Tests\Unit\Crypt;
|
||||||
|
|
||||||
class Unit_Crypt_RC2Test extends PhpseclibTestCase
|
use phpseclib3\Crypt\RC2;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
|
class RC2Test extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public $engines = [
|
public $engines = [
|
||||||
'PHP',
|
'PHP',
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt;
|
||||||
|
|
||||||
use phpseclib3\Crypt\Random;
|
use phpseclib3\Crypt\Random;
|
||||||
use phpseclib3\Crypt\RC4;
|
use phpseclib3\Crypt\RC4;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Unit_Crypt_RC4Test extends PhpseclibTestCase
|
class RC4Test extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function engineVectors()
|
public function engineVectors()
|
||||||
{
|
{
|
||||||
|
@ -6,13 +6,16 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt\RSA;
|
||||||
|
|
||||||
use phpseclib3\Crypt\RSA;
|
use phpseclib3\Crypt\RSA;
|
||||||
use phpseclib3\Crypt\RSA\Formats\Keys\PKCS1;
|
use phpseclib3\Crypt\RSA\Formats\Keys\PKCS1;
|
||||||
use phpseclib3\Crypt\RSA\Formats\Keys\PKCS8;
|
use phpseclib3\Crypt\RSA\Formats\Keys\PKCS8;
|
||||||
use phpseclib3\Crypt\RSA\PrivateKey;
|
use phpseclib3\Crypt\RSA\PrivateKey;
|
||||||
use phpseclib3\Crypt\RSA\PublicKey;
|
use phpseclib3\Crypt\RSA\PublicKey;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Unit_Crypt_RSA_CreateKeyTestRSA extends PhpseclibTestCase
|
class CreateKeyTestRSA extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testCreateKey()
|
public function testCreateKey()
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt\RSA;
|
||||||
|
|
||||||
use phpseclib3\Crypt\PublicKeyLoader;
|
use phpseclib3\Crypt\PublicKeyLoader;
|
||||||
use phpseclib3\Crypt\RSA;
|
use phpseclib3\Crypt\RSA;
|
||||||
use phpseclib3\Crypt\RSA\Formats\Keys\OpenSSH;
|
use phpseclib3\Crypt\RSA\Formats\Keys\OpenSSH;
|
||||||
@ -18,8 +20,9 @@ use phpseclib3\Crypt\RSA\PublicKey;
|
|||||||
use phpseclib3\Exception\NoKeyLoadedException;
|
use phpseclib3\Exception\NoKeyLoadedException;
|
||||||
use phpseclib3\Exception\UnsupportedFormatException;
|
use phpseclib3\Exception\UnsupportedFormatException;
|
||||||
use phpseclib3\Math\BigInteger;
|
use phpseclib3\Math\BigInteger;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Unit_Crypt_RSA_LoadKeyTest extends PhpseclibTestCase
|
class LoadKeyTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
|
@ -6,12 +6,15 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Crypt\RSA;
|
||||||
|
|
||||||
use phpseclib3\Crypt\PublicKeyLoader;
|
use phpseclib3\Crypt\PublicKeyLoader;
|
||||||
use phpseclib3\Crypt\RSA;
|
use phpseclib3\Crypt\RSA;
|
||||||
use phpseclib3\Crypt\RSA\Formats\Keys\PKCS8;
|
use phpseclib3\Crypt\RSA\Formats\Keys\PKCS8;
|
||||||
use phpseclib3\Math\BigInteger;
|
use phpseclib3\Math\BigInteger;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Unit_Crypt_RSA_ModeTest extends PhpseclibTestCase
|
class ModeTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testEncryptionModeNone()
|
public function testEncryptionModeNone()
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use phpseclib3\Crypt\Random;
|
namespace phpseclib3\Tests\Unit\Crypt;
|
||||||
|
|
||||||
class Unit_Crypt_RandomTest extends PhpseclibTestCase
|
use phpseclib3\Crypt\Random;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
|
class RandomTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function stringLengthData()
|
public function stringLengthData()
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use phpseclib3\Crypt\Salsa20;
|
namespace phpseclib3\Tests\Unit\Crypt;
|
||||||
|
|
||||||
class Unit_Crypt_Salsa20Test extends PhpseclibTestCase
|
use phpseclib3\Crypt\Salsa20;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
|
class Salsa20Test extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function engineVectors()
|
public function engineVectors()
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use phpseclib3\Crypt\TripleDES;
|
namespace phpseclib3\Tests\Unit\Crypt;
|
||||||
|
|
||||||
class Unit_Crypt_TripleDESTest extends PhpseclibTestCase
|
use phpseclib3\Crypt\TripleDES;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
|
class TripleDESTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public $engines = [
|
public $engines = [
|
||||||
'PHP',
|
'PHP',
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use phpseclib3\Crypt\Twofish;
|
namespace phpseclib3\Tests\Unit\Crypt;
|
||||||
|
|
||||||
class Unit_Crypt_TwofishTest extends PhpseclibTestCase
|
use phpseclib3\Crypt\Twofish;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
|
class TwofishTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testVectors()
|
public function testVectors()
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use phpseclib3\File\ANSI;
|
namespace phpseclib3\Tests\Unit\File;
|
||||||
|
|
||||||
class Unit_File_ANSITest extends PhpseclibTestCase
|
use phpseclib3\File\ANSI;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
|
class ANSITest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testCase1()
|
public function testCase1()
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use phpseclib3\File\ASN1;
|
namespace phpseclib3\Tests\Unit\File;
|
||||||
|
|
||||||
class Unit_File_ASN1Test extends PhpseclibTestCase
|
use phpseclib3\File\ASN1;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
|
class ASN1Test extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* on older versions of \phpseclib3\File\ASN1 this would yield a PHP Warning
|
* on older versions of \phpseclib3\File\ASN1 this would yield a PHP Warning
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use phpseclib3\File\X509;
|
namespace phpseclib3\Tests\Unit\File\X509;
|
||||||
|
|
||||||
class Unit_File_X509_CRLTest extends PhpseclibTestCase
|
use phpseclib3\File\X509;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
|
class CRLTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testLoadCRL()
|
public function testLoadCRL()
|
||||||
{
|
{
|
||||||
|
@ -6,11 +6,14 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\File\X509;
|
||||||
|
|
||||||
use phpseclib3\Crypt\PublicKeyLoader;
|
use phpseclib3\Crypt\PublicKeyLoader;
|
||||||
use phpseclib3\Crypt\RSA;
|
use phpseclib3\Crypt\RSA;
|
||||||
use phpseclib3\File\X509;
|
use phpseclib3\File\X509;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Unit_File_X509_CSRTest extends PhpseclibTestCase
|
class CSRTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testLoadCSR()
|
public function testLoadCSR()
|
||||||
{
|
{
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\File\X509;
|
||||||
|
|
||||||
use phpseclib3\Crypt\RSA;
|
use phpseclib3\Crypt\RSA;
|
||||||
use phpseclib3\File\X509;
|
use phpseclib3\File\X509;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Unit_File_X509_SPKACTest extends PhpseclibTestCase
|
class SPKACTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testLoadSPKAC()
|
public function testLoadSPKAC()
|
||||||
{
|
{
|
||||||
|
@ -6,12 +6,15 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\File\X509;
|
||||||
|
|
||||||
use phpseclib3\Crypt\EC;
|
use phpseclib3\Crypt\EC;
|
||||||
use phpseclib3\Crypt\RSA;
|
use phpseclib3\Crypt\RSA;
|
||||||
use phpseclib3\File\ASN1;
|
use phpseclib3\File\ASN1;
|
||||||
use phpseclib3\File\X509;
|
use phpseclib3\File\X509;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Unit_File_X509_X509ExtensionTest extends PhpseclibTestCase
|
class X509ExtensionTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testCustomExtension()
|
public function testCustomExtension()
|
||||||
{
|
{
|
||||||
|
@ -6,13 +6,16 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\File\X509;
|
||||||
|
|
||||||
use phpseclib3\Crypt\PublicKeyLoader;
|
use phpseclib3\Crypt\PublicKeyLoader;
|
||||||
use phpseclib3\Crypt\RSA;
|
use phpseclib3\Crypt\RSA;
|
||||||
use phpseclib3\File\ASN1;
|
use phpseclib3\File\ASN1;
|
||||||
use phpseclib3\File\ASN1\Element;
|
use phpseclib3\File\ASN1\Element;
|
||||||
use phpseclib3\File\X509;
|
use phpseclib3\File\X509;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Unit_File_X509_X509Test extends PhpseclibTestCase
|
class X509Test extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testExtensionMapping()
|
public function testExtensionMapping()
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,11 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Math\BigInteger;
|
||||||
|
|
||||||
use phpseclib3\Math\BigInteger\Engines\BCMath;
|
use phpseclib3\Math\BigInteger\Engines\BCMath;
|
||||||
|
|
||||||
class Unit_Math_BigInteger_BCMathTest extends Unit_Math_BigInteger_TestCase
|
class BCMathTest extends TestCase
|
||||||
{
|
{
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,11 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Math\BigInteger;
|
||||||
|
|
||||||
use phpseclib3\Math\BigInteger;
|
use phpseclib3\Math\BigInteger;
|
||||||
|
|
||||||
class Unit_Math_BigInteger_DefaultTest extends Unit_Math_BigInteger_TestCase
|
class DefaultTest extends TestCase
|
||||||
{
|
{
|
||||||
public function getInstance($x = 0, $base = 10)
|
public function getInstance($x = 0, $base = 10)
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,11 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Math\BigInteger;
|
||||||
|
|
||||||
use phpseclib3\Math\BigInteger\Engines\GMP;
|
use phpseclib3\Math\BigInteger\Engines\GMP;
|
||||||
|
|
||||||
class Unit_Math_BigInteger_GMPTest extends Unit_Math_BigInteger_TestCase
|
class GMPTest extends TestCase
|
||||||
{
|
{
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,11 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Math\BigInteger;
|
||||||
|
|
||||||
use phpseclib3\Math\BigInteger\Engines\PHP32;
|
use phpseclib3\Math\BigInteger\Engines\PHP32;
|
||||||
|
|
||||||
class Unit_Math_BigInteger_PHP32Test extends Unit_Math_BigInteger_TestCase
|
class PHP32Test extends TestCase
|
||||||
{
|
{
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Math\BigInteger;
|
||||||
|
|
||||||
|
use phpseclib3\Exception\BadConfigurationException;
|
||||||
use phpseclib3\Math\BigInteger\Engines\PHP64;
|
use phpseclib3\Math\BigInteger\Engines\PHP64;
|
||||||
|
|
||||||
class Unit_Math_BigInteger_PHP64OpenSSLTest extends Unit_Math_BigInteger_TestCase
|
class PHP64OpenSSLTest extends TestCase
|
||||||
{
|
{
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,11 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Math\BigInteger;
|
||||||
|
|
||||||
use phpseclib3\Math\BigInteger\Engines\PHP64;
|
use phpseclib3\Math\BigInteger\Engines\PHP64;
|
||||||
|
|
||||||
class Unit_Math_BigInteger_PHP64Test extends Unit_Math_BigInteger_TestCase
|
class PHP64Test extends TestCase
|
||||||
{
|
{
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,11 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
|
namespace phpseclib3\Tests\Unit\Math\BigInteger;
|
||||||
|
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
|
abstract class TestCase extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testConstructorBase2()
|
public function testConstructorBase2()
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace phpseclib3\Tests\Unit\Math;
|
||||||
|
|
||||||
use phpseclib3\Math\BigInteger;
|
use phpseclib3\Math\BigInteger;
|
||||||
use phpseclib3\Math\BigInteger\Engines\BCMath;
|
use phpseclib3\Math\BigInteger\Engines\BCMath;
|
||||||
use phpseclib3\Math\BigInteger\Engines\GMP;
|
use phpseclib3\Math\BigInteger\Engines\GMP;
|
||||||
use phpseclib3\Math\BigInteger\Engines\PHP32;
|
use phpseclib3\Math\BigInteger\Engines\PHP32;
|
||||||
use phpseclib3\Math\BigInteger\Engines\PHP64;
|
use phpseclib3\Math\BigInteger\Engines\PHP64;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
class Unit_Math_BigIntegerTest extends PhpseclibTestCase
|
class BigIntegerTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $className
|
* @param string $className
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use phpseclib3\Net\SFTP\Stream;
|
namespace phpseclib3\Tests\Unit\Net;
|
||||||
|
|
||||||
class Unit_Net_SFTPStreamUnitTest extends PhpseclibTestCase
|
use phpseclib3\Net\SFTP\Stream;
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
|
class SFTPStreamUnitTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function testRegisterWithoutArgument()
|
public function testRegisterWithoutArgument()
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,11 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Unit_Net_SSH2UnitTest extends PhpseclibTestCase
|
namespace phpseclib3\Tests\Unit\Net;
|
||||||
|
|
||||||
|
use phpseclib3\Tests\PhpseclibTestCase;
|
||||||
|
|
||||||
|
class SSH2UnitTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function formatLogDataProvider()
|
public function formatLogDataProvider()
|
||||||
{
|
{
|
||||||
|
@ -10,11 +10,13 @@ date_default_timezone_set('UTC');
|
|||||||
|
|
||||||
$loader_path = __DIR__ . '/../vendor/autoload.php';
|
$loader_path = __DIR__ . '/../vendor/autoload.php';
|
||||||
if (!file_exists($loader_path)) {
|
if (!file_exists($loader_path)) {
|
||||||
echo "Dependencies must be installed using composer:\n\n";
|
exit(<<<EOF
|
||||||
echo "php composer.phar install\n\n";
|
Dependencies must be installed using composer:
|
||||||
echo "See http://getcomposer.org for help with installing composer\n";
|
php composer.phar install
|
||||||
exit(1);
|
See https://getcomposer.org for help with installing composer.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$loader = include $loader_path;
|
require $loader_path;
|
||||||
$loader->add('', __DIR__);
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user