Wednesday, 18 September 2013

OpenSSL retrieving data from a certificate

OpenSSL retrieving data from a certificate

I am trying to enable https protocol in my local website. I have
implemented uploading mechanism of the certificates and it works like
charm. The next thing that I want to implement is to show some key
information which are retrieved from the uploaded certificate. By this way
the user can see that the certificate is successfully uploaded and
working. So for example, I want to show the organization name, expiry
date. I tried the following but it returns all the name information. I
want to pick the organization name up from this list. Can anyone guide me
through?
$certInfo = openssl_x509_parse(file_get_contents($cert_directory .
'ssl.pem'));
echo $certInfo['name'];
Another question is, what information would be meaningful for the user to
see? I am planning to show organization name and expiry date but perhaps
it would be useful to show some other information as well. Can you comment
on this?

No comments:

Post a Comment