KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)SSLContext.java 1.13 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.security.*;
19 import java.util.*;
20
21 import com.sun.net.ssl.internal.ssl.ExportControl;
22 import sun.security.jca.GetInstance;
23
24 /**
25  * Instances of this class represent a secure socket protocol
26  * implementation which acts as a factory for secure socket
27  * factories or <code>SSLEngine</code>s. This class is initialized
28  * with an optional set of key and trust managers and source of
29  * secure random bytes.
30  *
31  * @since 1.4
32  * @version 1.26, 02/11/04
33  */

34 public class SSLContext
35 {
36
37     /**
38      * Creates an SSLContext object.
39      *
40      * @param contextSpi the delegate
41      * @param provider the provider
42      * @param protocol the protocol
43      */

44     protected SSLContext(SSLContextSpi contextSpi, Provider provider, String
45         protocol)
46     { }
47
48     /**
49      * Generates a <code>SSLContext</code> object that implements the
50      * specified secure socket protocol.
51      * <P>
52      * If the default provider package provides an implementation of the
53      * requested key management algorithm, an instance of
54      * <code>SSLContext</code> containing that implementation is
55      * returned. If the algorithm is not available in the default provider
56      * package, other provider packages are searched.
57      *
58      * @param protocol the standard name of the requested protocol.
59      * @return the new <code>SSLContext</code> object
60      * @exception NoSuchAlgorithmException if the specified protocol is not
61      * available in the default provider package or any of the
62      * other provider packages that were searched.
63      */

64     public static SSLContext getInstance(String protocol)
65         throws NoSuchAlgorithmException
66     {
67         return null;
68     }
69
70     /**
71      * Generates a <code>SSLContext</code> object that implements the
72      * specified secure socket protocol from the specified provider.
73      *
74      * @param protocol the standard name of the requested protocol.
75      * @param provider the name of the provider
76      * @return the new <code>SSLContext</code> object
77      * @throws NoSuchAlgorithmException if the specified protocol is not
78      * available from the specified provider.
79      * @throws NoSuchProviderException if the specified provider has not
80      * been configured.
81      * @throws IllegalArgumentException if the provider name is null or empty.
82      */

83     public static SSLContext getInstance(String protocol, String provider)
84         throws NoSuchAlgorithmException, NoSuchProviderException
85     {
86         return null;
87     }
88
89     /**
90      * Generates a <code>SSLContext</code> object that implements the
91      * specified secure socket protocol from the specified provider.
92      *
93      * @param protocol the standard name of the requested protocol.
94      * @param provider an instance of the provider
95      * @return the new <code>SSLContext</code> object
96      * @throws NoSuchAlgorithmException if the specified protocol is not
97      * available from the specified provider.
98      * @throws IllegalArgumentException if the provider name is null.
99      */

100     public static SSLContext getInstance(String protocol, Provider provider)
101         throws NoSuchAlgorithmException
102     {
103         return null;
104     }
105
106     /**
107      * Returns the protocol name of this <code>SSLContext</code> object.
108      *
109      * <p>This is the same name that was specified in one of the
110      * <code>getInstance</code> calls that created this
111      * <code>SSLContext</code> object.
112      *
113      * @return the protocol name of this <code>SSLContext</code> object.
114      */

115     public final String getProtocol() {
116         return null;
117     }
118
119     /**
120      * Returns the provider of this <code>SSLContext</code> object.
121      *
122      * @return the provider of this <code>SSLContext</code> object
123      */

124     public final Provider getProvider() {
125         return null;
126     }
127
128     /**
129      * Initializes this context. Either of the first two parameters
130      * may be null in which case the installed security providers will
131      * be searched for the highest priority implementation of the
132      * appropriate factory. Likewise, the secure random parameter may
133      * be null in which case the default implementation will be used.
134      * <P>
135      * Only the first instance of a particular key and/or trust manager
136      * implementation type in the array is used. (For example, only
137      * the first javax.net.ssl.X509KeyManager in the array will be used.)
138      *
139      * @param km the sources of authentication keys or null
140      * @param tm the sources of peer authentication trust decisions or null
141      * @param random the source of randomness for this generator or null
142      * @throws KeyManagementException if this operation fails
143      */

144     public final void init(KeyManager[] km, TrustManager[] tm, SecureRandom
145         random) throws KeyManagementException
146     { }
147
148     /**
149      * Returns a <code>SocketFactory</code> object for this
150      * context.
151      *
152      * @return the <code>SocketFactory</code> object
153      */

154     public final SSLSocketFactory getSocketFactory() {
155         return null;
156     }
157
158     /**
159      * Returns a <code>ServerSocketFactory</code> object for
160      * this context.
161      *
162      * @return the <code>ServerSocketFactory</code> object
163      */

164     public final SSLServerSocketFactory getServerSocketFactory() {
165         return null;
166     }
167
168     /**
169      * Creates a new <code>SSLEngine</code> using this context.
170      * <P>
171      * Applications using this factory method are providing no hints
172      * for an internal session reuse strategy. If hints are desired,
173      * {@link #createSSLEngine(String, int)} should be used
174      * instead.
175      * <P>
176      * Some cipher suites (such as Kerberos) require remote hostname
177      * information, in which case this factory method should not be used.
178      *
179      * @return the <code>SSLEngine</code> object
180      * @throws UnsupportedOperationException if the underlying provider
181      * does not implement the operation.
182      * @since 1.5
183      */

184     public final SSLEngine createSSLEngine() {
185         return null;
186     }
187
188     /**
189      * Creates a new <code>SSLEngine</code> using this context using
190      * advisory peer information.
191      * <P>
192      * Applications using this factory method are providing hints
193      * for an internal session reuse strategy.
194      * <P>
195      * Some cipher suites (such as Kerberos) require remote hostname
196      * information, in which case peerHost needs to be specified.
197      *
198      * @param peerHost the non-authoritative name of the host
199      * @param peerPort the non-authoritative port
200      * @return the new <code>SSLEngine</code> object
201      * @throws UnsupportedOperationException if the underlying provider
202      * does not implement the operation.
203      * @since 1.5
204      */

205     public final SSLEngine createSSLEngine(String peerHost, int peerPort) {
206         return null;
207     }
208
209     /**
210      * Returns the server session context, which represents the set of
211      * SSL sessions available for use during the handshake phase of
212      * server-side SSL sockets.
213      * <P>
214      * This context may be unavailable in some environments, in which
215      * case this method returns null. For example, when the underlying
216      * SSL provider does not provide an implementation of SSLSessionContext
217      * interface, this method returns null. A non-null session context
218      * is returned otherwise.
219      *
220      * @return server session context bound to this SSL context
221      */

222     public final SSLSessionContext getServerSessionContext() {
223         return null;
224     }
225
226     /**
227      * Returns the client session context, which represents the set of
228      * SSL sessions available for use during the handshake phase of
229      * client-side SSL sockets.
230      * <P>
231      * This context may be unavailable in some environments, in which
232      * case this method returns null. For example, when the underlying
233      * SSL provider does not provide an implementation of SSLSessionContext
234      * interface, this method returns null. A non-null session context
235      * is returned otherwise.
236      *
237      * @return client session context bound to this SSL context
238      */

239     public final SSLSessionContext getClientSessionContext() {
240         return null;
241     }
242 }
243
Popular Tags