note 71601 deleted from function.openssl-x509-parse by nlopess
| From: | nlopess@php.net | Date: | Thu, 07 Dec 2006 18:15:36 +0000 |
| Subject: | note 71601 deleted from function.openssl-x509-parse by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-120401@lists.php.net to get a copy of this message | ||
Note Submitter: philip dot brusten at cc dot kuleuven dot be
----
Since there is no function (yet) to parse CSRs, I used a simple workaround.
<?php
// make a temporary key
$key = openssl_pkey_new();
// use the key to self-sign the csr
$crt = openssl_csr_sign($csr,NULL,$key,1);
// the resulting certificate can be parsed
$ssl = openssl_x509_parse($crt);
// dump the CSR subject information
echo '<pre>';
echo var_dump($ssl['subject']);
echo '</pre>';
$o =$ssl['subject']['O'];
$c =$ssl['subject']['C'];
$cn =$ssl['subject']['CN'];
//...
?>