title: How to use a self signed certificate with XAMPP for HTTPS requests using cURL?
body: <p>I installed XAMPP and I need to test some HTTPS requests. First of all i tried to configure XAMPP so I can use the HTTPS requests.</p>
  
  <p>This is what I did :</p>
  
  <p>1) In the php.ini file , I uncommented the <code>openssl module</code>.</p>
  
  <p>2) In the httpd.conf file , I uncommented the <code>LoadModule ssl_module modules/mod_ssl.so</code></p>
  
  <p>3) In the httpd-ssl.conf file , I redirected </p>
  
  <p><code>SSLCertificateFile "conf/ssl.crt/ipm.crt"</code> and </p>
  
  <p><code>SSLCertificateKeyFile "conf/ssl.key/ipm.key</code>" to my .crt and .key files.</p>
  
  <p>4) I put my ipm.crt and ipm.key files in the apache folders <code>ssl.crt</code> and <code>ssl.key</code> inside XAMPP. </p>
  
  <p>5) I created my self signed certificate by doing : </p>
  
  <pre><code>openssl req -config openssl.cnf -new -out ipm.csr -keyout ipm.pem
  
  openssl rsa -in ipm.pem -out ipm.key
  
  openssl x509 -in ipm.csr -out ipm.crt -req -signkey ipm.key -days 365
  </code></pre>
  
  <p>Now I am using a script to send an XML file. I am using cURL and my code is :</p>
  
  <pre><code>&lt;?php
    /*
     * XML Sender/Client.
     */
    // Get our XML. You can declare it here or even load a file.
  
  
    $xml = file_get_contents("data.xml");
  
  
    // We send XML via CURL using POST with a http header of text/xml.
    $ch = curl_init();
  
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
  
    curl_setopt($ch, CURLOPT_CAINFO,  getcwd().'/cert/ipm.crt');
    curl_setopt($ch, CURLOPT_SSLCERT, getcwd().'/cert/ipm.pem');
    curl_setopt($ch, CURLOPT_SSLCERTPASSWD,'password');
  
  
    //I use this line only for debugging through fiddler. Must delete after done with debugging.
    curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8888');
  
    // set URL and other appropriate options
    curl_setopt($ch, CURLOPT_URL, "https://ipv4.fiddler/iPM/receiver.php");
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
    curl_setopt($ch, CURLOPT_REFERER, 'https://ipv4.fiddler/iPM/receiver.php');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $ch_result = curl_exec($ch);
    echo "Result = ".$ch_result;
  
    echo 'Curl error: ' . curl_error($ch);
  
    curl_close($ch);
    // Print CURL result.
  ?&gt;
  </code></pre>
  
  <p>But I get this error back: <code>Curl error: unable to use client certificate (no key found or wrong pass phrase?)</code></p>
  
  <p>However when I created my certificate I did put as a password the phrase: <code>password</code></p>
  
  <p>Any ideas on the matter?</p>