Package javax.net.ssl

Class TrustManagerFactory

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

public class TrustManagerFactory
extends Object
The factory for TrustManagers based on KeyStore or provider specific implementation.
  • Constructor Details

    • TrustManagerFactory

      protected TrustManagerFactory​(TrustManagerFactorySpi factorySpi, Provider provider, String algorithm)
      Creates a new TrustManagerFactory instance.
      Parameters:
      factorySpi - the implementation delegate.
      provider - the provider
      algorithm - the algorithm name.
  • Method Details

    • getDefaultAlgorithm

      public static final String getDefaultAlgorithm()
      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.
    • getInstance

      public static final TrustManagerFactory getInstance​(String algorithm) throws NoSuchAlgorithmException
      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)
    • getInstance

      public static final TrustManagerFactory getInstance​(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException
      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)
    • getInstance

      public static final TrustManagerFactory getInstance​(String algorithm, Provider provider) throws NoSuchAlgorithmException
      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)
    • getAlgorithm

      public final String getAlgorithm()
      Returns the name of this TrustManagerFactory algorithm implementation.
      Returns:
      the name of this TrustManagerFactory algorithm implementation.
    • getProvider

      public final Provider getProvider()
      Returns the provider for this TrustManagerFactory instance.
      Returns:
      the provider for this TrustManagerFactory instance.
    • init

      public final void init​(KeyStore ks) throws KeyStoreException
      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.
    • init

      public final void init​(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException
      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.
    • getTrustManagers

      public final TrustManager[] getTrustManagers()
      Returns the list of TrustManagers with one entry for each type of trust material.
      Returns:
      the list of TrustManagers