diff --git a/phpseclib/Crypt/PublicKeyLoader.php b/phpseclib/Crypt/PublicKeyLoader.php index db4abf7c..c7c7e0af 100644 --- a/phpseclib/Crypt/PublicKeyLoader.php +++ b/phpseclib/Crypt/PublicKeyLoader.php @@ -15,8 +15,8 @@ namespace phpseclib3\Crypt; +use phpseclib3\Crypt\Common\AsymmetricKey; use phpseclib3\Exception\NoKeyLoadedException; -use phpseclib3\Crypt\Common\PrivateKey; use phpseclib3\File\X509; /** diff --git a/phpseclib/File/ASN1.php b/phpseclib/File/ASN1.php index 9d468ec1..cdc5b697 100644 --- a/phpseclib/File/ASN1.php +++ b/phpseclib/File/ASN1.php @@ -826,7 +826,7 @@ abstract class ASN1 * * "Special" mappings can be applied via $special. * - * @param string $source + * @param Element|string|array $source * @param array $mapping * @param array $special * @return string @@ -841,7 +841,7 @@ abstract class ASN1 /** * ASN.1 Encode (Helper function) * - * @param string $source + * @param Element|string|array $source * @param array $mapping * @param int $idx * @param array $special diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index 874bcb11..ba6a0481 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -3061,7 +3061,7 @@ class X509 -- http://tools.ietf.org/html/rfc5280#section-4.1.2.5 */ - if (strtolower($date) == 'lifetime') { + if (is_string($date) && strtolower($date) === 'lifetime') { $temp = '99991231235959Z'; $temp = chr(ASN1::TYPE_GENERALIZED_TIME) . ASN1::encodeLength(strlen($temp)) . $temp; $this->endDate = new Element($temp); diff --git a/tests/Unit/Crypt/DHTest.php b/tests/Unit/Crypt/DHTest.php index e6e15ba3..cf911b61 100644 --- a/tests/Unit/Crypt/DHTest.php +++ b/tests/Unit/Crypt/DHTest.php @@ -19,11 +19,11 @@ class Unit_Crypt_DHTest extends PhpseclibTestCase { $a = DH::createParameters('diffie-hellman-group1-sha1'); $a = str_replace("\r\n", "\n", trim($a)); - $b = '-----BEGIN DH PARAMETERS----- + $b = str_replace("\r\n", "\n", '-----BEGIN DH PARAMETERS----- MIGHAoGBAP//////////yQ/aoiFowjTExmKLgNwc0SkCTgiKZ8x0Agu+pjsTmyJR Sgh5jjQE3e+VGbPNOkMbMCsKbfJfFDdP4TVtbVHCReSFtXZiXn7G9ExC6aY37WsL /1y29Aa37e44a/taiZ+lrp8kEXxLH+ZJKGZR7OZTgf//////////AgEC ------END DH PARAMETERS-----'; +-----END DH PARAMETERS-----'); $this->assertSame($b, "$a"); } @@ -43,11 +43,11 @@ Sgh5jjQE3e+VGbPNOkMbMCsKbfJfFDdP4TVtbVHCReSFtXZiXn7G9ExC6aY37WsL $base = new BigInteger(2); $a = DH::createParameters($prime, $base); $a = str_replace("\r\n", "\n", trim($a)); - $b = '-----BEGIN DH PARAMETERS----- + $b = str_replace("\r\n", "\n", '-----BEGIN DH PARAMETERS----- MIGHAoGBAP//////////yQ/aoiFowjTExmKLgNwc0SkCTgiKZ8x0Agu+pjsTmyJR Sgh5jjQE3e+VGbPNOkMbMCsKbfJfFDdP4TVtbVHCReSFtXZiXn7G9ExC6aY37WsL /1y29Aa37e44a/taiZ+lrp8kEXxLH+ZJKGZR7OZTgf//////////AgEC ------END DH PARAMETERS-----'; +-----END DH PARAMETERS-----'); $this->assertSame($b, "$a"); }