use of org.apache.ignite.internal.client.ssl.GridSslBasicContextFactory in project ignite by apache.
the class CommandHandler method createSslSupportFactory.
/**
* @param args Commond args.
* @return Ssl support factory.
*/
@NotNull
private GridSslBasicContextFactory createSslSupportFactory(ConnectionAndSslParameters args) {
GridSslBasicContextFactory factory = new GridSslBasicContextFactory();
List<String> sslProtocols = split(args.sslProtocol(), ",");
String sslProtocol = F.isEmpty(sslProtocols) ? DFLT_SSL_PROTOCOL : sslProtocols.get(0);
factory.setProtocol(sslProtocol);
factory.setKeyAlgorithm(args.sslKeyAlgorithm());
if (sslProtocols.size() > 1)
factory.setProtocols(sslProtocols);
factory.setCipherSuites(split(args.getSslCipherSuites(), ","));
factory.setKeyStoreFilePath(args.sslKeyStorePath());
if (args.sslKeyStorePassword() != null)
factory.setKeyStorePassword(args.sslKeyStorePassword());
else {
char[] keyStorePwd = requestPasswordFromConsole("SSL keystore password: ");
args.sslKeyStorePassword(keyStorePwd);
factory.setKeyStorePassword(keyStorePwd);
}
factory.setKeyStoreType(args.sslKeyStoreType());
if (F.isEmpty(args.sslTrustStorePath()))
factory.setTrustManagers(GridSslBasicContextFactory.getDisabledTrustManager());
else {
factory.setTrustStoreFilePath(args.sslTrustStorePath());
if (args.sslTrustStorePassword() != null)
factory.setTrustStorePassword(args.sslTrustStorePassword());
else {
char[] trustStorePwd = requestPasswordFromConsole("SSL truststore password: ");
args.sslTrustStorePassword(trustStorePwd);
factory.setTrustStorePassword(trustStorePwd);
}
factory.setTrustStoreType(args.sslTrustStoreType());
}
return factory;
}
Aggregations