src/java.base/share/classes/sun/security/ssl/CipherSuite.java
changeset 57718 a93b7b28f644
parent 55353 946f7f2d321c
child 58679 9c3209ff7550
equal deleted inserted replaced
57716:bfcdcd00e4fb 57718:a93b7b28f644
    33 import java.util.List;
    33 import java.util.List;
    34 import static sun.security.ssl.CipherSuite.HashAlg.*;
    34 import static sun.security.ssl.CipherSuite.HashAlg.*;
    35 import static sun.security.ssl.CipherSuite.KeyExchange.*;
    35 import static sun.security.ssl.CipherSuite.KeyExchange.*;
    36 import static sun.security.ssl.CipherSuite.MacAlg.*;
    36 import static sun.security.ssl.CipherSuite.MacAlg.*;
    37 import static sun.security.ssl.SSLCipher.*;
    37 import static sun.security.ssl.SSLCipher.*;
    38 import sun.security.ssl.NamedGroup.NamedGroupType;
    38 import sun.security.ssl.NamedGroup.NamedGroupSpec;
    39 import static sun.security.ssl.NamedGroup.NamedGroupType.*;
    39 import static sun.security.ssl.NamedGroup.NamedGroupSpec.*;
    40 
    40 
    41 /**
    41 /**
    42  * Enum for SSL/(D)TLS cipher suites.
    42  * Enum for SSL/(D)TLS cipher suites.
    43  *
    43  *
    44  * Please refer to the "TLS Cipher Suite Registry" section for more details
    44  * Please refer to the "TLS Cipher Suite Registry" section for more details
  1123         K_SCSV          ("SCSV",           true,  true,   NAMED_GROUP_NONE);
  1123         K_SCSV          ("SCSV",           true,  true,   NAMED_GROUP_NONE);
  1124 
  1124 
  1125         // name of the key exchange algorithm, e.g. DHE_DSS
  1125         // name of the key exchange algorithm, e.g. DHE_DSS
  1126         final String name;
  1126         final String name;
  1127         final boolean allowed;
  1127         final boolean allowed;
  1128         final NamedGroupType[] groupTypes;
  1128         final NamedGroupSpec[] groupTypes;
  1129         private final boolean alwaysAvailable;
  1129         private final boolean alwaysAvailable;
  1130         private final boolean isAnonymous;
  1130         private final boolean isAnonymous;
  1131 
  1131 
  1132         KeyExchange(String name, boolean allowed,
  1132         KeyExchange(String name, boolean allowed,
  1133                 boolean isAnonymous, NamedGroupType... groupTypes) {
  1133                 boolean isAnonymous, NamedGroupSpec... groupTypes) {
  1134             this.name = name;
  1134             this.name = name;
  1135             this.groupTypes = groupTypes;
  1135             this.groupTypes = groupTypes;
  1136             this.allowed = allowed;
  1136             this.allowed = allowed;
  1137 
  1137 
  1138             this.alwaysAvailable = allowed && (!name.startsWith("EC"));
  1138             this.alwaysAvailable = allowed && (!name.startsWith("EC"));
  1142         boolean isAvailable() {
  1142         boolean isAvailable() {
  1143             if (alwaysAvailable) {
  1143             if (alwaysAvailable) {
  1144                 return true;
  1144                 return true;
  1145             }
  1145             }
  1146 
  1146 
  1147             if (NamedGroupType.arrayContains(
  1147             if (NamedGroupSpec.arrayContains(groupTypes,
  1148                     groupTypes, NamedGroupType.NAMED_GROUP_ECDHE)) {
  1148                     NamedGroupSpec.NAMED_GROUP_ECDHE)) {
  1149                 return (allowed && JsseJce.isEcAvailable());
  1149                 return (allowed && JsseJce.isEcAvailable());
  1150             } else {
  1150             } else {
  1151                 return allowed;
  1151                 return allowed;
  1152             }
  1152             }
  1153         }
  1153         }