Hello,
I want to retrieve the details of an SSL certificate of HTTPS
websites, using openSSL, running on Windows 2003. This works fine as
follows:
openssl s_client www.somewebsite.com:443 > cert.txt
In order to close the openSSL connection to the HTTPS website, I have
to manually type "quit" + enter.
Now I want to use this line in a PHP script (running on Windows 2003
with IIS6), so I do not have the possibility to type "quit" + enter.
If I use following code, the PHP script will hang:
shell_exec("openssl s_client www.somewebsite.com:443 > cert.txt")
Is there a possibility to automate openSSL s_client, so it can be used
from a script or batch ?
I have tried to invoke the above openSSL command from VBS, and use
sendkeys("quit{enter}"). This works fine if ran from a DOS window, but
not if the VBS script in turn is invoked by a PHP webpage. In this
case, the PHP page will wait for the VBS script to end, and because
the VBS script is invoked from a PHP webpage and not in a DOS window,
the sendkeys function doesn't work. So PHP will wait infinitely and
hang.
Can openSSL s_client be automated, or can one of the PHP functions
shell_exec, or exec or popen be used without the script hanging
infinitely ?
Thanks for your help,
Niko