Passing .PEM and .KEY as string in Curl using PHP

前端 未结 4 2025
星月不相逢
星月不相逢 2021-02-12 20:56

I\'ve a CERT and private key files. I\'m using cUrl and PHP to connect to another service. At the moment, I\'ve cert and key in files and it works perfectly fine with following

4条回答
  •  梦如初夏
    2021-02-12 21:41

    The answer is unfortunately as easy as it is simple: No, it is not possible.

    The underlying libcurl has no API for providing keys as strings, only as files!

    Bonus material:

    If you're sure that your libcurl is built with OpenSSL, you can actually use the CURLOPT_SSL_CTX_FUNCTION option to do it. However:

    1. that makes it an libcurl+OpenSSL specific solution

    2. I don't think PHP/CURL exposes that function (enough) to allow this. You would probably need to extend the binding code first...

    (I should add that I am the main author and maintainer of libcurl.)

提交回复
热议问题