This discussion is archived
0 Replies Latest reply: Jan 28, 2009 6:02 AM by 843851 RSS

SSL message with unsupported version occured

843851 Newbie
Currently Being Moderated
Hi!

So I am trying to learn some secure communications implementations in Xlets and called the folowing main method in a Xlet running in A STB with MHP 1.1:
public static void main(String[] args) throws UnknownHostException, IOException {
          // TODO Auto-generated method stub
          String host = "www.verisign.co.uk";
          int port = 443;
          
          
          
          SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault();
          SSLSocket socket = (SSLSocket) factory.createSocket(host, port);
          socket.setSoTimeout(10000);
          try {
               System.out.println("Starting SSL handshake...");
               socket.addHandshakeCompletedListener(new MyHandshakeListener());
               socket.startHandshake();
               System.out.println();
               System.out.println("No errors, certificate is already trusted");
          //     System.out.println("Just connected to "
               //          + socket.getRemoteSocketAddress());

               PrintWriter out = new PrintWriter(new OutputStreamWriter(socket
                         .getOutputStream()));
               out.println("GET "
                         + "https://www.verisign.co.uk/"
                         + " HTTP/1.1");
               out.println("Connection: Closed");
               out.println();
               out.flush();

               BufferedReader input = new BufferedReader(new InputStreamReader(
                         socket.getInputStream()));

               String line;

               while ((line = input.readLine()) != null) {
                    System.out.println(line);
               }

               out.close();
               input.close();

               socket.close();
          } catch (SSLException e) {
               System.out.println();
               e.printStackTrace(System.out);
          }
     }
But I am getting the exception below and I have not found too much help. If anyone knows how to solve this!

javax.net.ssl.SSLProtocolException: SSL message with unsupported version occured
[1#7:1] at tv.osmosys.security.net.ssl.SSLInputRecord.read(Ljava/io/InputStream;)V(Unknown Source)
[1#7:1] at tv.osmosys.security.net.ssl.SSLInputRecord.readProtocolRecord(Ljava/io/InputStream;Ltv/osmosys/security/net/ssl/CBCCipher;Ltv/osmosys/security/net/ssl/MAC;)V(Unknown Source)
[1#7:1] at tv.osmosys.security.net.ssl.SSLSocketImpl.processRecord(Ltv/osmosys/security/net/ssl/SSLInputRecord;Z)V(Unknown Source)
[1#7:1] at tv.osmosys.security.net.ssl.SSLSocketImpl.flushData(Ltv/osmosys/security/net/ssl/SSLOutputRecord;)V(Unknown Source)
[1#7:1] at tv.osmosys.security.net.ssl.AppDataOutputStream.flush()V(Unknown Source)
[1#7:1] at tv.osmosys.security.net.ssl.SSLSocketImpl.startHandshake()V(Unknown Source)
[1#7:1] at test.TestValidHttps.main([Ljava/lang/String;)V(Unknown Source)