title: ACE SSL Error: peer did not return a certificate
body: <p>I am making both server and client for an application, using the ACE library with OpenSSL. I am trying to get mutual authentication to work, o the server will only accept connections from trusted clients.</p>
  
  <p>I have generated a CA key and cert, and used it to sign a server cert and a client cert (each with their own keys also). I seem to be loading the trusted store correctly, but I keep getting the error "peer did not return a certificate" during handshake.</p>
  
  <h3>Server side code:</h3>
  
  <pre><code>ACE_SSL_Context *context = ACE_SSL_Context::instance();
  
  context-&gt;set_mode(ACE_SSL_Context::SSLv23_server);
  context-&gt;certificate("../ACE-server/server_cert.pem", SSL_FILETYPE_PEM);
  context-&gt;private_key("../ACE-server/server_key.pem", SSL_FILETYPE_PEM);
  
  if (context-&gt;load_trusted_ca("../ACE-server/trusted.pem", 0, false) == -1) {
      ACE_ERROR_RETURN((LM_ERROR, "%p\n", "load_trusted_ca"), -1);
  }
  
  if (context-&gt;have_trusted_ca() &lt;= 0) {
      ACE_ERROR_RETURN((LM_ERROR, "%p\n", "have_trusted_ca"), -1);
  }
  </code></pre>
  
  <h3>Client side code:</h3>
  
  <pre><code>ACE_SSL_Context *context = ACE_SSL_Context::instance();
  context-&gt;set_mode(ACE_SSL_Context::SSLv23_client);
  context-&gt;certificate("../ACE-client/client_cert.pem", SSL_FILETYPE_PEM);
  context-&gt;private_key("../ACE-client/client_key.pem", SSL_FILETYPE_PEM);
  </code></pre>
  
  <p>I generated the certificates following these instructions: <a href="https://blog.codeship.com/how-to-set-up-mutual-tls-authentication/" rel="nofollow noreferrer">https://blog.codeship.com/how-to-set-up-mutual-tls-authentication/</a></p>
  
  <p>And checking online, I found that if the .crt and .key files are readable, they should already be in .pem format and there is no need to convert them. So I just changed the extension and used them here.</p>
  
  <p>Any help is appreciated!</p>