From 305dc1967a6d4564557e7d99f8db17aff8ba4c5e Mon Sep 17 00:00:00 2001 From: terrafrost Date: Tue, 3 May 2016 21:08:58 -0500 Subject: [PATCH] Tests/X509: fix bad merge --- phpseclib/File/X509.php | 18 +++++++++--------- tests/Unit/File/X509/X509Test.php | 9 ++++----- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index 414e7eb6..d81a72ca 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -1080,7 +1080,7 @@ class X509 ); $this->SubjectDirectoryAttributes = array( - 'type' => FILE_ASN1_TYPE_SEQUENCE, + 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => $Attribute @@ -1254,7 +1254,7 @@ class X509 ); $this->PostalAddress = array( - 'type' => FILE_ASN1_TYPE_SEQUENCE, + 'type' => ASN1::TYPE_SEQUENCE, 'optional' => true, 'min' => 1, 'max' => -1, @@ -1833,7 +1833,7 @@ class X509 $map = $this->_getMapping($type); 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 switch (true) { 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'); $subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier'); switch (true) { @@ -2145,7 +2145,7 @@ class X509 $ca = $this->CAs[$i]; switch (true) { 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'); $subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier', $ca); switch (true) { @@ -2191,7 +2191,7 @@ class X509 $ca = $this->CAs[$i]; switch (true) { 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'); $subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier', $ca); switch (true) { @@ -2496,7 +2496,7 @@ class X509 $asn1 = new ASN1(); $asn1->loadOIDs($this->oids); $filters = array(); - $filters['value'] = array('type' => FILE_ASN1_TYPE_UTF8_STRING); + $filters['value'] = array('type' => ASN1::TYPE_UTF8_STRING); $asn1->loadFilters($filters); $this->_mapOutDNs($dn, 'rdnSequence', $asn1); $dn = $dn['rdnSequence']; @@ -2649,7 +2649,7 @@ class X509 $asn1 = new ASN1(); $asn1->loadOIDs($this->oids); $filters = array(); - $filters['rdnSequence']['value'] = array('type' => FILE_ASN1_TYPE_UTF8_STRING); + $filters['rdnSequence']['value'] = array('type' => ASN1::TYPE_UTF8_STRING); $asn1->loadFilters($filters); $this->_mapOutDNs($dn, 'rdnSequence', $asn1); @@ -2721,7 +2721,7 @@ class X509 $start = false; } - return $format == FILE_X509_DN_OPENSSL ? $result : $output; + return $format == self::DN_OPENSSL ? $result : $output; } /** diff --git a/tests/Unit/File/X509/X509Test.php b/tests/Unit/File/X509/X509Test.php index 3c9ea291..3b88161c 100644 --- a/tests/Unit/File/X509/X509Test.php +++ b/tests/Unit/File/X509/X509Test.php @@ -226,7 +226,6 @@ aBtsWpliLSex/HHhtRW9AkBGcq67zKmEpJ9kXcYLEjJii3flFS+Ct/rNm+Hhm1l7 $this->assertEquals($x509->getOID('zzz'), 'zzz'); } -<<<<<<< HEAD public function testIPAddressSubjectAltNamesDecoding() { $test = '-----BEGIN CERTIFICATE----- @@ -264,7 +263,7 @@ NDEuGt30Vl2de7G1glnhaceB6Q9KfH7p2gAwNP9JMTtx3PtEcA== public function testPostalAddress() { - $x509 = new File_X509(); + $x509 = new X509(); $decoded = $x509->loadX509('-----BEGIN CERTIFICATE----- MIIFzzCCBLegAwIBAgIDAfdlMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAlBM MSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMSQwIgYD @@ -311,12 +310,12 @@ Mj93S $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'; - $this->assertEquals($x509->getDN(FILE_X509_DN_STRING), $expected); + $this->assertEquals($x509->getDN(X509::DN_STRING), $expected); } public function testStrictComparison() { - $x509 = new File_X509(); + $x509 = new X509(); $x509->loadCA('-----BEGIN CERTIFICATE----- MIIEbDCCA1SgAwIBAgIUJguKOMpJm/yRMDlMOW04NV0YPXowDQYJKoZIhvcNAQEF BQAwYTELMAkGA1UEBhMCUEwxNzA1BgNVBAoTLkNaaUMgQ2VudHJhc3QgU0EgdyBp @@ -389,7 +388,7 @@ Mj93S define('FILE_X509_IGNORE_TYPE', true); - $x509 = new File_X509(); + $x509 = new X509(); $x509->loadCA('-----BEGIN CERTIFICATE----- MIIEbDCCA1SgAwIBAgIUJguKOMpJm/yRMDlMOW04NV0YPXowDQYJKoZIhvcNAQEF BQAwYTELMAkGA1UEBhMCUEwxNzA1BgNVBAoTLkNaaUMgQ2VudHJhc3QgU0EgdyBp