KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > remoting > security > SSLSocketBuilderMBean


1 package org.jboss.remoting.security;
2
3 import java.io.IOException JavaDoc;
4 import java.security.KeyManagementException JavaDoc;
5 import java.security.KeyStoreException JavaDoc;
6 import java.security.NoSuchAlgorithmException JavaDoc;
7 import java.security.UnrecoverableKeyException JavaDoc;
8 import java.security.cert.CertificateException JavaDoc;
9 import javax.net.ServerSocketFactory;
10 import javax.net.SocketFactory;
11
12 /**
13  * @author <a HREF="mailto:telrod@e2technologies.net">Tom Elrod</a>
14  */

15 public interface SSLSocketBuilderMBean
16 {
17    /**
18     * create the service, do expensive operations etc
19     */

20    void create() throws Exception JavaDoc;
21
22    /**
23     * start the service, create is already called
24     */

25    void start() throws Exception JavaDoc;
26
27    /**
28     * stop the service
29     */

30    void stop();
31
32    /**
33     * destroy the service, tear down
34     */

35    void destroy();
36
37    /**
38     * Will indicate if should use the SSLServerSocketFactory.getDefault() for getting the ServerSocketFactory
39     * to use (when calling createSSLServerSocketFactory()).
40     * If true, will allow for setting key store location (via javax.net.ssl.keyStore system property) and
41     * setting of the key store password (via javax.net.ssl.keyStorePassword system property) and no other
42     * configuration is needed (none of the other setters will need to be called and are in fact ignored). If set to
43     * false, will allow the custom setting of secure socket protocol, key management algorithm, key store type,
44     * key store url, key store password, and key password.<p/>
45     * The default value is true.<p/>
46     * <b>NOTE: If this is not explicitly set to false, no customizations can be made and the default implementation
47     * provided by the JVM vendor being used will be executed.</b>
48     *
49     * @param shouldUse
50     */

51    void setUseSSLServerSocketFactory(boolean shouldUse);
52
53    /**
54     * Return whether SSLServerSocketFactory.getDefault() will be used or not. See setUseSSLServerSocketFactory() for more
55     * information on what this means.
56     *
57     * @return
58     */

59    boolean getUseSSLServerSocketFactory();
60
61    /**
62     * Will indicate if should use the SSLSocketFactory.getDefault() for getting the SocketFactory
63     * to use (when calling createSSLSocketFactory()).
64     * If true, will allow for setting trust store location (via Djavax.net.ssl.trustStore system property) and no other
65     * configuration is needed (none of the other setters will need to be called and are in fact ignored). If set to
66     * false, will allow the custom setting of secure socket protocol, key management algorithm, key store type,
67     * ant trust store url.<p/>
68     * The default value is true.<p/>
69     * <b>NOTE: If this is not explicitly set to false, no customizations can be made and the default implementation
70     * provided by the JVM vendor being used will be executed.</b>
71     *
72     * @param shouldUse
73     */

74    void setUseSSLSocketFactory(boolean shouldUse);
75
76    /**
77     * Return whether SSLSocketFactory.getDefault() will be used or not. See setUseSSLSocketFactory() for more
78     * information on what this means.
79     *
80     * @return
81     */

82    boolean getUseSSLSocketFactory();
83
84    /**
85     * The protocol for the SSLContext. Some acceptable values are TLS, SSL, and SSLv3.
86     * Defaults to DEFAULT_SECURE_SOCKET_PROTOCOL.
87     */

88    String JavaDoc getSecureSocketProtocol();
89
90    /**
91     * The protocol for the SSLContext. Some acceptable values are TLS, SSL, and SSLv3.
92     * Defaults to DEFAULT_SECURE_SOCKET_PROTOCOL.
93     */

94    void setSecureSocketProtocol(String JavaDoc secureSocketProtocol);
95
96    /**
97     * The algorithm for the key manager factory.
98     * Defaults to DEFAULT_KEY_MANAGEMENT_ALGORITHM.
99     */

100    String JavaDoc getKeyManagementAlgorithm();
101
102    /**
103     * The algorithm for the key manager factory.
104     * Defaults to DEFAULT_KEY_MANAGEMENT_ALGORITHM.
105     */

106    void setKeyManagementAlgorithm(String JavaDoc keyManagementAlgorithm);
107
108    /**
109     * The type to be used for the key store.
110     * Defaults to DEFAULT_KEY_STORE_TYPE. Some acceptable values are JKS (Java Keystore - Sun's keystore format),
111     * JCEKS (Java Cryptography Extension keystore - More secure version of JKS), and
112     * PKCS12 (Public-Key Cryptography Standards #12 keystore - RSA's Personal Information Exchange Syntax Standard).
113     * These are not case sensitive.
114     */

115    String JavaDoc getKeyStoreType();
116
117    /**
118     * The type to be used for the key store.
119     * Defaults to DEFAULT_KEY_STORE_TYPE. Some acceptable values are JKS (Java Keystore - Sun's keystore format),
120     * JCEKS (Java Cryptography Extension keystore - More secure version of JKS), and
121     * PKCS12 (Public-Key Cryptography Standards #12 keystore - RSA's Personal Information Exchange Syntax Standard).
122     * These are not case sensitive.
123     */

124    void setKeyStoreType(String JavaDoc keyStoreType);
125
126    /**
127     * Sets the password to use for the key store. This only needs to be set if setUseSSLServerSocketFactory() is set
128     * to false (otherwise will be ignored). The value passed will also be used for the key password if it is not
129     * explicitly set.
130     *
131     * @param passphrase
132     */

133    void setKeyStorePassword(String JavaDoc passphrase);
134
135    /**
136     * Sets the password to use for the keys within the key store. This only needs to be set if setUseSSLServerSocketFactory()
137     * is set to false (otherwise will be ignored). If this value is not set, but the key store password is, it will use
138     * that value for the key password.
139     *
140     * @param passphrase
141     */

142    void setKeyPassword(String JavaDoc passphrase);
143
144    /**
145     * Will create a SSLServerSocketFactory. If the useSSLServerSocketFactory property is set to true (which is the default),
146     * it will use SSLServerSocketFactory.getDefault() to get the server socket factory. Otherwise, if property is false,
147     * will use all the other custom properties that have been set to create a custom server socket factory.
148     *
149     * @return
150     * @throws java.io.IOException
151     * @throws java.security.NoSuchAlgorithmException
152     *
153     * @throws java.security.KeyStoreException
154     *
155     * @throws java.security.cert.CertificateException
156     *
157     * @throws java.security.UnrecoverableKeyException
158     *
159     * @throws java.security.KeyManagementException
160     *
161     */

162    ServerSocketFactory createSSLServerSocketFactory()
163          throws IOException JavaDoc, NoSuchAlgorithmException JavaDoc, KeyStoreException JavaDoc,
164                 CertificateException JavaDoc, UnrecoverableKeyException JavaDoc, KeyManagementException JavaDoc;
165
166    /**
167     * Will create a SSLSocketFactory. If the useSSLSocketFactory property is set to true (which is the default),
168     * it will use SSLSocketFactory.getDefault() to get the socket factory. Otherwise, if property is false,
169     * will use all the other custom properties that have been set to create a custom server socket factory.
170     *
171     * @return
172     * @throws java.io.IOException
173     * @throws java.security.NoSuchAlgorithmException
174     *
175     * @throws java.security.KeyStoreException
176     *
177     * @throws java.security.cert.CertificateException
178     *
179     * @throws java.security.KeyManagementException
180     *
181     */

182    SocketFactory createSSLSocketFactory()
183          throws IOException JavaDoc, NoSuchAlgorithmException JavaDoc, KeyStoreException JavaDoc,
184                 CertificateException JavaDoc, KeyManagementException JavaDoc;
185
186    /**
187     * This is the url string to the key store to use. If UseSSLServerSocketFactory is true, this will be ignored
188     * and will use the value set by the javax.net.ssl.keyStore system property. Otherwise, if UseSSLServerSocketFactory
189     * is false, this must be set.
190     *
191     * @param storeURL
192     * @throws java.io.IOException
193     */

194    void setKeyStoreURL(String JavaDoc storeURL) throws IOException JavaDoc;
195
196    /**
197     * This is the url string to the trust store to use. If UseSSLSocketFactory is true, this will be ignored
198     * and will use the value set by the javax.net.ssl.trustStore system property. Otherwise, if UseSSLSocketFactory
199     * is false, this must be set.
200     *
201     * @param storeURL
202     * @throws java.io.IOException
203     */

204    void setTrustStoreURL(String JavaDoc storeURL) throws IOException JavaDoc;
205 }
206
Popular Tags