public class TrustManagerFactory extends Object
TrustManager
Constructor and Description |
---|
TrustManagerFactory() |
Modifier and Type | Method and Description |
---|---|
String |
getAlgorithm()
Returns the algorithm name of this
TrustManagerFactory object. |
static String |
getDefaultAlgorithm()
Obtains the default TrustManagerFactory algorithm name.
|
static TrustManagerFactory |
getInstance(String algorithm)
Returns a
TrustManagerFactory object that acts as a factory for trust managers. |
TrustManager[] |
getTrustManagers()
Returns one trust manager for each type of trust material.
|
void |
init(KeyStore ks)
Initializes this factory with a source of certificate authorities and related trust material.
|
public static final String getDefaultAlgorithm()
The default TrustManager can be changed at runtime by setting the value of the
ssl.TrustManagerFactory.algorithm
security property to the desired algorithm name.
ssl.TrustManagerFactory.algorithm
security
property, or an implementation-specific default if no such property exists.public final String getAlgorithm()
TrustManagerFactory
object.
This is the same name that was specified in one of the getInstance
calls that created this
TrustManagerFactory
object.
TrustManagerFactory
objectpublic static final TrustManagerFactory getInstance(String algorithm) throws NoSuchAlgorithmException
TrustManagerFactory
object that acts as a factory for trust managers.
This method traverses the list of registered security Providers, starting with the most preferred Provider. A new TrustManagerFactory object encapsulating the TrustManagerFactorySpi implementation from the first Provider that supports the specified algorithm is returned.
algorithm
- the standard name of the requested trust management algorithm. See the
Java Secure Socket
Extension Reference Guide for information about standard algorithm names.TrustManagerFactory
object.NoSuchAlgorithmException
- if no Provider supports a TrustManagerFactorySpi implementation for the specified algorithm.NullPointerException
- if algorithm is null.public final void init(@Nullable KeyStore ks) throws KeyStoreException
The provider typically uses a KeyStore as a basis for making trust decisions.
ks
- the key store, or nullKeyStoreException
- if this operation failspublic final TrustManager[] getTrustManagers()
IllegalStateException
- if the factory is not initialized.