vmlinz / sandrop

Automatically exported from code.google.com/p/sandrop
1 stars 0 forks source link

SandroProxy connection to ssl servers; TrustManagers #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
TrustManager can be trustAllManager or android OS trustManagers

  private static TrustManager[] _trustAllCerts = new TrustManager[] {
        new X509TrustManager() {
            public X509Certificate[] getAcceptedIssuers() {
                return null;
            }
            public void checkClientTrusted(X509Certificate[] certs, String authType) {
                _logger.fine("trust manager checkClientTrusted authType:" + authType);
                if (certs != null){
                    for (int i = 0; i < certs.length; i++) {
                        _logger.fine("trust manager checkClientTrusted:" + certs[i]);
                    }
                }
            }
            public void checkServerTrusted(X509Certificate[] certs, String authType) {
                _logger.fine("trust manager checkClientTrusted authType:" + authType);
                if (certs != null){
                    for (int i = 0; i < certs.length; i++) {
                        _logger.fine("trust manager checkClientTrusted:" + certs[i]);
                    }
                }
            }
        }
    };

if (!pref.getBoolean(PreferenceUtils.ssTrustAllManager, false)){
    _logger.info("using ssl os trust managers");
    TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
    tmf.init((KeyStore) null);
    trustManagers = tmf.getTrustManagers();
}else{
    _logger.info("warrning: using ssl trust all manager!!!");
}

Original issue reported on code.google.com by supp.san...@gmail.com on 26 Oct 2012 at 1:50

GoogleCodeExporter commented 9 years ago
Change how to handle unsecure sites with Preferences->Trust all SSL server certs

Original comment by supp.san...@gmail.com on 26 Oct 2012 at 2:12

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by supp.san...@gmail.com on 29 Oct 2012 at 6:50