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.
I have added the following java parameter so that tls1.2 is highest priority.
-Dhttps.protocols=TLSv1.2
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.
I did some play around the java.security file in jdk/jre/lib/security folder.
i currently have following disabled algorithms:
jdk.certpath.disabledAlgorithms= MD2, MD4, MD5, SHA224, DSA, EC keySize < 256, RSA keySize < 2048, SHA1 keysize < 224
jdk.tls.disabledAlgorithms=DSA, DHE, EC keySize < 256, RSA keySize < 2048, SHA1 keysize < 224
I am using java 7, update 79. I am not inclined towards intercepting each connection and checking the tls version.
My server certificate is 2048 bit generated with MD5 with RSA algorithm.
If the disabled algorithm list has RSA in place of RSA keySize < 2048, I get the SSLHandShakeError with error message : no cipher suites in common.
please help how to make java accept only tls 1.2 connections.
解决方案
I found a solution for this. I set the
jdk.tls.disabledAlgorithms= SSLv2Hello, SSLv3, TLSv1, TLSv1.1
in the file jre/lib/security/java.security on the server.
After setting this, server only accepts the TLS1.2 connection and reject lower security protocol versions.