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 class  ExportControlled.X509TrustManagerWrapper
    Implementation of X509TrustManager wrapping JVM X509TrustManagers to add expiration and identity check
  • Method Summary

    Modifier and Type Method Description
    static void checkValidProtocols​(java.util.List<java.lang.String> protocols)  
    static java.security.interfaces.RSAPublicKey decodeRSAPublicKey​(java.lang.String key)  
    static boolean enabled()  
    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.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)
    Configure the SSLContext based on the supplier property set.
    static boolean isSSLEstablished​(java.net.Socket socket)  
    static java.net.Socket performTlsHandshake​(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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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, FeatureNotAvailableException
      Converts the socket being used in the given SocketConnection to an SSLSocket by performing the SSL/TLS handshake.
      Parameters:
      rawSocket - original non-SSL socket
      socketConnection - 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 occurs
      SSLParamsException - 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 SSLParamsException
      Configure the SSLContext based on the supplier property set.
      Parameters:
      clientCertificateKeyStore - clientCertificateKeyStore
      trustCertificateKeyStore - trustCertificateKeyStore
      fallbackToDefaultTrustStore - fallbackToDefaultTrustStore
      verifyServerCert - verifyServerCert
      hostName - host name
      exceptionInterceptor - 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