[php-src] PR #20931: Extend x.509 parsing to include machine-readable info about subjectAlternativeNames
| From: | StephenWall | Date: | Tue, 13 Jan 2026 22:17:49 +0000 |
| Subject: | [php-src] PR #20931: Extend x.509 parsing to include machine-readable info about subjectAlternativeNames | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-34549@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/20931
Author: StephenWall
This adds an additional array element to the output of
openssl_x509_parse() that
includes detailed info about the subjectAlternativeName extension in an easily machine parsable
format.
Example:
If the contents of the extension appear as this in the current openssl_x509_parse() output (wrapped
for readability):
```
Array
(
[name] => ...
...
[extensions] => Array
(
[subjectAltName] =>
DNS:www.good.org,
email:good@good.org,
IP Address:192.168.0.1,
othername:<unsupported>,
othername:SmtpUTF8Mailbox:test@test.example.com,
URI:sip:6000@192.168.0.1,
DirName:/C=US/ST=CA/L=San Francisco/O=Example Company/OU=Example Company
Unit/CN=Bob,
Registered ID:1.2.3.4.5
)
)
```
you would see a new top-level array element like this:
```
Array
(
...
[subjectAlternativeName] => Array
(
[0] => Array
(
[type] => DNS
[value] => www.good.org
)
[1] => Array
(
[type] => email
[value] => good@good.org
)
[2] => Array
(
[type] => IP Address
[value] => 192.168.0.1
)
[3] => Array
(
[type] => othername
[value] => Array
(
[1.3.6.1.5.5.7.8.7] => foo@example.org
)
)
[4] => Array
(
[type] => othername
[value] => Array
(
[1.3.6.1.5.5.7.8.9] => test@test.example.com
)
)
[5] => Array
(
[type] => URI
[value] => sip:6000@192.168.0.1
)
[6] => Array
(
[type] => DirName
[value] => Array
(
[2.5.4.6] => US
[2.5.4.8] => CA
[2.5.4.7] => San Francisco
[2.5.4.10] => Example Company
[2.5.4.11] => Example Company Unit
[2.5.4.3] => Bob
)
)
[7] => Array
(
[type] => Registered ID
[value] => 1.2.3.4.5
)
)
)
```