.createTrustManagerFactory(); context.addInfo("trust manager algorithm '" + tmf.getAlgorithm() + "' provider '" + tmf.getProvider() + "'");
trustMgrFact.getProvider().getName()});
protected X509TrustManager[] getSystemTrustManagers() { TrustManagerFactory trustManagerFactory = null; try { trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init((KeyStore)null); } catch (NoSuchAlgorithmException e) { } catch (KeyStoreException e) { } logger.info("Detected Truststore: {}", trustManagerFactory.getProvider().getName()); List<X509TrustManager> x509TrustManagers = new ArrayList<X509TrustManager>(); for (TrustManager trustManager : trustManagerFactory.getTrustManagers()) { if (trustManager instanceof X509TrustManager) { X509TrustManager x509TrustManager = (X509TrustManager)trustManager; logger.info(" Trusted issuers found: " + x509TrustManager.getAcceptedIssuers().length); x509TrustManagers.add(x509TrustManager); } } return x509TrustManagers.toArray(new X509TrustManager[]{}); } protected String checkTrustedCertStatus(X509Certificate certificate, X509TrustManager[] trustManagers) {
@Override public TrustManagerFactory createTrustManagerFactory(final String algorithm) throws NoSuchAlgorithmException { checkNotNull(algorithm); TrustManagerFactory obj; try { obj = TrustManagerFactory.getInstance(algorithm, getProvider()); } catch (NoSuchAlgorithmException e) { logFallback(e); obj = TrustManagerFactory.getInstance(algorithm); } if (log.isTraceEnabled()) { log.trace("Created trust-manager-factory: {} ({})", obj.getAlgorithm(), obj.getProvider().getName()); } return obj; }
@Test public void testExplicitProvider() throws Exception { TrustManagerFactory factory = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm()); factoryBean.setProvider(factory.getProvider().getName()); assertNotNull(factoryBean.createTrustManagerFactory()); }
/** * Creates trust managers using the receiver's trust store configuration. * @param context context for status messages * @return an array of trust managers or {@code null} if no trust store * configuration was provided * @throws NoSuchProviderException if a provider specified for one * of the trust manager components is not known to the platform * @throws NoSuchAlgorithmException if an algorithm specified for * one of the trust manager components is not known to the relevant * provider * @throws KeyStoreException if an error occurs in reading a key * store containing trust anchors */ private TrustManager[] createTrustManagers(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyStoreException { if (getTrustStore() == null) return null; KeyStore trustStore = getTrustStore().createKeyStore(); context.addInfo("trust store of type '" + trustStore.getType() + "' provider '" + trustStore.getProvider() + "': " + getTrustStore().getLocation()); TrustManagerFactory tmf = getTrustManagerFactory().createTrustManagerFactory(); context.addInfo("trust manager algorithm '" + tmf.getAlgorithm() + "' provider '" + tmf.getProvider() + "'"); tmf.init(trustStore); return tmf.getTrustManagers(); }
/** * Creates trust managers using the receiver's trust store configuration. * @param context context for status messages * @return an array of trust managers or {@code null} if no trust store * configuration was provided * @throws NoSuchProviderException if a provider specified for one * of the trust manager components is not known to the platform * @throws NoSuchAlgorithmException if an algorithm specified for * one of the trust manager components is not known to the relevant * provider * @throws KeyStoreException if an error occurs in reading a key * store containing trust anchors */ private TrustManager[] createTrustManagers(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyStoreException { if (getTrustStore() == null) return null; KeyStore trustStore = getTrustStore().createKeyStore(); context.addInfo("trust store of type '" + trustStore.getType() + "' provider '" + trustStore.getProvider() + "': " + getTrustStore().getLocation()); TrustManagerFactory tmf = getTrustManagerFactory().createTrustManagerFactory(); context.addInfo("trust manager algorithm '" + tmf.getAlgorithm() + "' provider '" + tmf.getProvider() + "'"); tmf.init(trustStore); return tmf.getTrustManagers(); }
/** * Creates trust managers using the receiver's trust store configuration. * @param context context for status messages * @return an array of trust managers or {@code null} if no trust store * configuration was provided * @throws NoSuchProviderException if a provider specified for one * of the trust manager components is not known to the platform * @throws NoSuchAlgorithmException if an algorithm specified for * one of the trust manager components is not known to the relevant * provider * @throws KeyStoreException if an error occurs in reading a key * store containing trust anchors */ private TrustManager[] createTrustManagers(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyStoreException { if (getTrustStore() == null) return null; KeyStore trustStore = getTrustStore().createKeyStore(); context.addInfo("trust store of type '" + trustStore.getType() + "' provider '" + trustStore.getProvider() + "': " + getTrustStore().getLocation()); TrustManagerFactory tmf = getTrustManagerFactory().createTrustManagerFactory(); context.addInfo("trust manager algorithm '" + tmf.getAlgorithm() + "' provider '" + tmf.getProvider() + "'"); tmf.init(trustStore); return tmf.getTrustManagers(); }
/** * Creates trust managers using the receiver's trust store configuration. * @param context context for status messages * @return an array of trust managers or {@code null} if no trust store * configuration was provided * @throws NoSuchProviderException if a provider specified for one * of the trust manager components is not known to the platform * @throws NoSuchAlgorithmException if an algorithm specified for * one of the trust manager components is not known to the relevant * provider * @throws KeyStoreException if an error occurs in reading a key * store containing trust anchors */ private TrustManager[] createTrustManagers(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyStoreException { if (getTrustStore() == null) return null; KeyStore trustStore = getTrustStore().createKeyStore(); context.addInfo("trust store of type '" + trustStore.getType() + "' provider '" + trustStore.getProvider() + "': " + getTrustStore().getLocation()); TrustManagerFactory tmf = getTrustManagerFactory().createTrustManagerFactory(); context.addInfo("trust manager algorithm '" + tmf.getAlgorithm() + "' provider '" + tmf.getProvider() + "'"); tmf.init(trustStore); return tmf.getTrustManagers(); }
.createTrustManagerFactory(); context.addInfo("trust manager algorithm '" + tmf.getAlgorithm() + "' provider '" + tmf.getProvider() + "'");
/** * Creates trust managers using the receiver's trust store configuration. * @param context context for status messages * @return an array of trust managers or {@code null} if no trust store * configuration was provided * @throws NoSuchProviderException if a provider specified for one * of the trust manager components is not known to the platform * @throws NoSuchAlgorithmException if an algorithm specified for * one of the trust manager components is not known to the relevant * provider * @throws KeyStoreException if an error occurs in reading a key * store containing trust anchors */ private TrustManager[] createTrustManagers(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyStoreException { if (getTrustStore() == null) return null; KeyStore trustStore = getTrustStore().createKeyStore(); context.addInfo("trust store of type '" + trustStore.getType() + "' provider '" + trustStore.getProvider() + "': " + getTrustStore().getLocation()); TrustManagerFactory tmf = getTrustManagerFactory().createTrustManagerFactory(); context.addInfo("trust manager algorithm '" + tmf.getAlgorithm() + "' provider '" + tmf.getProvider() + "'"); tmf.init(trustStore); return tmf.getTrustManagers(); }
/** * Creates trust managers using the receiver's trust store configuration. * @param context context for status messages * @return an array of trust managers or {@code null} if no trust store * configuration was provided * @throws NoSuchProviderException if a provider specified for one * of the trust manager components is not known to the platform * @throws NoSuchAlgorithmException if an algorithm specified for * one of the trust manager components is not known to the relevant * provider * @throws KeyStoreException if an error occurs in reading a key * store containing trust anchors */ private TrustManager[] createTrustManagers(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyStoreException { if (getTrustStore() == null) return null; KeyStore trustStore = getTrustStore().createKeyStore(); context.addInfo("trust store of type '" + trustStore.getType() + "' provider '" + trustStore.getProvider() + "': " + getTrustStore().getLocation()); TrustManagerFactory tmf = getTrustManagerFactory().createTrustManagerFactory(); context.addInfo("trust manager algorithm '" + tmf.getAlgorithm() + "' provider '" + tmf.getProvider() + "'"); tmf.init(trustStore); return tmf.getTrustManagers(); }
/** * Creates trust managers using the receiver's trust store configuration. * @param context context for status messages * @return an array of trust managers or {@code null} if no trust store * configuration was provided * @throws NoSuchProviderException if a provider specified for one * of the trust manager components is not known to the platform * @throws NoSuchAlgorithmException if an algorithm specified for * one of the trust manager components is not known to the relevant * provider * @throws KeyStoreException if an error occurs in reading a key * store containing trust anchors */ private TrustManager[] createTrustManagers(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyStoreException { if (getTrustStore() == null) return null; KeyStore trustStore = getTrustStore().createKeyStore(); context.addInfo( "trust store of type '" + trustStore.getType() + "' provider '" + trustStore.getProvider() + "': " + getTrustStore().getLocation()); TrustManagerFactory tmf = getTrustManagerFactory() .createTrustManagerFactory(); context.addInfo("trust manager algorithm '" + tmf.getAlgorithm() + "' provider '" + tmf.getProvider() + "'"); tmf.init(trustStore); return tmf.getTrustManagers(); }
trustMgrFact.getProvider().getName()});
trustMgrFact.getProvider().getName()});
trustMgrFact.getProvider().getName()});