|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-09-23 20:12 UTC] bassijunior at yahoo dot com dot br
Description: ------------ I need to open a certificate request like one array, like I did with the X.509 certificate. To verify a X.509 certificate I use openssl_x509_parse( mixed x509cert [, bool shortnames]). And about the certificate request? I want to do the same that i did with certificate.How Can read it? Is there any function to do that? PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 13:00:01 2025 UTC |
For example, with a openssl_X509_parse function() I can print the certificate. But I need to do this with a request created by openssl_csr_new() function. I oopen the certificate and I print this: <?php . . . $cert = "$pwd\\demoCA\\user_cert_signed.pem"; $fp = fopen ($cert, "rb", 1); if($fp===false) { echo "Erro abrindo arquivo"; exit; } $conteudo = addslashes(fread ($fp, filesize($cert))); //$cert_dados = file_get_contents($cert); $nome=openssl_x509_parse($conteudo); print_r($nome["subject"]["CN"]); print_r($nome["subject"]["C"]); print_r($nome["subject"]["ST"]); print_r($nome["subject"]["L"]); . . . ?> I want to do this with request too, and not only with a certificate. Thanks!!With 5.2.0 or later: Is it what you are looking for? $csr = file_get_contents('somecsr'); $csr_details = openssl_csr_get_subject($csr, 1) print_r($details); and to get the pkey: $key = openssl_csr_get_public_key($csr); You can try it using the snapshot: http://snaps.php.net but it will not be backported to 5.1.