use of com.datastax.driver.core.RemoteEndpointAwareJdkSSLOptions in project cassandra by apache.
the class BulkLoader method buildSSLOptions.
private static SSLOptions buildSSLOptions(EncryptionOptions clientEncryptionOptions) {
if (!clientEncryptionOptions.isEnabled()) {
return null;
}
SSLContext sslContext;
try {
sslContext = SSLFactory.createSSLContext(clientEncryptionOptions, true);
} catch (IOException e) {
throw new RuntimeException("Could not create SSL Context.", e);
}
// Temporarily override newSSLEngine to set accepted protocols until it is added to
// RemoteEndpointAwareJdkSSLOptions. See CASSANDRA-13325 and CASSANDRA-16362.
RemoteEndpointAwareJdkSSLOptions sslOptions = new RemoteEndpointAwareJdkSSLOptions(sslContext, null) {
protected SSLEngine newSSLEngine(SocketChannel channel, InetSocketAddress remoteEndpoint) {
SSLEngine engine = super.newSSLEngine(channel, remoteEndpoint);
String[] acceptedProtocols = clientEncryptionOptions.acceptedProtocolsArray();
if (acceptedProtocols != null && acceptedProtocols.length > 0)
engine.setEnabledProtocols(acceptedProtocols);
return engine;
}
};
return sslOptions;
}
Aggregations