title: SSL Handshake Failed - Java 1.8
body: <p>Just letting folks know about an issue I had that many seemed to have had after upgrading to Java 1.8.  Not all of the solutions are the same hence posting how I resolved this.</p>
  
  <p>But first... This is not a solution worthy of production systems since security is being effectively downgraded.  However, if you are blocked testing etc. it is probably quite suitable.</p>
  
  <p>My issue was that no matter what I did... enabled SSLv3 etc. I always received </p>
  
  <pre><code>"javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure".
  </code></pre>
  
  <p>Here are the steps I took to 'solve' this.</p>
  
  <p>First, I discovered which cipher the server was using.  I did this via openssl.</p>
  
  <pre><code>openssl s_client -host yourproblemhost.com -port 443
  </code></pre>
  
  <p>This yields (at the end...)</p>
  
  <pre><code>SSL-Session:
      Protocol  : TLSv1.2
      Cipher    : RC4-MD5
  </code></pre>
  
  <p>Now.. what do we use 'Java-wise' to enable that cipher?</p>
  
  <p><a href="https://docs.oracle.com/cd/E19728-01/820-2550/cipher_suites.html" rel="noreferrer">Oracle link</a></p>
  
  <p>In that link, it has the names and their Java counterpart.  So for RC4-MD5, we have SSL_RSA_WITH_RC4_128_MD5.</p>
  
  <p>ok good.  Now I added a System property.</p>
  
  <pre><code>-Dhttps.cipherSuites=SSL_RSA_WITH_RC4_128_MD5
  </code></pre>
  
  <p>And in my code...</p>
  
  <pre><code>Security.setProperty("jdk.tls.disabledAlgorithms", "" /*disabledAlgorithms */ );
  </code></pre>
  
  <p>Again.. <strong>this is an absolute last resort 'fix'</strong>... But if you're hitting your head aganst a wall to get it running (for testing), I hope it comes in useful.</p>