From c154993b3b34687e358535d609597e13f2bd9e50 Mon Sep 17 00:00:00 2001 From: Immanuel klinkenberg Date: Wed, 8 Oct 2014 14:16:25 +0200 Subject: [PATCH 1/2] setupClientCertifcate() Method added. --- Pest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Pest.php b/Pest.php index 7cb9d86..f7c9212 100644 --- a/Pest.php +++ b/Pest.php @@ -84,6 +84,24 @@ public function setupAuth($user, $pass, $auth = 'basic') $this->curl_opts[CURLOPT_HTTPAUTH] = constant('CURLAUTH_' . strtoupper($auth)); $this->curl_opts[CURLOPT_USERPWD] = $user . ":" . $pass; } + + /** + * Setup client certificate + * + * @param string $certificateFile + * @param string $privateKeyFile + * @param string $privateKeyPassword Optional + */ + public function setupClientCertificate($certificateFile, $privateKeyFile, $privateKeyPassword = null) + { + $this->curl_opts[CURLOPT_SSLCERT] = $certificateFile; + $this->curl_opts[CURLOPT_SSLKEY] = $privateKeyFile; + + if(is_string($privateKeyPassword) && strlen($privateKeyPassword) > 0) + { + $this->curl_opts[CURLOPT_SSLKEYPASSWD] = $privateKeyPassword; + } + } /** * Set cookies for this session From e93e88af3607c885c418c057e02c638e7ec98e8c Mon Sep 17 00:00:00 2001 From: Immanuel klinkenberg Date: Thu, 9 Oct 2014 00:35:27 +0200 Subject: [PATCH 2/2] Changed indent to 4 lines and removed emtpy line. --- Pest.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Pest.php b/Pest.php index f7c9212..94d9a74 100644 --- a/Pest.php +++ b/Pest.php @@ -94,13 +94,12 @@ public function setupAuth($user, $pass, $auth = 'basic') */ public function setupClientCertificate($certificateFile, $privateKeyFile, $privateKeyPassword = null) { - $this->curl_opts[CURLOPT_SSLCERT] = $certificateFile; - $this->curl_opts[CURLOPT_SSLKEY] = $privateKeyFile; - - if(is_string($privateKeyPassword) && strlen($privateKeyPassword) > 0) - { - $this->curl_opts[CURLOPT_SSLKEYPASSWD] = $privateKeyPassword; - } + $this->curl_opts[CURLOPT_SSLCERT] = $certificateFile; + $this->curl_opts[CURLOPT_SSLKEY] = $privateKeyFile; + if(is_string($privateKeyPassword) && strlen($privateKeyPassword) > 0) + { + $this->curl_opts[CURLOPT_SSLKEYPASSWD] = $privateKeyPassword; + } } /**