Tests/ECDSA: make tests work on PHP 5.6 (by skipping some tests)

This commit is contained in:
terrafrost 2018-11-24 08:14:41 -06:00
parent 0398f7a815
commit 3c4fbe131f
2 changed files with 12 additions and 0 deletions

View File

@ -9,6 +9,7 @@
use phpseclib\Crypt\ECDSA; use phpseclib\Crypt\ECDSA;
use phpseclib\File\ASN1; use phpseclib\File\ASN1;
use phpseclib\Crypt\ECDSA\Curves\Ed448; use phpseclib\Crypt\ECDSA\Curves\Ed448;
use phpseclib\Math\BigInteger;
class Ed448PublicKey class Ed448PublicKey
{ {
@ -106,6 +107,7 @@ class Unit_Crypt_ECDSA_CurveTest extends PhpseclibTestCase
* Verify the correctness of the point addition / doubling / multiplication algorithms * Verify the correctness of the point addition / doubling / multiplication algorithms
* *
* @dataProvider curves * @dataProvider curves
* @requires PHP 7.0
*/ */
public function testKeyGeneration($name) public function testKeyGeneration($name)
{ {
@ -145,6 +147,7 @@ class Unit_Crypt_ECDSA_CurveTest extends PhpseclibTestCase
* Sign with internal engine, verify with best engine * Sign with internal engine, verify with best engine
* *
* @dataProvider curves * @dataProvider curves
* @requires PHP 7.0
*/ */
public function testInternalSign($name) public function testInternalSign($name)
{ {
@ -175,6 +178,7 @@ class Unit_Crypt_ECDSA_CurveTest extends PhpseclibTestCase
* Sign with best engine, verify with internal engine * Sign with best engine, verify with internal engine
* *
* @dataProvider curves * @dataProvider curves
* @requires PHP 7.0
*/ */
public function testInternalVerify($name) public function testInternalVerify($name)
{ {

View File

@ -9,10 +9,17 @@ use phpseclib\Crypt\RSA;
use phpseclib\Crypt\RSA\Keys\PKCS1; use phpseclib\Crypt\RSA\Keys\PKCS1;
use phpseclib\Crypt\RSA\Keys\PKCS8; use phpseclib\Crypt\RSA\Keys\PKCS8;
use phpseclib\Crypt\RSA\Keys\PuTTY; use phpseclib\Crypt\RSA\Keys\PuTTY;
use phpseclib\Crypt\RSA\Keys\OpenSSH;
use phpseclib\Math\BigInteger; use phpseclib\Math\BigInteger;
class Unit_Crypt_RSA_LoadKeyTest extends PhpseclibTestCase class Unit_Crypt_RSA_LoadKeyTest extends PhpseclibTestCase
{ {
public static function setUpBeforeClass()
{
PuTTY::setComment('phpseclib-generated-key');
OpenSSH::setComment('phpseclib-generated-key');
}
public function testBadKey() public function testBadKey()
{ {
$rsa = new RSA(); $rsa = new RSA();
@ -393,6 +400,7 @@ Private-MAC: 03e2cb74e1d67652fbad063d2ed0478f31bdf256
$rsa->setPrivateKeyFormat('PuTTY'); $rsa->setPrivateKeyFormat('PuTTY');
$key2 = (string) $rsa; $key2 = (string) $rsa;
OpenSSH::setComment('ecdsa-key-20181105');
$this->assertSame($key, $key2); $this->assertSame($key, $key2);
} }