public class KeyManagerFactory extends Object
KeyManager
Constructor and Description |
---|
KeyManagerFactory() |
Modifier and Type | Method and Description |
---|---|
String |
getAlgorithm()
Returns the algorithm name of this
KeyManagerFactory object. |
static String |
getDefaultAlgorithm()
Obtains the default KeyManagerFactory algorithm name.
|
static KeyManagerFactory |
getInstance(String algorithm)
Returns a
KeyManagerFactory object that acts as a factory for key managers. |
KeyManager[] |
getKeyManagers()
Returns one key manager for each type of key material.
|
void |
init(KeyStore ks,
char[] password)
Initializes this factory with a source of key material.
|
public final String getAlgorithm()
KeyManagerFactory
object.
This is the same name that was specified in one of the getInstance
calls that created this
KeyManagerFactory
object.
KeyManagerFactory
object.public static final String getDefaultAlgorithm()
The default algorithm can be changed at runtime by setting the value of the
ssl.KeyManagerFactory.algorithm
security property to the desired algorithm name.
ssl.KeyManagerFactory.algorithm
security property,
or an implementation-specific default if no such property exists.public static final KeyManagerFactory getInstance(String algorithm) throws NoSuchAlgorithmException
KeyManagerFactory
object that acts as a factory for key managers.
This method traverses the list of registered security Providers, starting with the most preferred Provider. A new KeyManagerFactory object encapsulating the KeyManagerFactorySpi implementation from the first Provider that supports the specified algorithm is returned.
algorithm
- the standard name of the requested algorithm. See the
Java Secure Socket
Extension Reference Guide for information about standard algorithm names.KeyManagerFactory
object.NoSuchAlgorithmException
- if no Provider supports a KeyManagerFactorySpi implementation for the specified algorithm.NullPointerException
- if algorithm
is null.public final KeyManager[] getKeyManagers()
IllegalStateException
- if the KeyManagerFactory is not initializedpublic final void init(@Nullable KeyStore ks, char[] password) throws KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException
The provider typically uses a KeyStore for obtaining key material for use during secure socket negotiations. The KeyStore is generally password-protected.
ks
- the key store or nullpassword
- the password for recovering keys in the KeyStoreKeyStoreException
- if this operation failsNoSuchAlgorithmException
- if the specified algorithm is not available from the specified provider.UnrecoverableKeyException
- if the key cannot be recovered (e.g. the given password is wrong).