1 /* 2 * Copyright (c) 2001, 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. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 1.3 01/03/08 26 * @bug 4330535 27 * @summary Client should follow suite order in 28 * SSLSocket.setEnabledCipherSuites() 29 * @run main/othervm CipherSuiteOrder 30 * 31 * SunJSSE does not support dynamic system properties, no way to re-use 32 * system properties in samevm/agentvm mode. 33 * @author Jaya Hangal 34 */ 35 36 import java.io.*; 37 import java.net.*; 38 import javax.net.ssl.*; 39 40 public class CipherSuiteOrder { 41 42 /* 43 * ============================================================= 44 * Set the various variables needed for the tests, then 45 * specify what tests to run on each side. 46 */ 47 48 /* 49 * Should we run the client or server in a separate thread? 50 * Both sides can throw exceptions, but do you have a preference 51 * as to which side should be the main thread. 52 */ 53 static boolean separateServerThread = true; 54 55 /* 56 * Where do we find the keystores? 57 */ 179 sslOS.write(80); 180 sslOS.flush(); 181 int read = sslIS.read(); 182 System.out.println("client read: " + read); 183 184 sslSocket.close(); 185 } 186 187 /* 188 * ============================================================= 189 * The remainder is just support stuff 190 */ 191 192 // use any free port by default 193 volatile int serverPort = 0; 194 195 volatile Exception serverException = null; 196 volatile Exception clientException = null; 197 198 public static void main(String[] args) throws Exception { 199 String keyFilename = 200 System.getProperty("test.src", "./") + "/" + pathToStores + 201 "/" + keyStoreFile; 202 String trustFilename = 203 System.getProperty("test.src", "./") + "/" + pathToStores + 204 "/" + trustStoreFile; 205 206 System.setProperty("javax.net.ssl.keyStore", keyFilename); 207 System.setProperty("javax.net.ssl.keyStorePassword", passwd); 208 System.setProperty("javax.net.ssl.trustStore", trustFilename); 209 System.setProperty("javax.net.ssl.trustStorePassword", passwd); 210 211 if (debug) 212 System.setProperty("javax.net.debug", "all"); 213 214 /* 215 * Start the tests. 216 */ 217 new CipherSuiteOrder(); 218 } | 1 /* 2 * Copyright (c) 2001, 2015, 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. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 1.3 01/03/08 26 * @bug 4330535 27 * @summary Client should follow suite order in 28 * SSLSocket.setEnabledCipherSuites() 29 * @run main/othervm CipherSuiteOrder 30 * 31 * SunJSSE does not support dynamic system properties, no way to re-use 32 * system properties in samevm/agentvm mode. 33 * @author Jaya Hangal 34 */ 35 36 import java.io.*; 37 import java.security.Security; 38 import javax.net.ssl.*; 39 40 public class CipherSuiteOrder { 41 42 /* 43 * ============================================================= 44 * Set the various variables needed for the tests, then 45 * specify what tests to run on each side. 46 */ 47 48 /* 49 * Should we run the client or server in a separate thread? 50 * Both sides can throw exceptions, but do you have a preference 51 * as to which side should be the main thread. 52 */ 53 static boolean separateServerThread = true; 54 55 /* 56 * Where do we find the keystores? 57 */ 179 sslOS.write(80); 180 sslOS.flush(); 181 int read = sslIS.read(); 182 System.out.println("client read: " + read); 183 184 sslSocket.close(); 185 } 186 187 /* 188 * ============================================================= 189 * The remainder is just support stuff 190 */ 191 192 // use any free port by default 193 volatile int serverPort = 0; 194 195 volatile Exception serverException = null; 196 volatile Exception clientException = null; 197 198 public static void main(String[] args) throws Exception { 199 // reset the security property to make sure that the algorithms 200 // and keys used in this test are not disabled. 201 Security.setProperty("jdk.tls.disabledAlgorithms", ""); 202 203 String keyFilename = 204 System.getProperty("test.src", "./") + "/" + pathToStores + 205 "/" + keyStoreFile; 206 String trustFilename = 207 System.getProperty("test.src", "./") + "/" + pathToStores + 208 "/" + trustStoreFile; 209 210 System.setProperty("javax.net.ssl.keyStore", keyFilename); 211 System.setProperty("javax.net.ssl.keyStorePassword", passwd); 212 System.setProperty("javax.net.ssl.trustStore", trustFilename); 213 System.setProperty("javax.net.ssl.trustStorePassword", passwd); 214 215 if (debug) 216 System.setProperty("javax.net.debug", "all"); 217 218 /* 219 * Start the tests. 220 */ 221 new CipherSuiteOrder(); 222 } |