public class

KeyManagerFactory

extends Object
java.lang.Object
   ↳ javax.net.ssl.KeyManagerFactory

Class Overview

The public API for KeyManagerFactory implementations.

Summary

Protected Constructors
KeyManagerFactory(KeyManagerFactorySpi factorySpi, Provider provider, String algorithm)
Creates a new KeyManagerFactory.
Public Methods
final String getAlgorithm()
Returns the name of the key management algorithm.
final static String getDefaultAlgorithm()
Returns the default key manager factory algorithm name.
final static KeyManagerFactory getInstance(String algorithm, String provider)
Creates a new KeyManagerFactory instance for the specified key management algorithm from the specified provider.
final static KeyManagerFactory getInstance(String algorithm, Provider provider)
Creates a new KeyManagerFactory instance for the specified key management algorithm from the specified provider.
final static KeyManagerFactory getInstance(String algorithm)
Creates a new KeyManagerFactory instance for the specified key management algorithm.
final KeyManager[] getKeyManagers()
Returns a list of key managers, one instance for each type of key in the key store.
final Provider getProvider()
Returns the provider for this KeyManagerFactory instance.
final void init(ManagerFactoryParameters spec)
Initializes this instance with the specified factory parameters.
final void init(KeyStore ks, char[] password)
Initializes this instance with the specified key store and password.
[Expand]
Inherited Methods
From class java.lang.Object

Protected Constructors

protected KeyManagerFactory (KeyManagerFactorySpi factorySpi, Provider provider, String algorithm)

Since: API Level 1

Creates a new KeyManagerFactory.

Parameters
factorySpi the implementation delegate.
provider the provider.
algorithm the key management algorithm name.

Public Methods

public final String getAlgorithm ()

Since: API Level 1

Returns the name of the key management algorithm.

Returns
  • the name of the key management algorithm.

public static final String getDefaultAlgorithm ()

Since: API Level 1

Returns the default key manager factory algorithm name.

The default algorithm name is specified by the security property: 'ssl.KeyManagerFactory.algorithm'.

Returns
  • the default algorithm name.

public static final KeyManagerFactory getInstance (String algorithm, String provider)

Since: API Level 1

Creates a new KeyManagerFactory instance for the specified key management algorithm from the specified provider.

Parameters
algorithm the name of the requested key management algorithm name.
provider the name of the provider that provides the requested algorithm.
Returns
  • a key manager factory for the requested algorithm.
Throws
NoSuchAlgorithmException if the specified provider cannot provide the requested algorithm.
NoSuchProviderException if the specified provider does not exist.
NullPointerException if algorithm is null (instead of NoSuchAlgorithmException as in 1.4 release)

public static final KeyManagerFactory getInstance (String algorithm, Provider provider)

Since: API Level 1

Creates a new KeyManagerFactory instance for the specified key management algorithm from the specified provider.

Parameters
algorithm the name of the requested key management algorithm name.
provider the provider that provides the requested algorithm.
Returns
  • a key manager factory for the requested algorithm.
Throws
NoSuchAlgorithmException if the specified provider cannot provide the requested algorithm.
NullPointerException if algorithm is null (instead of NoSuchAlgorithmException as in 1.4 release)

public static final KeyManagerFactory getInstance (String algorithm)

Since: API Level 1

Creates a new KeyManagerFactory instance for the specified key management algorithm.

Parameters
algorithm the name of the requested key management algorithm.
Returns
  • a key manager factory for the requested algorithm.
Throws
NoSuchAlgorithmException if no installed provider can provide the requested algorithm.
NullPointerException if algorithm is null (instead of NoSuchAlgorithmException as in 1.4 release)

public final KeyManager[] getKeyManagers ()

Since: API Level 1

Returns a list of key managers, one instance for each type of key in the key store.

Returns
  • a list of key managers.

public final Provider getProvider ()

Since: API Level 1

Returns the provider for this KeyManagerFactory instance.

Returns
  • the provider for this KeyManagerFactory instance.

public final void init (ManagerFactoryParameters spec)

Since: API Level 1

Initializes this instance with the specified factory parameters.

Parameters
spec the factory parameters.
Throws
InvalidAlgorithmParameterException if an error occurs.

public final void init (KeyStore ks, char[] password)

Since: API Level 1

Initializes this instance with the specified key store and password.

Parameters
ks the key store or null to use the default key store.
password the password for the specified key store or null if no key store is provided.
Throws
KeyStoreException if initializing this key manager factory fails.
NoSuchAlgorithmException if a required algorithm is not available.
UnrecoverableKeyException if a key cannot be recovered.