javax.net.ssl

Class KeyManagerFactory


public class KeyManagerFactory
extends Object

A class that creates key manager implementations based on a requested algorithm.

Constructor Summary

KeyManagerFactory(KeyManagerFactorySpi kmfSpi, Provider provider, String algorithm)
Create a new key manager factory.

Method Summary

String
getAlgorithm()
Returns the name of this key manager factory algorithm.
static String
getDefaultAlgorithm()
Get the default algorithm name.
static KeyManagerFactory
getInstance(String algorithm)
Create an instance of the named key manager factory, from the first provider that implements it.
static KeyManagerFactory
getInstance(String algorithm, String provider)
Create an instance of the named key manager factory, from the named provider.
static KeyManagerFactory
getInstance(String algorithm, Provider provider)
Create an instance of the named key manager factory, from the given provider.
KeyManager[]
getKeyManagers()
Get an array of key managers appropriate for this algorithm, with the most preferred manager first.
Provider
getProvider()
Returns the provider of this implementation.
void
init(KeyStore store, char[] passwd)
Initialize this instance with a key store and a password for private key entries.
void
init(ManagerFactoryParameters params)
Initialize this instance with an implementation-dependent parameter object.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

KeyManagerFactory

protected KeyManagerFactory(KeyManagerFactorySpi kmfSpi,
                            Provider provider,
                            String algorithm)
Create a new key manager factory.
Parameters:
kmfSpi - The underlying engine.
provider - The engine's provider.
algorithm - The name of this algorithm.

Method Details

getAlgorithm

public final String getAlgorithm()
Returns the name of this key manager factory algorithm.
Returns:
The name of this key manager factory algorithm.

getDefaultAlgorithm

public static final String getDefaultAlgorithm()
Get the default algorithm name. This value may be specified at run-time via the security property "ssl.KeyManagerFactory.algorithm". If this property is not specified, this method returns "JessieX509".
Returns:
The default key manager factory algorithm's name.

getInstance

public static final KeyManagerFactory getInstance(String algorithm)
            throws NoSuchAlgorithmException
Create an instance of the named key manager factory, from the first provider that implements it.
Parameters:
algorithm - The type of key manager factory to get.
Returns:
An appropriate implementation of that algoritm.
Throws:
NoSuchAlgorithmException - If no provider implements the requested algorithm.
IllegalArgumentException - if algorithm is null or is an empty string.

getInstance

public static final KeyManagerFactory getInstance(String algorithm,
                                                  String provider)
            throws NoSuchAlgorithmException,
                   NoSuchProviderException
Create an instance of the named key manager factory, from the named provider.
Parameters:
algorithm - The type of key manager factory to get.
provider - The name of the provider to get the implementation from.
Returns:
An appropriate implementation of that algorithm.
Throws:
NoSuchAlgorithmException - If the provider does not implement the requested algorithm.
NoSuchProviderException - If the named provider does not exist.
IllegalArgumentException - if either algorithm or provider is null, or if algorithm is an empty string.

getInstance

public static final KeyManagerFactory getInstance(String algorithm,
                                                  Provider provider)
            throws NoSuchAlgorithmException
Create an instance of the named key manager factory, from the given provider.
Parameters:
algorithm - The type of key manager factory to get.
provider - The provider to get the implementation from.
Returns:
An appropriate implementation of that algorithm.
Throws:
NoSuchAlgorithmException - If the provider does not implement the requested algorithm.
IllegalArgumentException - if either algorithm or provider is null, or if algorithm is an empty string.

getKeyManagers

public final KeyManager[] getKeyManagers()
Get an array of key managers appropriate for this algorithm, with the most preferred manager first.
Returns:
The array of key managers.

getProvider

public final Provider getProvider()
Returns the provider of this implementation.
Returns:
The provider of this implementation.

init

public final void init(KeyStore store,
                       char[] passwd)
            throws KeyStoreException,
                   NoSuchAlgorithmException,
                   UnrecoverableKeyException
Initialize this instance with a key store and a password for private key entries.
Parameters:
store - The key store to read.
passwd - The password protecting private keys in the store.
Throws:
KeyStoreException - If an error occurs reading the keys.
NoSuchAlgorithmException - If an algorithm (such as a certificate algorithm) is not available.
UnrecoverableKeyException - If the password is incorrect.

init

public final void init(ManagerFactoryParameters params)
            throws InvalidAlgorithmParameterException
Initialize this instance with an implementation-dependent parameter object.
Parameters:
params - The parameters to initialize with.
Throws:
InvalidAlgorithmParameterException - If the specified parameters are inappropriate.

KeyManagerFactory.java -- factory for key managers. Copyright (C) 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.