TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("SunX509"); trustKeyStore = KeyStore.getInstance(trustKeyStoreInfo.getType()); trustKeyStore.load(new FileInputStream(trustKeyStoreInfo.getKeyStorePath()), trustKeyStoreInfo.getPassword().toCharArray()); trustManagerFactory.init(trustKeyStore); if (keyStoreInfo != null && keyStoreInfo.getKeyStorePath() != null) { KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); keyStore = KeyStore.getInstance(keyStoreInfo.getType()); keyStore.load(new FileInputStream(keyStoreInfo.getKeyStorePath()), keyStoreInfo .getPassword().toCharArray()); keyManagerFactory.init(keyStore, keyStoreInfo.getPassword().toCharArray()); logger.info("SSL: Key store:{}", keyStoreInfo.getKeyStorePath()); logger.info("SSL: Trust key store:{}", trustKeyStoreInfo.getKeyStorePath()); return context.getSocketFactory(); } catch (Exception e) {
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("SunX509"); trustKeyStore = KeyStore.getInstance(trustKeyStoreInfo.getType()); trustKeyStore.load(new FileInputStream(trustKeyStoreInfo.getKeyStorePath()), trustKeyStoreInfo.getPassword().toCharArray()); trustManagerFactory.init(trustKeyStore); if (keyStoreInfo != null && keyStoreInfo.getKeyStorePath() != null) { KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); keyStore = KeyStore.getInstance(keyStoreInfo.getType()); keyStore.load(new FileInputStream(keyStoreInfo.getKeyStorePath()), keyStoreInfo .getPassword().toCharArray()); keyManagerFactory.init(keyStore, keyStoreInfo.getPassword().toCharArray()); logger.info("SSL: Key store:{}", keyStoreInfo.getKeyStorePath()); logger.info("SSL: Trust key store:{}", trustKeyStoreInfo.getKeyStorePath()); return context.getSocketFactory(); } catch (Exception e) {
public SSLServerSocketFactory getSSLServerSocketFactory() throws SSLConfigurationException { checkNotNull(keyStoreInfo, "keyStoreInfo may not be null"); String KEY_STORE_PASSWORD = getKeyStoreInfo().getPassword(); String KEY_STORE_PATH = getKeyStoreInfo().getKeyStorePath(); KeyStore keyStore = null; KeyStore trustKeyStore = null; String TRUST_KEY_STORE_PATH = getTrustKeyStoreInfo().getKeyStorePath(); String TRUST_KEY_STORE_PASSWORD = getTrustKeyStoreInfo().getPassword(); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("SunX509"); logger.info("SSL: Key store:{}", keyStoreInfo.getKeyStorePath()); if (trustKeyStore != null) { logger.info("SSL: Trust key store:{}", trustKeyStoreInfo.getKeyStorePath());
public SSLServerSocketFactory getSSLServerSocketFactory() throws SSLConfigurationException { checkNotNull(keyStoreInfo, "keyStoreInfo may not be null"); String KEY_STORE_PASSWORD = getKeyStoreInfo().getPassword(); String KEY_STORE_PATH = getKeyStoreInfo().getKeyStorePath(); KeyStore keyStore = null; KeyStore trustKeyStore = null; String TRUST_KEY_STORE_PATH = getTrustKeyStoreInfo().getKeyStorePath(); String TRUST_KEY_STORE_PASSWORD = getTrustKeyStoreInfo().getPassword(); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("SunX509"); logger.info("SSL: Key store:{}", keyStoreInfo.getKeyStorePath()); if (trustKeyStore != null) { logger.info("SSL: Trust key store:{}", trustKeyStoreInfo.getKeyStorePath());