From 6c2798be903b56c1b08745687a9ede9f7ad2923b Mon Sep 17 00:00:00 2001 From: terrafrost Date: Mon, 29 Jun 2015 21:53:27 -0500 Subject: [PATCH 1/2] X509: set another parameters field to null --- phpseclib/File/X509.php | 2 ++ tests/Unit/File/X509/X509Test.php | 1 + 2 files changed, 3 insertions(+) diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index 5ff29017..429b7724 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -1512,6 +1512,8 @@ class File_X509 it seems like perhaps the ASN.1 description ought not say the parameters field is OPTIONAL, but whatever. */ $cert['tbsCertificate']['subjectPublicKeyInfo']['algorithm']['parameters'] = null; + // https://tools.ietf.org/html/rfc3279#section-2.2.1 + $cert['signatureAlgorithm']['parameters'] = null; } } diff --git a/tests/Unit/File/X509/X509Test.php b/tests/Unit/File/X509/X509Test.php index 40737d8c..34999245 100644 --- a/tests/Unit/File/X509/X509Test.php +++ b/tests/Unit/File/X509/X509Test.php @@ -137,6 +137,7 @@ aBtsWpliLSex/HHhtRW9AkBGcq67zKmEpJ9kXcYLEjJii3flFS+Ct/rNm+Hhm1l7 $cert = $x509->loadX509($cert); $this->assertArrayHasKey('parameters', $cert['tbsCertificate']['subjectPublicKeyInfo']['algorithm']); + $this->assertArrayHasKey('parameters', $cert['signatureAlgorithm']); } private function _encodeOID($oid) From 77c757d0955c1bf6d1731ce132de353b902c0a25 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Mon, 29 Jun 2015 22:10:18 -0500 Subject: [PATCH 2/2] X509: set one more parameter to null --- phpseclib/File/X509.php | 1 + tests/Unit/File/X509/X509Test.php | 1 + 2 files changed, 2 insertions(+) diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index 429b7724..3649c3e7 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -1514,6 +1514,7 @@ class File_X509 $cert['tbsCertificate']['subjectPublicKeyInfo']['algorithm']['parameters'] = null; // https://tools.ietf.org/html/rfc3279#section-2.2.1 $cert['signatureAlgorithm']['parameters'] = null; + $cert['tbsCertificate']['signature']['parameters'] = null; } } diff --git a/tests/Unit/File/X509/X509Test.php b/tests/Unit/File/X509/X509Test.php index 34999245..375a4549 100644 --- a/tests/Unit/File/X509/X509Test.php +++ b/tests/Unit/File/X509/X509Test.php @@ -138,6 +138,7 @@ aBtsWpliLSex/HHhtRW9AkBGcq67zKmEpJ9kXcYLEjJii3flFS+Ct/rNm+Hhm1l7 $this->assertArrayHasKey('parameters', $cert['tbsCertificate']['subjectPublicKeyInfo']['algorithm']); $this->assertArrayHasKey('parameters', $cert['signatureAlgorithm']); + $this->assertArrayHasKey('parameters', $cert['tbsCertificate']['signature']); } private function _encodeOID($oid)