KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > management > geronimo > KeystoreManager


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.geronimo.management.geronimo;
18
19 import javax.net.ssl.SSLServerSocketFactory;
20 import javax.net.ssl.SSLSocketFactory;
21
22 /**
23  * Management interface for working with keystores. Mostly this is used to
24  * identify KeystoreInstances to work with individual keystores.
25  *
26  * @see KeystoreInstance
27  *
28  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
29  */

30 public interface KeystoreManager {
31     /**
32      * Gets the names of the keystores available in the server.
33      */

34     public KeystoreInstance[] getKeystores();
35
36     /**
37      * Gets a ServerSocketFactory using one Keystore to access the private key
38      * and another to provide the list of trusted certificate authorities.
39      * @param provider The SSL provider to use, or null for the default
40      * @param protocol The SSL protocol to use
41      * @param algorithm The SSL algorithm to use
42      * @param keyStore The key keystore name as provided by listKeystores. The
43      * KeystoreInstance for this keystore must be unlocked.
44      * @param keyAlias The name of the private key in the keystore. The
45      * KeystoreInstance for this keystore must have unlocked
46      * this key.
47      * @param trustStore The trust keystore name as provided by listKeystores.
48      * The KeystoreInstance for this keystore must have
49      * unlocked this key.
50      * @param loader The class loader used to resolve factory classes.
51      *
52      * @throws KeystoreIsLocked Occurs when the requested key keystore cannot
53      * be used because it has not been unlocked.
54      * @throws KeyIsLocked Occurs when the requested private key in the key
55      * keystore cannot be used because it has not been
56      * unlocked.
57      */

58     public SSLServerSocketFactory createSSLServerFactory(String JavaDoc provider, String JavaDoc protocol, String JavaDoc algorithm,
59                                                    String JavaDoc keyStore, String JavaDoc keyAlias, String JavaDoc trustStore, ClassLoader JavaDoc loader)
60             throws KeystoreException;
61
62
63     /**
64      * Gets a SocketFactory using one Keystore to access the private key
65      * and another to provide the list of trusted certificate authorities.
66      * @param provider The SSL provider to use, or null for the default
67      * @param protocol The SSL protocol to use
68      * @param algorithm The SSL algorithm to use
69      * @param keyStore The key keystore name as provided by listKeystores. The
70      * KeystoreInstance for this keystore must be unlocked.
71      * @param keyAlias The name of the private key in the keystore. The
72      * KeystoreInstance for this keystore must have unlocked
73      * this key.
74      * @param trustStore The trust keystore name as provided by listKeystores.
75      * The KeystoreInstance for this keystore must have
76      * unlocked this key.
77      * @param loader The class loader used to resolve factory classes.
78      *
79      * @throws KeystoreIsLocked Occurs when the requested key keystore cannot
80      * be used because it has not been unlocked.
81      * @throws KeyIsLocked Occurs when the requested private key in the key
82      * keystore cannot be used because it has not been
83      * unlocked.
84      */

85     public SSLSocketFactory createSSLFactory(String JavaDoc provider, String JavaDoc protocol, String JavaDoc algorithm,
86                                                    String JavaDoc keyStore, String JavaDoc keyAlias, String JavaDoc trustStore, ClassLoader JavaDoc loader)
87             throws KeystoreException;
88
89
90     /**
91      * Gets a SocketFactory using one Keystore to access the private key
92      * and another to provide the list of trusted certificate authorities.
93      * @param provider The SSL provider to use, or null for the default
94      * @param protocol The SSL protocol to use
95      * @param algorithm The SSL algorithm to use
96      * @param trustStore The trust keystore name as provided by listKeystores.
97      * The KeystoreInstance for this keystore must have
98      * unlocked this key.
99      * @param loader The class loader used to resolve factory classes.
100      *
101      * @throws KeystoreIsLocked Occurs when the requested key keystore cannot
102      * be used because it has not been unlocked.
103      * @throws KeyIsLocked Occurs when the requested private key in the key
104      * keystore cannot be used because it has not been
105      * unlocked.
106      */

107     public SSLSocketFactory createSSLFactory(String JavaDoc provider, String JavaDoc protocol, String JavaDoc algorithm,
108                                                    String JavaDoc trustStore, ClassLoader JavaDoc loader)
109             throws KeystoreException;
110
111     /**
112      * Creates a new, empty keystore. The name should be a valid file name
113      * with no path separator characters.
114      *
115      * @param name The name of the keystore to create
116      * @param password The password to use to protect the new keystore
117      */

118     public KeystoreInstance createKeystore(String JavaDoc name, char[] password) throws KeystoreException;
119
120     /**
121      * Gets the aliases for any keystores that are available to be used as
122      * private key keystores for an SSL factory. This means the keystore is
123      * unlocked and contains at least one private key that's unlocked.
124      */

125     public KeystoreInstance[] getUnlockedKeyStores();
126
127     /**
128      * Gets the aliases for any keystores that are available to be used as
129      * trusted certificate keystores for an SSL factory. This means the
130      * keystore is unlocked and contains at least one trust certificate.
131      */

132     public KeystoreInstance[] getUnlockedTrustStores();
133 }
134
Popular Tags