Path: blob/master/test/jdk/javax/net/ssl/DTLS/CipherSuite.java
41152 views
/*1* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223// SunJSSE does not support dynamic system properties, no way to re-use24// system properties in samevm/agentvm mode.2526/*27* @test28* @bug 804375829* @key intermittent30* @summary Datagram Transport Layer Security (DTLS)31* @modules java.base/sun.security.util32* jdk.crypto.ec33* @library /test/lib34* @build DTLSOverDatagram35* @run main/othervm CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA36* @run main/othervm CipherSuite TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA25637* @run main/othervm CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA25638* @run main/othervm CipherSuite TLS_DHE_RSA_WITH_AES_128_CBC_SHA25639* @run main/othervm CipherSuite TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA40* @run main/othervm CipherSuite TLS_DHE_RSA_WITH_AES_128_CBC_SHA41* @run main/othervm CipherSuite TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA re-enable42* @run main/othervm CipherSuite TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA25643* @run main/othervm CipherSuite TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA25644* @run main/othervm CipherSuite TLS_RSA_WITH_AES_128_GCM_SHA25645* @run main/othervm CipherSuite TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA25646* @run main/othervm CipherSuite TLS_DHE_RSA_WITH_AES_128_GCM_SHA25647* @run main/othervm CipherSuite TLS_DHE_DSS_WITH_AES_128_GCM_SHA25648* @run main/othervm CipherSuite TLS_ECDH_RSA_WITH_AES_128_GCM_SHA25649*/5051import javax.net.ssl.SSLEngine;52import java.security.Security;5354/**55* Test common DTLS cipher suites.56*/57public class CipherSuite extends DTLSOverDatagram {5859// use the specific cipher suite60volatile static String cipherSuite;6162public static void main(String[] args) throws Exception {63if (args.length > 1 && "re-enable".equals(args[1])) {64Security.setProperty("jdk.tls.disabledAlgorithms", "");65}6667cipherSuite = args[0];6869CipherSuite testCase = new CipherSuite();70testCase.runTest(testCase);71}7273@Override74SSLEngine createSSLEngine(boolean isClient) throws Exception {75SSLEngine engine = super.createSSLEngine(isClient);7677if (isClient) {78engine.setEnabledCipherSuites(new String[]{cipherSuite});79}8081return engine;82}83}848586