title: Resteasy Client with SSL client authentication does not work
body: <p>I have p12 client certificate. I have host with SSL certificate which is signed by RapidSSL and which added my p12 cert for client authentication. I use Resteasy Client to access to this host. The code below which I use to connect:</p>
  
  <pre><code>ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
  KeyStore keyStore = KeyStore.getInstance("PKCS12");
  keyStore.load(classLoader.getResourceAsStream("my_cert.p12"), keyPass.toCharArray());
  SSLContext sslContext = SSLContexts.custom()
          .loadKeyMaterial(keyStore, "my_pass".toCharArray())
          .build();
  ResteasyClientBuilder clientBuilder = (ResteasyClientBuilder) ResteasyClientBuilder.newBuilder();
  clientBuilder.sslContext(sslContext);
  Client client = clientBuilder.build();
  WebTarget webTarget = client.target("https://client_auth.somehost.com/wrong/path");
  Response response = webTarget.request().get();
  Assert.assertEquals(404, response.getStatus());
  </code></pre>
  
  <p>No exception, no other errors. It just returns 403 for any URLs.</p>
  
  <p>To check, that my cert.p12 is correct I've tried to connect using curl.</p>
  
  <ol>
  <li><p>convert p12 to pem</p>
  
  <p>openssl pkcs12 -in my_cert.p12 -out my_cert.pem -clcerts</p></li>
  <li><p>try to connect using curl</p>
  
  <p>curl -v -1 --cert my_cert.pem:my_pass "<a href="https://client_auth.somehost.com/wrong/path" rel="nofollow">https://client_auth.somehost.com/wrong/path</a>"</p></li>
  </ol>
  
  <p>the result:</p>
  
  <pre><code>curl: (60) SSL certificate problem: self signed certificate in certificate chain
  </code></pre>
  
  <ol start="3">
  <li><p>download through browser host Certificate and specify it as trusted</p>
  
  <p>curl -v -1 --cert my_cert.pem:my_pass --cacert public_CA.crt "<a href="https://client_auth.somehost.com/wrong/path" rel="nofollow">https://client_auth.somehost.com/wrong/path</a>"</p></li>
  </ol>
  
  <p>the result was:</p>
  
  <pre><code>HTTP/1.1 404 Not Found
  </code></pre>
  
  <p>So, it means that my_cert is OK. So why it does not work from the java code?</p>
  
  <p>Java version "1.8.0_31" 
  Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
  Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)</p>
  
  <h2>Update</h2>
  
  <p>I've rewrote code to java native SSL, and got absolutely the same result.
  Also, I found information, that host based on apache with openSSL on CentOS.</p>