CakePHP 3.6+ Http Client with X.509 "client certificate"


#1

Hello there :heart_eyes:

To be able to use an institutional REST web-service, I need to auth :key: with a X.509 client certificate.
I was planning to use Cake/Http/Client class to make my requests but I am not sure it is possible to pass a client certificate (certificate, private key :closed_lock_with_key: and passphrase if needed).

I found ways to do that using Guzzle (https://stackoverflow.com/a/49590036) or curl (https://stackoverflow.com/a/11310280) but I would have preferred to use the Cake native Http Client.

Do you know if that is possible ?

Thanks :wink:


#2

Find out in the API
https://api.cakephp.org/3.7/source-class-Cake.Http.Client.Adapter.Curl.html#113
https://api.cakephp.org/3.7/source-class-Cake.Http.Client.Adapter.Stream.html#215

Options keys are ssl_local_cert and ssl_passphrase but not currently in the docs.
I will try that and make a PR to add it to the doc :wink: