Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/net/SecureCacheResponse.java
38829 views
/*1* Copyright (c) 2003, 2004, 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 java.net;2627import java.security.cert.Certificate;28import javax.net.ssl.SSLPeerUnverifiedException;29import java.security.Principal;30import java.util.List;3132/**33* Represents a cache response originally retrieved through secure34* means, such as TLS.35*36* @since 1.537*/38public abstract class SecureCacheResponse extends CacheResponse {39/**40* Returns the cipher suite in use on the original connection that41* retrieved the network resource.42*43* @return a string representing the cipher suite44*/45public abstract String getCipherSuite();4647/**48* Returns the certificate chain that were sent to the server during49* handshaking of the original connection that retrieved the50* network resource. Note: This method is useful only51* when using certificate-based cipher suites.52*53* @return an immutable List of Certificate representing the54* certificate chain that was sent to the server. If no55* certificate chain was sent, null will be returned.56* @see #getLocalPrincipal()57*/58public abstract List<Certificate> getLocalCertificateChain();5960/**61* Returns the server's certificate chain, which was established as62* part of defining the session in the original connection that63* retrieved the network resource, from cache. Note: This method64* can be used only when using certificate-based cipher suites;65* using it with non-certificate-based cipher suites, such as66* Kerberos, will throw an SSLPeerUnverifiedException.67*68* @return an immutable List of Certificate representing the server's69* certificate chain.70* @throws SSLPeerUnverifiedException if the peer is not verified.71* @see #getPeerPrincipal()72*/73public abstract List<Certificate> getServerCertificateChain()74throws SSLPeerUnverifiedException;7576/**77* Returns the server's principal which was established as part of78* defining the session during the original connection that79* retrieved the network resource.80*81* @return the server's principal. Returns an X500Principal of the82* end-entity certiticate for X509-based cipher suites, and83* KerberosPrincipal for Kerberos cipher suites.84*85* @throws SSLPeerUnverifiedException if the peer was not verified.86*87* @see #getServerCertificateChain()88* @see #getLocalPrincipal()89*/90public abstract Principal getPeerPrincipal()91throws SSLPeerUnverifiedException;9293/**94* Returns the principal that was sent to the server during95* handshaking in the original connection that retrieved the96* network resource.97*98* @return the principal sent to the server. Returns an X500Principal99* of the end-entity certificate for X509-based cipher suites, and100* KerberosPrincipal for Kerberos cipher suites. If no principal was101* sent, then null is returned.102*103* @see #getLocalCertificateChain()104* @see #getPeerPrincipal()105*/106public abstract Principal getLocalPrincipal();107}108109110