/** * build TSSLTranportParameters by getting trust store path, trust store password, * ssl protocol (default SSL) , store type (default JKS), cipher suites * */ public static TSSLTransportParameters getTSSLTransportParameters() { String SSLTrustStore = System.getProperty("ssl.truststore"); if (SSLTrustStore == null) return null; String SSLTrustStorePassword = System.getProperty("ssl.truststore.password"); String SSLProtocol = System.getProperty("ssl.protocol"); String SSLStoreType = System.getProperty("ssl.store.type"); String SSLCipherSuites = System.getProperty("ssl.cipher.suites"); if (SSLProtocol == null) SSLProtocol = SSL_PROTOCOL; if (SSLStoreType == null) SSLStoreType = SSL_STORE_TYPE; String [] cipherSuites = null; if (SSLCipherSuites != null) cipherSuites = SSLCipherSuites.split(","); TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters(SSLProtocol, cipherSuites); params.setTrustStore(SSLTrustStore, SSLTrustStorePassword, TRUST_MANAGER_TYPE, SSLStoreType); return params; }
public TSSLTransportParameters getTTransportParams() { if (useJsse) throw new IllegalStateException("Cannot get TTransportParams for JSEE configuration."); TSSLTransportParameters params; if (cipherSuites != null) { params = new TSSLTransportParameters(clientProtocol, cipherSuites); } else { params = new TSSLTransportParametersHack(clientProtocol); } params.requireClientAuth(clientAuth); if (keyStoreSet) { params.setKeyStore(keyStorePath, keyStorePass, null, keyStoreType); } if (trustStoreSet) { params.setTrustStore(trustStorePath, trustStorePass, null, trustStoreType); } return params; }
private EntitlementThriftClient.Client getThriftClient() throws Exception { TSSLTransportFactory.TSSLTransportParameters param = new TSSLTransportFactory.TSSLTransportParameters(); param.setTrustStore(trustStore, trustStorePass); TTransport transport; transport = TSSLTransportFactory.getClientSocket(thriftHost, thriftPort, ProxyConstants.THRIFT_TIME_OUT, param); TProtocol protocol = new TBinaryProtocol(transport); return new EntitlementThriftClient.Client(protocol); } }
public static TTransport getSSLSocket(String host, int port, int loginTimeout, String trustStorePath, String trustStorePassWord) throws TTransportException { TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters(); params.setTrustStore(trustStorePath, trustStorePassWord); params.requireClientAuth(true); return TSSLTransportFactory.getClientSocket(host, port, loginTimeout, params); }
private TSocket createTLSSocket(String host) throws TTransportException { TSSLTransportParameters sslParams = new TSSLTransportParameters("SSL", m_dbtls_cipher_suites); if (!Utils.isEmpty(m_keystore)) { sslParams.setKeyStore(m_keystore, m_keystorepassword); } if (!Utils.isEmpty(m_truststore)) { sslParams.setTrustStore(m_truststore, m_truststorepassword); } return TSSLTransportFactory.getClientSocket(host, m_dbport, m_db_timeout_millis, sslParams); } // createTLSSocket
public static TTransport getSSLSocket(String host, int port, int loginTimeout, String trustStorePath, String trustStorePassWord) throws TTransportException { TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters(); params.setTrustStore(trustStorePath, trustStorePassWord); params.requireClientAuth(true); // The underlying SSLSocket object is bound to host:port with the given SO_TIMEOUT and // SSLContext created with the given params TSocket tSSLSocket = TSSLTransportFactory.getClientSocket(host, port, loginTimeout, params); return getSSLSocketWithHttps(tSSLSocket); }
private EntitlementThriftClient.Client getThriftClient() throws Exception { TSSLTransportFactory.TSSLTransportParameters param = new TSSLTransportFactory.TSSLTransportParameters(); param.setTrustStore(trustStore, trustStorePass); TTransport transport; transport = TSSLTransportFactory.getClientSocket(thriftHost, thriftPort, ProxyConstants.THRIFT_TIME_OUT, param); TProtocol protocol = new TBinaryProtocol(transport); return new EntitlementThriftClient.Client(protocol); } }
public static TTransport getSSLSocket(String host, int port, int loginTimeout, String trustStorePath, String trustStorePassWord) throws TTransportException { TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters(); params.setTrustStore(trustStorePath, trustStorePassWord); params.requireClientAuth(true); // The underlying SSLSocket object is bound to host:port with the given SO_TIMEOUT and // SSLContext created with the given params TSocket tSSLSocket = TSSLTransportFactory.getClientSocket(host, port, loginTimeout, params); return getSSLSocketWithHttps(tSSLSocket); }
public ThriftSecureClientPoolFactory(String trustStore, String trustStorePassword) { super(trustStore, trustStorePassword); params = new TSSLTransportFactory.TSSLTransportParameters(); params.setTrustStore(getTrustStore(), getTrustStorePassword()); }
@Override @SuppressWarnings("resource") public TTransport openTransport(String host, int port) throws Exception { TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters(protocol, cipherSuites); params.setTrustStore(truststore, truststorePassword); if (null != keystore) params.setKeyStore(keystore, keystorePassword); TTransport trans = TSSLTransportFactory.getClientSocket(host, port, SOCKET_TIMEOUT, params); return new TFramedTransport(trans, DEFAULT_MAX_FRAME_SIZE); }
@Override public TTransport openTransport(String host, int port) throws Exception { TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters(protocol, cipherSuites); params.setTrustStore(truststore, truststorePassword); if (null != keystore) params.setKeyStore(keystore, keystorePassword); TTransport trans = TSSLTransportFactory.getClientSocket(host, port, SOCKET_TIMEOUT, params); int frameSize = 15 * 1024 * 1024; // 15 MiB return new TFramedTransport(trans, frameSize); }
public static TTransport getSSLSocket(String host, int port, int loginTimeout, String trustStorePath, String trustStorePassWord) throws TTransportException { TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters(); params.setTrustStore(trustStorePath, trustStorePassWord); params.requireClientAuth(true); return TSSLTransportFactory.getClientSocket(host, port, loginTimeout, params); }
public ThriftSecureClientPoolFactory(String trustStore, String trustStorePassword) { super(trustStore, trustStorePassword); params = new TSSLTransportFactory.TSSLTransportParameters(); params.setTrustStore(getTrustStore(), getTrustStorePassword()); }
private TSocket createTLSSocket(String host) throws TTransportException { ServerConfig config = ServerConfig.getInstance(); String[] cipherSuites = config.dbtls_cipher_suites.toArray(new String[]{}); TSSLTransportParameters sslParams = new TSSLTransportParameters("SSL", cipherSuites); if (!Utils.isEmpty(config.keystore)) { sslParams.setKeyStore(config.keystore, config.keystorepassword); } if (!Utils.isEmpty(config.truststore)) { sslParams.setTrustStore(config.truststore, config.truststorepassword); } return TSSLTransportFactory.getClientSocket(host, config.dbport, config.db_timeout_millis, sslParams); } // createTLSSocket
public static TTransport getSSLSocket(String host, int port, int loginTimeout, String trustStorePath, String trustStorePassWord) throws TTransportException { TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters(); params.setTrustStore(trustStorePath, trustStorePassWord); params.requireClientAuth(true); return TSSLTransportFactory.getClientSocket(host, port, loginTimeout, params); }
/** * Set the truststore and password * * @param trustStore Location of the Truststore on disk * @param trustPass Truststore password */ public void setTrustStore(String trustStore, String trustPass) { setTrustStore(trustStore, trustPass, null, null); }
/** * Set the truststore, password, certificate type and the store type * * @param trustStoreStream Truststore content input stream * @param trustPass Truststore password * @param trustManagerType The default is X509 * @param trustStoreType The default is JKS */ public void setTrustStore(InputStream trustStoreStream, String trustPass, String trustManagerType, String trustStoreType) { this.trustStoreStream = trustStoreStream; setTrustStore("", trustPass, trustManagerType, trustStoreType); }
/** * Set the truststore and password * * @param trustStoreStream Truststore content input stream * @param trustPass Truststore password */ public void setTrustStore(InputStream trustStoreStream, String trustPass) { setTrustStore(trustStoreStream, trustPass, null, null); }
public static TTransport getSSLSocket(String host, int port, int loginTimeout, String trustStorePath, String trustStorePassWord) throws TTransportException { TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters(); params.setTrustStore(trustStorePath, trustStorePassWord); params.requireClientAuth(true); // The underlying SSLSocket object is bound to host:port with the given SO_TIMEOUT and // SSLContext created with the given params TSocket tSSLSocket = TSSLTransportFactory.getClientSocket(host, port, loginTimeout, params); return getSSLSocketWithHttps(tSSLSocket); }
public static TTransport getSSLSocket(String host, int port, int loginTimeout, String trustStorePath, String trustStorePassWord) throws TTransportException { TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters(); params.setTrustStore(trustStorePath, trustStorePassWord); params.requireClientAuth(true); // The underlying SSLSocket object is bound to host:port with the given SO_TIMEOUT and // SSLContext created with the given params TSocket tSSLSocket = TSSLTransportFactory.getClientSocket(host, port, loginTimeout, params); return getSSLSocketWithHttps(tSSLSocket); }