php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38937 openssl_csr_parse()
Submitted: 2006-09-23 20:12 UTC Modified: 2006-10-10 14:39 UTC
Votes:4
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:4 (100.0%)
From: bassijunior at yahoo dot com dot br Assigned: pajoye (profile)
Status: Not a bug Package: OpenSSL related
PHP Version: 5.1.6 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bassijunior at yahoo dot com dot br
New email:
PHP Version: OS:

 

 [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? 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-02 23:21 UTC] bassijunior at yahoo dot com dot br
Hi, 

Some news about that????? Nobody answers me...

Thanks!!
 [2006-10-03 00:17 UTC] pajoye@php.net
What are you trying to do?

Parse a peer certicate?
 [2006-10-03 00:54 UTC] bassijunior at yahoo dot com dot br
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!!
 [2006-10-03 01:02 UTC] pajoye@php.net
By request, do you mean from an url? like https://example.com?
 [2006-10-05 01:34 UTC] bassijunior at yahoo dot com dot br
No. 
I am developing a project using the openssl functions in the PHP.
These certificates, that I generate,  aren?t to use as web certificate. I will use this certificate to prove that a user submited a file for me, for example. It's a aplication very unusual.

Condensing, before generate a certificate, I have to generate a request certificate, ok? I do this using openssl_csr_new function.
I only want to know how I can read a certificate request. To read the certificate(.PEM) I use the openssl_X509_parse, how I showed in my last comment, but I also need to read the certificate request. How can I read it? Is there a openssl_????_parse to read a certificate request?

Thanks!
 [2006-10-05 11:28 UTC] pajoye@php.net
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.
 [2006-10-08 04:33 UTC] bassijunior at yahoo dot com dot br
Hi, 
I think so. 
But I don?t know how to use the snapshot.
What can I do to use this? I did a download, but now, apache  doesn?t work.
 [2006-10-08 11:29 UTC] pajoye@php.net
Snapshots are just like release. You can follow the install instructions in the manual to install them. You can use the CLI (console) to test it.
 [2006-10-08 18:51 UTC] bassijunior at yahoo dot com dot br
I found something in the Internet, but it doesn?t work.
Where can I found a good documentation about that?
And, another thing, do you know when the new version of PHP, the version 5.2 will be available?
Thanks.
 [2006-10-08 21:10 UTC] pajoye@php.net
5.2 will be released in the next 2-3 weeks. The documentation will be added in the PHP manual.

But what did not work? the 5.2 install?
 [2006-10-10 01:36 UTC] bassijunior at yahoo dot com dot br
Hi,

I downloaded the PHP 5.2(.zip). Then, I extracted the files to the php directory. After this,  the apache doesn't start.
I'm looking for about the install documentation in the Internet, but I didn't yet found.

Thanks.
 [2006-10-10 13:13 UTC] pajoye@php.net
All you need is here:
http://www.php.net/manual/en/install.windows.php

I close this bug, solved (not a bug, bogus, the new functions already exist).
 [2006-10-10 14:39 UTC] bassijunior at yahoo dot com dot br
Ok.

I will access this site that you recommended.

Thank you very much by your help!!
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 11:01:28 2025 UTC