2

I'm working on Boss Linux OS. I'm trying to work out how to validate a SSL certificate and also retrieve the SSL/TLS version used, cipher used and the algorithm (SHA, MD5..), expiry date of the certificate used by the site passed as parameter

openssl s_client -connect www.google.com:443

using this command helps me view the certificate of www.google.com. Now from that output i need to extract the SSL/TLS version used by them, cipher used, algorithm used, expiry date of the certificate and so on... I need to write a PHP program to extract those values.

2 Answers 2

1

If you're familiar with OpenSSl, http://php.net/manual/en/book.openssl.php, then you might be able to make a very small PHP file like so:

<?php
echo '<pre>';
passthru("openssl [parameters] $certificate");
echo '</pre>';
?>

Variable $certificate is collected by a simple form (upload form perhaps?) so you can analyze a raw certificate file.

Could you though, maybe provide more information on the type of SSL certificate?

You're not going to be able to figure out the cipher very easily, it will take something like Cain and Abel and a powerful processor, and lots of time.

Sign up to request clarification or add additional context in comments.

1 Comment

i need to pass the site name (ex: www.google.com) for which i need to 1st retrieve the certificate and then validate the certificate. From the certificate i need to extract the SSL/TLS version used, the Cipher used, the algorithm used and the expiry date of the certificate.
1

You don't need cain or whatever...!!

For the cipher you can simply use the openssl x509 -in file.crt -help

Also I wouldn't use the system() call for executing a form input :) You are better off using openssl_ functions that are built into php!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.