KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > net > SecureCacheResponse


1 /*
2  * @(#)SecureCacheResponse.java 1.1 03/09/22
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.net;
9
10 import java.security.cert.Certificate JavaDoc;
11 import javax.net.ssl.SSLPeerUnverifiedException;
12 import java.security.Principal JavaDoc;
13 import java.util.List JavaDoc;
14
15 /**
16  * Represents a cache response originally retrieved through secure
17  * means, such as TLS.
18  *
19  * @since 1.5
20  */

21 public abstract class SecureCacheResponse extends CacheResponse JavaDoc {
22     /**
23      * Returns the cipher suite in use on the original connection that
24      * retrieved the network resource.
25      *
26      * @return a string representing the cipher suite
27      */

28     public abstract String JavaDoc getCipherSuite();
29  
30     /**
31      * Returns the certificate chain that were sent to the server during
32      * handshaking of the original connection that retrieved the
33      * network resource. Note: This method is useful only
34      * when using certificate-based cipher suites.
35      *
36      * @return an immutable List of Certificate representing the
37      * certificate chain that was sent to the server. If no
38      * certificate chain was sent, null will be returned.
39      * @see #getLocalPrincipal()
40      */

41     public abstract List JavaDoc<Certificate JavaDoc> getLocalCertificateChain();
42
43     /**
44      * Returns the server's certificate chain, which was established as
45      * part of defining the session in the original connection that
46      * retrieved the network resource, from cache. Note: This method
47      * can be used only when using certificate-based cipher suites;
48      * using it with non-certificate-based cipher suites, such as
49      * Kerberos, will throw an SSLPeerUnverifiedException.
50      *
51      * @return an immutable List of Certificate representing the server's
52      * certificate chain.
53      * @throws SSLPeerUnverifiedException if the peer is not verified.
54      * @see #getPeerPrincipal()
55      */

56     public abstract List JavaDoc<Certificate JavaDoc> getServerCertificateChain()
57     throws SSLPeerUnverifiedException;
58     
59     /**
60      * Returns the server's principal which was established as part of
61      * defining the session during the original connection that
62      * retrieved the network resource.
63      *
64      * @return the server's principal. Returns an X500Principal of the
65      * end-entity certiticate for X509-based cipher suites, and
66      * KerberosPrincipal for Kerberos cipher suites.
67      *
68      * @throws SSLPeerUnverifiedException if the peer was not verified.
69      *
70      * @see #getServerCertificateChain()
71      * @see #getLocalPrincipal()
72      */

73      public abstract Principal JavaDoc getPeerPrincipal()
74              throws SSLPeerUnverifiedException;
75  
76     /**
77       * Returns the principal that was sent to the server during
78       * handshaking in the original connection that retrieved the
79       * network resource.
80       *
81       * @return the principal sent to the server. Returns an X500Principal
82       * of the end-entity certificate for X509-based cipher suites, and
83       * KerberosPrincipal for Kerberos cipher suites. If no principal was
84       * sent, then null is returned.
85       *
86       * @see #getLocalCertificateChain()
87       * @see #getPeerPrincipal()
88       */

89      public abstract Principal JavaDoc getLocalPrincipal();
90 }
91
Popular Tags