@Test public void testCreateContext() throws Exception { factoryBean.setKeyManagerFactory(keyManagerFactory); factoryBean.setKeyStore(keyStore); factoryBean.setTrustManagerFactory(trustManagerFactory); factoryBean.setTrustStore(trustStore); factoryBean.setSecureRandom(secureRandom); assertNotNull(factoryBean.createContext(context)); assertTrue(keyManagerFactory.isFactoryCreated()); assertTrue(trustManagerFactory.isFactoryCreated()); assertTrue(keyStore.isKeyStoreCreated()); assertTrue(trustStore.isKeyStoreCreated()); assertTrue(secureRandom.isSecureRandomCreated()); assertTrue(context.hasInfoMatching(SSL_CONFIGURATION_MESSAGE_PATTERN)); assertTrue(context.hasInfoMatching(KEY_MANAGER_FACTORY_MESSAGE_PATTERN)); assertTrue(context.hasInfoMatching(TRUST_MANAGER_FACTORY_MESSAGE_PATTERN)); assertTrue(context.hasInfoMatching(KEY_STORE_MESSAGE_PATTERN)); assertTrue(context.hasInfoMatching(TRUST_STORE_MESSAGE_PATTERN)); assertTrue(context.hasInfoMatching(SECURE_RANDOM_MESSAGE_PATTERN)); }
public SSLContext createContext(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyManagementException, UnrecoverableKeyException, KeyStoreException, CertificateException { SSLContext sslContext = getProvider() != null ? SSLContext.getInstance(getProtocol(), getProvider()) : SSLContext.getInstance(getProtocol()); context.addInfo("SSL protocol '" + sslContext.getProtocol() + "' provider '" + sslContext.getProvider() + "'"); KeyManager[] keyManagers = createKeyManagers(context); TrustManager[] trustManagers = createTrustManagers(context); SecureRandom secureRandom = createSecureRandom(context); sslContext.init(keyManagers, trustManagers, secureRandom); return sslContext; }
SSLContextFactoryBean { public SSLContext createContext(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyManagementException, UnrecoverableKeyException, KeyStoreException, CertificateException { SSLContext sslContext = getProvider() != null ? SSLContext.getInstance(getProtocol(), getProvider()) : SSLContext.getInstance(getProtocol()); context.addInfo("SSL protocol '" + sslContext.getProtocol() + "' provider '" + sslContext.getProvider() + "'"); KeyManager[] keyManagers = createKeyManagers(context); TrustManager[] trustManagers = createTrustManagers(context); SecureRandom secureRandom = createSecureRandom(context); sslContext.init(keyManagers, trustManagers, secureRandom); return sslContext; } }
SSLContextFactoryBean { public SSLContext createContext(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyManagementException, UnrecoverableKeyException, KeyStoreException, CertificateException { SSLContext sslContext = getProvider() != null ? SSLContext.getInstance(getProtocol(), getProvider()) : SSLContext.getInstance(getProtocol()); context.addInfo("SSL protocol '" + sslContext.getProtocol() + "' provider '" + sslContext.getProvider() + "'"); KeyManager[] keyManagers = createKeyManagers(context); TrustManager[] trustManagers = createTrustManagers(context); SecureRandom secureRandom = createSecureRandom(context); sslContext.init(keyManagers, trustManagers, secureRandom); return sslContext; }  }
SSLContextFactoryBean { public SSLContext createContext(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyManagementException, UnrecoverableKeyException, KeyStoreException, CertificateException { SSLContext sslContext = getProvider() != null ? SSLContext.getInstance(getProtocol(), getProvider()) : SSLContext.getInstance(getProtocol()); context.addInfo("SSL protocol '" + sslContext.getProtocol() + "' provider '" + sslContext.getProvider() + "'"); KeyManager[] keyManagers = createKeyManagers(context); TrustManager[] trustManagers = createTrustManagers(context); SecureRandom secureRandom = createSecureRandom(context); sslContext.init(keyManagers, trustManagers, secureRandom); return sslContext; }  SSLContext createContext(ContextAware context); KeyStoreFactoryBean getKeyStore(); void setKeyStore(KeyStoreFactoryBean keyStore); KeyStoreFactoryBean getTrustStore(); void setTrustStore(KeyStoreFactoryBean trustStore); SecureRandomFactoryBean getSecureRandom(); void setSecureRandom(SecureRandomFactoryBean secureRandom); KeyManagerFactoryFactoryBean getKeyManagerFactory(); void setKeyManagerFactory(
      KeyManagerFactoryFactoryBean keyManagerFactory); TrustManagerFactoryFactoryBean getTrustManagerFactory(); void setTrustManagerFactory(
      TrustManagerFactoryFactoryBean trustManagerFactory); String getProtocol(); void setProtocol(String protocol); String getProvider(); void setProvider(String provider); }
SSLContextFactoryBean { public SSLContext createContext(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyManagementException, UnrecoverableKeyException, KeyStoreException, CertificateException { SSLContext sslContext = getProvider() != null ? SSLContext.getInstance(getProtocol(), getProvider()) : SSLContext.getInstance(getProtocol()); context.addInfo("SSL protocol '" + sslContext.getProtocol() + "' provider '" + sslContext.getProvider() + "'"); KeyManager[] keyManagers = createKeyManagers(context); TrustManager[] trustManagers = createTrustManagers(context); SecureRandom secureRandom = createSecureRandom(context); sslContext.init(keyManagers, trustManagers, secureRandom); return sslContext; }  SSLContext createContext(ContextAware context); KeyStoreFactoryBean getKeyStore(); void setKeyStore(KeyStoreFactoryBean keyStore); KeyStoreFactoryBean getTrustStore(); void setTrustStore(KeyStoreFactoryBean trustStore); SecureRandomFactoryBean getSecureRandom(); void setSecureRandom(SecureRandomFactoryBean secureRandom); KeyManagerFactoryFactoryBean getKeyManagerFactory(); void setKeyManagerFactory(
      KeyManagerFactoryFactoryBean keyManagerFactory); TrustManagerFactoryFactoryBean getTrustManagerFactory(); void setTrustManagerFactory(
      TrustManagerFactoryFactoryBean trustManagerFactory); String getProtocol(); void setProtocol(String protocol); String getProvider(); void setProvider(String provider);  }