Merge branch '3.0'

This commit is contained in:
terrafrost 2021-01-12 11:12:51 -06:00
commit b3bff1eb2c
4 changed files with 8 additions and 8 deletions

View File

@ -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;
/**

View File

@ -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

View File

@ -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);

View File

@ -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");
}