private void configureTransportFactory(ITransportFactory transportFactory, TOptions options) { Map<String, String> factoryOptions = new HashMap<>(); // If the supplied factory supports the same set of options as our SSL impl, set those if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE)) factoryOptions.put(SSLTransportFactory.TRUSTSTORE, options.trustStore.value()); if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE_PASSWORD)) factoryOptions.put(SSLTransportFactory.TRUSTSTORE_PASSWORD, options.trustStorePw.value()); if (transportFactory.supportedOptions().contains(SSLTransportFactory.PROTOCOL)) factoryOptions.put(SSLTransportFactory.PROTOCOL, options.protocol.value()); if (transportFactory.supportedOptions().contains(SSLTransportFactory.CIPHER_SUITES)) factoryOptions.put(SSLTransportFactory.CIPHER_SUITES, options.ciphers.value()); // Now check if any of the factory's supported options are set as system properties for (String optionKey : transportFactory.supportedOptions()) if (System.getProperty(optionKey) != null) factoryOptions.put(optionKey, System.getProperty(optionKey)); transportFactory.setOptions(factoryOptions); }
private void configureTransportFactory(ITransportFactory transportFactory, TOptions options) { Map<String, String> factoryOptions = new HashMap<>(); // If the supplied factory supports the same set of options as our SSL impl, set those if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE)) factoryOptions.put(SSLTransportFactory.TRUSTSTORE, options.trustStore.value()); if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE_PASSWORD)) factoryOptions.put(SSLTransportFactory.TRUSTSTORE_PASSWORD, options.trustStorePw.value()); if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE)) factoryOptions.put(SSLTransportFactory.KEYSTORE, options.keyStore.value()); if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE_PASSWORD)) factoryOptions.put(SSLTransportFactory.KEYSTORE_PASSWORD, options.keyStorePw.value()); if (transportFactory.supportedOptions().contains(SSLTransportFactory.PROTOCOL)) factoryOptions.put(SSLTransportFactory.PROTOCOL, options.protocol.value()); if (transportFactory.supportedOptions().contains(SSLTransportFactory.CIPHER_SUITES)) factoryOptions.put(SSLTransportFactory.CIPHER_SUITES, options.ciphers.value()); // Now check if any of the factory's supported options are set as system properties for (String optionKey : transportFactory.supportedOptions()) if (System.getProperty(optionKey) != null) factoryOptions.put(optionKey, System.getProperty(optionKey)); transportFactory.setOptions(factoryOptions); }
private static void configureTransportFactory(ITransportFactory transportFactory, EncryptionOptions encOptions) { Map<String, String> options = new HashMap<>(); // If the supplied factory supports the same set of options as our SSL impl, set those if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE)) options.put(SSLTransportFactory.TRUSTSTORE, encOptions.truststore); if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE_PASSWORD)) options.put(SSLTransportFactory.TRUSTSTORE_PASSWORD, encOptions.truststore_password); if (transportFactory.supportedOptions().contains(SSLTransportFactory.PROTOCOL)) options.put(SSLTransportFactory.PROTOCOL, encOptions.protocol); if (transportFactory.supportedOptions().contains(SSLTransportFactory.CIPHER_SUITES)) options.put(SSLTransportFactory.CIPHER_SUITES, Joiner.on(',').join(encOptions.cipher_suites)); if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE) && encOptions.require_client_auth) options.put(SSLTransportFactory.KEYSTORE, encOptions.keystore); if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE_PASSWORD) && encOptions.require_client_auth) options.put(SSLTransportFactory.KEYSTORE_PASSWORD, encOptions.keystore_password); // Now check if any of the factory's supported options are set as system properties for (String optionKey : transportFactory.supportedOptions()) if (System.getProperty(optionKey) != null) options.put(optionKey, System.getProperty(optionKey)); transportFactory.setOptions(options); }