/** * Gets the trust manager factory configuration. * @return factory bean; if no trust manager factory * configuration has been set, a default factory bean is returned */ public TrustManagerFactoryFactoryBean getTrustManagerFactory() { if (trustManagerFactory == null) { return new TrustManagerFactoryFactoryBean(); } return trustManagerFactory; }
/** * Creates a {@link TrustManagerFactory} using the receiver's configuration. * @return factory object * @throws NoSuchProviderException if the provider specified by * {@link #setProvider(String)} is not known to the platform * @throws NoSuchAlgorithmException if the algorithm specified by * {@link #setAlgorithm(String)} is not known to the specified provider * (or to the default platform provider if no provider is specified) */ public TrustManagerFactory createTrustManagerFactory() throws NoSuchProviderException, NoSuchAlgorithmException { return getProvider() != null ? TrustManagerFactory.getInstance(getAlgorithm(), getProvider()) : TrustManagerFactory.getInstance(getAlgorithm()); }
.createTrustManagerFactory(); context.addInfo("trust manager algorithm '" + tmf.getAlgorithm() + "' provider '" + tmf.getProvider() + "'");
@Test public void testExplicitAlgorithm() throws Exception { factoryBean.setAlgorithm(TrustManagerFactory.getDefaultAlgorithm()); assertNotNull(factoryBean.createTrustManagerFactory()); }
@Test public void testExplicitProvider() throws Exception { TrustManagerFactory factory = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm()); factoryBean.setProvider(factory.getProvider().getName()); assertNotNull(factoryBean.createTrustManagerFactory()); }
@Override public TrustManagerFactory createTrustManagerFactory() throws NoSuchProviderException, NoSuchAlgorithmException { factoryCreated = true; return super.createTrustManagerFactory(); }
/** * Creates a {@link TrustManagerFactory} using the receiver's configuration. * @return factory object * @throws NoSuchProviderException if the provider specified by * {@link #setProvider(String)} is not known to the platform * @throws NoSuchAlgorithmException if the algorithm specified by * {@link #setAlgorithm(String)} is not known to the specified provider * (or to the default platform provider if no provider is specified) */ public TrustManagerFactory createTrustManagerFactory() throws NoSuchProviderException, NoSuchAlgorithmException { return getProvider() != null ? TrustManagerFactory.getInstance(getAlgorithm(), getProvider()) : TrustManagerFactory.getInstance(getAlgorithm()); }
@Test public void testDefaults() throws Exception { assertNotNull(factoryBean.createTrustManagerFactory()); }
/** * Gets the trust manager factory configuration. * @return factory bean; if no trust manager factory * configuration has been set, a default factory bean is returned */ public TrustManagerFactoryFactoryBean getTrustManagerFactory() { if (trustManagerFactory == null) { return new TrustManagerFactoryFactoryBean(); } return trustManagerFactory; }
/** * Creates a {@link TrustManagerFactory} using the receiver's configuration. * @return factory object * @throws NoSuchProviderException if the provider specified by * {@link #setProvider(String)} is not known to the platform * @throws NoSuchAlgorithmException if the algorithm specified by * {@link #setAlgorithm(String)} is not known to the specified provider * (or to the default platform provider if no provider is specified) */ public TrustManagerFactory createTrustManagerFactory() throws NoSuchProviderException, NoSuchAlgorithmException { return getProvider() != null ? TrustManagerFactory.getInstance(getAlgorithm(), getProvider()) : TrustManagerFactory.getInstance(getAlgorithm()); }
/** * 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(); }
/** * Gets the trust manager factory configuration. * @return factory bean; if no trust manager factory * configuration has been set, a default factory bean is returned */ public TrustManagerFactoryFactoryBean getTrustManagerFactory() { if (trustManagerFactory == null) { return new TrustManagerFactoryFactoryBean(); } return trustManagerFactory; }
/** * Creates a {@link TrustManagerFactory} using the receiver's configuration. * @return factory object * @throws NoSuchProviderException if the provider specified by * {@link #setProvider(String)} is not known to the platform * @throws NoSuchAlgorithmException if the algorithm specified by * {@link #setAlgorithm(String)} is not known to the specified provider * (or to the default platform provider if no provider is specified) */ public TrustManagerFactory createTrustManagerFactory() throws NoSuchProviderException, NoSuchAlgorithmException { return getProvider() != null ? TrustManagerFactory.getInstance(getAlgorithm(), getProvider()) : TrustManagerFactory.getInstance(getAlgorithm()); }
/** * 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(); }
/** * Gets the trust manager factory configuration. * @return factory bean; if no trust manager factory * configuration has been set, a default factory bean is returned */ public TrustManagerFactoryFactoryBean getTrustManagerFactory() { if (trustManagerFactory == null) { return new TrustManagerFactoryFactoryBean(); } return trustManagerFactory; }
/** * Creates a {@link TrustManagerFactory} using the receiver's configuration. * @return factory object * @throws NoSuchProviderException if the provider specified by * {@link #setProvider(String)} is not known to the platform * @throws NoSuchAlgorithmException if the algorithm specified by * {@link #setAlgorithm(String)} is not known to the specified provider * (or to the default platform provider if no provider is specified) */ public TrustManagerFactory createTrustManagerFactory() throws NoSuchProviderException, NoSuchAlgorithmException { return getProvider() != null ? TrustManagerFactory.getInstance(getAlgorithm(), getProvider()) : TrustManagerFactory.getInstance(getAlgorithm()); }
/** * 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(); }
/** * Gets the trust manager factory configuration. * @return factory bean; if no trust manager factory * configuration has been set, a default factory bean is returned */ public TrustManagerFactoryFactoryBean getTrustManagerFactory() { if (trustManagerFactory == null) { return new TrustManagerFactoryFactoryBean(); } return trustManagerFactory; }
/** * Creates a {@link TrustManagerFactory} using the receiver's configuration. * @return factory object * @throws NoSuchProviderException if the provider specified by * {@link #setProvider(String)} is not known to the platform * @throws NoSuchAlgorithmException if the algorithm specified by * {@link #setAlgorithm(String)} is not known to the specified provider * (or to the default platform provider if no provider is specified) */ public TrustManagerFactory createTrustManagerFactory() throws NoSuchProviderException, NoSuchAlgorithmException { return getProvider() != null ? TrustManagerFactory.getInstance(getAlgorithm(), getProvider()) : TrustManagerFactory.getInstance(getAlgorithm()); }
/** * 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(); }