/** * Returns a configured SSLServerSocketFactory. * * @return the configured SSLSocketFactory. * @throws GeneralSecurityException thrown if the SSLSocketFactory could not * be initialized. * @throws IOException thrown if and IO error occurred while loading * the server keystore. */ public SSLServerSocketFactory createSSLServerSocketFactory() throws GeneralSecurityException, IOException { if (mode != Mode.SERVER) { throw new IllegalStateException( "Factory is not in SERVER mode. Actual mode is " + mode.toString()); } return context.getServerSocketFactory(); }
/** * Returns a configured SSLSocketFactory. * * @return the configured SSLSocketFactory. * @throws GeneralSecurityException thrown if the SSLSocketFactory could not * be initialized. * @throws IOException thrown if and IO error occurred while loading * the server keystore. */ public SSLSocketFactory createSSLSocketFactory() throws GeneralSecurityException, IOException { if (mode != Mode.CLIENT) { throw new IllegalStateException( "Factory is not in CLIENT mode. Actual mode is " + mode.toString()); } return context.getSocketFactory(); }
/** * Returns the hostname verifier it should be used in HttpsURLConnections. * * @return the hostname verifier. */ public HostnameVerifier getHostnameVerifier() { if (mode != Mode.CLIENT) { throw new IllegalStateException( "Factory is not in CLIENT mode. Actual mode is " + mode.toString()); } return hostnameVerifier; }
LOG.debug(mode.toString() + " KeyStore: " + keystoreLocation); is.close(); LOG.debug(mode.toString() + " Loaded KeyStore: " + keystoreLocation); } else { keystore.load(null, null); DEFAULT_SSL_TRUSTSTORE_RELOAD_INTERVAL); LOG.debug(mode.toString() + " TrustStore: " + truststoreLocation); truststoreReloadInterval); trustManager.init(); LOG.debug(mode.toString() + " Loaded TrustStore: " + truststoreLocation); trustManagers = new TrustManager[]{trustManager}; } else {
LOG.debug(mode.toString() + " KeyStore: " + keystoreLocation); is.close(); LOG.debug(mode.toString() + " Loaded KeyStore: " + keystoreLocation); } else { keystore.load(null, null); DEFAULT_SSL_TRUSTSTORE_RELOAD_INTERVAL); LOG.debug(mode.toString() + " TrustStore: " + truststoreLocation); truststoreReloadInterval); trustManager.init(); LOG.debug(mode.toString() + " Loaded TrustStore: " + truststoreLocation); trustManagers = new TrustManager[]{trustManager}; } else {
LOG.debug(mode.toString() + " KeyStore: " + keystoreLocation); is.close(); LOG.debug(mode.toString() + " Loaded KeyStore: " + keystoreLocation); } else { keystore.load(null, null); DEFAULT_SSL_TRUSTSTORE_RELOAD_INTERVAL); LOG.debug(mode.toString() + " TrustStore: " + truststoreLocation); truststoreReloadInterval); trustManager.init(); LOG.debug(mode.toString() + " Loaded TrustStore: " + truststoreLocation); trustManagers = new TrustManager[]{trustManager}; } else {
/** * Resolves a property name to its client/server version if applicable. * <p/> * NOTE: This method is public for testing purposes. * * @param mode client/server mode. * @param template property name template. * @return the resolved property name. */ @VisibleForTesting public static String resolvePropertyName(SSLFactory.Mode mode, String template) { return MessageFormat.format( template, StringUtils.toLowerCase(mode.toString())); }
/** * Resolves a property name to its client/server version if applicable. * <p/> * NOTE: This method is public for testing purposes. * * @param mode client/server mode. * @param template property name template. * @return the resolved property name. */ @VisibleForTesting public static String resolvePropertyName(SSLFactory.Mode mode, String template) { return MessageFormat.format( template, StringUtils.toLowerCase(mode.toString())); }
/** * Resolves a property name to its client/server version if applicable. * <p/> * NOTE: This method is public for testing purposes. * * @param mode client/server mode. * @param template property name template. * @return the resolved property name. */ @VisibleForTesting public static String resolvePropertyName(SSLFactory.Mode mode, String template) { return MessageFormat.format( template, StringUtils.toLowerCase(mode.toString())); }
/** * Resolves a property name to its client/server version if applicable. * <p/> * NOTE: This method is public for testing purposes. * * @param mode client/server mode. * @param template property name template. * @return the resolved property name. */ @VisibleForTesting public static String resolvePropertyName(SSLFactory.Mode mode, String template) { return MessageFormat.format( template, StringUtils.toLowerCase(mode.toString())); }
conf, keyPasswordProperty, keystorePassword); if (LOG.isDebugEnabled()) { LOG.debug(mode.toString() + " KeyStore: " + keystoreLocation); LOG.debug(mode.toString() + " Loaded KeyStore: " + keystoreLocation); LOG.debug(mode.toString() + " TrustStore: " + truststoreLocation); trustManager.init(); if (LOG.isDebugEnabled()) { LOG.debug(mode.toString() + " Loaded TrustStore: " + truststoreLocation);
/** * Resolves a property name to its client/server version if applicable. * <p/> * NOTE: This method is public for testing purposes. * * @param mode client/server mode. * @param template property name template. * @return the resolved property name. */ @VisibleForTesting public static String resolvePropertyName(SSLFactory.Mode mode, String template) { return MessageFormat.format( template, StringUtils.toLowerCase(mode.toString())); }