1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-12-14 01:57:20 +01:00

Merge branch '3.0'

This commit is contained in:
terrafrost 2021-04-17 08:32:05 -05:00
commit 4b24efb042
5 changed files with 17 additions and 21 deletions

View File

@ -19,13 +19,7 @@ matrix:
- php: nightly - php: nightly
install: install:
- wget http://ftp.gnu.org/gnu/parallel/parallel-20170822.tar.bz2 - phpenv config-rm xdebug.ini
- tar -xvjf parallel*
- cd parallel-20170822
- ./configure
- make
- sudo make install
- cd ..
- eval `ssh-agent -s` - eval `ssh-agent -s`
- travis/setup-secure-shell.sh - travis/setup-secure-shell.sh
- sh -c "if [ '$TRAVIS_PHP_VERSION' != 'hhvm' -a `php -r "echo (int) version_compare(PHP_VERSION, '7.0', '<');"` = "1" ]; then travis/install-php-extensions.sh; fi" - sh -c "if [ '$TRAVIS_PHP_VERSION' != 'hhvm' -a `php -r "echo (int) version_compare(PHP_VERSION, '7.0', '<');"` = "1" ]; then travis/install-php-extensions.sh; fi"

View File

@ -14,7 +14,7 @@ use phpseclib3\Crypt\DSA\PrivateKey;
/** /**
* @requires PHP 7.0 * @requires PHP 7.0
*/ */
class Unit_Crypt_DSA_CreateKeyTest extends PhpseclibTestCase class Unit_Crypt_DSA_CreateKeyTestDSA extends PhpseclibTestCase
{ {
public function testCreateParameters() public function testCreateParameters()
{ {

View File

@ -11,6 +11,7 @@ use phpseclib3\File\ASN1;
use phpseclib3\Crypt\EC\Curves\Ed448; use phpseclib3\Crypt\EC\Curves\Ed448;
use phpseclib3\Math\BigInteger; use phpseclib3\Math\BigInteger;
use phpseclib3\Crypt\PublicKeyLoader; use phpseclib3\Crypt\PublicKeyLoader;
use phpseclib3\Common\Functions\Strings;
class Ed448PublicKey class Ed448PublicKey
{ {
@ -18,6 +19,10 @@ class Ed448PublicKey
public static function load($key, $password = '') 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 = ['curve' => new Ed448()];
$components['QA'] = self::extractPoint($key, $components['curve']); $components['QA'] = self::extractPoint($key, $components['curve']);
@ -29,6 +34,10 @@ class Ed448PrivateKey
{ {
public static function load($key, $password = '') 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 = ['curve' => new Ed448()];
$components['dA'] = $components['curve']->extractSecret($key); $components['dA'] = $components['curve']->extractSecret($key);
$components['QA'] = $components['curve']->multiplyPoint($components['curve']->getBasePoint(), $components['dA']); $components['QA'] = $components['curve']->multiplyPoint($components['curve']->getBasePoint(), $components['dA']);

View File

@ -11,7 +11,7 @@ use phpseclib3\Crypt\RSA\Formats\Keys\PKCS1;
use phpseclib3\Crypt\RSA\PrivateKey; use phpseclib3\Crypt\RSA\PrivateKey;
use phpseclib3\Crypt\RSA\PublicKey; use phpseclib3\Crypt\RSA\PublicKey;
class Unit_Crypt_RSA_CreateKeyTest extends PhpseclibTestCase class Unit_Crypt_RSA_CreateKeyTestRSA extends PhpseclibTestCase
{ {
public function testCreateKey() public function testCreateKey()
{ {

View File

@ -38,15 +38,8 @@ then
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Functional_Net_/class /g' find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Functional_Net_/class /g'
fi fi
if [ "$TRAVIS_PHP_VERSION" = 'hhvm' -o `php -r "echo (int) version_compare(PHP_VERSION, '7.0', '>=');"` = "1" ]
then
find tests -type f -name "*Test.php" | \
parallel --gnu --keep-order \
"echo '== {} =='; \"$PHPUNIT\" $PHPUNIT_ARGS {};"
else
"$PHPUNIT" \ "$PHPUNIT" \
$PHPUNIT_ARGS \ $PHPUNIT_ARGS \
--coverage-text \ --coverage-text \
--coverage-clover code_coverage/clover.xml \ --coverage-clover code_coverage/clover.xml \
--coverage-html code_coverage/ --coverage-html code_coverage/
fi