Is it possible to create a POST request using guzzle6 which has .pfx-certificate attached to it?
The documention only mentions pem-format: http://docs.guzzlephp.org/en/stable/request-options.html#cert
Is it possible to create a POST request using guzzle6 which has .pfx-certificate attached to it?
The documention only mentions pem-format: http://docs.guzzlephp.org/en/stable/request-options.html#cert
Although the documentation at http://docs.guzzlephp.org/en/stable/request-options.html#cert doesn't mention it, it seems to be possible to also use pfx-format with guzzle.
PFX certificates are used for "mutual authentications", that means, the PFX is generated with your local private key and the remote public cert.
To generate a PFX key you run:
openssl pkcs12 -inkey your_privkey.pem -in remote_pub.cert -export -out mixed.pfx
To make a request using the PFX cert, you can:
$api = new \GuzzleHttp\Client([
'base_uri' => $baseUrl,
'cert' => 'path/to/mixed.pfx',
'curl' => [CURLOPT_SSLCERTTYPE => 'P12'], // to define it's a PFX key
]);