private void init() { if (myTrustedCerts != null) { return; } Collection trustedCerts = new ArrayList(); // load trusted certs from files. for (int i = 0; i < myServerCertFiles.length; i++) { X509Certificate cert = loadCertificate(myServerCertFiles[i]); if (cert != null) { trustedCerts.add(cert); } } X509TrustManager[] trustManagers = getDefaultTrustManagers(); for (int i = 0; trustManagers != null && i < trustManagers.length; i++) { X509TrustManager trustManager = trustManagers[i]; X509Certificate[] acceptedCerts = trustManager.getAcceptedIssuers(); for (int c = 0; acceptedCerts != null && c < acceptedCerts.length; c++) { X509Certificate cert = acceptedCerts[c]; trustedCerts.add(cert); } } myTrustedCerts = (X509Certificate[]) trustedCerts.toArray(new X509Certificate[trustedCerts.size()]); }
private void init() { if (myTrustedCerts != null) { return; } Collection trustedCerts = new ArrayList(); // load trusted certs from files. for (int i = 0; i < myServerCertFiles.length; i++) { X509Certificate cert = loadCertificate(myServerCertFiles[i]); if (cert != null) { trustedCerts.add(cert); } } X509TrustManager[] trustManagers = getDefaultTrustManagers(); for (int i = 0; trustManagers != null && i < trustManagers.length; i++) { X509TrustManager trustManager = trustManagers[i]; X509Certificate[] acceptedCerts = trustManager.getAcceptedIssuers(); for (int c = 0; acceptedCerts != null && c < acceptedCerts.length; c++) { X509Certificate cert = acceptedCerts[c]; trustedCerts.add(cert); } } myTrustedCerts = (X509Certificate[]) trustedCerts.toArray(new X509Certificate[trustedCerts.size()]); }
private void init() { if (myTrustedCerts != null) { return; } Collection trustedCerts = new ArrayList(); // load trusted certs from files. for (int i = 0; i < myServerCertFiles.length; i++) { X509Certificate cert = loadCertificate(myServerCertFiles[i]); if (cert != null) { trustedCerts.add(cert); } } X509TrustManager[] trustManagers = getDefaultTrustManagers(); for (int i = 0; trustManagers != null && i < trustManagers.length; i++) { X509TrustManager trustManager = trustManagers[i]; X509Certificate[] acceptedCerts = trustManager.getAcceptedIssuers(); for (int c = 0; acceptedCerts != null && c < acceptedCerts.length; c++) { X509Certificate cert = acceptedCerts[c]; trustedCerts.add(cert); } } myTrustedCerts = (X509Certificate[]) trustedCerts.toArray(new X509Certificate[trustedCerts.size()]); }