CTM Posted August 2, 2006 Share Posted August 2, 2006 Hi,I've been trying for a few days to make a script which would loop through a list of IPs through HTTPS connections and, if the server happens to issue a certificate, I'd like to fetch the issuer and user of said certificate and log that into a text file.Now, connecting and looping isn't really hard, but I can't figure out how to get the certificate. I know how to parse it (once I get (somehow) the x509cert data), but the documention on that part seems to be lacking on the web. I've looked in the Zend CVS, and since PHP 5.1.3, apparently there are now two new SSL Context Options, capture_peer_cert and capture_peer_cert_chain, which would seem to be what I need. Unfortunately, I have no idea how to use those, and then they say the certificate data (in x509 format) will be returned as a SSL Stream Context variable, something I didn't even know about.If anyone could help me out, I'd appreciate. :)Edit : Apparently, everywhere I've posted this no one's been able to help me...Where could I get support for this issue then, if no one on common php boards knows anything about it? Quote Link to comment Share on other sites More sharing options...
bltesar Posted August 3, 2006 Share Posted August 3, 2006 have you looked at the php.net info on this subject?http://us3.php.net/manual/en/ref.openssl.php Quote Link to comment Share on other sites More sharing options...
CTM Posted August 4, 2006 Author Share Posted August 4, 2006 I did, but the answer wasn't there.However, I did fix my problem. You simply put the 'capture_peer_cert' in the 'ssl' wrapper in the stream context, and once connected, you fetch the new context and if there is a certificate, it'll return it in the context under the wrapper 'ssl' as 'peer_certificate'. While I had understand that much, I'd forgotten to put -with--openssl[=DIR]Eh... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.