PHP stream_context_set_option SSL certificate as string
===

I've got a weird issue. Basically, I need to do this:

     $handle = stream_context_create();
     stream_context_set_option($handle , 'ssl', 'local_cert', '/tmp/cert');

However. The certificate is not held as a file within the server. Rather it's an encrypted string held in a clustered database environment. So instead of the certificate being a file name pointer, its the physical content of the certificate. So instead of using the file name, I need to specify the content of the certificate instead.

For example:

     $cert = '-----BEGIN CERTIFICATE-----....
     upWbwmdMd61SjNCdtOpZcNW3YmzuT96Fr7GUPiDQ
     -----END CERTIFICATE-----';

Does anyone have any idea whatsoever how on earth I can do this? I'm scratching my head over this problem, but my gut instinct says it is doable.

Thanks in advance everyone!