public class

TrustManagerFactory

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

Class Overview

The factory for TrustManagers based on KeyStore or provider specific implementation.

Summary

Protected Constructors
TrustManagerFactory(TrustManagerFactorySpi factorySpi, Provider provider, String algorithm)
Creates a new TrustManagerFactory instance.
Public Methods
final String getAlgorithm()
Returns the name of this TrustManagerFactory algorithm implementation.
final static String getDefaultAlgorithm()
Returns the default algorithm name for the TrustManagerFactory.
final static TrustManagerFactory getInstance(String algorithm, String provider)
Creates a new TrustManagerFactory instance for the specified trust management algorithm from the specified provider.
final static TrustManagerFactory getInstance(String algorithm, Provider provider)
Creates a new TrustManagerFactory instance for the specified trust management algorithm from the specified provider.
final static TrustManagerFactory getInstance(String algorithm)
Creates a new TrustManagerFactory instance for the specified trust management algorithm.
final Provider getProvider()
Returns the provider for this TrustManagerFactory instance.
final TrustManager[] getTrustManagers()
Returns the list of TrustManagers with one entry for each type of trust material.
final void init(KeyStore ks)
Initializes this factory instance with the specified keystore as source of certificate authorities and trust material.
final void init(ManagerFactoryParameters spec)
Initializes this factory instance with the specified provider-specific parameters for a source of trust material.
[Expand]
Inherited Methods
From class java.lang.Object

Protected Constructors

protected TrustManagerFactory (TrustManagerFactorySpi factorySpi, Provider provider, String algorithm)

Since: API Level 1

Creates a new TrustManagerFactory instance.

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

Public Methods

public final String getAlgorithm ()

Since: API Level 1

Returns the name of this TrustManagerFactory algorithm implementation.

Returns
  • the name of this TrustManagerFactory algorithm implementation.

public static final String getDefaultAlgorithm ()

Since: API Level 1

Returns the default algorithm name for the TrustManagerFactory. The default algorithm name is specified by the security property 'ssl.TrustManagerFactory.algorithm'.

Returns
  • the default algorithm name.

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

Since: API Level 1

Creates a new TrustManagerFactory instance for the specified trust management algorithm from the specified provider.

Parameters
algorithm the name of the requested trust management algorithm name.
provider the name of the provider that provides the requested algorithm.
Returns
  • a trust 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 TrustManagerFactory getInstance (String algorithm, Provider provider)

Since: API Level 1

Creates a new TrustManagerFactory instance for the specified trust 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 TrustManagerFactory getInstance (String algorithm)

Since: API Level 1

Creates a new TrustManagerFactory instance for the specified trust management algorithm.

Parameters
algorithm the name of the requested trust management algorithm.
Returns
  • a trust 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 Provider getProvider ()

Since: API Level 1

Returns the provider for this TrustManagerFactory instance.

Returns
  • the provider for this TrustManagerFactory instance.

public final TrustManager[] getTrustManagers ()

Since: API Level 1

Returns the list of TrustManagers with one entry for each type of trust material.

Returns
  • the list of TrustManagers

public final void init (KeyStore ks)

Since: API Level 1

Initializes this factory instance with the specified keystore as source of certificate authorities and trust material.

Parameters
ks the keystore or null.
Throws
KeyStoreException if the initialization fails.

public final void init (ManagerFactoryParameters spec)

Since: API Level 1

Initializes this factory instance with the specified provider-specific parameters for a source of trust material.

Parameters
spec the provider-specific parameters.
Throws
InvalidAlgorithmParameterException if the initialization fails.