public class ProgrammaticSslEngineFactory extends Object implements SslEngineFactory
SSLContext
.
Note that this class will create SSL engines with advisory peer information (SSLContext.createSSLEngine(String, int)
) whenever possible.
If those defaults do not work for you, it should be pretty straightforward to write your own implementation by extending or duplicating this class.
Modifier and Type | Field and Description |
---|---|
protected String[] |
cipherSuites |
protected boolean |
requireHostnameValidation |
protected SSLContext |
sslContext |
Constructor and Description |
---|
ProgrammaticSslEngineFactory(SSLContext sslContext)
Creates an instance with the given
SSLContext , default cipher suites and no host name
validation. |
ProgrammaticSslEngineFactory(SSLContext sslContext,
String[] cipherSuites)
Creates an instance with the given
SSLContext and cipher suites, and no host name
validation. |
ProgrammaticSslEngineFactory(SSLContext sslContext,
String[] cipherSuites,
boolean requireHostnameValidation)
Creates an instance with the given
SSLContext , cipher suites and host name validation. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
SSLEngine |
newSslEngine(EndPoint remoteEndpoint)
Creates a new SSL engine each time a connection is established.
|
protected final SSLContext sslContext
protected final String[] cipherSuites
protected final boolean requireHostnameValidation
public ProgrammaticSslEngineFactory(@NonNull SSLContext sslContext)
SSLContext
, default cipher suites and no host name
validation.sslContext
- the SSLContext
to use.public ProgrammaticSslEngineFactory(@NonNull SSLContext sslContext, @Nullable String[] cipherSuites)
SSLContext
and cipher suites, and no host name
validation.sslContext
- the SSLContext
to use.cipherSuites
- the cipher suites to use, or null to use the default ones.public ProgrammaticSslEngineFactory(@NonNull SSLContext sslContext, @Nullable String[] cipherSuites, boolean requireHostnameValidation)
SSLContext
, cipher suites and host name validation.sslContext
- the SSLContext
to use.cipherSuites
- the cipher suites to use, or null to use the default ones.requireHostnameValidation
- whether to enable host name validation. If enabled, host name
validation will be done using HTTPS algorithm.@NonNull public SSLEngine newSslEngine(@NonNull EndPoint remoteEndpoint)
SslEngineFactory
newSslEngine
in interface SslEngineFactory
remoteEndpoint
- the remote endpoint we are connecting to (the address of the Cassandra
node).public void close()
close
in interface AutoCloseable
Copyright © 2017–2024. All rights reserved.