title: Requirements for Successful SSL Communication
body: <p>I'm using thrift to write a C++ client which will call securely to the server (which is not written by me) written in java (code generated for both server and client using same thrift files). I'm a newbie in SSL communication. For the java server side, I imported the public key certificate of client to the server truststore (server-truststore.jks) to verify the client authenticity. I exported the public certificate from the server side keystore (server.jks) and used it in the client side to authenticate the server key certificate during the SSL handshake. If I list down what I did for the SSL communication:</p>
  
  <p>Server Side (java):</p>
  
  <ol>
  <li>exported the client's public key certificate to the server's truststore</li>
  </ol>
  
  <p>Cleint Side (C++):</p>
  
  <ol>
  <li>Loaded the server's public certificate which was exported from the server's keystore</li>
  <li>separately loaded the client's public key and private key (This is because I can't directly use a java key store since the client is written in c++) </li>
  </ol>
  
  <p>All the certificates used are self signed.</p>
  
  <p>So far I have been unsuccessful and got the following error continuously:</p>
  
  <pre><code>SSL_connect: certificate verify failed
  </code></pre>
  
  <p>I have two questions:</p>
  
  <ol>
  <li>Is the approach I used for SSL communication correct? If not, what is the correct one?</li>
  <li>Any possible reasons for this error?</li>
  </ol>
  
  <p>Thank you.</p>