mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-27 03:42:40 +00:00
Merge branch '2.0'
This commit is contained in:
commit
1041131bb1
@ -1010,7 +1010,8 @@ class X509
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($names = $this->getExtension('id-ce-subjectAltName')) {
|
if ($names = $this->getExtension('id-ce-subjectAltName')) {
|
||||||
foreach ($names as $key => $value) {
|
foreach ($names as $name) {
|
||||||
|
foreach ($name as $key => $value) {
|
||||||
$value = str_replace(['.', '*'], ['\.', '[^.]*'], $value);
|
$value = str_replace(['.', '*'], ['\.', '[^.]*'], $value);
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
case 'dNSName':
|
case 'dNSName':
|
||||||
@ -1036,6 +1037,7 @@ class X509
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,4 +514,41 @@ F7xAUxmPUnNb2teatMf2Rmj0fs+d
|
|||||||
$this->assertEquals($cert['tbsCertificate']['validity']['notBefore']['utcTime'], 'Tue, 07 Jan 2014 00:00:00 +0000');
|
$this->assertEquals($cert['tbsCertificate']['validity']['notBefore']['utcTime'], 'Tue, 07 Jan 2014 00:00:00 +0000');
|
||||||
$this->assertEquals($cert['tbsCertificate']['validity']['notAfter']['utcTime'], 'Fri, 01 Apr 2016 07:00:00 +0000');
|
$this->assertEquals($cert['tbsCertificate']['validity']['notAfter']['utcTime'], 'Fri, 01 Apr 2016 07:00:00 +0000');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testValidateURL()
|
||||||
|
{
|
||||||
|
$test = '-----BEGIN CERTIFICATE-----
|
||||||
|
MIIEgDCCA2igAwIBAgIIPUwrl6kGL2QwDQYJKoZIhvcNAQELBQAwSTELMAkGA1UE
|
||||||
|
BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxJTAjBgNVBAMTHEdvb2dsZSBJbnRl
|
||||||
|
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UdIAQaMBgwDAYKKwYBBAHW
|
||||||
|
eQIFATAIBgZngQwBAgIwMAYDVR0fBCkwJzAloCOgIYYfaHR0cDovL3BraS5nb29n
|
||||||
|
bGUuY29tL0dJQUcyLmNybDANBgkqhkiG9w0BAQsFAAOCAQEAYJ+3TXE7etCjkLEE
|
||||||
|
/CN1BKGQVkYoCshZS3FkX8vUBP2orgvu9VGiLN9lb8+LMO+uNMVf+PLNsTP3lQ0q
|
||||||
|
oFzpU8xsv/87L7UcJoCge2ZR4kANgjmJ12TG7dCcPpbH2qu7Y8wnWubik5U68gsI
|
||||||
|
Qopg3hKg24p645o4exwsd/lOrsqh3vPorwZwU2Ekd2wKdxBID3puQA1jvWOBUcJI
|
||||||
|
Oe2K7+R2Cf6p8bYmm3OABuYkvO8D+u8gIdIO5cP+ic+SDOGVNJaT949YPes/S99R
|
||||||
|
9NQRFKcjEPl1UYh5bpPTKYzS7cTcDYG6xvbtG/XKEsK5U9UggzY6PCOPDDYpF+rq
|
||||||
|
C47x9g==
|
||||||
|
-----END CERTIFICATE-----';
|
||||||
|
|
||||||
|
$x509 = new X509();
|
||||||
|
|
||||||
|
$cert = $x509->loadX509($test);
|
||||||
|
|
||||||
|
$this->assertTrue($x509->validateURL('https://www.google.com'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user