Re: Retrieving client SSL info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 26 May 2005 21:32:27 +0200, in php.general php@xxxxxx (Peter
Brodersen) wrote:

>A phpinfo() only shows that $_SERVER['HTTPS'] has been set to "on".
>The mod_ssl-refrence shows though that a lot of other environment
>variables should be present:
>http://www.modssl.org/docs/2.1/ssl_reference.html#ToC23
>.. but I can't seem to retrieve this information anywhere.

I reached the following solution:

I never got access to any SSL_*-variables under $_SERVER (not even the
server variables or using another language - or server, php version
and OS), but a workaround for Apache and mod_ssl is to add
	SSLOptions +ExportCertData
to httpd.conf (or .htaccess)

The certificate presented by the client would then be stored in
$_SERVER['SSL_CLIENT_CERT'] (the only SSL_*-variable available,
besides SSL_SERVER_CERT). The data could then be retrieved using
openssl_x509_parse(), e.g.:

<?php
$cert = openssl_x509_parse($_SERVER['SSL_CLIENT_CERT']);
print $cert['subject']['CN'];
?>

I would still like to know why the SSL-variables aren't available, but
I don't think this is a PHP issue.

Just wanted to post my solution for the sake of mail archives :-)

-- 
- Peter Brodersen

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux