FileDocCategorySizeDatePackage
TrustManagerFactory.javaAPI DocAndroid 1.5 API3822Wed May 06 22:42:46 BST 2009com.android.email.mail.store

TrustManagerFactory

public final class TrustManagerFactory extends Object

Fields Summary
private static final String
LOG_TAG
private static X509TrustManager
sSecureTrustManager
private static X509TrustManager
sUnsecureTrustManager
Constructors Summary
private TrustManagerFactory()

        try {
            javax.net.ssl.TrustManagerFactory tmf = javax.net.ssl.TrustManagerFactory.getInstance("X509");
            tmf.init((KeyStore) null);
            TrustManager[] tms = tmf.getTrustManagers();
            if (tms != null) {
                for (TrustManager tm : tms) {
                    if (tm instanceof X509TrustManager) {
                        sSecureTrustManager = (X509TrustManager) tm;
                        break;
                    }
                }
            }
        } catch (NoSuchAlgorithmException e) {
            Log.e(LOG_TAG, "Unable to get X509 Trust Manager ", e);
        } catch (KeyStoreException e) {
            Log.e(LOG_TAG, "Key Store exception while initializing TrustManagerFactory ", e);
        }

        sUnsecureTrustManager = new SimpleX509TrustManager();
    
    
Methods Summary
public static javax.net.ssl.X509TrustManagerget(java.lang.String host, boolean secure)

        return secure ? new SecureX509TrustManager(sSecureTrustManager, host) :
                sUnsecureTrustManager;