src/java.base/share/classes/sun/security/ssl/SSLExtension.java
branchJDK-8145252-TLS13-branch
changeset 56584 a0f3377c58c7
parent 56559 a423173d0578
child 56646 e57205a6e4ee
equal deleted inserted replaced
56579:fb93f16d20fa 56584:a0f3377c58c7
    42                                 ProtocolVersion.PROTOCOLS_TO_13,
    42                                 ProtocolVersion.PROTOCOLS_TO_13,
    43                                 ServerNameExtension.chNetworkProducer,
    43                                 ServerNameExtension.chNetworkProducer,
    44                                 ServerNameExtension.chOnLoadConcumer,
    44                                 ServerNameExtension.chOnLoadConcumer,
    45                                 null,
    45                                 null,
    46                                 null,
    46                                 null,
       
    47                                 null,
    47                                 ServerNameExtension.chStringize),
    48                                 ServerNameExtension.chStringize),
    48     SH_SERVER_NAME          (0x0000, "server_name",
    49     SH_SERVER_NAME          (0x0000, "server_name",
    49                                 SSLHandshake.SERVER_HELLO,
    50                                 SSLHandshake.SERVER_HELLO,
    50                                 ProtocolVersion.PROTOCOLS_TO_12,
    51                                 ProtocolVersion.PROTOCOLS_TO_12,
    51                                 ServerNameExtension.shNetworkProducer,
    52                                 ServerNameExtension.shNetworkProducer,
    52                                 ServerNameExtension.shOnLoadConcumer,
    53                                 ServerNameExtension.shOnLoadConcumer,
       
    54                                 null,
    53                                 null,
    55                                 null,
    54                                 null,
    56                                 null,
    55                                 ServerNameExtension.shStringize),
    57                                 ServerNameExtension.shStringize),
    56     EE_SERVER_NAME          (0x0000, "server_name",
    58     EE_SERVER_NAME          (0x0000, "server_name",
    57                                 SSLHandshake.ENCRYPTED_EXTENSIONS,
    59                                 SSLHandshake.ENCRYPTED_EXTENSIONS,
    58                                 ProtocolVersion.PROTOCOLS_OF_13,
    60                                 ProtocolVersion.PROTOCOLS_OF_13,
    59                                 ServerNameExtension.eeNetworkProducer,
    61                                 ServerNameExtension.eeNetworkProducer,
    60                                 ServerNameExtension.eeOnLoadConcumer,
    62                                 ServerNameExtension.eeOnLoadConcumer,
    61                                 null,
    63                                 null,
    62                                 null,
    64                                 null,
       
    65                                 null,
    63                                 ServerNameExtension.shStringize),
    66                                 ServerNameExtension.shStringize),
    64     CH_MAX_FRAGMENT_LENGTH (0x0001, "max_fragment_length",
    67     CH_MAX_FRAGMENT_LENGTH (0x0001, "max_fragment_length",
    65                                 SSLHandshake.CLIENT_HELLO,
    68                                 SSLHandshake.CLIENT_HELLO,
    66                                 ProtocolVersion.PROTOCOLS_TO_13,
    69                                 ProtocolVersion.PROTOCOLS_TO_13,
    67                                 MaxFragExtension.chNetworkProducer,
    70                                 MaxFragExtension.chNetworkProducer,
    68                                 MaxFragExtension.chOnLoadConcumer,
    71                                 MaxFragExtension.chOnLoadConcumer,
    69                                 null,
    72                                 null,
    70                                 null,
    73                                 null,
       
    74                                 null,
    71                                 MaxFragExtension.maxFragLenStringize),
    75                                 MaxFragExtension.maxFragLenStringize),
    72     SH_MAX_FRAGMENT_LENGTH (0x0001, "max_fragment_length",
    76     SH_MAX_FRAGMENT_LENGTH (0x0001, "max_fragment_length",
    73                                 SSLHandshake.SERVER_HELLO,
    77                                 SSLHandshake.SERVER_HELLO,
    74                                 ProtocolVersion.PROTOCOLS_TO_12,
    78                                 ProtocolVersion.PROTOCOLS_TO_12,
    75                                 MaxFragExtension.shNetworkProducer,
    79                                 MaxFragExtension.shNetworkProducer,
    76                                 MaxFragExtension.shOnLoadConcumer,
    80                                 MaxFragExtension.shOnLoadConcumer,
    77                                 null,
    81                                 null,
    78                                 MaxFragExtension.shOnTradeConsumer,
    82                                 MaxFragExtension.shOnTradeConsumer,
       
    83                                 null,
    79                                 MaxFragExtension.maxFragLenStringize),
    84                                 MaxFragExtension.maxFragLenStringize),
    80     EE_MAX_FRAGMENT_LENGTH (0x0001, "max_fragment_length",
    85     EE_MAX_FRAGMENT_LENGTH (0x0001, "max_fragment_length",
    81                                 SSLHandshake.ENCRYPTED_EXTENSIONS,
    86                                 SSLHandshake.ENCRYPTED_EXTENSIONS,
    82                                 ProtocolVersion.PROTOCOLS_OF_13,
    87                                 ProtocolVersion.PROTOCOLS_OF_13,
    83                                 MaxFragExtension.eeNetworkProducer,
    88                                 MaxFragExtension.eeNetworkProducer,
    84                                 MaxFragExtension.eeOnLoadConcumer,
    89                                 MaxFragExtension.eeOnLoadConcumer,
    85                                 null,
    90                                 null,
    86                                 MaxFragExtension.eeOnTradeConsumer,
    91                                 MaxFragExtension.eeOnTradeConsumer,
       
    92                                 null,
    87                                 MaxFragExtension.maxFragLenStringize),
    93                                 MaxFragExtension.maxFragLenStringize),
    88     CLIENT_CERTIFICATE_URL  (0x0002, "client_certificate_url"),
    94     CLIENT_CERTIFICATE_URL  (0x0002, "client_certificate_url"),
    89     TRUSTED_CA_KEYS         (0x0003, "trusted_ca_keys"),
    95     TRUSTED_CA_KEYS         (0x0003, "trusted_ca_keys"),
    90     TRUNCATED_HMAC          (0x0004, "truncated_hmac"),
    96     TRUNCATED_HMAC          (0x0004, "truncated_hmac"),
    91 
    97 
    94                                 ProtocolVersion.PROTOCOLS_TO_13,
   100                                 ProtocolVersion.PROTOCOLS_TO_13,
    95                                 CertStatusExtension.chNetworkProducer,
   101                                 CertStatusExtension.chNetworkProducer,
    96                                 CertStatusExtension.chOnLoadConsumer,
   102                                 CertStatusExtension.chOnLoadConsumer,
    97                                 null,
   103                                 null,
    98                                 null,
   104                                 null,
       
   105                                 null,
    99                                 CertStatusExtension.certStatusReqStringize),
   106                                 CertStatusExtension.certStatusReqStringize),
   100     SH_STATUS_REQUEST       (0x0005, "status_request",
   107     SH_STATUS_REQUEST       (0x0005, "status_request",
   101                                 SSLHandshake.SERVER_HELLO,
   108                                 SSLHandshake.SERVER_HELLO,
   102                                 ProtocolVersion.PROTOCOLS_TO_12,
   109                                 ProtocolVersion.PROTOCOLS_TO_12,
   103                                 CertStatusExtension.shNetworkProducer,
   110                                 CertStatusExtension.shNetworkProducer,
   104                                 CertStatusExtension.shOnLoadConsumer,
   111                                 CertStatusExtension.shOnLoadConsumer,
       
   112                                 null,
   105                                 null,
   113                                 null,
   106                                 null,
   114                                 null,
   107                                 CertStatusExtension.certStatusReqStringize),
   115                                 CertStatusExtension.certStatusReqStringize),
   108 
   116 
   109     CR_STATUS_REQUEST       (0x0005, "status_request"),
   117     CR_STATUS_REQUEST       (0x0005, "status_request"),
   112                                 ProtocolVersion.PROTOCOLS_OF_13,
   120                                 ProtocolVersion.PROTOCOLS_OF_13,
   113                                 CertStatusExtension.ctNetworkProducer,
   121                                 CertStatusExtension.ctNetworkProducer,
   114                                 CertStatusExtension.ctOnLoadConsumer,
   122                                 CertStatusExtension.ctOnLoadConsumer,
   115                                 null,
   123                                 null,
   116                                 null,
   124                                 null,
       
   125                                 null,
   117                                 CertStatusExtension.certStatusRespStringize),
   126                                 CertStatusExtension.certStatusRespStringize),
   118     // extensions defined in RFC 4681
   127     // extensions defined in RFC 4681
   119     USER_MAPPING            (0x0006, "user_mapping"),
   128     USER_MAPPING            (0x0006, "user_mapping"),
   120 
   129 
   121     // extensions defined in RFC 5878
   130     // extensions defined in RFC 5878
   131                                 ProtocolVersion.PROTOCOLS_TO_13,
   140                                 ProtocolVersion.PROTOCOLS_TO_13,
   132                                 SupportedGroupsExtension.chNetworkProducer,
   141                                 SupportedGroupsExtension.chNetworkProducer,
   133                                 SupportedGroupsExtension.chOnLoadConcumer,
   142                                 SupportedGroupsExtension.chOnLoadConcumer,
   134                                 null,
   143                                 null,
   135                                 null,
   144                                 null,
       
   145                                 null,
   136                                 SupportedGroupsExtension.sgsStringize),
   146                                 SupportedGroupsExtension.sgsStringize),
   137     EE_SUPPORTED_GROUPS     (0x000A, "supported_groups",
   147     EE_SUPPORTED_GROUPS     (0x000A, "supported_groups",
   138                                 SSLHandshake.ENCRYPTED_EXTENSIONS,
   148                                 SSLHandshake.ENCRYPTED_EXTENSIONS,
   139                                 ProtocolVersion.PROTOCOLS_OF_13,
   149                                 ProtocolVersion.PROTOCOLS_OF_13,
   140                                 SupportedGroupsExtension.eeNetworkProducer,
   150                                 SupportedGroupsExtension.eeNetworkProducer,
   141                                 SupportedGroupsExtension.eeOnLoadConcumer,
   151                                 SupportedGroupsExtension.eeOnLoadConcumer,
   142                                 null,
   152                                 null,
   143                                 null,
   153                                 null,
       
   154                                 null,
   144                                 SupportedGroupsExtension.sgsStringize),
   155                                 SupportedGroupsExtension.sgsStringize),
   145 
   156 
   146     CH_EC_POINT_FORMATS     (0x000B, "ec_point_formats",
   157     CH_EC_POINT_FORMATS     (0x000B, "ec_point_formats",
   147                                 SSLHandshake.CLIENT_HELLO,
   158                                 SSLHandshake.CLIENT_HELLO,
   148                                 ProtocolVersion.PROTOCOLS_TO_12,
   159                                 ProtocolVersion.PROTOCOLS_TO_12,
   149                                 ECPointFormatsExtension.chNetworkProducer,
   160                                 ECPointFormatsExtension.chNetworkProducer,
   150                                 ECPointFormatsExtension.chOnLoadConcumer,
   161                                 ECPointFormatsExtension.chOnLoadConcumer,
   151                                 null,
   162                                 null,
   152                                 null,
   163                                 null,
       
   164                                 null,
   153                                 ECPointFormatsExtension.epfStringize),
   165                                 ECPointFormatsExtension.epfStringize),
   154     SH_EC_POINT_FORMATS     (0x000B, "ec_point_formats",
   166     SH_EC_POINT_FORMATS     (0x000B, "ec_point_formats",
   155                                 SSLHandshake.SERVER_HELLO,
   167                                 SSLHandshake.SERVER_HELLO,
   156                                 ProtocolVersion.PROTOCOLS_TO_12,
   168                                 ProtocolVersion.PROTOCOLS_TO_12,
   157                                 null,   // not use of the producer
   169                                 null,   // not use of the producer
   158                                 ECPointFormatsExtension.shOnLoadConcumer,
   170                                 ECPointFormatsExtension.shOnLoadConcumer,
       
   171                                 null,
   159                                 null,
   172                                 null,
   160                                 null,
   173                                 null,
   161                                 ECPointFormatsExtension.epfStringize),
   174                                 ECPointFormatsExtension.epfStringize),
   162 
   175 
   163     // extensions defined in RFC 5054
   176     // extensions defined in RFC 5054
   169                                 ProtocolVersion.PROTOCOLS_12_13,
   182                                 ProtocolVersion.PROTOCOLS_12_13,
   170                                 SignatureAlgorithmsExtension.chNetworkProducer,
   183                                 SignatureAlgorithmsExtension.chNetworkProducer,
   171                                 SignatureAlgorithmsExtension.chOnLoadConcumer,
   184                                 SignatureAlgorithmsExtension.chOnLoadConcumer,
   172                                 SignatureAlgorithmsExtension.chOnLoadAbsence,
   185                                 SignatureAlgorithmsExtension.chOnLoadAbsence,
   173                                 SignatureAlgorithmsExtension.chOnTradeConsumer,
   186                                 SignatureAlgorithmsExtension.chOnTradeConsumer,
       
   187                                 SignatureAlgorithmsExtension.chOnTradeAbsence,
   174                                 SignatureAlgorithmsExtension.ssStringize),
   188                                 SignatureAlgorithmsExtension.ssStringize),
   175     CR_SIGNATURE_ALGORITHMS (0x000D, "signature_algorithms",
   189     CR_SIGNATURE_ALGORITHMS (0x000D, "signature_algorithms",
   176                                 SSLHandshake.CERTIFICATE_REQUEST,
   190                                 SSLHandshake.CERTIFICATE_REQUEST,
   177                                 ProtocolVersion.PROTOCOLS_OF_13,
   191                                 ProtocolVersion.PROTOCOLS_OF_13,
   178                                 SignatureAlgorithmsExtension.crNetworkProducer,
   192                                 SignatureAlgorithmsExtension.crNetworkProducer,
   179                                 SignatureAlgorithmsExtension.crOnLoadConcumer,
   193                                 SignatureAlgorithmsExtension.crOnLoadConcumer,
   180                                 SignatureAlgorithmsExtension.crOnLoadAbsence,
   194                                 SignatureAlgorithmsExtension.crOnLoadAbsence,
   181                                 SignatureAlgorithmsExtension.crOnTradeConsumer,
   195                                 SignatureAlgorithmsExtension.crOnTradeConsumer,
       
   196                                 null,
   182                                 SignatureAlgorithmsExtension.ssStringize),
   197                                 SignatureAlgorithmsExtension.ssStringize),
   183 
   198 
   184     CH_SIGNATURE_ALGORITHMS_CERT (0x0032, "signature_algorithms_cert",
   199     CH_SIGNATURE_ALGORITHMS_CERT (0x0032, "signature_algorithms_cert",
   185                                 SSLHandshake.CLIENT_HELLO,
   200                                 SSLHandshake.CLIENT_HELLO,
   186                                 ProtocolVersion.PROTOCOLS_12_13,
   201                                 ProtocolVersion.PROTOCOLS_12_13,
   187                                 CertSignAlgsExtension.chNetworkProducer,
   202                                 CertSignAlgsExtension.chNetworkProducer,
   188                                 CertSignAlgsExtension.chOnLoadConcumer,
   203                                 CertSignAlgsExtension.chOnLoadConcumer,
   189                                 null,
   204                                 null,
   190                                 CertSignAlgsExtension.chOnTradeConsumer,
   205                                 CertSignAlgsExtension.chOnTradeConsumer,
       
   206                                 null,
   191                                 CertSignAlgsExtension.ssStringize),
   207                                 CertSignAlgsExtension.ssStringize),
   192     CR_SIGNATURE_ALGORITHMS_CERT (0x0032, "signature_algorithms_cert",
   208     CR_SIGNATURE_ALGORITHMS_CERT (0x0032, "signature_algorithms_cert",
   193                                 SSLHandshake.CERTIFICATE_REQUEST,
   209                                 SSLHandshake.CERTIFICATE_REQUEST,
   194                                 ProtocolVersion.PROTOCOLS_OF_13,
   210                                 ProtocolVersion.PROTOCOLS_OF_13,
   195                                 CertSignAlgsExtension.crNetworkProducer,
   211                                 CertSignAlgsExtension.crNetworkProducer,
   196                                 CertSignAlgsExtension.crOnLoadConcumer,
   212                                 CertSignAlgsExtension.crOnLoadConcumer,
   197                                 null,
   213                                 null,
   198                                 CertSignAlgsExtension.crOnTradeConsumer,
   214                                 CertSignAlgsExtension.crOnTradeConsumer,
       
   215                                 null,
   199                                 CertSignAlgsExtension.ssStringize),
   216                                 CertSignAlgsExtension.ssStringize),
   200 
   217 
   201     // extensions defined in RFC 5764
   218     // extensions defined in RFC 5764
   202     USE_SRTP                (0x000E, "use_srtp"),
   219     USE_SRTP                (0x000E, "use_srtp"),
   203 
   220 
   210                                 ProtocolVersion.PROTOCOLS_TO_13,
   227                                 ProtocolVersion.PROTOCOLS_TO_13,
   211                                 AlpnExtension.chNetworkProducer,
   228                                 AlpnExtension.chNetworkProducer,
   212                                 AlpnExtension.chOnLoadConcumer,
   229                                 AlpnExtension.chOnLoadConcumer,
   213                                 AlpnExtension.chOnLoadAbsence,
   230                                 AlpnExtension.chOnLoadAbsence,
   214                                 null,
   231                                 null,
       
   232                                 null,
   215                                 AlpnExtension.alpnStringize),
   233                                 AlpnExtension.alpnStringize),
   216     SH_ALPN                 (0x0010, "application_layer_protocol_negotiation",
   234     SH_ALPN                 (0x0010, "application_layer_protocol_negotiation",
   217                                 SSLHandshake.SERVER_HELLO,
   235                                 SSLHandshake.SERVER_HELLO,
   218                                 ProtocolVersion.PROTOCOLS_TO_12,
   236                                 ProtocolVersion.PROTOCOLS_TO_12,
   219                                 AlpnExtension.shNetworkProducer,
   237                                 AlpnExtension.shNetworkProducer,
   220                                 AlpnExtension.shOnLoadConcumer,
   238                                 AlpnExtension.shOnLoadConcumer,
   221                                 AlpnExtension.shOnLoadAbsence,
   239                                 AlpnExtension.shOnLoadAbsence,
   222                                 null,
   240                                 null,
       
   241                                 null,
   223                                 AlpnExtension.alpnStringize),
   242                                 AlpnExtension.alpnStringize),
   224     EE_ALPN                 (0x0010, "application_layer_protocol_negotiation",
   243     EE_ALPN                 (0x0010, "application_layer_protocol_negotiation",
   225                                 SSLHandshake.ENCRYPTED_EXTENSIONS,
   244                                 SSLHandshake.ENCRYPTED_EXTENSIONS,
   226                                 ProtocolVersion.PROTOCOLS_OF_13,
   245                                 ProtocolVersion.PROTOCOLS_OF_13,
   227                                 AlpnExtension.shNetworkProducer,
   246                                 AlpnExtension.shNetworkProducer,
   228                                 AlpnExtension.shOnLoadConcumer,
   247                                 AlpnExtension.shOnLoadConcumer,
   229                                 AlpnExtension.shOnLoadAbsence,
   248                                 AlpnExtension.shOnLoadAbsence,
   230                                 null,
   249                                 null,
       
   250                                 null,
   231                                 AlpnExtension.alpnStringize),
   251                                 AlpnExtension.alpnStringize),
   232 
   252 
   233     // extensions defined in RFC 6961
   253     // extensions defined in RFC 6961
   234     CH_STATUS_REQUEST_V2    (0x0011, "status_request_v2",
   254     CH_STATUS_REQUEST_V2    (0x0011, "status_request_v2",
   235                                 SSLHandshake.CLIENT_HELLO,
   255                                 SSLHandshake.CLIENT_HELLO,
   236                                 ProtocolVersion.PROTOCOLS_TO_12,
   256                                 ProtocolVersion.PROTOCOLS_TO_12,
   237                                 CertStatusExtension.chV2NetworkProducer,
   257                                 CertStatusExtension.chV2NetworkProducer,
   238                                 CertStatusExtension.chV2OnLoadConsumer,
   258                                 CertStatusExtension.chV2OnLoadConsumer,
   239                                 null,
   259                                 null,
   240                                 null,
   260                                 null,
       
   261                                 null,
   241                                 CertStatusExtension.certStatusReqV2Stringize),
   262                                 CertStatusExtension.certStatusReqV2Stringize),
   242     SH_STATUS_REQUEST_V2    (0x0011, "status_request_v2",
   263     SH_STATUS_REQUEST_V2    (0x0011, "status_request_v2",
   243                                 SSLHandshake.SERVER_HELLO,
   264                                 SSLHandshake.SERVER_HELLO,
   244                                 ProtocolVersion.PROTOCOLS_TO_12,
   265                                 ProtocolVersion.PROTOCOLS_TO_12,
   245                                 CertStatusExtension.shV2NetworkProducer,
   266                                 CertStatusExtension.shV2NetworkProducer,
   246                                 CertStatusExtension.shV2OnLoadConsumer,
   267                                 CertStatusExtension.shV2OnLoadConsumer,
       
   268                                 null,
   247                                 null,
   269                                 null,
   248                                 null,
   270                                 null,
   249                                 CertStatusExtension.certStatusReqV2Stringize),
   271                                 CertStatusExtension.certStatusReqV2Stringize),
   250 
   272 
   251     // extensions defined in RFC 6962
   273     // extensions defined in RFC 6962
   267                                 ProtocolVersion.PROTOCOLS_TO_12,
   289                                 ProtocolVersion.PROTOCOLS_TO_12,
   268                                 ExtendedMasterSecretExtension.chNetworkProducer,
   290                                 ExtendedMasterSecretExtension.chNetworkProducer,
   269                                 ExtendedMasterSecretExtension.chOnLoadConcumer,
   291                                 ExtendedMasterSecretExtension.chOnLoadConcumer,
   270                                 ExtendedMasterSecretExtension.chOnLoadAbsence,
   292                                 ExtendedMasterSecretExtension.chOnLoadAbsence,
   271                                 null,
   293                                 null,
       
   294                                 null,
   272                                 ExtendedMasterSecretExtension.emsStringize),
   295                                 ExtendedMasterSecretExtension.emsStringize),
   273     SH_EXTENDED_MASTER_SECRET  (0x0017, "extended_master_secret",
   296     SH_EXTENDED_MASTER_SECRET  (0x0017, "extended_master_secret",
   274                                 SSLHandshake.SERVER_HELLO,
   297                                 SSLHandshake.SERVER_HELLO,
   275                                 ProtocolVersion.PROTOCOLS_TO_12,
   298                                 ProtocolVersion.PROTOCOLS_TO_12,
   276                                 ExtendedMasterSecretExtension.shNetworkProducer,
   299                                 ExtendedMasterSecretExtension.shNetworkProducer,
   277                                 ExtendedMasterSecretExtension.shOnLoadConcumer,
   300                                 ExtendedMasterSecretExtension.shOnLoadConcumer,
   278                                 ExtendedMasterSecretExtension.shOnLoadAbsence,
   301                                 ExtendedMasterSecretExtension.shOnLoadAbsence,
       
   302                                 null,
   279                                 null,
   303                                 null,
   280                                 ExtendedMasterSecretExtension.emsStringize),
   304                                 ExtendedMasterSecretExtension.emsStringize),
   281 
   305 
   282     // extensions defined in RFC draft-ietf-tokbind-negotiation
   306     // extensions defined in RFC draft-ietf-tokbind-negotiation
   283     TOKEN_BINDING           (0x0018, "token_binding "),
   307     TOKEN_BINDING           (0x0018, "token_binding "),
   298                                 ProtocolVersion.PROTOCOLS_OF_13,
   322                                 ProtocolVersion.PROTOCOLS_OF_13,
   299                                 SupportedVersionsExtension.chNetworkProducer,
   323                                 SupportedVersionsExtension.chNetworkProducer,
   300                                 SupportedVersionsExtension.chOnLoadConcumer,
   324                                 SupportedVersionsExtension.chOnLoadConcumer,
   301                                 null,
   325                                 null,
   302                                 null,
   326                                 null,
       
   327                                 null,
   303                                 SupportedVersionsExtension.chStringize),
   328                                 SupportedVersionsExtension.chStringize),
   304     SH_SUPPORTED_VERSIONS   (0x002B, "supported_versions",
   329     SH_SUPPORTED_VERSIONS   (0x002B, "supported_versions",
   305                                 SSLHandshake.SERVER_HELLO,
   330                                 SSLHandshake.SERVER_HELLO,
   306                                         // and HelloRetryRequest
   331                                         // and HelloRetryRequest
   307                                 ProtocolVersion.PROTOCOLS_OF_13,
   332                                 ProtocolVersion.PROTOCOLS_OF_13,
   308                                 SupportedVersionsExtension.shNetworkProducer,
   333                                 SupportedVersionsExtension.shNetworkProducer,
   309                                 SupportedVersionsExtension.shOnLoadConcumer,
   334                                 SupportedVersionsExtension.shOnLoadConcumer,
       
   335                                 null,
   310                                 null,
   336                                 null,
   311                                 null,
   337                                 null,
   312                                 SupportedVersionsExtension.shStringize),
   338                                 SupportedVersionsExtension.shStringize),
   313     HRR_SUPPORTED_VERSIONS  (0x002B, "supported_versions",
   339     HRR_SUPPORTED_VERSIONS  (0x002B, "supported_versions",
   314                                 SSLHandshake.HELLO_RETRY_REQUEST,
   340                                 SSLHandshake.HELLO_RETRY_REQUEST,
   315                                 ProtocolVersion.PROTOCOLS_OF_13,
   341                                 ProtocolVersion.PROTOCOLS_OF_13,
   316                                 SupportedVersionsExtension.hrrNetworkProducer,
   342                                 SupportedVersionsExtension.hrrNetworkProducer,
   317                                 SupportedVersionsExtension.hrrOnLoadConcumer,
   343                                 SupportedVersionsExtension.hrrOnLoadConcumer,
   318                                 null,
   344                                 null,
   319                                 null,
   345                                 null,
       
   346                                 null,
   320                                 SupportedVersionsExtension.hrrStringize),
   347                                 SupportedVersionsExtension.hrrStringize),
   321     MH_SUPPORTED_VERSIONS   (0x002B, "supported_versions",
   348     MH_SUPPORTED_VERSIONS   (0x002B, "supported_versions",
   322                                 SSLHandshake.MESSAGE_HASH,
   349                                 SSLHandshake.MESSAGE_HASH,
   323                                 ProtocolVersion.PROTOCOLS_OF_13,
   350                                 ProtocolVersion.PROTOCOLS_OF_13,
   324                                 SupportedVersionsExtension.hrrReproducer,
   351                                 SupportedVersionsExtension.hrrReproducer,
   325                                 null, null, null,
   352                                 null, null, null,
       
   353                                 null,
   326                                 SupportedVersionsExtension.hrrStringize),
   354                                 SupportedVersionsExtension.hrrStringize),
   327 
   355 
   328     CH_COOKIE               (0x002C, "cookie",
   356     CH_COOKIE               (0x002C, "cookie",
   329                                 SSLHandshake.CLIENT_HELLO,
   357                                 SSLHandshake.CLIENT_HELLO,
   330                                 ProtocolVersion.PROTOCOLS_OF_13,
   358                                 ProtocolVersion.PROTOCOLS_OF_13,
   331                                 CookieExtension.chNetworkProducer,
   359                                 CookieExtension.chNetworkProducer,
   332                                 CookieExtension.chOnLoadConcumer,
   360                                 CookieExtension.chOnLoadConcumer,
   333                                 null,
   361                                 null,
   334                                 CookieExtension.chOnTradeConsumer,
   362                                 CookieExtension.chOnTradeConsumer,
       
   363                                 null,
   335                                 CookieExtension.cookieStringize),
   364                                 CookieExtension.cookieStringize),
   336     HRR_COOKIE              (0x002C, "cookie",
   365     HRR_COOKIE              (0x002C, "cookie",
   337                                 SSLHandshake.HELLO_RETRY_REQUEST,
   366                                 SSLHandshake.HELLO_RETRY_REQUEST,
   338                                 ProtocolVersion.PROTOCOLS_OF_13,
   367                                 ProtocolVersion.PROTOCOLS_OF_13,
   339                                 CookieExtension.hrrNetworkProducer,
   368                                 CookieExtension.hrrNetworkProducer,
   340                                 CookieExtension.hrrOnLoadConcumer,
   369                                 CookieExtension.hrrOnLoadConcumer,
   341                                 null, null,
   370                                 null, null,
       
   371                                 null,
   342                                 CookieExtension.cookieStringize),
   372                                 CookieExtension.cookieStringize),
   343     MH_COOKIE               (0x002C, "cookie",
   373     MH_COOKIE               (0x002C, "cookie",
   344                                 SSLHandshake.MESSAGE_HASH,
   374                                 SSLHandshake.MESSAGE_HASH,
   345                                 ProtocolVersion.PROTOCOLS_OF_13,
   375                                 ProtocolVersion.PROTOCOLS_OF_13,
   346                                 CookieExtension.hrrNetworkReproducer,
   376                                 CookieExtension.hrrNetworkReproducer,
   347                                 null, null, null,
   377                                 null, null, null,
       
   378                                 null,
   348                                 CookieExtension.cookieStringize),
   379                                 CookieExtension.cookieStringize),
   349 
   380 
   350     PSK_KEY_EXCHANGE_MODES  (0x002D, "psk_key_exchange_modes",
   381     PSK_KEY_EXCHANGE_MODES  (0x002D, "psk_key_exchange_modes",
   351                                 SSLHandshake.CLIENT_HELLO,
   382                                 SSLHandshake.CLIENT_HELLO,
   352                                 ProtocolVersion.PROTOCOLS_OF_13,
   383                                 ProtocolVersion.PROTOCOLS_OF_13,
   353                                 PskKeyExchangeModesExtension.chNetworkProducer,
   384                                 PskKeyExchangeModesExtension.chNetworkProducer,
   354                                 PskKeyExchangeModesExtension.chOnLoadConsumer,
   385                                 PskKeyExchangeModesExtension.chOnLoadConsumer,
   355                                 null, null, null),
   386                                 null, null, null, null),
   356     CERTIFICATE_AUTHORITIES (0x002F, "certificate_authorities"),
   387     CERTIFICATE_AUTHORITIES (0x002F, "certificate_authorities"),
   357     OID_FILTERS             (0x0030, "oid_filters"),
   388     OID_FILTERS             (0x0030, "oid_filters"),
   358     POST_HANDSHAKE_AUTH     (0x0030, "post_handshake_auth"),
   389     POST_HANDSHAKE_AUTH     (0x0030, "post_handshake_auth"),
   359 
   390 
   360     CH_KEY_SHARE            (0x0033, "key_share",
   391     CH_KEY_SHARE            (0x0033, "key_share",
   361                                 SSLHandshake.CLIENT_HELLO,
   392                                 SSLHandshake.CLIENT_HELLO,
   362                                 ProtocolVersion.PROTOCOLS_OF_13,
   393                                 ProtocolVersion.PROTOCOLS_OF_13,
   363                                 KeyShareExtension.chNetworkProducer,
   394                                 KeyShareExtension.chNetworkProducer,
   364                                 KeyShareExtension.chOnLoadConcumer,
   395                                 KeyShareExtension.chOnLoadConcumer,
   365                                 null, null,
   396                                 null, null, null,
   366                                 KeyShareExtension.chStringize),
   397                                 KeyShareExtension.chStringize),
   367     SH_KEY_SHARE            (0x0033, "key_share",
   398     SH_KEY_SHARE            (0x0033, "key_share",
   368                                 SSLHandshake.SERVER_HELLO,
   399                                 SSLHandshake.SERVER_HELLO,
   369                                 ProtocolVersion.PROTOCOLS_OF_13,
   400                                 ProtocolVersion.PROTOCOLS_OF_13,
   370                                 KeyShareExtension.shNetworkProducer,
   401                                 KeyShareExtension.shNetworkProducer,
   371                                 KeyShareExtension.shOnLoadConcumer,
   402                                 KeyShareExtension.shOnLoadConcumer,
   372                                 KeyShareExtension.shOnLoadAbsence,
   403                                 KeyShareExtension.shOnLoadAbsence,
   373                                 null,
   404                                 null,
       
   405                                 null,
   374                                 KeyShareExtension.shStringize),
   406                                 KeyShareExtension.shStringize),
   375     HRR_KEY_SHARE           (0x0033, "key_share",
   407     HRR_KEY_SHARE           (0x0033, "key_share",
   376                                 SSLHandshake.HELLO_RETRY_REQUEST,
   408                                 SSLHandshake.HELLO_RETRY_REQUEST,
   377                                 ProtocolVersion.PROTOCOLS_OF_13,
   409                                 ProtocolVersion.PROTOCOLS_OF_13,
   378                                 KeyShareExtension.hrrNetworkProducer,
   410                                 KeyShareExtension.hrrNetworkProducer,
   379                                 KeyShareExtension.hrrOnLoadConcumer,
   411                                 KeyShareExtension.hrrOnLoadConcumer,
   380                                 null, null,
   412                                 null, null, null,
   381                                 KeyShareExtension.hrrStringize),
   413                                 KeyShareExtension.hrrStringize),
   382     MH_KEY_SHARE            (0x0033, "key_share",
   414     MH_KEY_SHARE            (0x0033, "key_share",
   383                                 SSLHandshake.MESSAGE_HASH,
   415                                 SSLHandshake.MESSAGE_HASH,
   384                                 ProtocolVersion.PROTOCOLS_OF_13,
   416                                 ProtocolVersion.PROTOCOLS_OF_13,
   385                                 KeyShareExtension.hrrNetworkReproducer,
   417                                 KeyShareExtension.hrrNetworkReproducer,
   386                                 null, null, null,
   418                                 null, null, null, null,
   387                                 KeyShareExtension.hrrStringize),
   419                                 KeyShareExtension.hrrStringize),
   388 
   420 
   389     // Extensions defined in RFC 5746
   421     // Extensions defined in RFC 5746
   390     CH_RENEGOTIATION_INFO   (0xff01, "renegotiation_info",
   422     CH_RENEGOTIATION_INFO   (0xff01, "renegotiation_info",
   391                                 SSLHandshake.CLIENT_HELLO,
   423                                 SSLHandshake.CLIENT_HELLO,
   392                                 ProtocolVersion.PROTOCOLS_TO_12,
   424                                 ProtocolVersion.PROTOCOLS_TO_12,
   393                                 RenegoInfoExtension.chNetworkProducer,
   425                                 RenegoInfoExtension.chNetworkProducer,
   394                                 RenegoInfoExtension.chOnLoadConcumer,
   426                                 RenegoInfoExtension.chOnLoadConcumer,
   395                                 RenegoInfoExtension.chOnLoadAbsence,
   427                                 RenegoInfoExtension.chOnLoadAbsence,
   396                                 null,
   428                                 null,
       
   429                                 null,
   397                                 RenegoInfoExtension.rniStringize),
   430                                 RenegoInfoExtension.rniStringize),
   398     SH_RENEGOTIATION_INFO   (0xff01, "renegotiation_info",
   431     SH_RENEGOTIATION_INFO   (0xff01, "renegotiation_info",
   399                                 SSLHandshake.SERVER_HELLO,
   432                                 SSLHandshake.SERVER_HELLO,
   400                                 ProtocolVersion.PROTOCOLS_TO_12,
   433                                 ProtocolVersion.PROTOCOLS_TO_12,
   401                                 RenegoInfoExtension.shNetworkProducer,
   434                                 RenegoInfoExtension.shNetworkProducer,
   402                                 RenegoInfoExtension.shOnLoadConcumer,
   435                                 RenegoInfoExtension.shOnLoadConcumer,
   403                                 RenegoInfoExtension.shOnLoadAbsence,
   436                                 RenegoInfoExtension.shOnLoadAbsence,
   404                                 null,
   437                                 null,
       
   438                                 null,
   405                                 RenegoInfoExtension.rniStringize),
   439                                 RenegoInfoExtension.rniStringize),
   406 
   440 
   407     // TLS 1.3 PSK extension must be last
   441     // TLS 1.3 PSK extension must be last
   408     CH_PRE_SHARED_KEY       (0x0029, "pre_shared_key",
   442     CH_PRE_SHARED_KEY       (0x0029, "pre_shared_key",
   409                             SSLHandshake.CLIENT_HELLO,
   443                                 SSLHandshake.CLIENT_HELLO,
   410                             ProtocolVersion.PROTOCOLS_OF_13,
   444                                 ProtocolVersion.PROTOCOLS_OF_13,
   411                             PreSharedKeyExtension.chNetworkProducer,
   445                                 PreSharedKeyExtension.chNetworkProducer,
   412                             PreSharedKeyExtension.chOnLoadConsumer,
   446                                 PreSharedKeyExtension.chOnLoadConsumer,
   413                             PreSharedKeyExtension.chOnLoadAbsence,
   447                                 PreSharedKeyExtension.chOnLoadAbsence,
   414                             PreSharedKeyExtension.chOnTradeConsumer,
   448                                 PreSharedKeyExtension.chOnTradeConsumer,
   415                             null),
   449                                 null, null),
   416     SH_PRE_SHARED_KEY       (0x0029, "pre_shared_key",
   450     SH_PRE_SHARED_KEY       (0x0029, "pre_shared_key",
   417                             SSLHandshake.SERVER_HELLO,
   451                                 SSLHandshake.SERVER_HELLO,
   418                             ProtocolVersion.PROTOCOLS_OF_13,
   452                                 ProtocolVersion.PROTOCOLS_OF_13,
   419                             PreSharedKeyExtension.shNetworkProducer,
   453                                 PreSharedKeyExtension.shNetworkProducer,
   420                             PreSharedKeyExtension.shOnLoadConsumer,
   454                                 PreSharedKeyExtension.shOnLoadConsumer,
   421                             PreSharedKeyExtension.shOnLoadAbsence,
   455                                 PreSharedKeyExtension.shOnLoadAbsence,
   422                             null, null);
   456                                 null, null, null);
   423 
   457 
   424     final int id;
   458     final int id;
   425     final SSLHandshake handshakeType;
   459     final SSLHandshake handshakeType;
   426     final String name;
   460     final String name;
   427     final ProtocolVersion[] supportedProtocols;
   461     final ProtocolVersion[] supportedProtocols;
   428     final HandshakeProducer networkProducer;
   462     final HandshakeProducer networkProducer;
   429     final ExtensionConsumer onLoadConcumer;
   463     final ExtensionConsumer onLoadConcumer;
   430     final HandshakeAbsence  onLoadAbsence;
   464     final HandshakeAbsence  onLoadAbsence;
   431     final HandshakeConsumer onTradeConsumer;
   465     final HandshakeConsumer onTradeConsumer;
       
   466     final HandshakeAbsence  onTradeAbsence;
   432     final SSLStringize stringize;
   467     final SSLStringize stringize;
   433 
   468 
   434     // known but unsupported extension
   469     // known but unsupported extension
   435     private SSLExtension(int id, String name) {
   470     private SSLExtension(int id, String name) {
   436         this.id = id;
   471         this.id = id;
   439         this.supportedProtocols = new ProtocolVersion[0];
   474         this.supportedProtocols = new ProtocolVersion[0];
   440         this.networkProducer = null;
   475         this.networkProducer = null;
   441         this.onLoadConcumer = null;
   476         this.onLoadConcumer = null;
   442         this.onLoadAbsence = null;
   477         this.onLoadAbsence = null;
   443         this.onTradeConsumer = null;
   478         this.onTradeConsumer = null;
       
   479         this.onTradeAbsence = null;
   444         this.stringize = null;
   480         this.stringize = null;
   445     }
   481     }
   446 
   482 
   447     // supported extension
   483     // supported extension
   448     private SSLExtension(int id, String name, SSLHandshake handshakeType,
   484     private SSLExtension(int id, String name, SSLHandshake handshakeType,
   449             ProtocolVersion[] supportedProtocols,
   485             ProtocolVersion[] supportedProtocols,
   450             HandshakeProducer producer,
   486             HandshakeProducer producer,
   451             ExtensionConsumer onLoadConcumer, HandshakeAbsence onLoadAbsence,
   487             ExtensionConsumer onLoadConcumer, HandshakeAbsence onLoadAbsence,
   452             HandshakeConsumer onTradeConsumer, SSLStringize stringize) {
   488             HandshakeConsumer onTradeConsumer, HandshakeAbsence onTradeAbsence,
   453 
   489             SSLStringize stringize) {
   454         this.id = id;
   490         this.id = id;
   455         this.handshakeType = handshakeType;
   491         this.handshakeType = handshakeType;
   456         this.name = name;
   492         this.name = name;
   457         this.supportedProtocols = supportedProtocols;
   493         this.supportedProtocols = supportedProtocols;
   458         this.networkProducer = producer;
   494         this.networkProducer = producer;
   459         this.onLoadConcumer = onLoadConcumer;
   495         this.onLoadConcumer = onLoadConcumer;
   460         this.onLoadAbsence = onLoadAbsence;
   496         this.onLoadAbsence = onLoadAbsence;
   461         this.onTradeConsumer = onTradeConsumer;
   497         this.onTradeConsumer = onTradeConsumer;
       
   498         this.onTradeAbsence = onTradeAbsence;
   462         this.stringize = stringize;
   499         this.stringize = stringize;
   463     }
   500     }
   464 
   501 
   465     static SSLExtension valueOf(SSLHandshake handshakeType, int extensionType) {
   502     static SSLExtension valueOf(SSLHandshake handshakeType, int extensionType) {
   466         for (SSLExtension ext : SSLExtension.values()) {
   503         for (SSLExtension ext : SSLExtension.values()) {
   512             throw new UnsupportedOperationException(
   549             throw new UnsupportedOperationException(
   513                     "Not yet supported extension processing.");
   550                     "Not yet supported extension processing.");
   514         }
   551         }
   515     }
   552     }
   516 
   553 
   517     void absent(ConnectionContext context,
   554     void absentOnLoad(ConnectionContext context,
   518             HandshakeMessage message) throws IOException {
   555             HandshakeMessage message) throws IOException {
   519         if (onLoadAbsence != null) {
   556         if (onLoadAbsence != null) {
   520             onLoadAbsence.absent(context, message);
   557             onLoadAbsence.absent(context, message);
       
   558         } else {
       
   559             throw new UnsupportedOperationException(
       
   560                     "Not yet supported extension absence processing.");
       
   561         }
       
   562     }
       
   563 
       
   564     void absentOnTrade(ConnectionContext context,
       
   565             HandshakeMessage message) throws IOException {
       
   566         if (onTradeAbsence != null) {
       
   567             onTradeAbsence.absent(context, message);
   521         } else {
   568         } else {
   522             throw new UnsupportedOperationException(
   569             throw new UnsupportedOperationException(
   523                     "Not yet supported extension absence processing.");
   570                     "Not yet supported extension absence processing.");
   524         }
   571         }
   525     }
   572     }