jdk/test/javax/net/ssl/sanity/ciphersuites/CheckCipherSuites.java
author xuelei
Wed, 05 Mar 2014 07:24:34 +0000
changeset 23052 241885315119
parent 7043 jdk/test/sun/security/ssl/sanity/ciphersuites/CheckCipherSuites.java@5e2d1edeb2c7
permissions -rw-r--r--
8032473: Restructure JSSE regression test hierarchy in jdk test Reviewed-by: weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5166
diff changeset
     2
 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5166
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5166
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5166
diff changeset
    21
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 * @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * @bug 4750141 4895631
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * @summary Check enabled and supported ciphersuites are correct
7043
5e2d1edeb2c7 6916074: Add support for TLS 1.2
xuelei
parents: 6856
diff changeset
    28
 * @ignore JSSE supported cipher suites are changed with CR 6916074,
5e2d1edeb2c7 6916074: Add support for TLS 1.2
xuelei
parents: 6856
diff changeset
    29
 *     need to update this test case in JDK 7 soon
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.net.ssl.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import javax.crypto.Cipher;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import javax.crypto.spec.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
public class CheckCipherSuites {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
    private final static String[] ENABLED_DEFAULT = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
        "SSL_RSA_WITH_RC4_128_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
        "SSL_RSA_WITH_RC4_128_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
        "TLS_RSA_WITH_AES_128_CBC_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    45
        "TLS_ECDH_ECDSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    46
        "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    47
        "TLS_ECDH_RSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    48
        "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    49
        "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    50
        "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    51
        "TLS_ECDHE_RSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    52
        "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        "TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
        "TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        "SSL_RSA_WITH_3DES_EDE_CBC_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    56
        "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    57
        "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    58
        "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    59
        "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        "SSL_RSA_WITH_DES_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        "SSL_DHE_RSA_WITH_DES_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        "SSL_DHE_DSS_WITH_DES_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        "SSL_RSA_EXPORT_WITH_RC4_40_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA",
6856
533f4ad71f88 6914943: Implement final TLS renegotiation fix
xuelei
parents: 5506
diff changeset
    69
        "TLS_EMPTY_RENEGOTIATION_INFO_SCSV",
533f4ad71f88 6914943: Implement final TLS renegotiation fix
xuelei
parents: 5506
diff changeset
    70
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    private final static String[] ENABLED_UNLIMITED = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        "SSL_RSA_WITH_RC4_128_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        "SSL_RSA_WITH_RC4_128_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        "TLS_RSA_WITH_AES_128_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        "TLS_RSA_WITH_AES_256_CBC_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    78
        "TLS_ECDH_ECDSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    79
        "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    80
        "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    81
        "TLS_ECDH_RSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    82
        "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    83
        "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    84
        "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    85
        "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    86
        "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    87
        "TLS_ECDHE_RSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    88
        "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    89
        "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        "TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        "TLS_DHE_RSA_WITH_AES_256_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        "TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        "TLS_DHE_DSS_WITH_AES_256_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        "SSL_RSA_WITH_3DES_EDE_CBC_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    95
        "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    96
        "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    97
        "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
    98
        "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        "SSL_RSA_WITH_DES_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        "SSL_DHE_RSA_WITH_DES_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        "SSL_DHE_DSS_WITH_DES_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        "SSL_RSA_EXPORT_WITH_RC4_40_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA",
6856
533f4ad71f88 6914943: Implement final TLS renegotiation fix
xuelei
parents: 5506
diff changeset
   108
        "TLS_EMPTY_RENEGOTIATION_INFO_SCSV",
533f4ad71f88 6914943: Implement final TLS renegotiation fix
xuelei
parents: 5506
diff changeset
   109
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    // supported ciphersuites using default JCE policy jurisdiction files
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    // AES/256 unavailable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    private final static String[] SUPPORTED_DEFAULT = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        "SSL_RSA_WITH_RC4_128_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        "SSL_RSA_WITH_RC4_128_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        "TLS_RSA_WITH_AES_128_CBC_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   118
        "TLS_ECDH_ECDSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   119
        "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   120
        "TLS_ECDH_RSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   121
        "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   122
        "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   123
        "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   124
        "TLS_ECDHE_RSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   125
        "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        "TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        "TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        "SSL_RSA_WITH_3DES_EDE_CBC_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   129
        "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   130
        "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   131
        "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   132
        "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        "SSL_RSA_WITH_DES_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        "SSL_DHE_RSA_WITH_DES_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        "SSL_DHE_DSS_WITH_DES_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        "SSL_RSA_EXPORT_WITH_RC4_40_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA",
6856
533f4ad71f88 6914943: Implement final TLS renegotiation fix
xuelei
parents: 5506
diff changeset
   142
        "TLS_EMPTY_RENEGOTIATION_INFO_SCSV",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   143
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        "SSL_RSA_WITH_NULL_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        "SSL_RSA_WITH_NULL_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   146
        "TLS_ECDH_ECDSA_WITH_NULL_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   147
        "TLS_ECDH_RSA_WITH_NULL_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   148
        "TLS_ECDHE_ECDSA_WITH_NULL_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   149
        "TLS_ECDHE_RSA_WITH_NULL_SHA",
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        "SSL_DH_anon_WITH_RC4_128_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        "TLS_DH_anon_WITH_AES_128_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        "SSL_DH_anon_WITH_DES_CBC_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   154
        "TLS_ECDH_anon_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   155
        "TLS_ECDH_anon_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   156
        "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA",
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   159
        "TLS_ECDH_anon_WITH_NULL_SHA",
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        "TLS_KRB5_WITH_RC4_128_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        "TLS_KRB5_WITH_RC4_128_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        "TLS_KRB5_WITH_3DES_EDE_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        "TLS_KRB5_WITH_3DES_EDE_CBC_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        "TLS_KRB5_WITH_DES_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        "TLS_KRB5_WITH_DES_CBC_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        "TLS_KRB5_EXPORT_WITH_RC4_40_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        "TLS_KRB5_EXPORT_WITH_RC4_40_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        "TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   169
        "TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5",
6856
533f4ad71f88 6914943: Implement final TLS renegotiation fix
xuelei
parents: 5506
diff changeset
   170
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    // supported ciphersuites using unlimited JCE policy jurisdiction files
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    // AES/256 available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    private final static String[] SUPPORTED_UNLIMITED = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        "SSL_RSA_WITH_RC4_128_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        "SSL_RSA_WITH_RC4_128_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        "TLS_RSA_WITH_AES_128_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        "TLS_RSA_WITH_AES_256_CBC_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   180
        "TLS_ECDH_ECDSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   181
        "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   182
        "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   183
        "TLS_ECDH_RSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   184
        "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   185
        "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   186
        "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   187
        "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   188
        "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   189
        "TLS_ECDHE_RSA_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   190
        "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   191
        "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        "TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        "TLS_DHE_RSA_WITH_AES_256_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        "TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        "TLS_DHE_DSS_WITH_AES_256_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        "SSL_RSA_WITH_3DES_EDE_CBC_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   197
        "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   198
        "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   199
        "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   200
        "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        "SSL_RSA_WITH_DES_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        "SSL_DHE_RSA_WITH_DES_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        "SSL_DHE_DSS_WITH_DES_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        "SSL_RSA_EXPORT_WITH_RC4_40_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA",
6856
533f4ad71f88 6914943: Implement final TLS renegotiation fix
xuelei
parents: 5506
diff changeset
   210
        "TLS_EMPTY_RENEGOTIATION_INFO_SCSV",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   211
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        "SSL_RSA_WITH_NULL_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        "SSL_RSA_WITH_NULL_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   214
        "TLS_ECDH_ECDSA_WITH_NULL_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   215
        "TLS_ECDH_RSA_WITH_NULL_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   216
        "TLS_ECDHE_ECDSA_WITH_NULL_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   217
        "TLS_ECDHE_RSA_WITH_NULL_SHA",
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        "SSL_DH_anon_WITH_RC4_128_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        "TLS_DH_anon_WITH_AES_128_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        "TLS_DH_anon_WITH_AES_256_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        "SSL_DH_anon_WITH_DES_CBC_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   223
        "TLS_ECDH_anon_WITH_RC4_128_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   224
        "TLS_ECDH_anon_WITH_AES_128_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   225
        "TLS_ECDH_anon_WITH_AES_256_CBC_SHA",
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   226
        "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA",
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   229
        "TLS_ECDH_anon_WITH_NULL_SHA",
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        "TLS_KRB5_WITH_RC4_128_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        "TLS_KRB5_WITH_RC4_128_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        "TLS_KRB5_WITH_3DES_EDE_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        "TLS_KRB5_WITH_3DES_EDE_CBC_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        "TLS_KRB5_WITH_DES_CBC_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        "TLS_KRB5_WITH_DES_CBC_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        "TLS_KRB5_EXPORT_WITH_RC4_40_SHA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        "TLS_KRB5_EXPORT_WITH_RC4_40_MD5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        "TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA",
5166
81f798aa5765 6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents: 2
diff changeset
   239
        "TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5",
6856
533f4ad71f88 6914943: Implement final TLS renegotiation fix
xuelei
parents: 5506
diff changeset
   240
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    private static void showSuites(String[] suites) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        if ((suites == null) || (suites.length == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
            System.out.println("<none>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        for (int i = 0; i < suites.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
            System.out.println("  " + suites[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    public static void main(String[] args) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        long start = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        String[] ENABLED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        String[] SUPPORTED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
            Cipher c = Cipher.getInstance("AES/CBC/NoPadding");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
            SecretKeySpec key = new SecretKeySpec(new byte[32], "AES");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
            c.init(Cipher.ENCRYPT_MODE, key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
            System.out.println("AES/256 is available");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
            ENABLED = ENABLED_UNLIMITED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
            SUPPORTED = SUPPORTED_UNLIMITED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
        } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
            System.out.println("AES/256 is NOT available (" + e + ")");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
            ENABLED = ENABLED_DEFAULT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
            SUPPORTED = SUPPORTED_DEFAULT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
        SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        SSLSocket socket = (SSLSocket)factory.createSocket();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        String[] enabled = socket.getEnabledCipherSuites();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
        System.out.println("Default enabled ciphersuites:");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
        showSuites(enabled);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        if (Arrays.equals(ENABLED, enabled) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
            System.out.println("*** MISMATCH, should be ***");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
            showSuites(ENABLED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
            throw new Exception("Enabled ciphersuite mismatch");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
        System.out.println("OK");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        System.out.println();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
        String[] supported = socket.getSupportedCipherSuites();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        System.out.println("Supported ciphersuites:");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        showSuites(supported);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
        if (Arrays.equals(SUPPORTED, supported) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
            System.out.println("*** MISMATCH, should be ***");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
            showSuites(SUPPORTED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
            throw new Exception("Supported ciphersuite mismatch");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        System.out.println("OK");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        long end = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
        System.out.println("Done (" + (end - start) + " ms).");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
}