test/jdk/sun/security/ssl/CipherSuite/SupportedGroups.java
branchJDK-8171279-XDH-TLS-branch-2
changeset 56865 05c7b789076f
child 56866 d6feac8fbdff
equal deleted inserted replaced
56864:ec60669bc501 56865:05c7b789076f
       
     1 /*
       
     2  * Copyright (c) 2001, 2017, 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
       
    26  * @bug 8171279
       
    27  * @library /javax/net/ssl/templates
       
    28  * @summary Test TLS connection with each individual supported group
       
    29  * @run main/othervm SupportedGroups fail false
       
    30  * @run main/othervm SupportedGroups secp256r1
       
    31  * @run main/othervm SupportedGroups secp384r1
       
    32  * @run main/othervm SupportedGroups secp521r1
       
    33  * @run main/othervm SupportedGroups x25519
       
    34  * @run main/othervm SupportedGroups x448
       
    35  * @run main/othervm SupportedGroups ffdhe2048
       
    36  * @run main/othervm SupportedGroups ffdhe3072
       
    37  * @run main/othervm SupportedGroups ffdhe4096
       
    38  * @run main/othervm SupportedGroups ffdhe6144
       
    39  * @run main/othervm SupportedGroups ffdhe8192
       
    40  */
       
    41 
       
    42 
       
    43 public class SupportedGroups extends SSLSocketTemplate {
       
    44     /*
       
    45      * Run the test case.
       
    46      */
       
    47     public static void main(String[] args) throws Exception {
       
    48         System.setProperty("jdk.tls.namedGroups", args[0]);
       
    49 
       
    50         boolean shouldPass = true;
       
    51         if (args.length > 1) {
       
    52             shouldPass = Boolean.parseBoolean(args[1]);
       
    53         }
       
    54 
       
    55         boolean passed;
       
    56         try {
       
    57             (new SupportedGroups()).run();
       
    58             passed = true;
       
    59         } catch (Throwable ex) {
       
    60             passed = false;
       
    61         }
       
    62 
       
    63         if (passed != shouldPass) {
       
    64             throw new RuntimeException("passed: " + passed +
       
    65                 ", should pass: " + shouldPass);
       
    66         }
       
    67     }
       
    68 }