Adjust some tests for whitespace differences in OpenSSL 3

A trailing newline is no longer present in OpenSSL 3.
This commit is contained in:
Nikita Popov 2021-08-04 09:57:40 +02:00
parent 3ea57cf838
commit 0a530d7650
3 changed files with 13 additions and 19 deletions

View file

@ -7,11 +7,10 @@ openssl
$cert = file_get_contents(__DIR__ . "/bug28382cert.txt"); $cert = file_get_contents(__DIR__ . "/bug28382cert.txt");
$ext = openssl_x509_parse($cert); $ext = openssl_x509_parse($cert);
var_dump($ext['extensions']); var_dump($ext['extensions']);
/* openssl 1.0 prepends the string "Full Name:" to the crlDistributionPoints array key. /*
For now, as this is the one difference only between 0.9.x and 1.x, it's handled with * The reason for %A at the end of crlDistributionPoints and authorityKeyIdentifier is that
placeholders to not to duplicate the test. When more diffs come, a duplication would * OpenSSL 3.0 removes new lines which were present in previous versions.
be probably a better solution. */
*/
?> ?>
--EXPECTF-- --EXPECTF--
array(11) { array(11) {
@ -22,8 +21,7 @@ array(11) {
["nsCertType"]=> ["nsCertType"]=>
string(30) "SSL Client, SSL Server, S/MIME" string(30) "SSL Client, SSL Server, S/MIME"
["crlDistributionPoints"]=> ["crlDistributionPoints"]=>
string(%d) "%AURI:http://mobile.blue-software.ro:90/ca/crl.shtml string(%d) "%AURI:http://mobile.blue-software.ro:90/ca/crl.shtml%A"
"
["nsCaPolicyUrl"]=> ["nsCaPolicyUrl"]=>
string(38) "http://mobile.blue-software.ro:90/pub/" string(38) "http://mobile.blue-software.ro:90/pub/"
["subjectAltName"]=> ["subjectAltName"]=>
@ -31,9 +29,8 @@ array(11) {
["subjectKeyIdentifier"]=> ["subjectKeyIdentifier"]=>
string(59) "B0:A7:FF:F9:41:15:DE:23:39:BD:DD:31:0F:97:A0:B2:A2:74:E0:FC" string(59) "B0:A7:FF:F9:41:15:DE:23:39:BD:DD:31:0F:97:A0:B2:A2:74:E0:FC"
["authorityKeyIdentifier"]=> ["authorityKeyIdentifier"]=>
string(115) "DirName:/C=RO/ST=Romania/L=Craiova/O=Sergiu/OU=Sergiu SRL/CN=Sergiu CA/emailAddress=n_sergiu@hotmail.com string(%d) "DirName:/C=RO/ST=Romania/L=Craiova/O=Sergiu/OU=Sergiu SRL/CN=Sergiu CA/emailAddress=n_sergiu@hotmail.com
serial:00 serial:00%A"
"
["keyUsage"]=> ["keyUsage"]=>
string(71) "Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment" string(71) "Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment"
["nsBaseUrl"]=> ["nsBaseUrl"]=>

View file

@ -9,11 +9,10 @@ $info = openssl_x509_parse($cert);
var_export($info['extensions']); var_export($info['extensions']);
?> ?>
--EXPECT-- --EXPECTF--
array ( array (
'basicConstraints' => 'CA:FALSE', 'basicConstraints' => 'CA:FALSE',
'subjectKeyIdentifier' => '88:5A:55:C0:52:FF:61:CD:52:A3:35:0F:EA:5A:9C:24:38:22:F7:5C', 'subjectKeyIdentifier' => '88:5A:55:C0:52:FF:61:CD:52:A3:35:0F:EA:5A:9C:24:38:22:F7:5C',
'keyUsage' => 'Digital Signature, Non Repudiation, Key Encipherment', 'keyUsage' => 'Digital Signature, Non Repudiation, Key Encipherment',
'subjectAltName' => 'DNS:altnull.python.org' . "\0" . 'example.com, email:null@python.org' . "\0" . 'user@example.org, URI:http://null.python.org' . "\0" . 'http://example.org, IP Address:192.0.2.1, IP Address:2001:DB8:0:0:0:0:0:1 'subjectAltName' => 'DNS:altnull.python.org' . "\0" . 'example.com, email:null@python.org' . "\0" . 'user@example.org, URI:http://null.python.org' . "\0" . 'http://example.org, IP Address:192.0.2.1, IP Address:2001:DB8:0:0:0:0:0:1%A',
',
) )

View file

@ -153,10 +153,9 @@ array(16) {
["subjectKeyIdentifier"]=> ["subjectKeyIdentifier"]=>
string(59) "DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D" string(59) "DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D"
["authorityKeyIdentifier"]=> ["authorityKeyIdentifier"]=>
string(202) "keyid:DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D string(%d) "keyid:DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D
DirName:/C=BR/ST=Rio Grande do Sul/L=Porto Alegre/CN=Henrique do N. Angelo/emailAddress=hnangelo@php.net DirName:/C=BR/ST=Rio Grande do Sul/L=Porto Alegre/CN=Henrique do N. Angelo/emailAddress=hnangelo@php.net
serial:AE:C5:56:CC:72:37:50:A2 serial:AE:C5:56:CC:72:37:50:A2%A"
"
["basicConstraints"]=> ["basicConstraints"]=>
string(7) "CA:TRUE" string(7) "CA:TRUE"
} }
@ -301,10 +300,9 @@ array(16) {
["subjectKeyIdentifier"]=> ["subjectKeyIdentifier"]=>
string(59) "DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D" string(59) "DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D"
["authorityKeyIdentifier"]=> ["authorityKeyIdentifier"]=>
string(202) "keyid:DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D string(%d) "keyid:DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D
DirName:/C=BR/ST=Rio Grande do Sul/L=Porto Alegre/CN=Henrique do N. Angelo/emailAddress=hnangelo@php.net DirName:/C=BR/ST=Rio Grande do Sul/L=Porto Alegre/CN=Henrique do N. Angelo/emailAddress=hnangelo@php.net
serial:AE:C5:56:CC:72:37:50:A2 serial:AE:C5:56:CC:72:37:50:A2%A"
"
["basicConstraints"]=> ["basicConstraints"]=>
string(7) "CA:TRUE" string(7) "CA:TRUE"
} }