TL;DR: in 1.8.0_60, which to be clear is the current (binary-only) Oracle release downloaded from java.sun.com for the OS X platform, the default configuration of a SSLSocket created with the generic SSLContext.getInstance("TLS") or SSLContext.getInstance("SSL") includes v1.2 by default. This is not the case in any of the other examples
Here's a small test class and the results from a few different JVMs I have access to:
--- cut here --- ssl.SSLContext; ssl.SSLSocket;
import javax.net.
import javax.net.
public class TLSVersions
{
public static void main( String[] args )
{
String vendor = System.getProperty( "java.vendor" );
String version = System.getProperty( "java.version" );
System. out.println( String.format( "java.vendor\ tjava.version\ tproto\ tenabledProtoco ls" ) ); getInstance( protocol );
context. init( null, null, null ); getSocketFactor y().createSocke t(); getEnabledProto cols() );
System. out.println( String.format( "%s\t%s\t%s\t%s", vendor, version, protocol, enabledProtocols ) );
System. out.println( String.format( "%s\t%s\t%s\t%s", vendor, version, protocol, e.toString() ) );
for ( String protocol : new String[]{ "TLSv1.2", "TLSv1.1", "TLSv1", "TLS", "SSL" } )
{
try
{
SSLContext context = SSLContext.
SSLSocket socket = ( SSLSocket ) context.
String enabledProtocols = join( socket.
}
catch ( Exception e )
{
}
}
}
private static String join( String[] array )
{
if ( array.length == 0 )
{
return "";
}
StringBuilder sb = new StringBuilder( array[ 0 ] );
for ( int i = 1; i < array.length; i++ )
{
sb.append( ',' ).append( array[ i ] );
}
return sb.toString();
}
}
--- cut here ---
java.vendor or dpkg java.version proto enabledProtocols NoSuchAlgorithm Exception: TLSv1.2 SSLContext not available NoSuchAlgorithm Exception: TLSv1.1 SSLContext not available SSLv3,TLSv1 SSLv3,TLSv1 SSLv3,TLSv1 1,TLSv1. 2 1,TLSv1. 2 1,TLSv1. 2 1,TLSv1. 2 13.8-0ubuntu1 1.6.0_36 TLSv1.2 java.security. NoSuchAlgorithm Exception: TLSv1.2 SSLContext not available 13.8-0ubuntu1 1.6.0_36 TLSv1.1 SSLv3,TLSv1,TLSv1.1 13.8-0ubuntu1 1.6.0_36 TLSv1 SSLv3,TLSv1 13.8-0ubuntu1 1.6.0_36 TLS SSLv3,TLSv1 13.8-0ubuntu1 1.6.0_36 SSL SSLv3,TLSv1 1,TLSv1. 2
Apple Inc. 1.6.0_37 TLSv1.2 java.security.
Apple Inc. 1.6.0_37 TLSv1.1 java.security.
Apple Inc. 1.6.0_37 TLSv1 SSLv2Hello,
Apple Inc. 1.6.0_37 TLS SSLv2Hello,
Apple Inc. 1.6.0_37 SSL SSLv2Hello,
Oracle Corporation 1.7.0_80 TLSv1.2 TLSv1,TLSv1.
Oracle Corporation 1.7.0_80 TLSv1.1 TLSv1,TLSv1.1
Oracle Corporation 1.7.0_80 TLSv1 TLSv1
Oracle Corporation 1.7.0_80 TLS TLSv1
Oracle Corporation 1.7.0_80 SSL TLSv1
Oracle Corporation 1.8.0_60 TLSv1.2 TLSv1,TLSv1.
Oracle Corporation 1.8.0_60 TLSv1.1 TLSv1,TLSv1.1
Oracle Corporation 1.8.0_60 TLSv1 TLSv1
Oracle Corporation 1.8.0_60 TLS TLSv1,TLSv1.
Oracle Corporation 1.8.0_60 SSL TLSv1,TLSv1.
6b36-1.
6b36-1.
6b36-1.
6b36-1.
6b36-1.
7u79-2.5.6-0ubuntu1 1.7.0_79 TLSv1.2 TLSv1,TLSv1.
7u79-2.5.6-0ubuntu1 1.7.0_79 TLSv1.1 TLSv1,TLSv1.1
7u79-2.5.6-0ubuntu1 1.7.0_79 TLSv1 TLSv1
7u79-2.5.6-0ubuntu1 1.7.0_79 TLS TLSv1
7u79-2.5.6-0ubuntu1 1.7.0_79 SSL TLSv1
6b36-1. 13.8-0ubuntu2~ ppa2 1.6.0_36 TLSv1.2 java.security. NoSuchAlgorithm Exception: TLSv1.2 SSLContext not available 13.8-0ubuntu2~ ppa2 1.6.0_36 TLSv1.1 SSLv3,TLSv1,TLSv1.1 13.8-0ubuntu2~ ppa2 1.6.0_36 TLSv1 SSLv3,TLSv1 13.8-0ubuntu2~ ppa2 1.6.0_36 TLS SSLv3,TLSv1 13.8-0ubuntu2~ ppa2 1.6.0_36 SSL SSLv3,TLSv1
6b36-1.
6b36-1.
6b36-1.
6b36-1.
TL;DR: in 1.8.0_60, which to be clear is the current (binary-only) Oracle release downloaded from java.sun.com for the OS X platform, the default configuration of a SSLSocket created with the generic SSLContext. getInstance( "TLS") or SSLContext. getInstance( "SSL") includes v1.2 by default. This is not the case in any of the other examples