Solved

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

Posted on 2013-11-08
4
1,561 Views
Last Modified: 2014-01-12
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
Comment
Question by:rleyba828
  • 2
  • 2
4 Comments
 
LVL 63

Accepted Solution

by:
btan earned 500 total points
ID: 39636064
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
 

Author Comment

by:rleyba828
ID: 39636310
Thanks breadtan....let me try that out.
0
 

Author Comment

by:rleyba828
ID: 39774311
Hi Breadtan....sorry for the delayed reply.  thanks for pointing me in the right direction.
0
 
LVL 63

Expert Comment

by:btan
ID: 39774366
no worries, glad it helped
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This paper addresses the security of Sennheiser DECT Contact Center and Office (CC&O) headsets. It describes the DECT security chain comprised of “Pairing”, “Per Call Authentication” and “Encryption”, which are all part of the standard DECT protocol.
Ransomware is a growing menace to anyone using a computer or mobile device. Here are answers to some common questions about this vicious new form of malware.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question