PHP stream_context_set_option SSL certificate as string
Posted
by
Roger Thomas
on Stack Overflow
See other posts from Stack Overflow
or by Roger Thomas
Published on 2012-07-09T21:12:52Z
Indexed on
2012/07/09
21:15 UTC
Read the original article
Hit count: 651
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!
© Stack Overflow or respective owner