< prev index next >

test/javax/net/ssl/TLSv11/GenericBlockCipher.java

Print this page
rev 14346 : 8202343: Disable TLS 1.0 and 1.1
Reviewed-by: xuelei, dfuchs, coffeys, sgehwolf
   1 /*
   2  * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /*
  27  * @test
  28  * @bug 4873188
  29  * @summary Support TLS 1.1

  30  * @run main/othervm GenericBlockCipher
  31  *
  32  *     SunJSSE does not support dynamic system properties, no way to re-use
  33  *     system properties in samevm/agentvm mode.
  34  *
  35  * @author Xuelei Fan
  36  */
  37 
  38 import java.io.*;
  39 import java.net.*;
  40 import javax.net.ssl.*;
  41 
  42 public class GenericBlockCipher {
  43 
  44     /*
  45      * =============================================================
  46      * Set the various variables needed for the tests, then
  47      * specify what tests to run on each side.
  48      */
  49 


 143 
 144         sslOS.write('B');
 145         sslOS.flush();
 146         sslIS.read();
 147 
 148         sslSocket.close();
 149     }
 150 
 151     /*
 152      * =============================================================
 153      * The remainder is just support stuff
 154      */
 155 
 156     // use any free port by default
 157     volatile int serverPort = 0;
 158 
 159     volatile Exception serverException = null;
 160     volatile Exception clientException = null;
 161 
 162     public static void main(String[] args) throws Exception {



 163         String keyFilename =
 164             System.getProperty("test.src", ".") + "/" + pathToStores +
 165                 "/" + keyStoreFile;
 166         String trustFilename =
 167             System.getProperty("test.src", ".") + "/" + pathToStores +
 168                 "/" + trustStoreFile;
 169 
 170         System.setProperty("javax.net.ssl.keyStore", keyFilename);
 171         System.setProperty("javax.net.ssl.keyStorePassword", passwd);
 172         System.setProperty("javax.net.ssl.trustStore", trustFilename);
 173         System.setProperty("javax.net.ssl.trustStorePassword", passwd);
 174 
 175         if (debug)
 176             System.setProperty("javax.net.debug", "all");
 177 
 178         /*
 179          * Start the tests.
 180          */
 181         new GenericBlockCipher();
 182     }


   1 /*
   2  * Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /*
  27  * @test
  28  * @bug 4873188
  29  * @summary Support TLS 1.1
  30  * @library /lib/security
  31  * @run main/othervm GenericBlockCipher
  32  *
  33  *     SunJSSE does not support dynamic system properties, no way to re-use
  34  *     system properties in samevm/agentvm mode.
  35  *
  36  * @author Xuelei Fan
  37  */
  38 
  39 import java.io.*;
  40 import java.net.*;
  41 import javax.net.ssl.*;
  42 
  43 public class GenericBlockCipher {
  44 
  45     /*
  46      * =============================================================
  47      * Set the various variables needed for the tests, then
  48      * specify what tests to run on each side.
  49      */
  50 


 144 
 145         sslOS.write('B');
 146         sslOS.flush();
 147         sslIS.read();
 148 
 149         sslSocket.close();
 150     }
 151 
 152     /*
 153      * =============================================================
 154      * The remainder is just support stuff
 155      */
 156 
 157     // use any free port by default
 158     volatile int serverPort = 0;
 159 
 160     volatile Exception serverException = null;
 161     volatile Exception clientException = null;
 162 
 163     public static void main(String[] args) throws Exception {
 164         // Re-enable TLSv1.1 since test depends on it.
 165         SecurityUtils.removeFromDisabledTlsAlgs("TLSv1.1");
 166 
 167         String keyFilename =
 168             System.getProperty("test.src", ".") + "/" + pathToStores +
 169                 "/" + keyStoreFile;
 170         String trustFilename =
 171             System.getProperty("test.src", ".") + "/" + pathToStores +
 172                 "/" + trustStoreFile;
 173 
 174         System.setProperty("javax.net.ssl.keyStore", keyFilename);
 175         System.setProperty("javax.net.ssl.keyStorePassword", passwd);
 176         System.setProperty("javax.net.ssl.trustStore", trustFilename);
 177         System.setProperty("javax.net.ssl.trustStorePassword", passwd);
 178 
 179         if (debug)
 180             System.setProperty("javax.net.debug", "all");
 181 
 182         /*
 183          * Start the tests.
 184          */
 185         new GenericBlockCipher();
 186     }


< prev index next >