public static SSLConfigurationBuilder newBuilder() { return new SSLConfigurationBuilder(); }
throw new IllegalArgumentException(); SSLConfigurationBuilder sslConfigBuilder = SSLConfigurationBuilder.newBuilder(); sslConfigBuilder.setKeyStorePath(keyStorePath).setKeyStorePassword(keyStorePassword) .setKeyStoreType(keyStoreType).setClientAuth(clientAuth); if (clientAuth) { if (trustKeyStorePath != null) { throw new IllegalArgumentException(); sslConfigBuilder.setTrustKeyStorePath(trustKeyStorePath).setTrustKeyStorePassword (trustKeyStorePassword).setTrustKeyStoreType(trustKeyStoreType).setClientAuth(true); } else {// if trust keystore is null, use keystore as trust keystore sslConfigBuilder.useKeystoreAsTrustKeyStore(); builder.useSSL(sslConfigBuilder.build());
private SocksProxy initProxySSL(Arguments arguments, SocksServerBuilder builder, SocketAddress address) throws IllegalArgumentException { String keystorePath = arguments.getValue("-pk", null); String keystorePassword = arguments.getValue("-pw", null); String keystoreType = arguments.getValue("-pt", KEY_STORE_TYPE); if (keystorePath != null) { if (keystorePassword == null) { logger.info("Need password for keystore:{}", keystorePath); throw new IllegalArgumentException(); } SSLConfigurationBuilder sslConfigurationBuilder = SSLConfigurationBuilder.newBuilder(); sslConfigurationBuilder.setKeyStorePath(keystorePath).setKeyStorePassword(keystorePassword) .setKeyStoreType(keystoreType).useKeystoreAsTrustKeyStore(); return new SSLSocks5(address, sslConfigurationBuilder.build()); } return null; }
throw new IllegalArgumentException(); SSLConfigurationBuilder sslConfigBuilder = SSLConfigurationBuilder.newBuilder(); sslConfigBuilder.setKeyStorePath(keyStorePath).setKeyStorePassword(keyStorePassword) .setKeyStoreType(keyStoreType).setClientAuth(clientAuth); if (clientAuth) { if (trustKeyStorePath != null) { throw new IllegalArgumentException(); sslConfigBuilder.setTrustKeyStorePath(trustKeyStorePath).setTrustKeyStorePassword (trustKeyStorePassword).setTrustKeyStoreType(trustKeyStoreType).setClientAuth(true); } else {// if trust keystore is null, use keystore as trust keystore sslConfigBuilder.useKeystoreAsTrustKeyStore(); builder.useSSL(sslConfigBuilder.build());
private SocksProxy initProxySSL(Arguments arguments, SocksServerBuilder builder, SocketAddress address) throws IllegalArgumentException { String keystorePath = arguments.getValue("-pk", null); String keystorePassword = arguments.getValue("-pw", null); String keystoreType = arguments.getValue("-pt", KEY_STORE_TYPE); if (keystorePath != null) { if (keystorePassword == null) { logger.info("Need password for keystore:{}", keystorePath); throw new IllegalArgumentException(); } SSLConfigurationBuilder sslConfigurationBuilder = SSLConfigurationBuilder.newBuilder(); sslConfigurationBuilder.setKeyStorePath(keystorePath).setKeyStorePassword(keystorePassword) .setKeyStoreType(keystoreType).useKeystoreAsTrustKeyStore(); return new SSLSocks5(address, sslConfigurationBuilder.build()); } return null; }
public static SSLConfigurationBuilder newBuilder() { return new SSLConfigurationBuilder(); }