KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)KeyManagerFactory.java 1.10 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
20 import java.security.Security;
21 import sun.security.jca.GetInstance;
22
23 /**
24  * This class acts as a factory for key managers based on a
25  * source of key material. Each key manager manages a specific
26  * type of key material for use by secure sockets. The key
27  * material is based on a KeyStore and/or provider specific sources.
28  *
29  * @since 1.4
30  * @see KeyManager
31  * @version 1.17, 01/29/04
32  */

33 public class KeyManagerFactory
34 {
35
36     /**
37      * Creates a KeyManagerFactory object.
38      *
39      * @param factorySpi the delegate
40      * @param provider the provider
41      * @param algorithm the algorithm
42      */

43     protected KeyManagerFactory(KeyManagerFactorySpi factorySpi, Provider
44         provider, String algorithm)
45     { }
46
47     /**
48      * Obtains the default KeyManagerFactory algorithm name.
49      *
50      * <p>The default algorithm can be changed at runtime by setting
51      * the value of the "ssl.KeyManagerFactory.algorithm" security
52      * property (set in the Java security properties file or by calling
53      * {@link java.security.Security#setProperty(java.lang.String,
54      * java.lang.String)})
55      * to the desired algorithm name.
56      *
57      * @see java.security.Security#setProperty(java.lang.String,
58      * java.lang.String)
59      * @return the default algorithm name as specified in the
60      * Java security properties, or an implementation-specific
61      * default if no such property exists.
62      */

63     public static final String getDefaultAlgorithm() {
64         return null;
65     }
66
67     /**
68      * Returns the algorithm name of this <code>KeyManagerFactory</code> object.
69      *
70      * <p>This is the same name that was specified in one of the
71      * <code>getInstance</code> calls that created this
72      * <code>KeyManagerFactory</code> object.
73      *
74      * @return the algorithm name of this <code>KeyManagerFactory</code> object.
75      */

76     public final String getAlgorithm() {
77         return null;
78     }
79
80     /**
81      * Generates a <code>KeyManagerFactory</code> object that implements the
82      * specified key management algorithm.
83      * <P>
84      * If the default provider package provides an implementation of the
85      * requested key management algorithm, an instance of
86      * <code>KeyManagerFactory</code> containing that implementation is
87      * returned. If the algorithm is not available in the default provider
88      * package, other provider packages are searched.
89      *
90      * @param algorithm the standard name of the requested algorithm.
91      * @return the new <code>KeyManagerFactory</code> object
92      * @exception NoSuchAlgorithmException if the specified algorithm is not
93      * available in the default provider package or any of the other
94      * provider packages that were searched.
95      */

96     public static final KeyManagerFactory getInstance(String algorithm)
97         throws NoSuchAlgorithmException
98     {
99         return null;
100     }
101
102     /**
103      * Generates a <code>KeyManagerFactory</code> object for the specified
104      * key management algorithm from the specified provider.
105      *
106      * @param algorithm the standard name of the requested algorithm.
107      * @param provider the name of the provider
108      * @return the new <code>KeyManagerFactory</code> object
109      * @throws NoSuchAlgorithmException if the specified algorithm is not
110      * available from the specified provider.
111      * @throws NoSuchProviderException if the specified provider has not
112      * been configured.
113      * @throws IllegalArgumentException if the provider name is null or empty.
114      */

115     public static final KeyManagerFactory getInstance(String algorithm, String
116         provider) throws NoSuchAlgorithmException, NoSuchProviderException
117     {
118         return null;
119     }
120
121     /**
122      * Generates a <code>KeyManagerFactory</code> object for the specified
123      * key management algorithm from the specified provider.
124      *
125      * @param algorithm the standard name of the requested algorithm.
126      * @param provider an instance of the provider
127      * @return the new <code>KeyManagerFactory</code> object
128      * @throws NoSuchAlgorithmException if the specified algorithm is not
129      * available from the specified provider.
130      * @throws IllegalArgumentException if provider is null.
131      */

132     public static final KeyManagerFactory getInstance(String algorithm, Provider
133         provider) throws NoSuchAlgorithmException
134     {
135         return null;
136     }
137
138     /**
139      * Returns the provider of this <code>KeyManagerFactory</code> object.
140      *
141      * @return the provider of this <code>KeyManagerFactory</code> object
142      */

143     public final Provider getProvider() {
144         return null;
145     }
146
147     /**
148      * Initializes this factory with a source of key material.
149      * <P>
150      * The provider typically uses a KeyStore for obtaining
151      * key material for use during secure socket negotiations.
152      * The KeyStore is generally password-protected.
153      * <P>
154      * For more flexible initialization, please see
155      * {@link #init(ManagerFactoryParameters)}.
156      * <P>
157      *
158      * @param ks the key store or null
159      * @param password the password for recovering keys in the KeyStore
160      * @throws KeyStoreException if this operation fails
161      * @throws NoSuchAlgorithmException if the specified algorithm is not
162      * available from the specified provider.
163      * @throws UnrecoverableKeyException if the key cannot be recovered
164      * (e.g. the given password is wrong).
165      */

166     public final void init(KeyStore ks, char[] password)
167         throws KeyStoreException, NoSuchAlgorithmException,
168         UnrecoverableKeyException
169     { }
170
171     /**
172      * Initializes this factory with a source of provider-specific
173      * key material.
174      * <P>
175      * In some cases, initialization parameters other than a keystore
176      * and password may be needed by a provider. Users of that
177      * particular provider are expected to pass an implementation of
178      * the appropriate <CODE>ManagerFactoryParameters</CODE> as
179      * defined by the provider. The provider can then call the
180      * specified methods in the <CODE>ManagerFactoryParameters</CODE>
181      * implementation to obtain the needed information.
182      *
183      * @param spec an implementation of a provider-specific parameter
184      * specification
185      * @throws InvalidAlgorithmParameterException if an error is encountered
186      */

187     public final void init(ManagerFactoryParameters spec)
188         throws InvalidAlgorithmParameterException
189     { }
190
191     /**
192      * Returns one key manager for each type of key material.
193      *
194      * @return the key managers
195      */

196     public final KeyManager[] getKeyManagers() {
197         return null;
198     }
199 }
200
Popular Tags