Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1830
  • Last Modified:

Decode a PEM file in openssl using php (web based form)

Hi team,

   We work a lot with SSL certificates and we are looking for a php based solution where we just paste the certificate PEM file on a form on a web page, click submit then get the full details of the certificate we are working with....something similar to what this page is doing    --> http://www.sslshopper.com/certificate-decoder.html.  

We have a recent Centos/Apache web server in our office, but no one knows php.

Would appreciate if someone could post the code snippet that can let us do this.

Thanks very much.
0
rleyba828
Asked:
rleyba828
  • 2
  • 2
1 Solution
 
btanExec ConsultantCommented:
typically openssl is used
http://php.net/manual/en/function.openssl-x509-read.php

extract example:

// Get a certificate resource from the PEM string.
    $cert = openssl_x509_read( $pemdata );

// Parse the resource and print out the contents.
    $cert_data = openssl_x509_parse( $cert );
    array_walk( $cert_data, 'print_element' );
0
 
rleyba828Author Commented:
Thanks breadtan....let me try that out.
0
 
rleyba828Author Commented:
Hi Breadtan....sorry for the delayed reply.  thanks for pointing me in the right direction.
0
 
btanExec ConsultantCommented:
no worries, glad it helped
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now