Package com.mysql.cj.protocol
Class ExportControlled
java.lang.Object
com.mysql.cj.protocol.ExportControlled
public class ExportControlled
extends java.lang.Object
Holds functionality that falls under export-control regulations.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExportControlled.X509TrustManagerWrapperImplementation of X509TrustManager wrapping JVM X509TrustManagers to add expiration and identity check -
Method Summary
Modifier and Type Method Description static voidcheckValidProtocols(java.util.List<java.lang.String> protocols)static java.security.interfaces.RSAPublicKeydecodeRSAPublicKey(java.lang.String key)static booleanenabled()static byte[]encryptWithRSAPublicKey(byte[] source, java.security.interfaces.RSAPublicKey key)static byte[]encryptWithRSAPublicKey(byte[] source, java.security.interfaces.RSAPublicKey key, java.lang.String transformation)static javax.net.ssl.SSLContextgetSSLContext(com.mysql.cj.protocol.ExportControlled.KeyStoreConf clientCertificateKeyStore, com.mysql.cj.protocol.ExportControlled.KeyStoreConf trustCertificateKeyStore, boolean fallbackToDefaultTrustStore, boolean verifyServerCert, java.lang.String hostName, ExceptionInterceptor exceptionInterceptor)Configure theSSLContextbased on the supplier property set.static booleanisSSLEstablished(java.net.Socket socket)static java.net.SocketperformTlsHandshake(java.net.Socket rawSocket, SocketConnection socketConnection, ServerVersion serverVersion)Converts the socket being used in the given SocketConnection to an SSLSocket by performing the SSL/TLS handshake.
-
Method Details
-
enabled
public static boolean enabled() -
checkValidProtocols
public static void checkValidProtocols(java.util.List<java.lang.String> protocols) -
performTlsHandshake
public static java.net.Socket performTlsHandshake(java.net.Socket rawSocket, SocketConnection socketConnection, ServerVersion serverVersion) throws java.io.IOException, SSLParamsException, FeatureNotAvailableExceptionConverts the socket being used in the given SocketConnection to an SSLSocket by performing the SSL/TLS handshake.- Parameters:
rawSocket- original non-SSL socketsocketConnection- the Protocol instance containing the socket to convert to an SSLSocket.serverVersion- ServerVersion object- Returns:
- SSL socket
- Throws:
java.io.IOException- if i/o exception occursSSLParamsException- if the handshake fails, or if this distribution of Connector/J doesn't contain the SSL crypto hooks needed to perform the handshake.FeatureNotAvailableException- if TLS is not supported
-
getSSLContext
public static javax.net.ssl.SSLContext getSSLContext(com.mysql.cj.protocol.ExportControlled.KeyStoreConf clientCertificateKeyStore, com.mysql.cj.protocol.ExportControlled.KeyStoreConf trustCertificateKeyStore, boolean fallbackToDefaultTrustStore, boolean verifyServerCert, java.lang.String hostName, ExceptionInterceptor exceptionInterceptor) throws SSLParamsExceptionConfigure theSSLContextbased on the supplier property set.- Parameters:
clientCertificateKeyStore- clientCertificateKeyStoretrustCertificateKeyStore- trustCertificateKeyStorefallbackToDefaultTrustStore- fallbackToDefaultTrustStoreverifyServerCert- verifyServerCerthostName- host nameexceptionInterceptor- exception interceptor- Returns:
- SSLContext
- Throws:
SSLParamsException- if an error occurs
-
isSSLEstablished
public static boolean isSSLEstablished(java.net.Socket socket) -
decodeRSAPublicKey
public static java.security.interfaces.RSAPublicKey decodeRSAPublicKey(java.lang.String key) throws RSAException- Throws:
RSAException
-
encryptWithRSAPublicKey
public static byte[] encryptWithRSAPublicKey(byte[] source, java.security.interfaces.RSAPublicKey key, java.lang.String transformation) throws RSAException- Throws:
RSAException
-
encryptWithRSAPublicKey
public static byte[] encryptWithRSAPublicKey(byte[] source, java.security.interfaces.RSAPublicKey key) throws RSAException- Throws:
RSAException
-