jdk/src/java.base/share/classes/sun/security/ssl/CertStatusReqExtension.java
author jnimeh
Wed, 05 Aug 2015 12:19:38 -0700
changeset 32032 22badc53802f
permissions -rw-r--r--
8046321: OCSP Stapling for TLS Summary: Initial feature commit for OCSP stapling in JSSE Reviewed-by: xuelei, mullan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32032
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
     1
/*
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
     4
 *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    10
 *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    15
 * accompanied this code).
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    16
 *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    20
 *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    23
 * questions.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    24
 */
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    25
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    26
package sun.security.ssl;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    27
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    28
import java.io.IOException;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    29
import java.util.Objects;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    30
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    31
/*
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    32
 * RFC6066 defines the TLS extension,"status_request" (type 0x5),
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    33
 * which allows the client to request that the server perform OCSP
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    34
 * on the client's behalf.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    35
 * The "extension data" field of this extension contains a
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    36
 * "CertificateStatusRequest" structure:
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    37
 *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    38
 *      struct {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    39
 *          CertificateStatusType status_type;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    40
 *          select (status_type) {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    41
 *              case ocsp: OCSPStatusRequest;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    42
 *          } request;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    43
 *      } CertificateStatusRequest;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    44
 *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    45
 *      enum { ocsp(1), (255) } CertificateStatusType;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    46
 *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    47
 *      struct {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    48
 *          ResponderID responder_id_list<0..2^16-1>;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    49
 *          Extensions  request_extensions;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    50
 *      } OCSPStatusRequest;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    51
 *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    52
 *      opaque ResponderID<1..2^16-1>;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    53
 *      opaque Extensions<0..2^16-1>;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    54
 */
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    55
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    56
final class CertStatusReqExtension extends HelloExtension {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    57
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    58
    private final StatusRequestType statReqType;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    59
    private final StatusRequest request;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    60
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    61
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    62
    /**
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    63
     * Construct the default status request extension object.  The default
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    64
     * object results in a status_request extension where the extension
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    65
     * data segment is zero-length.  This is used primarily in ServerHello
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    66
     * messages where the server asserts it can do RFC 6066 status stapling.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    67
     */
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    68
    CertStatusReqExtension() {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    69
        super(ExtensionType.EXT_STATUS_REQUEST);
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    70
        statReqType = null;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    71
        request = null;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    72
    }
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    73
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    74
    /**
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    75
     * Construct the status request extension object given a request type
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    76
     *      and {@code StatusRequest} object.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    77
     *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    78
     * @param reqType a {@code StatusRequestExtType object correspoding
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    79
     *      to the underlying {@code StatusRequest} object.  A value of
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    80
     *      {@code null} is not allowed.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    81
     * @param statReq the {@code StatusRequest} object used to provide the
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    82
     *      encoding for the TLS extension.  A value of {@code null} is not
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    83
     *      allowed.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    84
     *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    85
     * @throws IllegalArgumentException if the provided {@code StatusRequest}
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    86
     *      does not match the type.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    87
     * @throws NullPointerException if either the {@code reqType} or
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    88
     *      {@code statReq} arguments are {@code null}.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    89
     */
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    90
    CertStatusReqExtension(StatusRequestType reqType, StatusRequest statReq) {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    91
        super(ExtensionType.EXT_STATUS_REQUEST);
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    92
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    93
        statReqType = Objects.requireNonNull(reqType,
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    94
                "Unallowed null value for status_type");
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    95
        request = Objects.requireNonNull(statReq,
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    96
                "Unallowed null value for request");
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    97
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    98
        // There is currently only one known status type (OCSP)
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
    99
        // We can add more clauses to cover other types in the future
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   100
        if (statReqType == StatusRequestType.OCSP) {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   101
            if (!(statReq instanceof OCSPStatusRequest)) {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   102
                throw new IllegalArgumentException("StatusRequest not " +
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   103
                        "of type OCSPStatusRequest");
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   104
            }
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   105
        }
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   106
    }
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   107
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   108
    /**
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   109
     * Construct the {@code CertStatusReqExtension} object from data read from
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   110
     *      a {@code HandshakeInputStream}
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   111
     *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   112
     * @param s the {@code HandshakeInputStream} providing the encoded data
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   113
     * @param len the length of the extension data
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   114
     *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   115
     * @throws IOException if any decoding errors happen during object
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   116
     *      construction.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   117
     */
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   118
    CertStatusReqExtension(HandshakeInStream s, int len) throws IOException {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   119
        super(ExtensionType.EXT_STATUS_REQUEST);
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   120
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   121
        if (len > 0) {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   122
            // Obtain the status type (first byte)
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   123
            statReqType = StatusRequestType.get(s.getInt8());
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   124
            if (statReqType == StatusRequestType.OCSP) {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   125
                request = new OCSPStatusRequest(s);
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   126
            } else {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   127
                // This is a status_type we don't understand.  Create
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   128
                // an UnknownStatusRequest in order to preserve the data
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   129
                request = new UnknownStatusRequest(s, len - 1);
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   130
            }
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   131
        } else {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   132
            // Treat this as a zero-length extension (i.e. from a ServerHello
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   133
            statReqType = null;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   134
            request = null;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   135
        }
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   136
    }
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   137
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   138
    /**
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   139
     * Return the length of the encoded extension, including extension type,
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   140
     *      extension length and status_type fields.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   141
     *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   142
     * @return the length in bytes, including the extension type and
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   143
     *      length fields.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   144
     */
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   145
    @Override
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   146
    int length() {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   147
        return (statReqType != null ? 5 + request.length() : 4);
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   148
    }
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   149
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   150
    /**
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   151
     * Send the encoded TLS extension through a {@code HandshakeOutputStream}
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   152
     *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   153
     * @param s the {@code HandshakeOutputStream} used to send the encoded data
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   154
     *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   155
     * @throws IOException tf any errors occur during the encoding process
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   156
     */
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   157
    @Override
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   158
    void send(HandshakeOutStream s) throws IOException {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   159
        s.putInt16(type.id);
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   160
        s.putInt16(this.length() - 4);
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   161
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   162
        if (statReqType != null) {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   163
            s.putInt8(statReqType.id);
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   164
            request.send(s);
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   165
        }
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   166
    }
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   167
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   168
    /**
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   169
     * Create a string representation of this {@code CertStatusReqExtension}
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   170
     *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   171
     * @return the string representation of this {@code CertStatusReqExtension}
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   172
     */
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   173
    @Override
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   174
    public String toString() {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   175
        StringBuilder sb = new StringBuilder("Extension ").append(type);
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   176
        if (statReqType != null) {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   177
            sb.append(": ").append(statReqType).append(", ").append(request);
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   178
        }
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   179
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   180
        return sb.toString();
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   181
    }
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   182
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   183
    /**
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   184
     * Return the type field for this {@code CertStatusReqExtension}
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   185
     *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   186
     * @return the {@code StatusRequestType} for this extension.  {@code null}
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   187
     *      will be returned if the default constructor is used to create
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   188
     *      a zero length status_request extension (found in ServerHello
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   189
     *      messages)
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   190
     */
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   191
    StatusRequestType getType() {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   192
        return statReqType;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   193
    }
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   194
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   195
    /**
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   196
     * Get the underlying {@code StatusRequest} for this
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   197
     *      {@code CertStatusReqExtension}
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   198
     *
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   199
     * @return the {@code StatusRequest} or {@code null} if the default
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   200
     * constructor was used to create this extension.
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   201
     */
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   202
    StatusRequest getRequest() {
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   203
        return request;
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   204
    }
22badc53802f 8046321: OCSP Stapling for TLS
jnimeh
parents:
diff changeset
   205
}