title: How to force java server to accept only tls 1.2 and reject tls 1.0 and tls 1.1 connections
body: <p>I have a HTTPS web service running on Java 7. I need to make changes so that this service only accepts TLS1.2 connection and reject SSL3, TLS1.0 and TLS1.1.</p>
  <p>I have added the following Java parameter so that TLS1.2 is the highest priority.</p>
  <pre><code>-Dhttps.protocols=TLSv1.2
  </code></pre>
  <p>but it also accepts the TLS1.0 connections from Java clients. If the client is also running with above Java parameter, the connection is TLS1.2 but if the client is running without this parameter, the connections is TLS1.0.</p>
  <p>I did some play around the <code>java.security</code> file in <code>jdk/jre/lib/security</code> folder.</p>
  <p>I currently have following disabled algorithms:</p>
  <pre><code>jdk.certpath.disabledAlgorithms= MD2, MD4, MD5, SHA224, DSA, EC keySize &lt; 256, RSA keySize &lt; 2048, SHA1 keysize &lt; 224
  jdk.tls.disabledAlgorithms=DSA, DHE, EC keySize &lt; 256, RSA keySize &lt; 2048, SHA1 keysize &lt; 224
  </code></pre>
  <p>I am using Java 7 update 79. I am not inclined towards intercepting each connection and checking the TLS version.</p>
  <p>My server certificate is 2048 bit generated with MD5 with RSA algorithm.</p>
  <p>If the disabled algorithm list has RSA in place of RSA keySize &lt; 2048, I get the <code>SSLHandShakeError</code> with error message:</p>
  <blockquote>
  <p>no cipher suites in common.</p>
  </blockquote>
  <p>My test program is running the HTTP server from following URL:
  <a href="http://www.herongyang.com/JDK/HTTPS-HttpsEchoer-Better-HTTPS-Server.html" rel="noreferrer">http://www.herongyang.com/JDK/HTTPS-HttpsEchoer-Better-HTTPS-Server.html</a></p>
  <p>Please help how to make java accept only TLS1.2 connections.</p>