KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > net > ssl > HandshakeCompletedEvent


1 /*
2  * @(#)HandshakeCompletedEvent.java 1.12 04/02/16
3  *
4  * Copyright (c) 2004 Sun Microsystems, Inc. All Rights Reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7   
8 /*
9  * NOTE:
10  * Because of various external restrictions (i.e. US export
11  * regulations, etc.), the actual source code can not be provided
12  * at this time. This file represents the skeleton of the source
13  * file, so that javadocs of the API can be created.
14  */

15
16 package javax.net.ssl;
17
18 import java.util.EventObject;
19 import java.security.cert.Certificate;
20 import java.security.Principal;
21 import java.security.cert.X509Certificate;
22 import javax.security.auth.x500.X500Principal;
23
24 /**
25  * This event indicates that an SSL handshake completed on a given
26  * SSL connection. All of the core information about that handshake's
27  * result is captured through an "SSLSession" object. As a convenience,
28  * this event class provides direct access to some important session
29  * attributes.
30  *
31  * <P> The source of this event is the SSLSocket on which handshaking
32  * just completed.
33  *
34  * @see SSLSocket
35  * @see HandshakeCompletedListener
36  * @see SSLSession
37  *
38  * @since 1.4
39  * @version 1.23
40  * @author David Brownell
41  */

42 public class HandshakeCompletedEvent extends EventObject
43 {
44
45     /**
46      * Constructs a new HandshakeCompletedEvent.
47      *
48      * @param sock the SSLSocket acting as the source of the event
49      * @param s the SSLSession this event is associated with
50      */

51     public HandshakeCompletedEvent(SSLSocket sock, SSLSession s) { }
52
53     /**
54      * Returns the session that triggered this event.
55      *
56      * @return the <code>SSLSession</code> for this handshake
57      */

58     public SSLSession getSession() {
59         return null;
60     }
61
62     /**
63      * Returns the cipher suite in use by the session which was produced
64      * by the handshake. (This is a convenience method for
65      * getting the ciphersuite from the SSLsession.)
66      *
67      * @return the name of the cipher suite negotiated during this session.
68      */

69     public String getCipherSuite() {
70         return null;
71     }
72
73     /**
74      * Returns the certificate(s) that were sent to the peer during
75      * handshaking.
76      * Note: This method is useful only when using certificate-based
77      * cipher suites.
78      *
79      * When multiple certificates are available for use in a
80      * handshake, the implementation chooses what it considers the
81      * "best" certificate chain available, and transmits that to
82      * the other side. This method allows the caller to know
83      * which certificate chain was actually used.
84      *
85      * @return an ordered array of certificates, with the local
86      * certificate first followed by any
87      * certificate authorities. If no certificates were sent,
88      * then null is returned.
89      * @see #getLocalPrincipal()
90      */

91     public Certificate[] getLocalCertificates() {
92         return null;
93     }
94
95     /**
96      * Returns the identity of the peer which was established as part
97      * of defining the session.
98      * Note: This method can be used only when using certificate-based
99      * cipher suites; using it with non-certificate-based cipher suites,
100      * such as Kerberos, will throw an SSLPeerUnverifiedException.
101      *
102      * @return an ordered array of the peer certificates,
103      * with the peer's own certificate first followed by
104      * any certificate authorities.
105      * @exception SSLPeerUnverifiedException if the peer is not verified.
106      * @see #getPeerPrincipal()
107      */

108     public Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException
109     {
110         return null;
111     }
112
113     /**
114      * Returns the identity of the peer which was identified as part
115      * of defining the session.
116      * Note: This method can be used only when using certificate-based
117      * cipher suites; using it with non-certificate-based cipher suites,
118      * such as Kerberos, will throw an SSLPeerUnverifiedException.
119      *
120      * <p><em>Note: this method exists for compatibility with previous
121      * releases. New applications should use
122      * {@link #getPeerCertificates} instead.</em></p>
123      *
124      * @return an ordered array of peer X.509 certificates,
125      * with the peer's own certificate first followed by any
126      * certificate authorities. (The certificates are in
127      * the original JSSE
128      * {@link javax.security.cert.X509Certificate} format).
129      * @exception SSLPeerUnverifiedException if the peer is not verified.
130      * @see #getPeerPrincipal()
131      */

132     public javax.security.cert.X509Certificate[] getPeerCertificateChain()
133         throws SSLPeerUnverifiedException
134     {
135         return null;
136     }
137
138     /**
139      * Returns the identity of the peer which was established as part of
140      * defining the session.
141      *
142      * @return the peer's principal. Returns an X500Principal of the
143      * end-entity certiticate for X509-based cipher suites, and
144      * KerberosPrincipal for Kerberos cipher suites.
145      *
146      * @throws SSLPeerUnverifiedException if the peer's identity has not
147      * been verified
148      *
149      * @see #getPeerCertificates()
150      * @see #getLocalPrincipal()
151      *
152      * @since 1.5
153      */

154     public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {
155         return null;
156     }
157
158     /**
159      * Returns the principal that was sent to the peer during handshaking.
160      *
161      * @return the principal sent to the peer. Returns an X500Principal
162      * of the end-entity certificate for X509-based cipher suites, and
163      * KerberosPrincipal for Kerberos cipher suites. If no principal was
164      * sent, then null is returned.
165      *
166      * @see #getLocalCertificates()
167      * @see #getPeerPrincipal()
168      *
169      * @since 1.5
170      */

171     public Principal getLocalPrincipal() {
172         return null;
173     }
174
175     /**
176      * Returns the socket which is the source of this event.
177      * (This is a convenience function, to let applications
178      * write code without type casts.)
179      *
180      * @return the socket on which the connection was made.
181      */

182     public SSLSocket getSocket() {
183         return null;
184     }
185 }
186
Popular Tags