FileDocCategorySizeDatePackage
TrustManagerFactory.javaAPI DocAndroid 1.5 API8800Wed May 06 22:41:06 BST 2009javax.net.ssl

TrustManagerFactory

public class TrustManagerFactory extends Object
The factory for {@code TrustManager}s based on {@code KeyStore} or provider specific implementation.
since
Android 1.0

Fields Summary
private static final String
SERVICE
private static org.apache.harmony.security.fortress.Engine
engine
private static final String
PROPERTYNAME
private final Provider
provider
private final TrustManagerFactorySpi
spiImpl
private final String
algorithm
Constructors Summary
protected TrustManagerFactory(TrustManagerFactorySpi factorySpi, Provider provider, String algorithm)
Creates a new {@code TrustManagerFactory} instance.

param
factorySpi the implementation delegate.
param
provider the provider
param
algorithm the algorithm name.
since
Android 1.0


                                                                  
      
                
        this.provider = provider;
        this.algorithm = algorithm;
        this.spiImpl = factorySpi;
    
Methods Summary
public final java.lang.StringgetAlgorithm()
Returns the name of this {@code TrustManagerFactory} algorithm implementation.

return
the name of this {@code TrustManagerFactory} algorithm implementation.
since
Android 1.0

        return algorithm;
    
public static final java.lang.StringgetDefaultAlgorithm()
Returns the default algorithm name for the {@code TrustManagerFactory}. The default algorithm name is specified by the security property {@code 'ssl.TrustManagerFactory.algorithm'}.

return
the default algorithm name.
since
Android 1.0

        return AccessController
                .doPrivileged(new java.security.PrivilegedAction<String>() {
                    public String run() {
                        return Security.getProperty(PROPERTYNAME);
                    }
                });
    
public static final javax.net.ssl.TrustManagerFactorygetInstance(java.lang.String algorithm)
Creates a new {@code TrustManagerFactory} instance for the specified trust management algorithm.

param
algorithm the name of the requested trust management algorithm.
return
a trust manager factory for the requested algorithm.
throws
NoSuchAlgorithmException if no installed provider can provide the requested algorithm.
throws
NullPointerException if {@code algorithm} is {@code null} (instead of NoSuchAlgorithmException as in 1.4 release)
since
Android 1.0

        if (algorithm == null) {
            throw new NullPointerException("algorithm is null");
        }
        synchronized (engine) {
            engine.getInstance(algorithm, null);
            return new TrustManagerFactory((TrustManagerFactorySpi) engine.spi,
                    engine.provider, algorithm);
        }
    
public static final javax.net.ssl.TrustManagerFactorygetInstance(java.lang.String algorithm, java.lang.String provider)
Creates a new {@code TrustManagerFactory} instance for the specified trust management algorithm from the specified provider.

param
algorithm the name of the requested trust management algorithm name.
param
provider the name of the provider that provides the requested algorithm.
return
a trust manager factory for the requested algorithm.
throws
NoSuchAlgorithmException if the specified provider cannot provide the requested algorithm.
throws
NoSuchProviderException if the specified provider does not exist.
throws
NullPointerException if {@code algorithm} is {@code null} (instead of NoSuchAlgorithmException as in 1.4 release)
since
Android 1.0

        if ((provider == null) || (provider.length() == 0)) {
            throw new IllegalArgumentException("Provider is null oe empty");
        }
        Provider impProvider = Security.getProvider(provider);
        if (impProvider == null) {
            throw new NoSuchProviderException(provider);
        }
        return getInstance(algorithm, impProvider);
    
public static final javax.net.ssl.TrustManagerFactorygetInstance(java.lang.String algorithm, java.security.Provider provider)
Creates a new {@code TrustManagerFactory} instance for the specified trust management algorithm from the specified provider.

param
algorithm the name of the requested key management algorithm name.
param
provider the provider that provides the requested algorithm.
return
a key manager factory for the requested algorithm.
throws
NoSuchAlgorithmException if the specified provider cannot provide the requested algorithm.
throws
NullPointerException if {@code algorithm} is {@code null} (instead of NoSuchAlgorithmException as in 1.4 release)
since
Android 1.0

        if (provider == null) {
            throw new IllegalArgumentException("Provider is null");
        }
        if (algorithm == null) {
            throw new NullPointerException("algorithm is null");
        }
        synchronized (engine) {
            engine.getInstance(algorithm, provider, null);
            return new TrustManagerFactory((TrustManagerFactorySpi) engine.spi,
                    provider, algorithm);
        }
    
public final java.security.ProvidergetProvider()
Returns the provider for this {@code TrustManagerFactory} instance.

return
the provider for this {@code TrustManagerFactory} instance.
since
Android 1.0

        return provider;
    
public final javax.net.ssl.TrustManager[]getTrustManagers()
Returns the list of {@code TrustManager}s with one entry for each type of trust material.

return
the list of {@code TrustManager}s
since
Android 1.0

        return spiImpl.engineGetTrustManagers();
    
public final voidinit(java.security.KeyStore ks)
Initializes this factory instance with the specified keystore as source of certificate authorities and trust material.

param
ks the keystore or {@code null}.
throws
KeyStoreException if the initialization fails.
since
Android 1.0

        spiImpl.engineInit(ks);
    
public final voidinit(javax.net.ssl.ManagerFactoryParameters spec)
Initializes this factory instance with the specified provider-specific parameters for a source of trust material.

param
spec the provider-specific parameters.
throws
InvalidAlgorithmParameterException if the initialization fails.
since
Android 1.0

        spiImpl.engineInit(spec);