/** * Creates a {@code ClientSSLSocketFactory} instance. This instance loads only the given trust * store file and key store file. Both trust store and key store must be protected by passwords, * even though it is not mandated by JSSE. * * @param trustStoreUrl A {@link URL} that points to a trust store file. If non-null, this URL * must refer to a JKS key store file that contains trusted certificates. * @param trustStorePassword The password of the given trust store file. If a trust store is * specified, then the password may not be empty. * @param keyStoreUrl A {@code URL} that points to a key store file that contains both client * certificate and the client's private key. If non-null, this URL must be of JKS format. * @param keyStorePassword the password of the given key store file. If a key store is * specified, then the password may not be empty. * @throws ClientSslSocketFactoryException thrown if creating this instance fails. */ public URLSslContextFactory(final URL trustStoreUrl, final String trustStorePassword, final URL keyStoreUrl, final String keyStorePassword) throws ClientSslSocketFactoryException { super(createKeyStore(trustStoreUrl, trustStorePassword), trustStorePassword, createKeyStore(keyStoreUrl, keyStorePassword), keyStorePassword); this.keyStoreUrl = keyStoreUrl; this.trustStoreUrl = trustStoreUrl; LOGGER.info("Loaded keyStore from: {}", keyStoreUrl); LOGGER.info("loaded trustStore from: {}", trustStoreUrl); }
@Override public String toString() { final StringBuilder builder = new StringBuilder(); builder.append("ClientSslSocketFactory [trustStoreUrl=").append(trustStoreUrl); if (trustStoreUrl != null) { builder.append(", trustStorePassword="); builder.append(Strings.repeat("*", this.getTrustStorePasswordLength())); } builder.append(", keyStoreUrl=").append(keyStoreUrl); if (keyStoreUrl != null) { builder.append(", keystorePassword = "); builder.append(Strings.repeat("*", this.getKeyStorePasswordLength())); } builder.append(']'); return builder.toString(); }
abstractFactory = new URLSslContextFactory(trustStoreUrl, (String) ncc.getProperty(CommonClientConfigKey.TrustStorePassword), keyStoreUrl,
sslContextFactory = new URLSslContextFactory(trustStoreUrl, clientConfig.get(CommonClientConfigKey.TrustStorePassword), keyStoreUrl,