Jump to content

SSL Problem


CTM

Recommended Posts

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?
Link to comment
Share on other sites

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...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.