← Back to team overview

openjdk team mailing list archive

[Bug 1314116] [NEW] SSL returned when requesting TLS Context

 

Public bug reported:

OpenJDK-7 provides a SSL context when requesting a TLS context.

According to the JavaDocs,  'SSLContext.getInstance("TLS")' should
return a TLS context, and I should *not* receive a context capable of
SSL
(http://docs.oracle.com/javase/7/docs/api/javax/net/ssl/SSLContext.html#getInstance%28java.lang.String%29):

    Returns a SSLContext object that implements the specified secure
socket protocol.

And the docs on 'getEnabledProtocols'
(http://docs.oracle.com/javase/7/docs/api/javax/net/ssl/SSLSocket.html#getEnabledProtocols%28%29):

    Returns the names of the protocol versions which are currently
enabled for use on this connection.

**********

$ javac ProtocolTest.java && java ProtocolTest
Supported Protocols: 5
  SSLv2Hello
  SSLv3
  TLSv1
  TLSv1.1
  TLSv1.2
Enabled Protocols: 2
  SSLv3
  TLSv1

**********

Ubuntu 14.04 (x64), fully patched:

$ uname -a
Linux ubuntu 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

**********

$ java -version
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.6) (7u51-2.4.6-1ubuntu4)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

**********

SSLContext context = SSLContext.getInstance("TLS");
context.init(null,null,null);

SSLSocketFactory factory = (SSLSocketFactory)context.getSocketFactory();
SSLSocket socket = (SSLSocket)factory.createSocket();

String[] protocols = socket.getSupportedProtocols();

System.out.println("Supported Protocols: " + protocols.length);
for(int i = 0; i < protocols.length; i++)
{
     System.out.println("  " + protocols[i]);
}

protocols = socket.getEnabledProtocols();

System.out.println("Enabled Protocols: " + protocols.length);
for(int i = 0; i < protocols.length; i++)
{
     System.out.println("  " + protocols[i]);
}

** Affects: openjdk-7 (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "Program to test supported and enabled protocols."
   https://bugs.launchpad.net/bugs/1314116/+attachment/4100238/+files/ProtocolTest.java

-- 
You received this bug notification because you are a member of OpenJDK,
which is subscribed to openjdk-7 in Ubuntu.
https://bugs.launchpad.net/bugs/1314116

Title:
  SSL returned when requesting TLS Context

Status in “openjdk-7” package in Ubuntu:
  New

Bug description:
  OpenJDK-7 provides a SSL context when requesting a TLS context.

  According to the JavaDocs,  'SSLContext.getInstance("TLS")' should
  return a TLS context, and I should *not* receive a context capable of
  SSL
  (http://docs.oracle.com/javase/7/docs/api/javax/net/ssl/SSLContext.html#getInstance%28java.lang.String%29):

      Returns a SSLContext object that implements the specified secure
  socket protocol.

  And the docs on 'getEnabledProtocols'
  (http://docs.oracle.com/javase/7/docs/api/javax/net/ssl/SSLSocket.html#getEnabledProtocols%28%29):

      Returns the names of the protocol versions which are currently
  enabled for use on this connection.

  **********

  $ javac ProtocolTest.java && java ProtocolTest
  Supported Protocols: 5
    SSLv2Hello
    SSLv3
    TLSv1
    TLSv1.1
    TLSv1.2
  Enabled Protocols: 2
    SSLv3
    TLSv1

  **********

  Ubuntu 14.04 (x64), fully patched:

  $ uname -a
  Linux ubuntu 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

  **********

  $ java -version
  java version "1.7.0_51"
  OpenJDK Runtime Environment (IcedTea 2.4.6) (7u51-2.4.6-1ubuntu4)
  OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

  **********

  SSLContext context = SSLContext.getInstance("TLS");
  context.init(null,null,null);

  SSLSocketFactory factory = (SSLSocketFactory)context.getSocketFactory();
  SSLSocket socket = (SSLSocket)factory.createSocket();

  String[] protocols = socket.getSupportedProtocols();

  System.out.println("Supported Protocols: " + protocols.length);
  for(int i = 0; i < protocols.length; i++)
  {
       System.out.println("  " + protocols[i]);
  }

  protocols = socket.getEnabledProtocols();

  System.out.println("Enabled Protocols: " + protocols.length);
  for(int i = 0; i < protocols.length; i++)
  {
       System.out.println("  " + protocols[i]);
  }

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openjdk-7/+bug/1314116/+subscriptions


Follow ups

References