Need help on client certificate validation using OpenSSL/PHP
| From: | Richard Rojas | Date: | Tue, 26 Nov 2002 02:58:01 +0000 |
| Subject: | Need help on client certificate validation using OpenSSL/PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-126033@lists.php.net to get a copy of this message | ||
Hi All,
I'm a PHP newbie and Im really having difficulty with client-server
certificate validation using Openssl and PHP. If somehow you know of a
tutorial, a website or sample PHP codes that checks (expired, revoked) and
validates client certificates, it would be of great help.
I already tried using $_SERVER variable and I was able to extract
the infos on the certificate and simply compare the dates for expiration and
the other parts for validation but I know this is a bad idea. That it would
be a good practice to use PHPs openssl functions instead.
Here's my code:
<?php
echo "CLIENT <br>";
echo "Issuer: " . $_SERVER['SSL_CLIENT_I_DN'];
echo "<br>";
echo "Subject: " . $_SERVER['SSL_CLIENT_S_DN'];
echo "<br>";
echo "Validity Start: " . $_SERVER['SSL_CLIENT_V_START'];
echo "<br>";
echo "Validity End: " . $_SERVER['SSL_CLIENT_V_END'];
echo "<br><br> SERVER <br>";
echo "Issuer: " . $_SERVER['SSL_SERVER_I_DN'];
echo "<br>";
echo "Subject: " . $_SERVER['SSL_SERVER_S_DN'];
echo "<br>";
echo "Validity Start: " . $_SERVER['SSL_SERVER_V_START'];
echo "<br>";
echo "Validity End: " . $_SERVER['SSL_SERVER_V_END'];
--- then comparisons occur next -------
?>
Please help me...
TIA,
Richard
PS. By the way, we converted our client certificates to PKCS#12 certificates