Garethp / php-ews

PHP Exchange Web Services
BSD 3-Clause "New" or "Revised" License
112 stars 45 forks source link

PHP curl request with ssl/tls client certificate #219

Open feldmarv opened 3 years ago

feldmarv commented 3 years ago

Hi there,

We want to send a tls client certificate for each request to the EWS server. Is there possiblity to add these certificates in each request directly in the php-ews library.

eg: https://gist.github.com/nebulak/c22ce4b409c774b75b0ac3cc43e56668

best regards Marvin

feldmarv commented 3 years ago

We have been able to implement the client certification handshake with the following code. Just in case someone is looking for the same requirement.

$authentication = [ 'curl' => [ CURLOPT_HTTPAUTH => CURLAUTH_BASIC | CURLAUTH_NTLM, CURLOPT_USERPWD => $username . ':' . $password, ], // https://docs.guzzlephp.org/en/stable/request-options.html#cert 'cert' => [$cert], // https://docs.guzzlephp.org/en/stable/request-options.html#ssl-key 'ssl_key' => [$sslKey], // https://docs.guzzlephp.org/en/stable/request-options.html#verify 'verify' => $caCert, ]; self::$api = API::withCustomAuthentication($server, $authentication, $options);