Path: blob/master/src/java.base/share/classes/javax/net/ssl/ExtendedSSLSession.java
41159 views
/*1* Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.net.ssl;2627import java.util.List;2829/**30* Extends the {@code SSLSession} interface to support additional31* session attributes.32*33* @since 1.734*/35public abstract class ExtendedSSLSession implements SSLSession {36/**37* Constructor for subclasses to call.38*/39public ExtendedSSLSession() {}4041/**42* Obtains an array of supported signature algorithms that the local side43* is willing to use.44* <p>45* Note: this method is used to indicate to the peer which signature46* algorithms may be used for digital signatures in TLS/DTLS 1.2. It is47* not meaningful for TLS/DTLS versions prior to 1.2.48* <p>49* The signature algorithm name must be a standard Java Security50* name (such as "SHA1withRSA", "SHA256withECDSA", and so on).51* See the <a href=52* "{@docRoot}/../specs/security/standard-names.html">53* Java Security Standard Algorithm Names</a> document54* for information about standard algorithm names.55* <p>56* Note: the local supported signature algorithms should conform to57* the algorithm constraints specified by58* {@link SSLParameters#getAlgorithmConstraints getAlgorithmConstraints()}59* method in {@code SSLParameters}.60*61* @return An array of supported signature algorithms, in descending62* order of preference. The return value is an empty array if63* no signature algorithm is supported.64*65* @see SSLParameters#getAlgorithmConstraints66*/67public abstract String[] getLocalSupportedSignatureAlgorithms();6869/**70* Obtains an array of supported signature algorithms that the peer is71* able to use.72* <p>73* Note: this method is used to indicate to the local side which signature74* algorithms may be used for digital signatures in TLS/DTLS 1.2. It is75* not meaningful for TLS/DTLS versions prior to 1.2.76* <p>77* The signature algorithm name must be a standard Java Security78* name (such as "SHA1withRSA", "SHA256withECDSA", and so on).79* See the <a href=80* "{@docRoot}/../specs/security/standard-names.html">81* Java Security Standard Algorithm Names</a> document82* for information about standard algorithm names.83*84* @return An array of supported signature algorithms, in descending85* order of preference. The return value is an empty array if86* the peer has not sent the supported signature algorithms.87*88* @see X509KeyManager89* @see X509ExtendedKeyManager90*/91public abstract String[] getPeerSupportedSignatureAlgorithms();9293/**94* Obtains a {@link List} containing all {@link SNIServerName}s95* of the requested Server Name Indication (SNI) extension.96* <P>97* In server mode, unless the return {@link List} is empty,98* the server should use the requested server names to guide its99* selection of an appropriate authentication certificate, and/or100* other aspects of security policy.101* <P>102* In client mode, unless the return {@link List} is empty,103* the client should use the requested server names to guide its104* endpoint identification of the peer's identity, and/or105* other aspects of security policy.106*107* @return a non-null immutable list of {@link SNIServerName}s of the108* requested server name indications. The returned list may be109* empty if no server name indications were requested.110* @throws UnsupportedOperationException if the underlying provider111* does not implement the operation112*113* @see SNIServerName114* @see X509ExtendedTrustManager115* @see X509ExtendedKeyManager116*117* @since 1.8118*/119public List<SNIServerName> getRequestedServerNames() {120throw new UnsupportedOperationException();121}122123/**124* Returns a {@link List} containing DER-encoded OCSP responses125* (using the ASN.1 type OCSPResponse defined in RFC 6960) for126* the client to verify status of the server's certificate during127* handshaking.128*129* <P>130* This method only applies to certificate-based server131* authentication. An {@link X509ExtendedTrustManager} will use the132* returned value for server certificate validation.133*134* @implSpec This method throws UnsupportedOperationException by default.135* Classes derived from ExtendedSSLSession must implement136* this method.137*138* @return a non-null unmodifiable list of byte arrays, each entry139* containing a DER-encoded OCSP response (using the140* ASN.1 type OCSPResponse defined in RFC 6960). The order141* of the responses must match the order of the certificates142* presented by the server in its Certificate message (See143* {@link SSLSession#getLocalCertificates()} for server mode,144* and {@link SSLSession#getPeerCertificates()} for client mode).145* It is possible that fewer response entries may be returned than146* the number of presented certificates. If an entry in the list147* is a zero-length byte array, it should be treated by the148* caller as if the OCSP entry for the corresponding certificate149* is missing. The returned list may be empty if no OCSP responses150* were presented during handshaking or if OCSP stapling is not151* supported by either endpoint for this handshake.152*153* @throws UnsupportedOperationException if the underlying provider154* does not implement the operation155*156* @see X509ExtendedTrustManager157*158* @since 9159*/160public List<byte[]> getStatusResponses() {161throw new UnsupportedOperationException();162}163}164165166