private TrustManager[] loadTrustManagers() throws GeneralSecurityException, IOException { KeyStore keyStore = null; if (StringUtils.hasText(trustStoreLocation)) { char[] pass = (StringUtils.hasText(trustStorePass) ? trustStorePass.trim().toCharArray() : null); keyStore = loadKeyStore(trustStoreLocation, pass); } else { LOG.debug("No truststore location specified! SSL is continuing with no truststore."); } TrustManagerFactory tmFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmFactory.init(keyStore); TrustManager[] tms = tmFactory.getTrustManagers(); if (tms != null && trust != null) { // be defensive since the underlying impl might not give us a copy TrustManager[] clone = new TrustManager[tms.length]; for (int i = 0; i < tms.length; i++) { TrustManager tm = tms[i]; if (tm instanceof X509TrustManager) { tm = new TrustManagerDelegate((X509TrustManager) tm, trust); } clone[i] = tm; } tms = clone; } return tms; }
private TrustManager[] loadTrustManagers() throws GeneralSecurityException, IOException { KeyStore keyStore = null; if (StringUtils.hasText(trustStoreLocation)) { char[] pass = (StringUtils.hasText(trustStorePass) ? trustStorePass.trim().toCharArray() : null); keyStore = loadKeyStore(trustStoreLocation, pass); } else { LOG.debug("No truststore location specified! SSL is continuing with no truststore."); } TrustManagerFactory tmFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmFactory.init(keyStore); TrustManager[] tms = tmFactory.getTrustManagers(); if (tms != null && trust != null) { // be defensive since the underlying impl might not give us a copy TrustManager[] clone = new TrustManager[tms.length]; for (int i = 0; i < tms.length; i++) { TrustManager tm = tms[i]; if (tm instanceof X509TrustManager) { tm = new TrustManagerDelegate((X509TrustManager) tm, trust); } clone[i] = tm; } tms = clone; } return tms; }
private TrustManager[] loadTrustManagers() throws GeneralSecurityException, IOException { KeyStore keyStore = null; if (StringUtils.hasText(trustStoreLocation)) { char[] pass = (StringUtils.hasText(trustStorePass) ? trustStorePass.trim().toCharArray() : null); keyStore = loadKeyStore(trustStoreLocation, pass); } else { LOG.debug("No truststore location specified! SSL is continuing with no truststore."); } TrustManagerFactory tmFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmFactory.init(keyStore); TrustManager[] tms = tmFactory.getTrustManagers(); if (tms != null && trust != null) { // be defensive since the underlying impl might not give us a copy TrustManager[] clone = new TrustManager[tms.length]; for (int i = 0; i < tms.length; i++) { TrustManager tm = tms[i]; if (tm instanceof X509TrustManager) { tm = new TrustManagerDelegate((X509TrustManager) tm, trust); } clone[i] = tm; } tms = clone; } return tms; }
private TrustManager[] loadTrustManagers() throws GeneralSecurityException, IOException { KeyStore keyStore = null; if (StringUtils.hasText(trustStoreLocation)) { char[] pass = (StringUtils.hasText(trustStorePass) ? trustStorePass.trim().toCharArray() : null); keyStore = loadKeyStore(trustStoreLocation, pass); } else { LOG.debug("No truststore location specified! SSL is continuing with no truststore."); } TrustManagerFactory tmFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmFactory.init(keyStore); TrustManager[] tms = tmFactory.getTrustManagers(); if (tms != null && trust != null) { // be defensive since the underlying impl might not give us a copy TrustManager[] clone = new TrustManager[tms.length]; for (int i = 0; i < tms.length; i++) { TrustManager tm = tms[i]; if (tm instanceof X509TrustManager) { tm = new TrustManagerDelegate((X509TrustManager) tm, trust); } clone[i] = tm; } tms = clone; } return tms; }
private TrustManager[] loadTrustManagers() throws GeneralSecurityException, IOException { KeyStore keyStore = null; if (StringUtils.hasText(trustStoreLocation)) { char[] pass = (StringUtils.hasText(trustStorePass) ? trustStorePass.trim().toCharArray() : null); keyStore = loadKeyStore(trustStoreLocation, pass); } TrustManagerFactory tmFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmFactory.init(keyStore); TrustManager[] tms = tmFactory.getTrustManagers(); if (tms != null && trust != null) { // be defensive since the underlying impl might not give us a copy TrustManager[] clone = new TrustManager[tms.length]; for (int i = 0; i < tms.length; i++) { TrustManager tm = tms[i]; if (tm instanceof X509TrustManager) { tm = new TrustManagerDelegate((X509TrustManager) tm, trust); } clone[i] = tm; } tms = clone; } return tms; }