@Test public void createKeyStore() throws Exception { builder = new SSLConnectionSocketFactoryBuilder(); mockStatic(KeyStore.class); when(KeyStore.getInstance("jks")).thenReturn(keyStoreMock); when(urlMock.openStream()).thenReturn(inputStreamMock); doNothing().when(keyStoreMock).load(inputStreamMock, PASSWORD.toCharArray()); doNothing().when(inputStreamMock).close(); KeyStore keystore = builder.createKeyStore(urlMock, PASSWORD); verify(keyStoreMock).load(inputStreamMock, PASSWORD.toCharArray()); assertEquals(keystore, keyStoreMock); }
protected KeyStore createKeyStore(final URL url, final String password) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { if (url == null) { throw new IllegalArgumentException("Keystore url may not be null"); } KeyStore keystore = KeyStore.getInstance("jks"); InputStream is = null; try { is = url.openStream(); keystore.load(is, password != null ? password.toCharArray() : null); } finally { if (is != null) is.close(); } return keystore; }
SSLConnectionSocketFactoryBuilder { protected KeyStore createKeyStore(final URL url, final String password) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { if (url == null) { throw new IllegalArgumentException("Keystore url may not be null"); } KeyStore keystore = KeyStore.getInstance("jks"); InputStream is = null; try { is = url.openStream(); keystore.load(is, password != null ? password.toCharArray() : null); } finally { if (is != null) is.close(); } return keystore; } }
SSLConnectionSocketFactoryBuilder { protected KeyStore createKeyStore(final URL url, final String password) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { if (url == null) { throw new IllegalArgumentException("Keystore url may not be null"); } KeyStore keystore = KeyStore.getInstance("jks"); InputStream is = null; try { is = url.openStream(); keystore.load(is, password != null ? password.toCharArray() : null); } finally { if (is != null) is.close(); } return keystore; }  }
SSLConnectionSocketFactoryBuilder { protected KeyStore createKeyStore(final URL url, final String password) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { if (url == null) { throw new IllegalArgumentException("Keystore url may not be null"); } KeyStore keystore = KeyStore.getInstance("jks"); InputStream is = null; try { is = url.openStream(); keystore.load(is, password != null ? password.toCharArray() : null); } finally { if (is != null) is.close(); } return keystore; }  static boolean checkEquality(String[] subArray, String[] largeArray); static boolean checkIfTLS2(String[] arr, String targetValue); SSLConnectionSocketFactory build(); SSLConnectionSocketFactoryBuilder setTrustAllRoots(String trustAllRoots); SSLConnectionSocketFactoryBuilder setInputTLS(String inputTLSversion); SSLConnectionSocketFactoryBuilder setKeystore(String keystore); SSLConnectionSocketFactoryBuilder setKeystorePassword(String keystorePassword); SSLConnectionSocketFactoryBuilder setTrustKeystore(String trustKeystore); SSLConnectionSocketFactoryBuilder setTrustPassword(String trustPassword); SSLConnectionSocketFactoryBuilder setallowedCyphers(String allowedCyphers); SSLConnectionSocketFactoryBuilder setX509HostnameVerifier(String x509HostnameVerifier); }
SSLConnectionSocketFactoryBuilder { protected KeyStore createKeyStore(final URL url, final String password) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { if (url == null) { throw new IllegalArgumentException("Keystore url may not be null"); } KeyStore keystore = KeyStore.getInstance("jks"); InputStream is = null; try { is = url.openStream(); keystore.load(is, password != null ? password.toCharArray() : null); } finally { if (is != null) is.close(); } return keystore; }  static boolean checkEquality(String[] subArray, String[] largeArray); static boolean checkIfTLS2(String[] arr, String targetValue); SSLConnectionSocketFactory build(); SSLConnectionSocketFactoryBuilder setTrustAllRoots(String trustAllRoots); SSLConnectionSocketFactoryBuilder setInputTLS(String inputTLSversion); SSLConnectionSocketFactoryBuilder setKeystore(String keystore); SSLConnectionSocketFactoryBuilder setKeystorePassword(String keystorePassword); SSLConnectionSocketFactoryBuilder setTrustKeystore(String trustKeystore); SSLConnectionSocketFactoryBuilder setTrustPassword(String trustPassword); SSLConnectionSocketFactoryBuilder setallowedCyphers(String allowedCyphers); SSLConnectionSocketFactoryBuilder setX509HostnameVerifier(String x509HostnameVerifier); static final String TRUST_ALL_ROOTS_ERROR; static final String SSL_CONNECTION_ERROR; static final String BAD_KEYSTORE_ERROR; static final String INVALID_KEYSTORE_ERROR; static final String BAD_TRUST_KEYSTORE_ERROR; static final String INVALID_TRUST_KEYSTORE_ERROR; static final String SSLv3; static final String TLSv10; static final String TLSv11; static final String TLSv12; static final String[] ARRAY_TLSv12; static final String[] array; static final String[] SUPPORTED_PROTOCOLS; static final String[] SUPPORTED_CYPHERS; public String[] cypherArray; }