title: Mutual SSL Authentication with gSOAP
body: <p>I am trying to connect with a SOAP Service which requires Mutual SSL Authentication.</p>
  
  <p>We created a self-signed certificate and transferred it to the service operator for them to verify our connections. Likewise, they sent us a copy of their ssl certificate.</p>
  
  <p>I have been able to successfully connect to an get the expected SOAP response from the service by using openssl s_client and manually entering the HTTP request, headers and SOAP content.
  I use the parameters similar to the following to make the successful connection:</p>
  
  <pre><code>openssl s_client -connect example.com:443 -key my_key.pem -cert my_cert.pem -pass file:my_passphrase
  </code></pre>
  
  <ul>
  <li><strong>my_key.pem</strong> is the filename of my private key</li>
  <li><strong>my_cert.pem</strong> is the filename of the self-signed certificate forwarded to the service operator.</li>
  <li><strong>my_passphrase</strong> contains the passphrase for the private key.</li>
  </ul>
  
  <p>I am now trying to access the same service using gSOAP and its C bindings. I followed the documentation at <a href="http://www.cs.fsu.edu/~engelen/soapdoc2.html" rel="nofollow">http://www.cs.fsu.edu/~engelen/soapdoc2.html</a> to create binding from the service WSDL and added a call to <code>soap_ssl_client_context()</code> to set up the SSL connection, but I'm running into a problem.</p>
  
  <p>I presumed that I should use the path to <strong>my_key.pem</strong> as the <code>keyfile</code> parameter, but using gdb, I can see that it is the call to <code>SSL_CTX_use_certificate_chain_file()</code> which is failing.
  gSOAP passes the <code>keyfile</code> parameter as the <code>file</code> argument to this call.</p>
  
  <p>Any help is much appreciated.</p>