src/java.base/share/classes/sun/security/ssl/ServerHandshakeContext.java
changeset 50768 68fa3d4026ea
parent 48225 718669e6b375
equal deleted inserted replaced
50767:356eaea05bf0 50768:68fa3d4026ea
       
     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.GetLongAction;
       
    33 
       
    34 class ServerHandshakeContext extends HandshakeContext {
       
    35     // To prevent the TLS renegotiation issues, by setting system property
       
    36     // "jdk.tls.rejectClientInitiatedRenegotiation" to true, applications in
       
    37     // server side can disable all client initiated SSL renegotiation
       
    38     // regardless of the support of TLS protocols.
       
    39     //
       
    40     // By default, allow client initiated renegotiation.
       
    41     static final boolean rejectClientInitiatedRenego =
       
    42             Utilities.getBooleanProperty(
       
    43                 "jdk.tls.rejectClientInitiatedRenegotiation", false);
       
    44 
       
    45     // legacy algorithm constraints
       
    46     static final AlgorithmConstraints legacyAlgorithmConstraints =
       
    47             new LegacyAlgorithmConstraints(
       
    48                     LegacyAlgorithmConstraints.PROPERTY_TLS_LEGACY_ALGS,
       
    49                     new SSLAlgorithmDecomposer());
       
    50 
       
    51     // temporary authentication information
       
    52     SSLPossession interimAuthn;
       
    53 
       
    54     StatusResponseManager.StaplingParameters stapleParams;
       
    55     CertificateMessage.CertificateEntry currentCertEntry;
       
    56     private static final long DEFAULT_STATUS_RESP_DELAY = 5000L;
       
    57     final long statusRespTimeout;
       
    58 
       
    59 
       
    60     ServerHandshakeContext(SSLContextImpl sslContext,
       
    61             TransportContext conContext) throws IOException {
       
    62         super(sslContext, conContext);
       
    63         long respTimeOut = AccessController.doPrivileged(
       
    64                     new GetLongAction("jdk.tls.stapling.responseTimeout",
       
    65                         DEFAULT_STATUS_RESP_DELAY));
       
    66         statusRespTimeout = respTimeOut >= 0 ? respTimeOut :
       
    67                 DEFAULT_STATUS_RESP_DELAY;
       
    68         handshakeConsumers.put(
       
    69                 SSLHandshake.CLIENT_HELLO.id, SSLHandshake.CLIENT_HELLO);
       
    70     }
       
    71 
       
    72     @Override
       
    73     void kickstart() throws IOException {
       
    74         if (!conContext.isNegotiated || kickstartMessageDelivered) {
       
    75             return;
       
    76         }
       
    77 
       
    78         SSLHandshake.kickstart(this);
       
    79         kickstartMessageDelivered = true;
       
    80     }
       
    81 }
       
    82