Package org.mariadb.jdbc.plugin
Interface TlsSocketPlugin
-
- All Known Implementing Classes:
DefaultTlsSocketPlugin
public interface TlsSocketPluginTLS Socket interface plugin
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default javax.net.ssl.SSLSocketcreateSocket(java.net.Socket socket, javax.net.ssl.SSLSocketFactory sslSocketFactory)Returns a socket layered over an existing socket negotiating the use of SSL over an existing socket.javax.net.ssl.KeyManager[]getKeyManager(Configuration conf, ExceptionFactory exceptionFactory)default javax.net.ssl.SSLSocketFactorygetSocketFactory(Configuration conf, ExceptionFactory exceptionFactory, HostAddress hostAddress)Build anSSLSocketFactoryfor the given configuration.javax.net.ssl.TrustManager[]getTrustManager(Configuration conf, ExceptionFactory exceptionFactory, HostAddress hostAddress)static javax.net.ssl.SSLSocketFactorynewSslSocketFactory(javax.net.ssl.KeyManager[] keyManagers, javax.net.ssl.TrustManager[] trustManagers, ExceptionFactory exceptionFactory)Build a freshSSLSocketFactoryfrom the given managers.java.lang.Stringtype()plugin type.voidverify(java.lang.String host, javax.net.ssl.SSLSession sslSession, long serverThreadId)Host name verifier implementation.
-
-
-
Method Detail
-
type
java.lang.String type()
plugin type.- Returns:
- plugin type
-
getTrustManager
javax.net.ssl.TrustManager[] getTrustManager(Configuration conf, ExceptionFactory exceptionFactory, HostAddress hostAddress) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getKeyManager
javax.net.ssl.KeyManager[] getKeyManager(Configuration conf, ExceptionFactory exceptionFactory) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getSocketFactory
default javax.net.ssl.SSLSocketFactory getSocketFactory(Configuration conf, ExceptionFactory exceptionFactory, HostAddress hostAddress) throws java.sql.SQLException
Build anSSLSocketFactoryfor the given configuration.A fresh
SSLContextis built on every call, so its (single-use) client SSL session cache is never shared between connections and TLS session resumption cannot occur across connections. The trust/key managers, the comparatively expensive part (loading key/trust stores), are what implementations are expected to cache, not the factory itself.- Parameters:
conf- configurationexceptionFactory- exception factoryhostAddress- host address (used to resolve a per-host sslMode override)- Returns:
- SSL socket factory
- Throws:
java.sql.SQLException- if the SSL context cannot be initialized
-
newSslSocketFactory
static javax.net.ssl.SSLSocketFactory newSslSocketFactory(javax.net.ssl.KeyManager[] keyManagers, javax.net.ssl.TrustManager[] trustManagers, ExceptionFactory exceptionFactory) throws java.sql.SQLExceptionBuild a freshSSLSocketFactoryfrom the given managers. A newSSLContextis created on each call, so no client SSL session cache is shared between connections (no TLS session resumption across connections).- Parameters:
keyManagers- key managers (maybenull)trustManagers- trust managersexceptionFactory- exception factory- Returns:
- a new SSL socket factory
- Throws:
java.sql.SQLException- if the SSL context cannot be initialized
-
createSocket
default javax.net.ssl.SSLSocket createSocket(java.net.Socket socket, javax.net.ssl.SSLSocketFactory sslSocketFactory) throws java.io.IOExceptionReturns a socket layered over an existing socket negotiating the use of SSL over an existing socket.- Parameters:
socket- existing socketsslSocketFactory- SSL socket factory- Returns:
- SSL socket
- Throws:
java.io.IOException- if any socket error occurs.
-
verify
void verify(java.lang.String host, javax.net.ssl.SSLSession sslSession, long serverThreadId) throws javax.net.ssl.SSLExceptionHost name verifier implementation.- Parameters:
host- hostnamesslSession- ssl sessionserverThreadId- current server threadId- Throws:
javax.net.ssl.SSLException- if verification fail
-
-