Android APIs
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)

Added in API level 1

Creates a new KeyManagerFactory.

Parameters
factorySpi KeyManagerFactorySpi: the implementation delegate.
provider Provider: the provider.
algorithm String: the key management algorithm name.

Public Methods

public final String getAlgorithm ()

Added in API level 1

Returns the name of the key management algorithm.

Returns
String the name of the key management algorithm.

public static final String getDefaultAlgorithm ()

Added in 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
String the default algorithm name.

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

Added in API level 1

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

Parameters
algorithm String: the name of the requested key management algorithm name.
provider String: the name of the provider that provides the requested algorithm.
Returns
KeyManagerFactory 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)

Added in API level 1

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

Parameters
algorithm String: the name of the requested key management algorithm name.
provider Provider: the provider that provides the requested algorithm.
Returns
KeyManagerFactory 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)

Added in API level 1

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

Parameters
algorithm String: the name of the requested key management algorithm.
Returns
KeyManagerFactory 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 ()

Added in API level 1

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

Returns
KeyManager[] a list of key managers.

public final Provider getProvider ()

Added in API level 1

Returns the provider for this KeyManagerFactory instance.

Returns
Provider the provider for this KeyManagerFactory instance.

public final void init (ManagerFactoryParameters spec)

Added in API level 1

Initializes this instance with the specified factory parameters.

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

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

Added in API level 1

Initializes this instance with the specified key store and password.

Parameters
ks KeyStore: the key store or null to use the default key store.
password char: 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.