001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.geronimo.management.geronimo;
018
019 import javax.net.ssl.SSLServerSocketFactory;
020 import javax.net.ssl.SSLSocketFactory;
021
022 /**
023 * Management interface for working with keystores. Mostly this is used to
024 * identify KeystoreInstances to work with individual keystores.
025 *
026 * @see KeystoreInstance
027 *
028 * @version $Rev: 487175 $ $Date: 2006-12-14 03:10:31 -0800 (Thu, 14 Dec 2006) $
029 */
030 public interface KeystoreManager {
031 /**
032 * Gets the names of the keystores available in the server.
033 */
034 public KeystoreInstance[] getKeystores();
035
036 /**
037 * Gets a ServerSocketFactory using one Keystore to access the private key
038 * and another to provide the list of trusted certificate authorities.
039 * @param provider The SSL provider to use, or null for the default
040 * @param protocol The SSL protocol to use
041 * @param algorithm The SSL algorithm to use
042 * @param keyStore The key keystore name as provided by listKeystores. The
043 * KeystoreInstance for this keystore must be unlocked.
044 * @param keyAlias The name of the private key in the keystore. The
045 * KeystoreInstance for this keystore must have unlocked
046 * this key.
047 * @param trustStore The trust keystore name as provided by listKeystores.
048 * The KeystoreInstance for this keystore must have
049 * unlocked this key.
050 * @param loader The class loader used to resolve factory classes.
051 *
052 * @throws KeystoreIsLocked Occurs when the requested key keystore cannot
053 * be used because it has not been unlocked.
054 * @throws KeyIsLocked Occurs when the requested private key in the key
055 * keystore cannot be used because it has not been
056 * unlocked.
057 */
058 public SSLServerSocketFactory createSSLServerFactory(String provider, String protocol, String algorithm,
059 String keyStore, String keyAlias, String trustStore, ClassLoader loader)
060 throws KeystoreException;
061
062
063 /**
064 * Gets a SocketFactory using one Keystore to access the private key
065 * and another to provide the list of trusted certificate authorities.
066 * @param provider The SSL provider to use, or null for the default
067 * @param protocol The SSL protocol to use
068 * @param algorithm The SSL algorithm to use
069 * @param keyStore The key keystore name as provided by listKeystores. The
070 * KeystoreInstance for this keystore must be unlocked.
071 * @param keyAlias The name of the private key in the keystore. The
072 * KeystoreInstance for this keystore must have unlocked
073 * this key.
074 * @param trustStore The trust keystore name as provided by listKeystores.
075 * The KeystoreInstance for this keystore must have
076 * unlocked this key.
077 * @param loader The class loader used to resolve factory classes.
078 *
079 * @throws KeystoreIsLocked Occurs when the requested key keystore cannot
080 * be used because it has not been unlocked.
081 * @throws KeyIsLocked Occurs when the requested private key in the key
082 * keystore cannot be used because it has not been
083 * unlocked.
084 */
085 public SSLSocketFactory createSSLFactory(String provider, String protocol, String algorithm,
086 String keyStore, String keyAlias, String trustStore, ClassLoader loader)
087 throws KeystoreException;
088
089
090 /**
091 * Gets a SocketFactory using one Keystore to access the private key
092 * and another to provide the list of trusted certificate authorities.
093 * @param provider The SSL provider to use, or null for the default
094 * @param protocol The SSL protocol to use
095 * @param algorithm The SSL algorithm to use
096 * @param trustStore The trust keystore name as provided by listKeystores.
097 * The KeystoreInstance for this keystore must have
098 * unlocked this key.
099 * @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 provider, String protocol, String algorithm,
108 String trustStore, ClassLoader 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 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 }