SslContextFactory
public class SslContextFactory
extends java.lang.Object
A utility class responsible for creating and managing SSL/TLS context objects based on a provided SslConfiguration. It enables the creation of secure sockets, engines, and server sockets, while supporting protocol and cipher suite selection.
Constructors:
public SslContextFactory() throws Exception
Creates a default SSL context using standard system properties or default configuration.
Throws Exception if SSL context initialization fails.
public SslContextFactory(SslConfiguration sslConfig) throws Exception
Initializes the factory with a specific SslConfiguration object for custom SSL setup.
Throws Exception if SSL context creation fails due to invalid config or keystore issues.
Methods:
SSLContext getSslContext() | Returns the configured SSLContext instance, typically used to create SSL engines or sockets. |
void checkKeyStore() | Validates the presence and structure of the keystore defined in the configuration. Throws if invalid or missing. |
String[] selectProtocols(String[] enabledProtocols, String[] supportedProtocols) | Chooses supported SSL/TLS protocols from those enabled and those available in the runtime. |
String[] selectCipherSuites(String[] enabledCipherSuites, String[] supportedCipherSuites) | Filters cipher suites by comparing the enabled list with those supported by the provider. |
SSLServerSocket newSslServerSocket(String host, int port, int backlog) |
Creates a new secure server socket bound to the specified host and port. Throws: IOException if socket creation fails. |
SSLSocket newSslSocket() |
Creates a new SSL client socket. Throws: IOException if the socket can't be created. |
SSLEngine newSslEngine(String host, int port) | Creates a new SSLEngine configured for the given host and port, suitable for non-blocking SSL connections. |
SSLEngine newSslEngine() | Creates a generic, unbound SSLEngine instance. |
Methods inherited from class java.lang.Object |
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Start innovating with Mobius
What's next? Let's talk!