php-ews icon indicating copy to clipboard operation
php-ews copied to clipboard

PHP curl request with ssl/tls client certificate

Open feldmarv opened this issue 4 years ago • 1 comments

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 avatar Jul 15 '21 11:07 feldmarv

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);

feldmarv avatar Oct 18 '21 13:10 feldmarv