01: /* Licensed to the Apache Software Foundation (ASF) under one or more
02: * contributor license agreements. See the NOTICE file distributed with
03: * this work for additional information regarding copyright ownership.
04: * The ASF licenses this file to You under the Apache License, Version 2.0
05: * (the "License"); you may not use this file except in compliance with
06: * the License. You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package java.net;
17:
18: import java.security.Principal;
19: import java.security.cert.Certificate;
20: import java.util.List;
21:
22: import javax.net.ssl.SSLPeerUnverifiedException;
23:
24: /**
25: * A secure cache response, which is originally retrieved through secure ways.
26: */
27: public abstract class SecureCacheResponse extends CacheResponse {
28: /**
29: * Constructor method
30: */
31: public SecureCacheResponse() {
32: super ();
33: }
34:
35: /**
36: * Gets the cipher suite string on the connection which is originally used
37: * to retrieve the network resource.
38: *
39: * @return the cipher suite string
40: */
41: public abstract String getCipherSuite();
42:
43: /**
44: * Gets local certificate chain. When the original connection retrieved the
45: * resource data, certificate chain was sent to the server during
46: * handshaking process. This method only takes effect when certificate-based
47: * cipher suite is enabled.
48: *
49: * @return the certificate chain that was sent to the server. The
50: * certificate chain is represented as a <code>List</code> of
51: * <code>Certificate</code>. If no certificate chain was sent,
52: * the method returns null.
53: */
54: public abstract List<Certificate> getLocalCertificateChain();
55:
56: /**
57: * Gets server's certificate chain from cache. As part of defining the
58: * session, the certificate chain was established when the original
59: * connection retrieved network resource. This method can only be invoked
60: * when certificated-based cypher suites is enable. Otherwise, it throws an
61: * <code>SSLPeerUnverifiedException</code>.
62: *
63: * @return The server's certificate chain, which is represented as a
64: * <code>List</code> of <code>Certificate</code>.
65: * @throws SSLPeerUnverifiedException
66: * If the peer is unverified.
67: */
68: public abstract List<Certificate> getServerCertificateChain()
69: throws SSLPeerUnverifiedException;
70:
71: /**
72: * Gets the server's <code>Principle</code>. When the original connection
73: * retrieved network resource, the principle was established when defining
74: * the session.
75: *
76: * @return an <code>Principal</code> represents the server's principal.
77: * @throws SSLPeerUnverifiedException
78: * If the peer is unverified.
79: */
80: public abstract Principal getPeerPrincipal()
81: throws SSLPeerUnverifiedException;
82:
83: /**
84: * Gets the <code>Principle</code> that the original connection sent to
85: * the server. When the original connection fetched the network resource,
86: * the <code>Principle</code> was sent to the server during handshaking
87: * process.
88: *
89: *
90: * @return the <code>principal</code> sent to the server. Returns an
91: * <code>X500Principal</code> for X509-based cipher suites. If no
92: * principal was sent, it returns null.
93: */
94: public abstract Principal getLocalPrincipal();
95: }
|