src/java.base/share/classes/sun/security/ssl/ServerHandshakeContext.java
branchJDK-8145252-TLS13-branch
changeset 56542 56aaa6cb3693
parent 48225 718669e6b375
child 56715 b152d06ed6a9
equal deleted inserted replaced
56541:92cbbfc996f3 56542:56aaa6cb3693
       
     1 /*
       
     2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * questions.
       
    24  */
       
    25 
       
    26 package sun.security.ssl;
       
    27 
       
    28 import java.io.IOException;
       
    29 import java.security.AlgorithmConstraints;
       
    30 import java.security.AccessController;
       
    31 import sun.security.util.LegacyAlgorithmConstraints;
       
    32 import sun.security.action.GetPropertyAction;
       
    33 import sun.security.action.GetLongAction;
       
    34 
       
    35 class ServerHandshakeContext extends HandshakeContext {
       
    36     // To prevent the TLS renegotiation issues, by setting system property
       
    37     // "jdk.tls.rejectClientInitiatedRenegotiation" to true, applications in
       
    38     // server side can disable all client initiated SSL renegotiations
       
    39     // regardless of the support of TLS protocols.
       
    40     //
       
    41     // By default, allow client initiated renegotiations.
       
    42     static final boolean rejectClientInitiatedRenego =
       
    43             Utilities.getBooleanProperty(
       
    44                 "jdk.tls.rejectClientInitiatedRenegotiation", false);
       
    45 
       
    46     // legacy algorithm constraints
       
    47     static final AlgorithmConstraints legacyAlgorithmConstraints =
       
    48             new LegacyAlgorithmConstraints(
       
    49                     LegacyAlgorithmConstraints.PROPERTY_TLS_LEGACY_ALGS,
       
    50                     new SSLAlgorithmDecomposer());
       
    51 
       
    52     // temporary authentication information
       
    53     SSLPossession interimAuthn;
       
    54 
       
    55     StatusResponseManager.StaplingParameters stapleParams;
       
    56     CertificateMessage.CertificateEntry currentCertEntry;
       
    57     private static final long DEFAULT_STATUS_RESP_DELAY = 5000L;
       
    58     final long statusRespTimeout;
       
    59 
       
    60 
       
    61     ServerHandshakeContext(SSLContextImpl sslContext,
       
    62             TransportContext conContext) throws IOException {
       
    63         super(sslContext, conContext);
       
    64         long respTimeOut = AccessController.doPrivileged(
       
    65                     new GetLongAction("jdk.tls.stapling.responseTimeout",
       
    66                         DEFAULT_STATUS_RESP_DELAY));
       
    67         statusRespTimeout = respTimeOut >= 0 ? respTimeOut :
       
    68                 DEFAULT_STATUS_RESP_DELAY;
       
    69         handshakeConsumers.put(
       
    70                 SSLHandshake.CLIENT_HELLO.id, SSLHandshake.CLIENT_HELLO);
       
    71     }
       
    72 
       
    73     @Override
       
    74     void kickstart() throws IOException {
       
    75         if (!conContext.isNegotiated || kickstartMessageDelivered) {
       
    76             return;
       
    77         }
       
    78 
       
    79         SSLHandshake.kickstart(this);
       
    80         kickstartMessageDelivered = true;
       
    81     }
       
    82 }
       
    83