mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-18 03:05:11 +00:00
Tests/X509: fix bad merge
This commit is contained in:
parent
538b48c346
commit
305dc1967a
@ -1080,7 +1080,7 @@ class X509
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->SubjectDirectoryAttributes = array(
|
$this->SubjectDirectoryAttributes = array(
|
||||||
'type' => FILE_ASN1_TYPE_SEQUENCE,
|
'type' => ASN1::TYPE_SEQUENCE,
|
||||||
'min' => 1,
|
'min' => 1,
|
||||||
'max' => -1,
|
'max' => -1,
|
||||||
'children' => $Attribute
|
'children' => $Attribute
|
||||||
@ -1254,7 +1254,7 @@ class X509
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->PostalAddress = array(
|
$this->PostalAddress = array(
|
||||||
'type' => FILE_ASN1_TYPE_SEQUENCE,
|
'type' => ASN1::TYPE_SEQUENCE,
|
||||||
'optional' => true,
|
'optional' => true,
|
||||||
'min' => 1,
|
'min' => 1,
|
||||||
'max' => -1,
|
'max' => -1,
|
||||||
@ -1833,7 +1833,7 @@ class X509
|
|||||||
|
|
||||||
$map = $this->_getMapping($type);
|
$map = $this->_getMapping($type);
|
||||||
if (!is_bool($map)) {
|
if (!is_bool($map)) {
|
||||||
$value = new File_ASN1_Element($asn1->encodeDER($value, $map));
|
$value = new Element($asn1->encodeDER($value, $map));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2128,7 +2128,7 @@ class X509
|
|||||||
// self-signed cert
|
// self-signed cert
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case !defined('FILE_X509_IGNORE_TYPE') && $this->currentCert['tbsCertificate']['issuer'] === $this->currentCert['tbsCertificate']['subject']:
|
case !defined('FILE_X509_IGNORE_TYPE') && $this->currentCert['tbsCertificate']['issuer'] === $this->currentCert['tbsCertificate']['subject']:
|
||||||
case defined('FILE_X509_IGNORE_TYPE') && $this->getIssuerDN(FILE_X509_DN_STRING) === $this->getDN(FILE_X509_DN_STRING):
|
case defined('FILE_X509_IGNORE_TYPE') && $this->getIssuerDN(self::DN_STRING) === $this->getDN(self::DN_STRING):
|
||||||
$authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier');
|
$authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier');
|
||||||
$subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier');
|
$subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier');
|
||||||
switch (true) {
|
switch (true) {
|
||||||
@ -2145,7 +2145,7 @@ class X509
|
|||||||
$ca = $this->CAs[$i];
|
$ca = $this->CAs[$i];
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case !defined('FILE_X509_IGNORE_TYPE') && $this->currentCert['tbsCertificate']['issuer'] === $ca['tbsCertificate']['subject']:
|
case !defined('FILE_X509_IGNORE_TYPE') && $this->currentCert['tbsCertificate']['issuer'] === $ca['tbsCertificate']['subject']:
|
||||||
case defined('FILE_X509_IGNORE_TYPE') && $this->getDN(FILE_X509_DN_STRING, $this->currentCert['tbsCertificate']['issuer']) === $this->getDN(FILE_X509_DN_STRING, $ca['tbsCertificate']['subject']):
|
case defined('FILE_X509_IGNORE_TYPE') && $this->getDN(self::DN_STRING, $this->currentCert['tbsCertificate']['issuer']) === $this->getDN(self::DN_STRING, $ca['tbsCertificate']['subject']):
|
||||||
$authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier');
|
$authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier');
|
||||||
$subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier', $ca);
|
$subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier', $ca);
|
||||||
switch (true) {
|
switch (true) {
|
||||||
@ -2191,7 +2191,7 @@ class X509
|
|||||||
$ca = $this->CAs[$i];
|
$ca = $this->CAs[$i];
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case !defined('FILE_X509_IGNORE_TYPE') && $this->currentCert['tbsCertList']['issuer'] === $ca['tbsCertificate']['subject']:
|
case !defined('FILE_X509_IGNORE_TYPE') && $this->currentCert['tbsCertList']['issuer'] === $ca['tbsCertificate']['subject']:
|
||||||
case defined('FILE_X509_IGNORE_TYPE') && $this->getDN(FILE_X509_DN_STRING, $this->currentCert['tbsCertList']['issuer']) === $this->getDN(FILE_X509_DN_STRING, $ca['tbsCertificate']['subject']):
|
case defined('FILE_X509_IGNORE_TYPE') && $this->getDN(self::DN_STRING, $this->currentCert['tbsCertList']['issuer']) === $this->getDN(self::DN_STRING, $ca['tbsCertificate']['subject']):
|
||||||
$authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier');
|
$authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier');
|
||||||
$subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier', $ca);
|
$subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier', $ca);
|
||||||
switch (true) {
|
switch (true) {
|
||||||
@ -2496,7 +2496,7 @@ class X509
|
|||||||
$asn1 = new ASN1();
|
$asn1 = new ASN1();
|
||||||
$asn1->loadOIDs($this->oids);
|
$asn1->loadOIDs($this->oids);
|
||||||
$filters = array();
|
$filters = array();
|
||||||
$filters['value'] = array('type' => FILE_ASN1_TYPE_UTF8_STRING);
|
$filters['value'] = array('type' => ASN1::TYPE_UTF8_STRING);
|
||||||
$asn1->loadFilters($filters);
|
$asn1->loadFilters($filters);
|
||||||
$this->_mapOutDNs($dn, 'rdnSequence', $asn1);
|
$this->_mapOutDNs($dn, 'rdnSequence', $asn1);
|
||||||
$dn = $dn['rdnSequence'];
|
$dn = $dn['rdnSequence'];
|
||||||
@ -2649,7 +2649,7 @@ class X509
|
|||||||
$asn1 = new ASN1();
|
$asn1 = new ASN1();
|
||||||
$asn1->loadOIDs($this->oids);
|
$asn1->loadOIDs($this->oids);
|
||||||
$filters = array();
|
$filters = array();
|
||||||
$filters['rdnSequence']['value'] = array('type' => FILE_ASN1_TYPE_UTF8_STRING);
|
$filters['rdnSequence']['value'] = array('type' => ASN1::TYPE_UTF8_STRING);
|
||||||
$asn1->loadFilters($filters);
|
$asn1->loadFilters($filters);
|
||||||
$this->_mapOutDNs($dn, 'rdnSequence', $asn1);
|
$this->_mapOutDNs($dn, 'rdnSequence', $asn1);
|
||||||
|
|
||||||
@ -2721,7 +2721,7 @@ class X509
|
|||||||
$start = false;
|
$start = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $format == FILE_X509_DN_OPENSSL ? $result : $output;
|
return $format == self::DN_OPENSSL ? $result : $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -226,7 +226,6 @@ aBtsWpliLSex/HHhtRW9AkBGcq67zKmEpJ9kXcYLEjJii3flFS+Ct/rNm+Hhm1l7
|
|||||||
$this->assertEquals($x509->getOID('zzz'), 'zzz');
|
$this->assertEquals($x509->getOID('zzz'), 'zzz');
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
public function testIPAddressSubjectAltNamesDecoding()
|
public function testIPAddressSubjectAltNamesDecoding()
|
||||||
{
|
{
|
||||||
$test = '-----BEGIN CERTIFICATE-----
|
$test = '-----BEGIN CERTIFICATE-----
|
||||||
@ -264,7 +263,7 @@ NDEuGt30Vl2de7G1glnhaceB6Q9KfH7p2gAwNP9JMTtx3PtEcA==
|
|||||||
|
|
||||||
public function testPostalAddress()
|
public function testPostalAddress()
|
||||||
{
|
{
|
||||||
$x509 = new File_X509();
|
$x509 = new X509();
|
||||||
$decoded = $x509->loadX509('-----BEGIN CERTIFICATE-----
|
$decoded = $x509->loadX509('-----BEGIN CERTIFICATE-----
|
||||||
MIIFzzCCBLegAwIBAgIDAfdlMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAlBM
|
MIIFzzCCBLegAwIBAgIDAfdlMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAlBM
|
||||||
MSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMSQwIgYD
|
MSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMSQwIgYD
|
||||||
@ -311,12 +310,12 @@ Mj93S
|
|||||||
$this->assertEquals($x509->getDNProp('id-at-postalAddress'), $expected);
|
$this->assertEquals($x509->getDNProp('id-at-postalAddress'), $expected);
|
||||||
|
|
||||||
$expected = "C=PL, O=Urz\xC4\x85d Miasta Gdyni/serialNumber=PESEL: 61060603118, CN=Jerzy Przeworski/postalAddress=" . '0F\X0C"AL. MARSZA\XC5\X82KA PI\XC5\X82SUDSKIEGO 52/54\X0C\X0D81-382 GDYNIA\X0C\X06POLSKA\X0C\X09POMORSKIE/givenName=Jerzy, SN=Przeworski';
|
$expected = "C=PL, O=Urz\xC4\x85d Miasta Gdyni/serialNumber=PESEL: 61060603118, CN=Jerzy Przeworski/postalAddress=" . '0F\X0C"AL. MARSZA\XC5\X82KA PI\XC5\X82SUDSKIEGO 52/54\X0C\X0D81-382 GDYNIA\X0C\X06POLSKA\X0C\X09POMORSKIE/givenName=Jerzy, SN=Przeworski';
|
||||||
$this->assertEquals($x509->getDN(FILE_X509_DN_STRING), $expected);
|
$this->assertEquals($x509->getDN(X509::DN_STRING), $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testStrictComparison()
|
public function testStrictComparison()
|
||||||
{
|
{
|
||||||
$x509 = new File_X509();
|
$x509 = new X509();
|
||||||
$x509->loadCA('-----BEGIN CERTIFICATE-----
|
$x509->loadCA('-----BEGIN CERTIFICATE-----
|
||||||
MIIEbDCCA1SgAwIBAgIUJguKOMpJm/yRMDlMOW04NV0YPXowDQYJKoZIhvcNAQEF
|
MIIEbDCCA1SgAwIBAgIUJguKOMpJm/yRMDlMOW04NV0YPXowDQYJKoZIhvcNAQEF
|
||||||
BQAwYTELMAkGA1UEBhMCUEwxNzA1BgNVBAoTLkNaaUMgQ2VudHJhc3QgU0EgdyBp
|
BQAwYTELMAkGA1UEBhMCUEwxNzA1BgNVBAoTLkNaaUMgQ2VudHJhc3QgU0EgdyBp
|
||||||
@ -389,7 +388,7 @@ Mj93S
|
|||||||
|
|
||||||
define('FILE_X509_IGNORE_TYPE', true);
|
define('FILE_X509_IGNORE_TYPE', true);
|
||||||
|
|
||||||
$x509 = new File_X509();
|
$x509 = new X509();
|
||||||
$x509->loadCA('-----BEGIN CERTIFICATE-----
|
$x509->loadCA('-----BEGIN CERTIFICATE-----
|
||||||
MIIEbDCCA1SgAwIBAgIUJguKOMpJm/yRMDlMOW04NV0YPXowDQYJKoZIhvcNAQEF
|
MIIEbDCCA1SgAwIBAgIUJguKOMpJm/yRMDlMOW04NV0YPXowDQYJKoZIhvcNAQEF
|
||||||
BQAwYTELMAkGA1UEBhMCUEwxNzA1BgNVBAoTLkNaaUMgQ2VudHJhc3QgU0EgdyBp
|
BQAwYTELMAkGA1UEBhMCUEwxNzA1BgNVBAoTLkNaaUMgQ2VudHJhc3QgU0EgdyBp
|
||||||
|
Loading…
Reference in New Issue
Block a user