note 49890 added to function.openssl-x509-parse
| From: | maarten at xolphin dot nl | Date: | Fri, 11 Feb 2005 10:00:49 +0000 |
| Subject: | note 49890 added to function.openssl-x509-parse | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84828@lists.php.net to get a copy of this message | ||
At this time very useful X509 oids (like streetAddress, postalCode and others) are missing. You can
find a list of them at http://www.alvestrand.no/objectid/2.5.4.html,
I hope they get included to openssl-x509-parse soon.
Until then you can get these oids anyway like this:
<?
function getOID($OID, $ssl)
{
preg_match('/\/' . $OID . '=([^\/]+)/', $ssl, $matches);
return $matches[1];
}
$cert = file_get_contents('test.crt');
$ssl = openssl_x509_parse($cert);
$Address = getOID('2.5.4.9', $ssl['name']);
$ZipCode = getOID('2.5.4.17', $ssl['name']);
$Postbox = getOID('2.5.4.18', $ssl['name']);
?>
The parseCert function from the Horde framework can be usefull for this too.
----
Manual Page -- http://www.php.net/manual/en/function.openssl-x509-parse.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49890
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49890&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49890&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49890&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49890&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49890&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49890&report=yes
Search -- http://master.php.net/manage/user-notes.php