javax.net.ssl

Class TrustManagerFactory


public class TrustManagerFactory
extends Object

A factory for creating trust manager objects.

Constructor Summary

TrustManagerFactory(TrustManagerFactorySpi tmfSpi, Provider provider, String algorithm)
Creates a new trust manager factory.

Method Summary

String
getAlgorithm()
Returns the name of this trust manager algorithm.
static String
getDefaultAlgorithm()
Returns the default algorithm for trust manager factories.
static TrustManagerFactory
getInstance(String algorithm)
Returns an instance of a trust manager factory for the given algorithm from the first provider that implements it.
static TrustManagerFactory
getInstance(String algorithm, String provider)
Returns an instance of a trust manager factory for the given algorithm from the named provider.
static TrustManagerFactory
getInstance(String algorithm, Provider provider)
Returns an instance of a trust manager factory for the given algorithm from the specified provider.
Provider
getProvider()
Returns the provider of the underlying implementation.
TrustManager[]
getTrustManagers()
Returns the trust managers created by this factory.
void
init(KeyStore store)
Initialize this instance with a key store.
void
init(ManagerFactoryParameters params)
Initialize this instance with some algorithm-specific parameters.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

TrustManagerFactory

protected TrustManagerFactory(TrustManagerFactorySpi tmfSpi,
                              Provider provider,
                              String algorithm)
Creates a new trust manager factory.
Parameters:
tmfSpi - The underlying engine class.
provider - The provider of the engine class.
algorithm - The trust manager algorithm name.

Method Details

getAlgorithm

public final String getAlgorithm()
Returns the name of this trust manager algorithm.
Returns:
The algorithm name.

getDefaultAlgorithm

public static final String getDefaultAlgorithm()
Returns the default algorithm for trust manager factories. The value returned is either the value of the security property "ssl.TrustManagerFactory.algorithm" if it is set, or the value "JessieX509" if not.
Returns:
The default algorithm name.
See Also:
Security.getProperty(java.lang.String)

getInstance

public static final TrustManagerFactory getInstance(String algorithm)
            throws NoSuchAlgorithmException
Returns an instance of a trust manager factory for the given algorithm from the first provider that implements it.
Parameters:
algorithm - The name of the algorithm to get.
Returns:
The instance of the trust manager factory.
Throws:
NoSuchAlgorithmException - If no provider implements the given algorithm.
IllegalArgumentException - if algorithm is null or is an empty string.

getInstance

public static final TrustManagerFactory getInstance(String algorithm,
                                                    String provider)
            throws NoSuchAlgorithmException,
                   NoSuchProviderException
Returns an instance of a trust manager factory for the given algorithm from the named provider.
Parameters:
algorithm - The name of the algorithm to get.
provider - The name of the provider to get the instance from.
Returns:
The instance of the trust manager factory.
Throws:
NoSuchAlgorithmException - If the provider does not implement the given algorithm.
NoSuchProviderException - If there is no such named provider.
IllegalArgumentException - if either algorithm or provider is null, or if algorithm is an empty string.

getInstance

public static final TrustManagerFactory getInstance(String algorithm,
                                                    Provider provider)
            throws NoSuchAlgorithmException
Returns an instance of a trust manager factory for the given algorithm from the specified provider.
Parameters:
algorithm - The name of the algorithm to get.
provider - The provider to get the instance from.
Returns:
The instance of the trust manager factory.
Throws:
NoSuchAlgorithmException - If the provider does not implement the given algorithm.
IllegalArgumentException - if either algorithm or provider is null, or if algorithm is an empty string.

getProvider

public final Provider getProvider()
Returns the provider of the underlying implementation.
Returns:
The provider.

getTrustManagers

public final TrustManager[] getTrustManagers()
Returns the trust managers created by this factory.
Returns:
The trust managers.

init

public final void init(KeyStore store)
            throws KeyStoreException
Initialize this instance with a key store. The key store may be null, in which case a default will be used.
Parameters:
store - The key store.
Throws:
KeyStoreException - If there is a problem reading from the key store.

init

public final void init(ManagerFactoryParameters params)
            throws InvalidAlgorithmParameterException
Initialize this instance with some algorithm-specific parameters.
Parameters:
params - The parameters.
Throws:
InvalidAlgorithmParameterException - If the supplied parameters are inappropriate for this instance.

TrustManagerFactory.java -- factory for trust managers. Copyright (C) 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.