src/java.base/share/classes/sun/security/ssl/CipherSuite.java

Print this page
rev 10851 : Implement TLS_FALLBACK_SCSV


 338         K_NULL       ("NULL",       false),
 339         K_RSA        ("RSA",        true),
 340         K_RSA_EXPORT ("RSA_EXPORT", true),
 341         K_DH_RSA     ("DH_RSA",     false),
 342         K_DH_DSS     ("DH_DSS",     false),
 343         K_DHE_DSS    ("DHE_DSS",    true),
 344         K_DHE_RSA    ("DHE_RSA",    true),
 345         K_DH_ANON    ("DH_anon",    true),
 346 
 347         K_ECDH_ECDSA ("ECDH_ECDSA",  ALLOW_ECC),
 348         K_ECDH_RSA   ("ECDH_RSA",    ALLOW_ECC),
 349         K_ECDHE_ECDSA("ECDHE_ECDSA", ALLOW_ECC),
 350         K_ECDHE_RSA  ("ECDHE_RSA",   ALLOW_ECC),
 351         K_ECDH_ANON  ("ECDH_anon",   ALLOW_ECC),
 352 
 353         // Kerberos cipher suites
 354         K_KRB5       ("KRB5", true),
 355         K_KRB5_EXPORT("KRB5_EXPORT", true),
 356 
 357         // renegotiation protection request signaling cipher suite
 358         K_SCSV       ("SCSV",        true);



 359 
 360         // name of the key exchange algorithm, e.g. DHE_DSS
 361         final String name;
 362         final boolean allowed;
 363         private final boolean alwaysAvailable;
 364 
 365         KeyExchange(String name, boolean allowed) {
 366             this.name = name;
 367             this.allowed = allowed;
 368             this.alwaysAvailable = allowed &&
 369                 (!name.startsWith("EC")) && (!name.startsWith("KRB"));
 370         }
 371 
 372         boolean isAvailable() {
 373             if (alwaysAvailable) {
 374                 return true;
 375             }
 376 
 377             if (name.startsWith("EC")) {
 378                 return (allowed && JsseJce.isEcAvailable());


1105         add("TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
1106             0xC012, --p, K_ECDHE_RSA,   B_3DES,    T);
1107         add("SSL_RSA_WITH_3DES_EDE_CBC_SHA",
1108             0x000a, --p, K_RSA,         B_3DES,    T);
1109         add("TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA",
1110             0xC003, --p, K_ECDH_ECDSA,  B_3DES,    T);
1111         add("TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA",
1112             0xC00D, --p, K_ECDH_RSA,    B_3DES,    T);
1113         add("SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA",
1114             0x0016, --p, K_DHE_RSA,     B_3DES,    T);
1115         add("SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA",
1116             0x0013, --p, K_DHE_DSS,     B_3DES,    N);
1117 
1118         add("SSL_RSA_WITH_RC4_128_MD5",
1119             0x0004, --p, K_RSA,         B_RC4_128, N);
1120 
1121         // Renegotiation protection request Signalling Cipher Suite Value (SCSV)
1122         add("TLS_EMPTY_RENEGOTIATION_INFO_SCSV",
1123             0x00ff, --p, K_SCSV,        B_NULL,    T);
1124 




1125         /*
1126          * Definition of the CipherSuites that are supported but not enabled
1127          * by default.
1128          * They are listed in preference order, preferred first, using the
1129          * following criteria:
1130          * 1. CipherSuites for KRB5 need additional KRB5 service
1131          *    configuration, and these suites are not common in practice,
1132          *    so we put KRB5 based cipher suites at the end of the supported
1133          *    list.
1134          * 2. If a cipher suite has been obsoleted, we put it at the end of
1135          *    the list.
1136          * 3. Prefer the stronger bulk cipher, in the order of AES_256,
1137          *    AES_128, RC-4, 3DES-EDE, DES, RC4_40, DES40, NULL.
1138          * 4. Prefer the stronger MAC algorithm, in the order of SHA384,
1139          *    SHA256, SHA, MD5.
1140          * 5. Prefer the better performance of key exchange and digital
1141          *    signature algorithm, in the order of ECDHE-ECDSA, ECDHE-RSA,
1142          *    RSA, ECDH-ECDSA, ECDH-RSA, DHE-RSA, DHE-DSS, anonymous.
1143          */
1144         p = DEFAULT_SUITES_PRIORITY;


1385         add("TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA",        0xc021);
1386         add("TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA",        0xc022);
1387 
1388         // Unsupported cipher suites from RFC 5489
1389         add("TLS_ECDHE_PSK_WITH_RC4_128_SHA",              0xc033);
1390         add("TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA",         0xc034);
1391         add("TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA",          0xc035);
1392         add("TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA",          0xc036);
1393         add("TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256",       0xc037);
1394         add("TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384",       0xc038);
1395         add("TLS_ECDHE_PSK_WITH_NULL_SHA",                 0xc039);
1396         add("TLS_ECDHE_PSK_WITH_NULL_SHA256",              0xc03a);
1397         add("TLS_ECDHE_PSK_WITH_NULL_SHA384",              0xc03b);
1398     }
1399 
1400     // ciphersuite SSL_NULL_WITH_NULL_NULL
1401     final static CipherSuite C_NULL = CipherSuite.valueOf(0, 0);
1402 
1403     // ciphersuite TLS_EMPTY_RENEGOTIATION_INFO_SCSV
1404     final static CipherSuite C_SCSV = CipherSuite.valueOf(0x00, 0xff);



1405 }


 338         K_NULL       ("NULL",       false),
 339         K_RSA        ("RSA",        true),
 340         K_RSA_EXPORT ("RSA_EXPORT", true),
 341         K_DH_RSA     ("DH_RSA",     false),
 342         K_DH_DSS     ("DH_DSS",     false),
 343         K_DHE_DSS    ("DHE_DSS",    true),
 344         K_DHE_RSA    ("DHE_RSA",    true),
 345         K_DH_ANON    ("DH_anon",    true),
 346 
 347         K_ECDH_ECDSA ("ECDH_ECDSA",  ALLOW_ECC),
 348         K_ECDH_RSA   ("ECDH_RSA",    ALLOW_ECC),
 349         K_ECDHE_ECDSA("ECDHE_ECDSA", ALLOW_ECC),
 350         K_ECDHE_RSA  ("ECDHE_RSA",   ALLOW_ECC),
 351         K_ECDH_ANON  ("ECDH_anon",   ALLOW_ECC),
 352 
 353         // Kerberos cipher suites
 354         K_KRB5       ("KRB5", true),
 355         K_KRB5_EXPORT("KRB5_EXPORT", true),
 356 
 357         // renegotiation protection request signaling cipher suite
 358         K_SCSV       ("SCSV",        true),
 359 
 360         // fallback signaling cipher suite
 361         K_FALLBACK_SCSV ("FALLBACK_SCSV", false);
 362 
 363         // name of the key exchange algorithm, e.g. DHE_DSS
 364         final String name;
 365         final boolean allowed;
 366         private final boolean alwaysAvailable;
 367 
 368         KeyExchange(String name, boolean allowed) {
 369             this.name = name;
 370             this.allowed = allowed;
 371             this.alwaysAvailable = allowed &&
 372                 (!name.startsWith("EC")) && (!name.startsWith("KRB"));
 373         }
 374 
 375         boolean isAvailable() {
 376             if (alwaysAvailable) {
 377                 return true;
 378             }
 379 
 380             if (name.startsWith("EC")) {
 381                 return (allowed && JsseJce.isEcAvailable());


1108         add("TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
1109             0xC012, --p, K_ECDHE_RSA,   B_3DES,    T);
1110         add("SSL_RSA_WITH_3DES_EDE_CBC_SHA",
1111             0x000a, --p, K_RSA,         B_3DES,    T);
1112         add("TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA",
1113             0xC003, --p, K_ECDH_ECDSA,  B_3DES,    T);
1114         add("TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA",
1115             0xC00D, --p, K_ECDH_RSA,    B_3DES,    T);
1116         add("SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA",
1117             0x0016, --p, K_DHE_RSA,     B_3DES,    T);
1118         add("SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA",
1119             0x0013, --p, K_DHE_DSS,     B_3DES,    N);
1120 
1121         add("SSL_RSA_WITH_RC4_128_MD5",
1122             0x0004, --p, K_RSA,         B_RC4_128, N);
1123 
1124         // Renegotiation protection request Signalling Cipher Suite Value (SCSV)
1125         add("TLS_EMPTY_RENEGOTIATION_INFO_SCSV",
1126             0x00ff, --p, K_SCSV,        B_NULL,    T);
1127 
1128         // Fallback in progress Signalling Cipher Suite Value (SCSV)
1129         add("TLS_FALLBACK_SCSV",
1130             0x5600, --p, K_FALLBACK_SCSV, B_NULL, F);
1131 
1132         /*
1133          * Definition of the CipherSuites that are supported but not enabled
1134          * by default.
1135          * They are listed in preference order, preferred first, using the
1136          * following criteria:
1137          * 1. CipherSuites for KRB5 need additional KRB5 service
1138          *    configuration, and these suites are not common in practice,
1139          *    so we put KRB5 based cipher suites at the end of the supported
1140          *    list.
1141          * 2. If a cipher suite has been obsoleted, we put it at the end of
1142          *    the list.
1143          * 3. Prefer the stronger bulk cipher, in the order of AES_256,
1144          *    AES_128, RC-4, 3DES-EDE, DES, RC4_40, DES40, NULL.
1145          * 4. Prefer the stronger MAC algorithm, in the order of SHA384,
1146          *    SHA256, SHA, MD5.
1147          * 5. Prefer the better performance of key exchange and digital
1148          *    signature algorithm, in the order of ECDHE-ECDSA, ECDHE-RSA,
1149          *    RSA, ECDH-ECDSA, ECDH-RSA, DHE-RSA, DHE-DSS, anonymous.
1150          */
1151         p = DEFAULT_SUITES_PRIORITY;


1392         add("TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA",        0xc021);
1393         add("TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA",        0xc022);
1394 
1395         // Unsupported cipher suites from RFC 5489
1396         add("TLS_ECDHE_PSK_WITH_RC4_128_SHA",              0xc033);
1397         add("TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA",         0xc034);
1398         add("TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA",          0xc035);
1399         add("TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA",          0xc036);
1400         add("TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256",       0xc037);
1401         add("TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384",       0xc038);
1402         add("TLS_ECDHE_PSK_WITH_NULL_SHA",                 0xc039);
1403         add("TLS_ECDHE_PSK_WITH_NULL_SHA256",              0xc03a);
1404         add("TLS_ECDHE_PSK_WITH_NULL_SHA384",              0xc03b);
1405     }
1406 
1407     // ciphersuite SSL_NULL_WITH_NULL_NULL
1408     final static CipherSuite C_NULL = CipherSuite.valueOf(0, 0);
1409 
1410     // ciphersuite TLS_EMPTY_RENEGOTIATION_INFO_SCSV
1411     final static CipherSuite C_SCSV = CipherSuite.valueOf(0x00, 0xff);
1412 
1413     // ciphersuite TLS_FALLBACK_SCSV
1414     final static CipherSuite C_FALLBACK_SCSV = CipherSuite.valueOf(0x56, 0x00);
1415 }